Added CMake test build options
This commit is contained in:
@@ -6,18 +6,78 @@ enable_testing()
|
||||
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
option(GLM_TEST_ENABLE "GLM test" OFF)
|
||||
if(NOT GLM_TEST_ENABLE)
|
||||
message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
||||
if(GLM_TEST_ENABLE_CXX_11)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-std=c++11)
|
||||
endif()
|
||||
elseif(NOT GLM_TEST_ENABLE_CXX_11)
|
||||
add_definitions(-DGLM_FORCE_CXX98)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-std=c++98)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF)
|
||||
if(GLM_TEST_ENABLE_MS_EXTENSIONS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-fms-extensions)
|
||||
add_definitions(-D_MSC_EXTENSIONS)
|
||||
endif()
|
||||
elseif(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-std=c++98)
|
||||
add_definitions(-pedantic)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/Za)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF)
|
||||
if(GLM_TEST_ENABLE_SIMD)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-msse2)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/arch:SSE2)
|
||||
endif()
|
||||
elseif(NOT GLM_TEST_ENABLE_SIMD)
|
||||
|
||||
add_definitions(-DGLM_FORCE_PURE)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-mfpmath=387)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF)
|
||||
if(GLM_TEST_ENABLE_FAST_MATH)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-ffast-math)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/fp:fast)
|
||||
endif()
|
||||
elseif(NOT GLM_TEST_ENABLE_FAST_MATH)
|
||||
if(MSVC)
|
||||
add_definitions(/fp:precise)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
#add_definitions(/Za)
|
||||
#add_definitions(-pedantic)
|
||||
#add_definitions(-S)
|
||||
#add_definitions(-s)
|
||||
#add_definitions(-msse2)
|
||||
#add_definitions(-std=c++0x)
|
||||
#add_definitions(-fms-extensions)
|
||||
#add_definitions(-D_MSC_EXTENSIONS)
|
||||
#add_definitions(-m32)
|
||||
#add_definitions(-mfpmath=387)
|
||||
#add_definitions(-ffast-math)
|
||||
#add_definitions(-O3)
|
||||
|
||||
#add_definitions(-fprofile-arcs -ftest-coverage) gcov
|
||||
@@ -32,9 +92,4 @@ add_subdirectory(test)
|
||||
add_subdirectory(bench)
|
||||
add_subdirectory(doc)
|
||||
|
||||
option(GLM_TEST_MODE "GLM test" OFF)
|
||||
if(NOT GLM_TEST_MODE)
|
||||
message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_MODE with ON to build and run the test bench")
|
||||
endif()
|
||||
|
||||
install(DIRECTORY glm DESTINATION include)
|
||||
|
||||
Reference in New Issue
Block a user