-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·62 lines (50 loc) · 1.98 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
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
find_package(Curses REQUIRED)
find_package(Libedit REQUIRED)
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(LLVM_VERSION_MAJOR GREATER 6)
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(LLVM_VERSION_MAJOR GREATER 6 AND TERRA_SLIB_INCLUDE_LLVM)
message(FATAL_ERROR "TERRA_SLIB_INCLUDE_LLVM is not supported in LLVM version >= 7")
endif()
if(DEFINED TERRA_STATIC_LINK_LUAJIT)
set(DEFAULT_TERRA_SLIB_INCLUDE_LUAJIT ${TERRA_STATIC_LINK_LUAJIT})
else()
set(DEFAULT_TERRA_SLIB_INCLUDE_LUAJIT ON)
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()
include(GNUInstallDirs)
include(VersionNumber)
include(BuildDirs)
include(GetLuaJIT)
include(ExtractLLVM)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_testing()
add_subdirectory(src)