-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
60 lines (44 loc) · 1.49 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
cmake_minimum_required(VERSION 3.16)
option(ENABLE_TIME_TRACE "Enable time trace for compile time optimization." OFF)
# Remove this block after bumping CMake to v3.21.0
# PROJECT_IS_TOP_LEVEL is defined then by default
if(CMAKE_VERSION VERSION_LESS 3.21.0)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(PROJECT_IS_TOP_LEVEL TRUE)
else()
set(PROJECT_IS_TOP_LEVEL FALSE)
endif()
endif()
if(PROJECT_IS_TOP_LEVEL)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "Default C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Require C++ standard")
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Allow C++ extensions")
endif()
# guard against in-source builds
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
endif()
# guard against bad build-type strings
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
project(acg
DESCRIPTION "Adversarr's CG Toolbox"
LANGUAGES CXX)
include(CheckCXXCompilerFlag)
include(GNUInstallDirs)
include(CMakeDependentOption)
include(cmake/utils.cmake)
# Further optimize for SIMD.
if(NOT MSVC)
acg_add_cxx_compiler_flag("-march=native")
endif()
# Time trace
if(${ENABLE_TIME_TRACE})
acg_add_cxx_compiler_flag("-ftime-trace")
endif()
add_subdirectory(core)
add_subdirectory(gui)
add_subdirectory(physics)
add_subdirectory(data)
add_subdirectory(examples)