forked from g-truc/glm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
133 lines (115 loc) · 3.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_policy(VERSION 2.6)
project(glm)
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()
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_PEDANTIC "Pedantic" ON)
if(GLM_TEST_ENABLE_CXX_PEDANTIC)
add_definitions(-pedantic)
endif()
if(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")
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")
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")
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")
endif()
endif()
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32))
option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF)
if(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
add_definitions(/Za)
endif()
endif()
option(GLM_TEST_ENABLE_SIMD_SSE2 "Enable SSE2 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_SSE3 "Enable SSE3 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_AVX "Enable AVX optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF)
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)
elseif(MSVC)
add_definitions(/arch:IA32)
endif()
elseif(GLM_TEST_ENABLE_AVX2)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-mavx2)
elseif(GLM_USE_INTEL)
add_definitions(/QxAVX2)
elseif(MSVC)
add_definitions(/arch:AVX2)
endif()
elseif(GLM_TEST_ENABLE_AVX)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-mavx)
elseif(GLM_USE_INTEL)
add_definitions(/QxAVX)
elseif(MSVC)
add_definitions(/arch:AVX)
endif()
elseif(GLM_TEST_ENABLE_SSE3)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-msse3)
elseif(GLM_USE_INTEL)
add_definitions(/QxSSE3)
elseif(MSVC)
add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3
endif()
elseif(GLM_TEST_ENABLE_SSE2)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-msse2)
elseif(GLM_USE_INTEL)
add_definitions(/QxSSE2)
elseif(MSVC)
if(NOT CMAKE_CL_64)
add_definitions(/arch:SSE2)
endif()
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(-S)
#add_definitions(-s)
#add_definitions(-m32)
#add_definitions(-O3)
#add_definitions(-fprofile-arcs -ftest-coverage) gcov
#ctest_enable_coverage()
endif()
include_directories(".")
include_directories("./test/external")
add_subdirectory(glm)
add_subdirectory(test)
install(DIRECTORY glm DESTINATION include)