-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (73 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
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
82
83
84
85
86
87
88
cmake_minimum_required(
VERSION 3.6
)
project(
csabr
LANGUAGES C
VERSION 0.1
)
add_compile_options(
-D_GNU_SOURCE
-Wall
-Winline
)
set(ASAN true)
if(ASAN)
if(UNIX)
add_compile_options(
-fsanitize=address
-fsanitize=leak
-fno-omit-frame-pointer
)
add_link_options(
-fsanitize=address
-fsanitize=leak
)
endif()
endif()
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O2")
set(CMAKE_C_STANDARD 17)
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/include/cctl
${PROJECT_SOURCE_DIR}/include/compiler
${PROJECT_SOURCE_DIR}/include/interpreter
${PROJECT_SOURCE_DIR}/include/interpreter/bif
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/compiler
${PROJECT_SOURCE_DIR}/src/interpreter
${PROJECT_SOURCE_DIR}/src/interpreter/bif
)
file(
GLOB
common_srcs
"${PROJECT_SOURCE_DIR}/src/*.c"
"${PROJECT_SOURCE_DIR}/include/*.h"
"${PROJECT_SOURCE_DIR}/include/cctl/*.h"
)
file(
GLOB
inter_srcs
"${PROJECT_SOURCE_DIR}/src/interpreter/*.c"
"${PROJECT_SOURCE_DIR}/src/interpreter/bif/*.c"
"${PROJECT_SOURCE_DIR}/include/interpreter/*.h"
"${PROJECT_SOURCE_DIR}/include/interpreter/bif/*.h"
)
file(
GLOB
comp_srcs
"${PROJECT_SOURCE_DIR}/src/compiler/*.c"
"${PROJECT_SOURCE_DIR}/include/compiler/*.h"
)
add_executable(
sabr
${comp_srcs} ${inter_srcs} ${common_srcs}
)
target_link_libraries(sabr m)
message("CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
message("CMAKE_C_COMPILER_ID: " ${CMAKE_C_COMPILER_ID})
message("CMAKE_GENERATOR: " ${CMAKE_GENERATOR})
message("CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR})
message("PROJECT_VERSION: " ${PROJECT_VERSION})
configure_file(${PROJECT_SOURCE_DIR}/cmake_config.in ${PROJECT_SOURCE_DIR}/include/cmake_config.h)