From b454c962f4784ed06908f668b66376600d21dc52 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 19 Jun 2017 16:25:44 +0200 Subject: cmake: move from build to mrproper and platform --- CMakeLists.txt | 2 +- cmake/opentrack-build.cmake | 45 ------------------------------------------ cmake/opentrack-mrproper.cmake | 33 +++++++++++++++++++++++++++++++ cmake/opentrack-platform.cmake | 23 ++++++++++++++++++++- 4 files changed, 56 insertions(+), 47 deletions(-) delete mode 100644 cmake/opentrack-build.cmake create mode 100644 cmake/opentrack-mrproper.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a90720a9..f6718bf5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") include(opentrack-check-build-directory) -include(opentrack-build) +include(opentrack-mrproper) project(opentrack) cmake_minimum_required(VERSION 2.8.11) diff --git a/cmake/opentrack-build.cmake b/cmake/opentrack-build.cmake deleted file mode 100644 index ab2bb3b8..00000000 --- a/cmake/opentrack-build.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE -# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL -# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -if(NOT CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") -endif() - -set(CMAKE_BUILD_TYPE_INIT "RELEASE") - -if(APPLE) - if(NOT CMAKE_OSX_ARCHITECTURES) - set(CMAKE_OSX_ARCHITECTURES "x86_64") - endif() -endif() - -function(cleanup_build_dir) - file(GLOB_RECURSE files LIST_DIRECTORIES TRUE RELATIVE "${CMAKE_BINARY_DIR}" "*") - - set(files_ "") - - set(got-cache FALSE) - - foreach(i ${files}) - if(i STREQUAL "CMakeCache.txt") - set(got-cache TRUE) - else() - list(APPEND files_ "${CMAKE_BINARY_DIR}/${i}") - endif() - endforeach() - - if(NOT got-cache) - message(FATAL_ERROR "sanity check failed") - endif() - - # let's hope nothing bad happens - file(REMOVE_RECURSE ${files_}) - - #execute_process(COMMAND cmake . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" OUTPUT_QUIET) -endfunction() diff --git a/cmake/opentrack-mrproper.cmake b/cmake/opentrack-mrproper.cmake new file mode 100644 index 00000000..faa11bd4 --- /dev/null +++ b/cmake/opentrack-mrproper.cmake @@ -0,0 +1,33 @@ +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +function(cleanup_build_dir) + file(GLOB_RECURSE files LIST_DIRECTORIES TRUE RELATIVE "${CMAKE_BINARY_DIR}" "*") + + set(files_ "") + + set(got-cache FALSE) + + foreach(i ${files}) + if(i STREQUAL "CMakeCache.txt") + set(got-cache TRUE) + else() + list(APPEND files_ "${CMAKE_BINARY_DIR}/${i}") + endif() + endforeach() + + if(NOT got-cache) + message(FATAL_ERROR "sanity check failed") + endif() + + # let's hope nothing bad happens + file(REMOVE_RECURSE ${files_}) + + #execute_process(COMMAND cmake . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" OUTPUT_QUIET) +endfunction() diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index fac5f2bf..a3f12f96 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -21,6 +21,27 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. +if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") +endif() + +set(CMAKE_BUILD_TYPE_INIT "RELEASE") + +if(APPLE) + if(NOT CMAKE_OSX_ARCHITECTURES) + set(CMAKE_OSX_ARCHITECTURES "x86_64") + endif() +endif() + +if(MSVC AND MSVC_VERSION LESS "1900") + message(FATAL_ERROR "Visual Studio too old. Use Visual Studio 2015 Update 3 or newer.") +endif() + +if(MSVC AND opentrack-64bit) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /HIGHENTROPYVA") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /HIGHENTROPYVA") +endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_COMPILER_IS_GNUCXX TRUE) set(CMAKE_COMPILER_IS_CLANG TRUE) @@ -33,7 +54,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang") endif() if((NOT CMAKE_COMPILER_IS_GNUCXX) EQUAL (NOT (NOT CMAKE_COMPILER_IS_GNUCC))) - message(FATAL_ERROR "cannot use either use both gcc and g++ or neither") + message(FATAL_ERROR "use either use both gcc and g++ or neither") endif() IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") -- cgit v1.2.3