-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
211 lines (205 loc) · 5.8 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# this is the build file for project swallow
# it is autogenerated by the xmake build system.
# do not edit by hand.
# project
cmake_minimum_required(VERSION 3.15.0)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_C_COMPILER "/usr/bin/x86_64-w64-mingw32-gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/x86_64-w64-mingw32-g++")
project(swallow VERSION 0.0.1 LANGUAGES CXX)
# target
add_executable(swa "")
set_target_properties(swa PROPERTIES OUTPUT_NAME "swa")
set_target_properties(swa PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/linux/x86_64/release")
add_dependencies(swa swc swi)
target_include_directories(swa PRIVATE
compiler
)
target_compile_options(swa PRIVATE
$<$<COMPILE_LANGUAGE:C>:-m64>
$<$<COMPILE_LANGUAGE:CXX>:-m64>
$<$<COMPILE_LANGUAGE:C>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-DNDEBUG>
)
set_target_properties(swa PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(swa PRIVATE cxx_std_20)
if(MSVC)
target_compile_options(swa PRIVATE $<$<CONFIG:Release>:-O2>)
else()
target_compile_options(swa PRIVATE -O3)
endif()
if(MSVC)
else()
target_compile_options(swa PRIVATE -fvisibility=hidden)
endif()
if(MSVC)
set_property(TARGET swa PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_libraries(swa PRIVATE
swi
swc
pthread
)
target_link_directories(swa PRIVATE
build/linux/x86_64/release
)
target_link_options(swa PRIVATE
-m64
)
if(Clang)
target_link_options(swa PRIVATE
-lc++abi
)
endif()
target_sources(swa PRIVATE
cli/main.cpp
)
# target
add_library(swallow_base STATIC "")
set_target_properties(swallow_base PROPERTIES OUTPUT_NAME "swallow_base")
set_target_properties(swallow_base PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/linux/x86_64/release")
target_compile_options(swallow_base PRIVATE
$<$<COMPILE_LANGUAGE:C>:-m64>
$<$<COMPILE_LANGUAGE:CXX>:-m64>
$<$<COMPILE_LANGUAGE:C>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-DNDEBUG>
)
set_target_properties(swallow_base PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(swallow_base PRIVATE cxx_std_20)
if(MSVC)
target_compile_options(swallow_base PRIVATE $<$<CONFIG:Release>:-O2>)
else()
target_compile_options(swallow_base PRIVATE -O3)
endif()
if(MSVC)
else()
target_compile_options(swallow_base PRIVATE -fvisibility=hidden)
endif()
if(MSVC)
set_property(TARGET swallow_base PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_options(swallow_base PRIVATE
-m64
)
target_sources(swallow_base PRIVATE
base/base.cpp
)
# target
add_library(swc STATIC "")
set_target_properties(swc PROPERTIES OUTPUT_NAME "swc")
set_target_properties(swc PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/linux/x86_64/release")
target_include_directories(swc PRIVATE
compiler
)
target_include_directories(swc SYSTEM PRIVATE
/home/muqiu/.xmake/packages/t/tl_optional/v1.1.0/c98c96f6367f4230ab618e8e653468c7/include
/home/muqiu/.xmake/packages/t/tl_expected/v1.1.0/57774aec28a24eb8b84e9c45d2905d73/include
/home/muqiu/.xmake/packages/s/spdlog/v1.14.1/6a0109080d85439d985a75b8a212f96a/include
)
target_compile_options(swc PRIVATE
$<$<COMPILE_LANGUAGE:C>:-m64>
$<$<COMPILE_LANGUAGE:CXX>:-m64>
$<$<COMPILE_LANGUAGE:C>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-DNDEBUG>
)
if(Clang)
target_compile_options(swc PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++>
)
endif()
set_target_properties(swc PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(swc PRIVATE cxx_std_20)
if(MSVC)
target_compile_options(swc PRIVATE $<$<CONFIG:Release>:-O2>)
else()
target_compile_options(swc PRIVATE -O3)
endif()
if(MSVC)
else()
target_compile_options(swc PRIVATE -fvisibility=hidden)
endif()
if(MSVC)
set_property(TARGET swc PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_libraries(swc PRIVATE
pthread
)
target_link_options(swc PRIVATE
-m64
)
if(Clang)
target_link_options(swc PRIVATE
-lc++abi
)
endif()
target_sources(swc PRIVATE
compiler/compiler.cpp
compiler/ast/ast.cpp
compiler/ast/dump.cpp
compiler/ast/gmachine.cpp
compiler/ast/type.cpp
compiler/diagnostics/diagnostics.cpp
compiler/diagnostics/utils.cpp
compiler/diagnostics/reporter.cpp
compiler/gmachine/binop.cpp
compiler/gmachine/environment.cpp
compiler/gmachine/instruction.cpp
compiler/ir/context.cpp
compiler/lexer/flex_lexer.cpp
compiler/lexer/lexer.cpp
compiler/parser/bison_parser.cpp
compiler/parser/parser.cpp
compiler/runtime/node.cpp
compiler/runtime/runtime.cpp
compiler/runtime/stack.cpp
compiler/type/dump.cpp
compiler/type/environment.cpp
compiler/type/type.cpp
)
# target
add_library(swi STATIC "")
set_target_properties(swi PROPERTIES OUTPUT_NAME "swi")
set_target_properties(swi PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/linux/x86_64/release")
add_dependencies(swi swc)
target_compile_options(swi PRIVATE
$<$<COMPILE_LANGUAGE:C>:-m64>
$<$<COMPILE_LANGUAGE:CXX>:-m64>
$<$<COMPILE_LANGUAGE:C>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-DNDEBUG>
)
set_target_properties(swi PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(swi PRIVATE cxx_std_20)
if(MSVC)
target_compile_options(swi PRIVATE $<$<CONFIG:Release>:-O2>)
else()
target_compile_options(swi PRIVATE -O3)
endif()
if(MSVC)
else()
target_compile_options(swi PRIVATE -fvisibility=hidden)
endif()
if(MSVC)
set_property(TARGET swi PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_libraries(swi PRIVATE
swc
pthread
)
target_link_directories(swi PRIVATE
build/linux/x86_64/release
)
target_link_options(swi PRIVATE
-m64
)
if(Clang)
target_link_options(swi PRIVATE
-lc++abi
)
endif()
target_sources(swi PRIVATE
repl/main.cpp
)