-
Notifications
You must be signed in to change notification settings - Fork 205
/
CMakeLists.txt
72 lines (59 loc) · 2.14 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
cmake_minimum_required(VERSION 3.5)
project(Terra)
list(INSERT CMAKE_MODULE_PATH 0 "${Terra_SOURCE_DIR}/cmake/Modules")
find_package(LLVM HINTS ${LLVM_HINTS} REQUIRED)
find_package(Clang REQUIRED)
find_package(Git) # for version number
if(TERRA_ENABLE_CUDA)
find_package(CUDA REQUIRED)
elseif(NOT DEFINED TERRA_ENABLE_CUDA)
find_package(CUDA)
endif()
set(TERRA_ENABLE_CUDA ${CUDA_FOUND} CACHE BOOL "Build Terra with support for CUDA")
if(DEFINED TERRA_STATIC_LINK_LLVM)
set(DEFAULT_TERRA_SLIB_INCLUDE_LLVM ${TERRA_STATIC_LINK_LLVM})
else()
if(WIN32)
set(DEFAULT_TERRA_SLIB_INCLUDE_LLVM OFF)
else()
set(DEFAULT_TERRA_SLIB_INCLUDE_LLVM ON)
endif()
endif()
set(TERRA_SLIB_INCLUDE_LLVM ${DEFAULT_TERRA_SLIB_INCLUDE_LLVM} CACHE BOOL "Include LLVM in Terra static libraries")
set(TERRA_STATIC_LINK_LLVM ON CACHE BOOL "Statically link Terra against LLVM")
if(TERRA_SLIB_INCLUDE_LLVM AND NOT TERRA_STATIC_LINK_LLVM)
message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LLVM requires TERRA_STATIC_LINK_LLVM to be set")
endif()
if(WIN32 AND TERRA_SLIB_INCLUDE_LLVM)
message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LLVM is not supported on Windows")
endif()
if(DEFINED TERRA_STATIC_LINK_LUAJIT)
set(DEFAULT_TERRA_SLIB_INCLUDE_LUAJIT ${TERRA_STATIC_LINK_LUAJIT})
else()
if(WIN32)
set(DEFAULT_TERRA_SLIB_INCLUDE_LUAJIT OFF)
else()
set(DEFAULT_TERRA_SLIB_INCLUDE_LUAJIT ON)
endif()
endif()
set(TERRA_SLIB_INCLUDE_LUAJIT ${DEFAULT_TERRA_SLIB_INCLUDE_LUAJIT} CACHE BOOL "Include LuaJIT in Terra static libraries")
set(TERRA_STATIC_LINK_LUAJIT ON CACHE BOOL "Statically link Terra against LuaJIT")
if(TERRA_SLIB_INCLUDE_LUAJIT AND NOT TERRA_STATIC_LINK_LUAJIT)
message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LUAJIT requires TERRA_STATIC_LINK_LUAJIT to be set")
endif()
if(WIN32 AND TERRA_SLIB_INCLUDE_LUAJIT)
message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LUAJIT is not supported on Windows")
endif()
include(GNUInstallDirs)
include(VersionNumber)
include(BuildDirs)
include(GetLuaJIT)
include(ExtractLLVM)
if(LLVM_VERSION_MAJOR GREATER 15)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing()
add_subdirectory(src)