|
|
@@ -1,11 +1,10 @@
|
|
|
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
|
|
-cmake_policy(VERSION 2.6)
|
|
|
-if (NOT CMAKE_VERSION VERSION_LESS "3.1")
|
|
|
- cmake_policy(SET CMP0054 NEW)
|
|
|
-endif()
|
|
|
+cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
|
|
+cmake_policy(VERSION 3.2)
|
|
|
|
|
|
-project(glm)
|
|
|
set(GLM_VERSION "0.9.9")
|
|
|
+project(glm VERSION ${GLM_VERSION} LANGUAGES CXX)
|
|
|
+
|
|
|
+message("Compiler: ${CMAKE_CXX_COMPILER_ID}")
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
|
|
@@ -14,8 +13,6 @@ include(CMakePackageConfigHelpers)
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
-add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
-
|
|
|
option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF)
|
|
|
if(GLM_STATIC_LIBRARY_ENABLE)
|
|
|
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_STATIC_LIBRARY_ENABLE with ON to build an optional static library")
|
|
|
@@ -26,99 +23,59 @@ if(GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
|
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_DYNAMIC_LIBRARY_ENABLE with ON to build an optional dynamic library")
|
|
|
endif()
|
|
|
|
|
|
-option(GLM_INSTALL_ENABLE "GLM install" ON)
|
|
|
-
|
|
|
option(GLM_TEST_ENABLE "GLM test" OFF)
|
|
|
if(NOT GLM_TEST_ENABLE)
|
|
|
message(STATUS "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_FAST_MATH "Enable fast math optimizations" OFF)
|
|
|
+option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
|
|
|
+option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
|
|
+option(GLM_TEST_ENABLE_CXX_14 "Enable C++ 14" OFF)
|
|
|
+option(GLM_TEST_ENABLE_CXX_17 "Enable C++ 17" OFF)
|
|
|
|
|
|
-if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX))
|
|
|
- option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
|
|
|
- option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF)
|
|
|
- option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
|
|
- option(GLM_TEST_ENABLE_CXX_1Y "Enable C++ 1y" OFF)
|
|
|
- option(GLM_TEST_ENABLE_CXX_14 "Enable C++ 14" OFF)
|
|
|
- option(GLM_TEST_ENABLE_CXX_1Z "Enable C++ 1z" OFF)
|
|
|
- option(GLM_TEST_ENABLE_CXX_17 "Enable C++ 17" OFF)
|
|
|
-
|
|
|
- if(GLM_TEST_ENABLE_CXX_17)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++17")
|
|
|
- message(STATUS "Build with C++17 features")
|
|
|
- elseif(GLM_TEST_ENABLE_CXX_1Z)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++1z")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++1z")
|
|
|
- message(STATUS "Build with C++1z features")
|
|
|
- elseif(GLM_TEST_ENABLE_CXX_14)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++14")
|
|
|
- message(STATUS "Build with C++14 features")
|
|
|
- elseif(GLM_TEST_ENABLE_CXX_1Y)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++1y")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++1y")
|
|
|
- message(STATUS "Build with C++1y features")
|
|
|
- elseif(GLM_TEST_ENABLE_CXX_11)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++11")
|
|
|
- message(STATUS "Build with C++11 features")
|
|
|
- elseif(GLM_TEST_ENABLE_CXX_0X)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++0x")
|
|
|
- message(STATUS "Build with C++0x features")
|
|
|
- elseif(GLM_TEST_ENABLE_CXX_98)
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
|
|
|
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
|
|
- set(CMAKE_CXX_FLAGS "-std=c++98")
|
|
|
- message(STATUS "Build with C++98 features")
|
|
|
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
- add_definitions(-Wno-long-long)
|
|
|
- endif()
|
|
|
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
- add_definitions(-Wno-c++11-long-long)
|
|
|
- endif()
|
|
|
- endif()
|
|
|
-endif()
|
|
|
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
- add_definitions(-Werror -Weverything -Wpedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-long-long -Wno-padded -Wno-documentation -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
|
|
|
- add_definitions(-Wno-undefined-reinterpret-cast -Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare -Wno-global-constructors -Wno-unused-macros -Wno-format-nonliteral)
|
|
|
+if(GLM_TEST_ENABLE_CXX_17)
|
|
|
+ set(CMAKE_CXX_STANDARD 17)
|
|
|
+ message(STATUS "GLM: Build with C++17 features")
|
|
|
+
|
|
|
+elseif(GLM_TEST_ENABLE_CXX_14)
|
|
|
+ set(CMAKE_CXX_STANDARD 14)
|
|
|
+ message(STATUS "GLM: Build with C++14 features")
|
|
|
+
|
|
|
+elseif(GLM_TEST_ENABLE_CXX_11)
|
|
|
+ set(CMAKE_CXX_STANDARD 11)
|
|
|
+ message(STATUS "GLM: Build with C++11 features")
|
|
|
+
|
|
|
+elseif(GLM_TEST_ENABLE_CXX_98)
|
|
|
+ set(CMAKE_CXX_STANDARD 98)
|
|
|
+ message(STATUS "GLM: Build with C++98 features")
|
|
|
endif()
|
|
|
|
|
|
option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF)
|
|
|
|
|
|
if(GLM_TEST_ENABLE_LANG_EXTENSIONS)
|
|
|
- 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()
|
|
|
+ set(CMAKE_CXX_EXTENSIONS ON)
|
|
|
+
|
|
|
+ message(STATUS "GLM: Build with C++ language extensions")
|
|
|
else()
|
|
|
- if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32))
|
|
|
- add_definitions(/Za)
|
|
|
- elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
|
|
|
- add_definitions(-pedantic)
|
|
|
- endif()
|
|
|
+ set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
endif()
|
|
|
|
|
|
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
- add_definitions(/FAs)
|
|
|
+option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF)
|
|
|
+if(GLM_TEST_ENABLE_FAST_MATH)
|
|
|
+ message(STATUS "GLM: Build with fast math optimizations")
|
|
|
+
|
|
|
+ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
|
|
|
+ add_compiler_options(-ffast-math)
|
|
|
+
|
|
|
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
+ add_compiler_options(/fp:fast)
|
|
|
+ endif()
|
|
|
+else()
|
|
|
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
+ add_compiler_options(/fp:precise)
|
|
|
+ endif()
|
|
|
endif()
|
|
|
|
|
|
option(GLM_TEST_ENABLE_SIMD_SSE2 "Enable SSE2 optimizations" OFF)
|
|
|
@@ -130,67 +87,76 @@ option(GLM_TEST_FORCE_PURE "Force 'pure' instructions" OFF)
|
|
|
if(GLM_TEST_FORCE_PURE)
|
|
|
add_definitions(-DGLM_FORCE_PURE)
|
|
|
|
|
|
- if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
- add_definitions(-mfpmath=387)
|
|
|
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
+ add_compiler_options(-mfpmath=387)
|
|
|
endif()
|
|
|
message(STATUS "GLM: No SIMD instruction set")
|
|
|
+
|
|
|
elseif(GLM_TEST_ENABLE_SIMD_AVX2)
|
|
|
- if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
- add_definitions(-mavx2)
|
|
|
- elseif(GLM_USE_INTEL)
|
|
|
- add_definitions(/QxAVX2)
|
|
|
+ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
+ add_compiler_options(-mavx2)
|
|
|
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
+ add_compiler_options(/QxAVX2)
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
- add_definitions(/arch:AVX2)
|
|
|
+ add_compiler_options(/arch:AVX2)
|
|
|
endif()
|
|
|
message(STATUS "GLM: AVX2 instruction set")
|
|
|
+
|
|
|
elseif(GLM_TEST_ENABLE_SIMD_AVX)
|
|
|
- if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
- add_definitions(-mavx)
|
|
|
- elseif(GLM_USE_INTEL)
|
|
|
- add_definitions(/QxAVX)
|
|
|
+ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
+ add_compiler_options(-mavx)
|
|
|
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
+ add_compiler_options(/QxAVX)
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
- add_definitions(/arch:AVX)
|
|
|
+ add_compiler_options(/arch:AVX)
|
|
|
endif()
|
|
|
message(STATUS "GLM: AVX instruction set")
|
|
|
+
|
|
|
elseif(GLM_TEST_ENABLE_SIMD_SSE3)
|
|
|
- if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
- add_definitions(-msse3)
|
|
|
- elseif(GLM_USE_INTEL)
|
|
|
- add_definitions(/QxSSE3)
|
|
|
+ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
+ add_compiler_options(-msse3)
|
|
|
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
+ add_compiler_options(/QxSSE3)
|
|
|
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") AND NOT CMAKE_CL_64)
|
|
|
- add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3
|
|
|
+ add_compiler_options(/arch:SSE2) # VC doesn't support /arch:SSE3
|
|
|
endif()
|
|
|
message(STATUS "GLM: SSE3 instruction set")
|
|
|
+
|
|
|
elseif(GLM_TEST_ENABLE_SIMD_SSE2)
|
|
|
- if(CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
- add_definitions(-msse2)
|
|
|
- elseif(GLM_USE_INTEL)
|
|
|
- add_definitions(/QxSSE2)
|
|
|
+ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
+ add_compiler_options(-msse2)
|
|
|
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
+ add_compiler_options(/QxSSE2)
|
|
|
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") AND NOT CMAKE_CL_64)
|
|
|
- add_definitions(/arch:SSE2)
|
|
|
+ add_compiler_options(/arch:SSE2)
|
|
|
endif()
|
|
|
message(STATUS "GLM: SSE2 instruction set")
|
|
|
endif()
|
|
|
|
|
|
-if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
- #add_definitions(-S)
|
|
|
- #add_definitions(-s)
|
|
|
- add_definitions(-O2)
|
|
|
+# Additional compiler options
|
|
|
|
|
|
- #add_definitions(-fprofile-arcs -ftest-coverage) gcov
|
|
|
- #ctest_enable_coverage()
|
|
|
-endif()
|
|
|
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
+ add_compiler_options(-Werror -Weverything)
|
|
|
+
|
|
|
+ add_compiler_options(-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-long-long -Wno-padded -Wno-documentation -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
|
|
|
+ add_compiler_options(-Wno-undefined-reinterpret-cast -Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare -Wno-global-constructors -Wno-unused-macros -Wno-format-nonliteral)
|
|
|
+
|
|
|
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
+ add_compiler_options(-O2)
|
|
|
+ add_compiler_options(-Wno-long-long)
|
|
|
|
|
|
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
- add_definitions(/FAs)
|
|
|
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
+ add_compiler_options(/FAs)
|
|
|
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
endif()
|
|
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}")
|
|
|
-include_directories("${PROJECT_SOURCE_DIR}/test/external")
|
|
|
|
|
|
add_subdirectory(glm)
|
|
|
add_subdirectory(test)
|
|
|
|
|
|
+option(GLM_INSTALL_ENABLE "GLM install" ON)
|
|
|
+
|
|
|
set(GLM_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm")
|
|
|
if (GLM_INSTALL_ENABLE)
|
|
|
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
@@ -209,25 +175,23 @@ configure_package_config_file(
|
|
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
|
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
|
|
|
|
|
-if (GLM_INSTALL_ENABLE)
|
|
|
+if(GLM_INSTALL_ENABLE)
|
|
|
install(FILES
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
|
|
|
DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
|
|
endif()
|
|
|
|
|
|
-if (NOT CMAKE_VERSION VERSION_LESS "3.0")
|
|
|
- add_library(glm INTERFACE)
|
|
|
- target_include_directories(glm INTERFACE
|
|
|
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
|
|
- install(TARGETS glm EXPORT glmTargets)
|
|
|
+add_library(glm INTERFACE)
|
|
|
+target_include_directories(glm INTERFACE
|
|
|
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
|
|
+install(TARGETS glm EXPORT glmTargets)
|
|
|
|
|
|
- export(EXPORT glmTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake")
|
|
|
+export(EXPORT glmTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake")
|
|
|
|
|
|
- if (GLM_INSTALL_ENABLE)
|
|
|
- install(EXPORT glmTargets FILE glmTargets.cmake DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
|
|
- endif()
|
|
|
+if(GLM_INSTALL_ENABLE)
|
|
|
+ install(EXPORT glmTargets FILE glmTargets.cmake DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
|
|
endif()
|
|
|
|
|
|
# build pkg-config file
|