-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
183 lines (141 loc) · 3.45 KB
/
Copy pathCMakeLists.txt
File metadata and controls
183 lines (141 loc) · 3.45 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
cmake_minimum_required(VERSION 3.20)
project(lambda_discipline)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(FetchContent)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 11.2.0
)
FetchContent_Declare(
replxx
GIT_REPOSITORY https://github.com/AmokHuginnsson/replxx.git
GIT_TAG master
)
FetchContent_Declare(
CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.5.0
)
FetchContent_MakeAvailable(fmt)
FetchContent_MakeAvailable(replxx)
FetchContent_MakeAvailable(CLI11)
function(enable_warnings target)
if (MSVC)
target_compile_options(${target} PRIVATE
/W4
/permissive-
)
else ()
target_compile_options(${target} PRIVATE
-Wall
-Wextra
-Wpedantic
-Wconversion
-Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Woverloaded-virtual
)
endif ()
endfunction()
###### SOURCE ######
file(GLOB_RECURSE SOURCE_SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/source/*.cpp
)
add_library(lbdSource STATIC
${SOURCE_SOURCE_FILES}
)
target_include_directories(lbdSource PUBLIC
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(lbdSource PUBLIC
fmt::fmt
)
###### DIAGNOSTICS ######
file(GLOB_RECURSE DIAGNOSTICS_SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/diagnostics/*.cpp
)
add_library(lbdDiagnostics STATIC
${DIAGNOSTICS_SOURCE_FILES}
)
target_include_directories(lbdDiagnostics PUBLIC
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(lbdDiagnostics PUBLIC
lbdSource
fmt::fmt
)
###### TYPE ######
file(GLOB_RECURSE TYPE_SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/type/*.cpp
)
add_library(lbdType STATIC
${TYPE_SOURCE_FILES}
)
target_include_directories(lbdType PUBLIC
${PROJECT_SOURCE_DIR}/include
)
###### FRONTEND ######
file(GLOB_RECURSE FRONTEND_SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/frontend/*.cpp
)
add_library(lbdFrontend STATIC
${FRONTEND_SOURCE_FILES}
)
target_include_directories(lbdFrontend PUBLIC
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(lbdFrontend PUBLIC
lbdDiagnostics
)
###### RUNTIME ######
file(GLOB_RECURSE RUNTIME_SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/runtime/*.cpp
)
add_library(lbdRuntime STATIC
${RUNTIME_SOURCE_FILES}
)
target_include_directories(lbdRuntime PUBLIC
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(lbdRuntime PUBLIC
lbdDiagnostics
)
###### MAIN EXECUTABLE ######
file(GLOB LBD_SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/*.cpp
${PROJECT_SOURCE_DIR}/src/utils/terminal/*.cpp
${PROJECT_SOURCE_DIR}/src/cli/*.cpp
${PROJECT_SOURCE_DIR}/src/cli/commands/*.cpp
)
add_executable(lbd
${LBD_SOURCE_FILES}
)
target_include_directories(lbd PRIVATE
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(lbd PRIVATE
lbdDiagnostics
lbdFrontend
lbdRuntime
lbdType
replxx
CLI11::CLI11
)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_link_options(lbd PRIVATE
-static-libstdc++
-static-libgcc
)
endif ()
###### WARNINGS ######
enable_warnings(lbdSource)
enable_warnings(lbdDiagnostics)
enable_warnings(lbdFrontend)
enable_warnings(lbdRuntime)
enable_warnings(lbd)
###### TESTS ######
enable_testing()