-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
82 lines (73 loc) · 2.78 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
cmake_minimum_required (VERSION 3.0)
project (gLM C CXX)
set(DEBUGBUILD 0)
set(BAD_HOST_FLAGS 0)
set(GPU_COMPUTE_VER 61)
set(PYTHON_VER_FLAG 2.2)
#Fix GPU compilation on bad ubuntu systems
if (DEFINED BAD_HOST)
if ((${BAD_HOST} EQUAL 1) OR (${BAD_HOST} EQUAL 0))
set(BAD_HOST_FLAGS ${BAD_HOST})
else()
message(SEND_ERROR "Invalid value for the BAD_HOST variable: ${BAD_HOST}. Valid values are 1 (for true) and 0 (for false)")
endif()
endif()
if (DEFINED COMPUTE_VER)
message("Setting custom compute version target for the GPU compilation: ${COMPUTE_VER}. If the version specified is invalid compilation will fail. If the version specified is higher than what your GPU supports, it will compile successfully but the tests won't pass.")
set(GPU_COMPUTE_VER ${COMPUTE_VER})
endif()
#Release build by default
if (DEFINED BUILDTYPE)
if (${BUILDTYPE} STREQUAL "release")
message("Building a release build with -O3.")
elseif(${BUILDTYPE} STREQUAL "debug")
set(DEBUGBUILD 1)
message("Building a debug build.")
else()
message(SEND_ERROR "Unrecognized build type. Valid values are \"release\" or \"debug\". Building a release build.")
endif()
else()
message("Building a release build with -O3.")
endif()
#Set python version to compile against
if (NOT DEFINED COMPILE_NEMATUS OR NOT ${COMPILE_NEMATUS})
set(COMPILE_NEMATUS 0)
else()
if (DEFINED PYTHON_VER)
set(PYTHON_VER_FLAG ${PYTHON_VER})
endif()
message("Building against python version: ${PYTHON_VER_FLAG}")
endif()
if(${DEBUGBUILD} EQUAL 1)
SET (CMAKE_CXX_FLAGS "-g -Wall")
SET (CMAKE_CXX_FLAGS_DEBUG "-g")
else()
SET (CMAKE_CXX_FLAGS "-O3 -Wall -DNDEBUG")
endif()
#GCC 6.0+ defaults to c++14 so no need to specify c++11 manually
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
find_package(CUDA REQUIRED) # For when we add CUDA files
include_directories (${CUDA_INCLUDE_DIRS})
#Add include directories
include_directories ("${PROJECT_SOURCE_DIR}/Btree")
include_directories ("${PROJECT_SOURCE_DIR}/Trie")
include_directories ("${PROJECT_SOURCE_DIR}/Parser")
include_directories ("${PROJECT_SOURCE_DIR}/misc")
include_directories ("${PROJECT_SOURCE_DIR}/gpu")
include_directories ("${PROJECT_SOURCE_DIR}/LM")
add_subdirectory (Test)
add_subdirectory (misc_testing)
add_subdirectory (bin)
add_subdirectory (gpu)
add_subdirectory (LM)
add_subdirectory (lib)
#add_subdirectory (Btree)
#add_subdirectory (Parser)
enable_testing ()
add_test (NAME AllTest COMMAND tests)
add_test (NAME gpu_test COMMAND gpu_tests_suite)
add_test (NAME gpu_test_v2 COMMAND gpu_tests_suite_v2)
add_test (NAME btree_test COMMAND btree_tests)
add_test (NAME lm_test COMMAND lm_tests)