forked from nathanwbrei/phasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
52 lines (39 loc) · 1.7 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
cmake_minimum_required(VERSION 3.9)
project(surrogate_toolkit VERSION 0.0.1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Enable -fPIC for all targets
# Set default standard to C++14, but allow user to override at command line
if(NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 20)
endif()
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g -Wall -Wextra -fno-omit-frame-pointer")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# CMake has been explicitly given an install dir, so we use that
elseif(DEFINED ENV{SURROGATE_HOME})
# CMake hasn't been told of an install dir, but we have an envvar, so we use that instead
set(CMAKE_INSTALL_PREFIX $ENV{SURROGATE_HOME} CACHE PATH "Comment explaining this nonsense" FORCE)
else()
# No explicit install dir, so we install to './install' to avoid clobbering /usr/local
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Comment explaining this nonsense" FORCE)
endif()
message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}")
option(USE_ASAN "Compile with address sanitizer" OFF)
if (${USE_ASAN})
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
message(STATUS "-----------------------")
message(STATUS "Build type is ${CMAKE_BUILD_TYPE}")
message(STATUS "Installation directory is ${CMAKE_INSTALL_PREFIX}")
if (${USE_ASAN})
message(STATUS "USE_ASAN On")
else()
message(STATUS "USE_ASAN Off")
endif()
message(STATUS "-----------------------")
include_directories(external)
add_subdirectory(examples)
add_subdirectory(surrogate)
add_subdirectory(memtrace)
add_subdirectory(memtrace_pin)
add_subdirectory(gpu_perf_tester)