-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
41 lines (34 loc) · 1.33 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.18.0)
project(Tsanalyze)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SRC_LIST)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
IF (WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -Wfatal-errors -Wstrict-prototypes -Wshadow -Wno-unused-parameter")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all")
ENDIF()
IF(${CMAKE_BUILD_TYPE} MATCHES "debug")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g")
add_compile_options(-fno-omit-frame-pointer -fmacro-backtrace-limit=0)
add_compile_options(-fsanitize=address -fsanitize-recover=all)
IF (CMAKE_HOST_APPLE)
add_link_options(-fsanitize=address -fsanitize-recover=all)
ELSE ()
add_compile_options(-fsanitize=leak)
ENDIF()
ELSE()
IF (WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Od")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
ENDIF()
ENDIF()
ADD_EXECUTABLE(tsanalyze ${SRC_LIST})
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
# on windows, use vcpkg install pybind11 and configure PYBIND11_DIR manually
find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(tsana ./pybind/binding.cpp ${SRC_LIST})
install(FILES ./pybind/tsanalyze.py DESTINATION /usr/local/bin)