mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
merge with hauke/eigen-cdash-improvements branch
This commit is contained in:
commit
9d82a7e204
@ -297,44 +297,9 @@ add_subdirectory(Eigen)
|
|||||||
|
|
||||||
add_subdirectory(doc EXCLUDE_FROM_ALL)
|
add_subdirectory(doc EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
add_custom_target(buildtests)
|
include(EigenConfigureTesting)
|
||||||
add_custom_target(check COMMAND "ctest")
|
# fixme, not sure this line is still needed:
|
||||||
add_dependencies(check buildtests)
|
|
||||||
|
|
||||||
# CMake/Ctest does not allow us to change the build command,
|
|
||||||
# so we have to workaround by directly editing the generated DartConfiguration.tcl file
|
|
||||||
# save CMAKE_MAKE_PROGRAM
|
|
||||||
set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM})
|
|
||||||
# and set a fake one
|
|
||||||
set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@")
|
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
enable_testing() # must be called from the root CMakeLists, see man page
|
enable_testing() # must be called from the root CMakeLists, see man page
|
||||||
include(EigenTesting)
|
|
||||||
ei_init_testing()
|
|
||||||
|
|
||||||
# overwrite default DartConfiguration.tcl
|
|
||||||
# The worarounds are different for each version of the MSVC IDE
|
|
||||||
if(MSVC_IDE)
|
|
||||||
if(MSVC_VERSION EQUAL 1600) # MSVC 2010
|
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE} \n # ")
|
|
||||||
else() # MSVC 2008 (TODO check MSVC 2005)
|
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} /project buildtests")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
# for make and nmake
|
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file(${CMAKE_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl)
|
|
||||||
# restore default CMAKE_MAKE_PROGRAM
|
|
||||||
set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE})
|
|
||||||
# un-set temporary variables so that it is like they never existed.
|
|
||||||
# CMake 2.6.3 introduces the more logical unset() syntax for this.
|
|
||||||
set(CMAKE_MAKE_PROGRAM_SAVE)
|
|
||||||
set(EIGEN_MAKECOMMAND_PLACEHOLDER)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
||||||
|
103
cmake/CMakeDetermineVSServicePack.cmake
Normal file
103
cmake/CMakeDetermineVSServicePack.cmake
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
# - Includes a public function for assisting users in trying to determine the
|
||||||
|
# Visual Studio service pack in use.
|
||||||
|
#
|
||||||
|
# Sets the passed in variable to one of the following values or an empty
|
||||||
|
# string if unknown.
|
||||||
|
# vc80
|
||||||
|
# vc80sp1
|
||||||
|
# vc90
|
||||||
|
# vc90sp1
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ===========================
|
||||||
|
#
|
||||||
|
# if(MSVC)
|
||||||
|
# include(CMakeDetermineVSServicePack)
|
||||||
|
# DetermineVSServicePack( my_service_pack )
|
||||||
|
#
|
||||||
|
# if( my_service_pack )
|
||||||
|
# message(STATUS "Detected: ${my_service_pack}")
|
||||||
|
# endif()
|
||||||
|
# endif()
|
||||||
|
#
|
||||||
|
# ===========================
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2009-2010 Kitware, Inc.
|
||||||
|
# Copyright 2009-2010 Philip Lowman <philip@yhbt.com>
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
# [INTERNAL]
|
||||||
|
# Please do not call this function directly
|
||||||
|
function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
|
||||||
|
if (${_cl_version} VERSION_EQUAL "14.00.50727.42")
|
||||||
|
set(_version "vc80")
|
||||||
|
elseif(${_cl_version} VERSION_EQUAL "14.00.50727.762")
|
||||||
|
set(_version "vc80sp1")
|
||||||
|
elseif(${_cl_version} VERSION_EQUAL "15.00.21022.08")
|
||||||
|
set(_version "vc90")
|
||||||
|
elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01")
|
||||||
|
set(_version "vc90sp1")
|
||||||
|
elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01")
|
||||||
|
set(_version "vc100")
|
||||||
|
else()
|
||||||
|
set(_version "")
|
||||||
|
endif()
|
||||||
|
set(${_OUT_VAR} ${_version} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
#
|
||||||
|
# A function to call to determine the Visual Studio service pack
|
||||||
|
# in use. See documentation above.
|
||||||
|
function(DetermineVSServicePack _pack)
|
||||||
|
if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})
|
||||||
|
if(${CMAKE_BUILD_TOOL} STREQUAL "nmake")
|
||||||
|
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} "/?"
|
||||||
|
ERROR_VARIABLE _output)
|
||||||
|
set(DETERMINED_VS_SERVICE_PACK ${_output})
|
||||||
|
else()
|
||||||
|
file(WRITE "${CMAKE_BINARY_DIR}/return0.cc"
|
||||||
|
"int main() { return 0; }\n")
|
||||||
|
|
||||||
|
try_compile(DETERMINED_VS_SERVICE_PACK
|
||||||
|
"${CMAKE_BINARY_DIR}"
|
||||||
|
"${CMAKE_BINARY_DIR}/return0.cc"
|
||||||
|
OUTPUT_VARIABLE _output
|
||||||
|
COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc")
|
||||||
|
|
||||||
|
file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DETERMINED_VS_SERVICE_PACK AND _output)
|
||||||
|
string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
_cl_version "${_output}")
|
||||||
|
if(_cl_version)
|
||||||
|
string(REGEX MATCHALL "[0-9]+"
|
||||||
|
_cl_version_list "${_cl_version}")
|
||||||
|
list(GET _cl_version_list 0 _major)
|
||||||
|
list(GET _cl_version_list 1 _minor)
|
||||||
|
list(GET _cl_version_list 2 _patch)
|
||||||
|
list(GET _cl_version_list 3 _tweak)
|
||||||
|
|
||||||
|
set(_cl_version_string ${_major}.${_minor}.${_patch}.${_tweak})
|
||||||
|
|
||||||
|
# Call helper function to determine VS version
|
||||||
|
_DetermineVSServicePackFromCompiler(_sp "${_cl_version_string}")
|
||||||
|
if(_sp)
|
||||||
|
#set(${_pack} "${_sp}(${_cl_version_string})" CACHE INTERNAL
|
||||||
|
set(${_pack} "${_sp}" CACHE INTERNAL
|
||||||
|
"The Visual Studio Release with Service Pack")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
79
cmake/EigenConfigureTesting.cmake
Normal file
79
cmake/EigenConfigureTesting.cmake
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
include(EigenTesting)
|
||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
# configure the "site" and "buildname"
|
||||||
|
ei_set_sitename()
|
||||||
|
|
||||||
|
# retrieve and store the build string
|
||||||
|
ei_set_build_string()
|
||||||
|
|
||||||
|
add_custom_target(buildtests)
|
||||||
|
add_custom_target(check COMMAND "ctest")
|
||||||
|
add_dependencies(check buildtests)
|
||||||
|
|
||||||
|
# check whether /bin/bash exists
|
||||||
|
find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
# CMake/Ctest does not allow us to change the build command,
|
||||||
|
# so we have to workaround by directly editing the generated DartConfiguration.tcl file
|
||||||
|
# save CMAKE_MAKE_PROGRAM
|
||||||
|
set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM})
|
||||||
|
# and set a fake one
|
||||||
|
set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@")
|
||||||
|
|
||||||
|
# This call activates testing and generates the DartConfiguration.tcl
|
||||||
|
include(CTest)
|
||||||
|
|
||||||
|
# overwrite default DartConfiguration.tcl
|
||||||
|
# The worarounds are different for each version of the MSVC IDE
|
||||||
|
if(MSVC_IDE)
|
||||||
|
if(MSVC_VERSION EQUAL 1600) # MSVC 2010
|
||||||
|
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE} \n# ")
|
||||||
|
else() # MSVC 2008 (TODO check MSVC 2005)
|
||||||
|
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} /project buildtests")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# for make and nmake
|
||||||
|
set(EIGEN_MAKECOMMAND_PLACEHOLDER "${CMAKE_MAKE_PROGRAM_SAVE} buildtests")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# copy ctest properties, which currently
|
||||||
|
# o raise the warning levels
|
||||||
|
configure_file(${CMAKE_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl)
|
||||||
|
|
||||||
|
# restore default CMAKE_MAKE_PROGRAM
|
||||||
|
set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE})
|
||||||
|
# un-set temporary variables so that it is like they never existed.
|
||||||
|
# CMake 2.6.3 introduces the more logical unset() syntax for this.
|
||||||
|
set(CMAKE_MAKE_PROGRAM_SAVE)
|
||||||
|
set(EIGEN_MAKECOMMAND_PLACEHOLDER)
|
||||||
|
|
||||||
|
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
|
||||||
|
|
||||||
|
# some documentation of this function would be nice
|
||||||
|
ei_init_testing()
|
||||||
|
|
||||||
|
# configure Eigen related testing options
|
||||||
|
option(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions using exceptions" OFF)
|
||||||
|
option(EIGEN_DEBUG_ASSERTS "Enable advanced debuging of assertions" OFF)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
option(EIGEN_COVERAGE_TESTING "Enable/disable gcov" OFF)
|
||||||
|
if(EIGEN_COVERAGE_TESTING)
|
||||||
|
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage")
|
||||||
|
set(CTEST_CUSTOM_COVERAGE_EXCLUDE "/test/")
|
||||||
|
else(EIGEN_COVERAGE_TESTING)
|
||||||
|
set(COVERAGE_FLAGS "")
|
||||||
|
endif(EIGEN_COVERAGE_TESTING)
|
||||||
|
if(EIGEN_TEST_C++0x)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
||||||
|
endif(EIGEN_TEST_C++0x)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS} -g2")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COVERAGE_FLAGS} -O2 -g2")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COVERAGE_FLAGS} -fno-inline-functions")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COVERAGE_FLAGS} -O0 -g3")
|
||||||
|
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||||
|
elseif(MSVC)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS")
|
||||||
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
48
cmake/EigenDetermineOSVersion.cmake
Normal file
48
cmake/EigenDetermineOSVersion.cmake
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# The utility function DetermineOSVersion aims at providing an
|
||||||
|
# improved version of the CMake variable ${CMAKE_SYSTEM} on Windows
|
||||||
|
# machines.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# include(EigenDetermineOSVersion)
|
||||||
|
# DetermineOSVersion(OS_VERSION)
|
||||||
|
# message("OS: ${OS_VERSION}")
|
||||||
|
|
||||||
|
# - A little helper variable which should not be directly called
|
||||||
|
function(DetermineShortWindowsName WIN_VERSION win_num_version)
|
||||||
|
if (${win_num_version} VERSION_EQUAL "6.1.7600")
|
||||||
|
set(_version "win7")
|
||||||
|
elseif(${win_num_version} VERSION_EQUAL "6.0.6000")
|
||||||
|
set(_version "winVista")
|
||||||
|
elseif(${win_num_version} VERSION_EQUAL "5.2.3790")
|
||||||
|
set(_version "winXpProf")
|
||||||
|
elseif(${win_num_version} VERSION_EQUAL "5.1.2600")
|
||||||
|
set(_version "winXp")
|
||||||
|
elseif(${win_num_version} VERSION_EQUAL "5.0.2195")
|
||||||
|
set(_version "win2000Prof")
|
||||||
|
else()
|
||||||
|
set(_version "")
|
||||||
|
endif()
|
||||||
|
set(${WIN_VERSION} ${_version} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(DetermineOSVersion OS_VERSION)
|
||||||
|
if (WIN32)
|
||||||
|
file (TO_NATIVE_PATH "$ENV{COMSPEC}" SHELL)
|
||||||
|
exec_program( ${SHELL} ARGS "/c" "ver"
|
||||||
|
OUTPUT_VARIABLE ver_output)
|
||||||
|
|
||||||
|
string(REGEX MATCHALL "[0-9]+"
|
||||||
|
ver_list "${ver_output}")
|
||||||
|
list(GET ver_list 0 _major)
|
||||||
|
list(GET ver_list 1 _minor)
|
||||||
|
list(GET ver_list 2 _patch)
|
||||||
|
|
||||||
|
set(win_num_version ${_major}.${_minor}.${_patch})
|
||||||
|
DetermineShortWindowsName(win_version "${win_num_version}")
|
||||||
|
if(win_version)
|
||||||
|
set(${OS_VERSION} ${win_version} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(${OS_VERSION} ${CMAKE_SYSTEM} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -1,14 +1,11 @@
|
|||||||
option(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions using exceptions" OFF)
|
|
||||||
option(EIGEN_DEBUG_ASSERTS "Enable advanced debuging of assertions" OFF)
|
|
||||||
|
|
||||||
include(CheckCXXSourceCompiles)
|
|
||||||
|
|
||||||
# check whether /bin/bash exists
|
|
||||||
find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)
|
|
||||||
|
|
||||||
macro(ei_add_property prop value)
|
macro(ei_add_property prop value)
|
||||||
get_property(previous GLOBAL PROPERTY ${prop})
|
get_property(previous GLOBAL PROPERTY ${prop})
|
||||||
set_property(GLOBAL PROPERTY ${prop} "${previous} ${value}")
|
if (NOT ${previous} OR ${previous} STREQUAL "")
|
||||||
|
set_property(GLOBAL PROPERTY ${prop} "${value}")
|
||||||
|
else()
|
||||||
|
set_property(GLOBAL PROPERTY ${prop} "${previous} ${value}")
|
||||||
|
endif()
|
||||||
endmacro(ei_add_property)
|
endmacro(ei_add_property)
|
||||||
|
|
||||||
#internal. See documentation of ei_add_test for details.
|
#internal. See documentation of ei_add_test for details.
|
||||||
@ -182,12 +179,13 @@ endmacro(ei_add_failtest)
|
|||||||
|
|
||||||
# print a summary of the different options
|
# print a summary of the different options
|
||||||
macro(ei_testing_print_summary)
|
macro(ei_testing_print_summary)
|
||||||
|
|
||||||
message(STATUS "************************************************************")
|
message(STATUS "************************************************************")
|
||||||
message(STATUS "*** Eigen's unit tests configuration summary ***")
|
message(STATUS "*** Eigen's unit tests configuration summary ***")
|
||||||
message(STATUS "************************************************************")
|
message(STATUS "************************************************************")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||||
|
message(STATUS "Build site: ${SITE}")
|
||||||
|
message(STATUS "Build string: ${BUILDNAME}")
|
||||||
get_property(EIGEN_TESTING_SUMMARY GLOBAL PROPERTY EIGEN_TESTING_SUMMARY)
|
get_property(EIGEN_TESTING_SUMMARY GLOBAL PROPERTY EIGEN_TESTING_SUMMARY)
|
||||||
get_property(EIGEN_TESTED_BACKENDS GLOBAL PROPERTY EIGEN_TESTED_BACKENDS)
|
get_property(EIGEN_TESTED_BACKENDS GLOBAL PROPERTY EIGEN_TESTED_BACKENDS)
|
||||||
get_property(EIGEN_MISSING_BACKENDS GLOBAL PROPERTY EIGEN_MISSING_BACKENDS)
|
get_property(EIGEN_MISSING_BACKENDS GLOBAL PROPERTY EIGEN_MISSING_BACKENDS)
|
||||||
@ -255,7 +253,6 @@ macro(ei_testing_print_summary)
|
|||||||
message(STATUS "\n${EIGEN_TESTING_SUMMARY}")
|
message(STATUS "\n${EIGEN_TESTING_SUMMARY}")
|
||||||
|
|
||||||
message(STATUS "************************************************************")
|
message(STATUS "************************************************************")
|
||||||
|
|
||||||
endmacro(ei_testing_print_summary)
|
endmacro(ei_testing_print_summary)
|
||||||
|
|
||||||
macro(ei_init_testing)
|
macro(ei_init_testing)
|
||||||
@ -276,24 +273,114 @@ macro(ei_init_testing)
|
|||||||
set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT "0")
|
set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT "0")
|
||||||
endmacro(ei_init_testing)
|
endmacro(ei_init_testing)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
macro(ei_set_sitename)
|
||||||
option(EIGEN_COVERAGE_TESTING "Enable/disable gcov" OFF)
|
# if the sitename is not yet set, try to set it
|
||||||
if(EIGEN_COVERAGE_TESTING)
|
if(NOT ${SITE} OR ${SITE} STREQUAL "")
|
||||||
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage")
|
set(eigen_computername $ENV{COMPUTERNAME})
|
||||||
set(CTEST_CUSTOM_COVERAGE_EXCLUDE "/test/")
|
set(eigen_hostname $ENV{HOSTNAME})
|
||||||
else(EIGEN_COVERAGE_TESTING)
|
if(eigen_hostname)
|
||||||
set(COVERAGE_FLAGS "")
|
set(SITE ${eigen_hostname})
|
||||||
endif(EIGEN_COVERAGE_TESTING)
|
elseif(eigen_computername)
|
||||||
if(EIGEN_TEST_C++0x)
|
set(SITE ${eigen_computername})
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
endif()
|
||||||
endif(EIGEN_TEST_C++0x)
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES Linux)
|
# in case it is already set, enforce lower case
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS} -g2")
|
if(SITE)
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COVERAGE_FLAGS} -O2 -g2")
|
string(TOLOWER ${SITE} SITE)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COVERAGE_FLAGS} -fno-inline-functions")
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COVERAGE_FLAGS} -O0 -g3")
|
endmacro(ei_set_sitename)
|
||||||
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
|
|
||||||
elseif(MSVC)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS")
|
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
|
|
||||||
|
macro(ei_get_compilerver VAR)
|
||||||
|
if(MSVC)
|
||||||
|
# on windows system, we use a modified CMake script
|
||||||
|
include(CMakeDetermineVSServicePack)
|
||||||
|
DetermineVSServicePack( my_service_pack )
|
||||||
|
|
||||||
|
if( my_service_pack )
|
||||||
|
set(${VAR} ${my_service_pack})
|
||||||
|
else()
|
||||||
|
set(${VAR} "na")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# on all other system we rely on ${CMAKE_CXX_COMPILER}
|
||||||
|
# supporting a "--version" flag
|
||||||
|
exec_program(${CMAKE_CXX_COMPILER}
|
||||||
|
ARGS --version
|
||||||
|
OUTPUT_VARIABLE eigen_cxx_compiler_version
|
||||||
|
)
|
||||||
|
# here I try to extract the version string
|
||||||
|
# - TODO: this can most likely be improved and fixed
|
||||||
|
string(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1.\\2.\\3"
|
||||||
|
eigen_cxx_compiler_version ${eigen_cxx_compiler_version})
|
||||||
|
# again, here is room for improvement
|
||||||
|
# what if the compiler is not "g++" !?
|
||||||
|
set(${VAR} "g++${eigen_cxx_compiler_version}")
|
||||||
|
endif()
|
||||||
|
endmacro(ei_get_compilerver)
|
||||||
|
|
||||||
|
macro(ei_get_cxxflags VAR)
|
||||||
|
set(${VAR} "")
|
||||||
|
ei_is_64bit_env(IS_64BIT_ENV)
|
||||||
|
if(EIGEN_TEST_NEON)
|
||||||
|
set(${VAR} NEON)
|
||||||
|
elseif(EIGEN_TEST_ALTIVEC)
|
||||||
|
set(${VAR} ALVEC)
|
||||||
|
elseif(EIGEN_TEST_SSE4_2)
|
||||||
|
set(${VAR} SSE42)
|
||||||
|
elseif(EIGEN_TEST_SSE4_1)
|
||||||
|
set(${VAR} SSE41)
|
||||||
|
elseif(EIGEN_TEST_SSSE3)
|
||||||
|
set(${VAR} SSSE3)
|
||||||
|
elseif(EIGEN_TEST_SSE3)
|
||||||
|
set(${VAR} SSE3)
|
||||||
|
elseif(EIGEN_TEST_SSE2 OR IS_64BIT_ENV)
|
||||||
|
set(${VAR} SSE2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIGEN_TEST_OPENMP)
|
||||||
|
if (${VAR} STREQUAL "")
|
||||||
|
set(${VAR} OMP)
|
||||||
|
else()
|
||||||
|
set(${VAR} ${${VAR}}-OMP)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIGEN_DEFAULT_TO_ROW_MAJOR)
|
||||||
|
if (${VAR} STREQUAL "")
|
||||||
|
set(${VAR} ROW)
|
||||||
|
else()
|
||||||
|
set(${VAR} ${${VAR}}-ROWMAJ)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro(ei_get_cxxflags)
|
||||||
|
|
||||||
|
macro(ei_set_build_string)
|
||||||
|
ei_get_compilerver(LOCAL_COMPILER_VERSION)
|
||||||
|
ei_get_cxxflags(LOCAL_COMPILER_FLAGS)
|
||||||
|
|
||||||
|
include(EigenDetermineOSVersion)
|
||||||
|
DetermineOSVersion(OS_VERSION)
|
||||||
|
|
||||||
|
set(TMP_BUILD_STRING ${OS_VERSION}-${LOCAL_COMPILER_VERSION})
|
||||||
|
|
||||||
|
if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL "")
|
||||||
|
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ei_is_64bit_env(IS_64BIT_ENV)
|
||||||
|
if(NOT IS_64BIT_ENV)
|
||||||
|
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-32bit)
|
||||||
|
else()
|
||||||
|
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-64bit)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(TOLOWER ${TMP_BUILD_STRING} BUILDNAME)
|
||||||
|
endmacro(ei_set_build_string)
|
||||||
|
|
||||||
|
macro(ei_is_64bit_env VAR)
|
||||||
|
if(CMAKE_CL_64)
|
||||||
|
set(${VAR} 1)
|
||||||
|
elseif("$ENV{Platform}" STREQUAL "X64") # nmake 64 bit
|
||||||
|
set(${VAR} 1)
|
||||||
|
endif()
|
||||||
|
endmacro(ei_is_64bit_env)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user