-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
149 lines (144 loc) · 4.2 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
# 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)
project(swallow VERSION 0.0.1 LANGUAGES CXX)
# target
set(CMAKE_C_COMPILER "/usr/bin/clang-18")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++-18")
add_library(base SHARED "")
set_target_properties(base PROPERTIES OUTPUT_NAME "base")
set_target_properties(base PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/linux/x86_64/release")
target_compile_options(base PRIVATE
$<$<COMPILE_LANGUAGE:C>:-m64>
$<$<COMPILE_LANGUAGE:CXX>:-m64>
$<$<COMPILE_LANGUAGE:C>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-DNDEBUG>
)
set_target_properties(base PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(base PRIVATE cxx_std_20)
if(MSVC)
target_compile_options(base PRIVATE $<$<CONFIG:Release>:-Ox -fp:fast>)
else()
target_compile_options(base PRIVATE -O3)
endif()
if(MSVC)
set_property(TARGET base PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_options(base PRIVATE
-m64
)
target_sources(base PRIVATE
base/base.cpp
)
# target
set(CMAKE_C_COMPILER "/usr/bin/clang-18")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++-18")
add_executable(swc "")
set_target_properties(swc PROPERTIES OUTPUT_NAME "swc")
set_target_properties(swc PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/linux/x86_64/release")
add_dependencies(swc base)
target_include_directories(swc PRIVATE
compiler
compiler/ast
compiler/type
compiler/lexer
compiler/parser
compiler/diagnostics
compiler/utils
)
target_compile_options(swc PRIVATE
$<$<COMPILE_LANGUAGE:C>:-m64>
$<$<COMPILE_LANGUAGE:CXX>:-m64>
$<$<COMPILE_LANGUAGE:C>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-DNDEBUG>
$<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++>
)
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>:-Ox -fp:fast>)
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
c++
base
)
target_link_directories(swc PRIVATE
build/linux/x86_64/release
)
target_link_options(swc PRIVATE
-m64
)
target_sources(swc PRIVATE
compiler/compiler.cpp
compiler/parser/parser.cpp
compiler/parser/bison_parser.cpp
compiler/type/dump.cpp
compiler/type/environment.cpp
compiler/type/type.cpp
compiler/diagnostics/reporter.cpp
compiler/diagnostics/diagnostics.cpp
compiler/diagnostics/utils.cpp
compiler/g-machine/instruction.cpp
compiler/g-machine/binop.cpp
compiler/g-machine/environment.cpp
compiler/lexer/flex_lexer.cpp
compiler/lexer/lexer.cpp
compiler/ast/ast.cpp
compiler/ast/g-machine.cpp
compiler/ast/dump.cpp
compiler/ast/type.cpp
)
# target
set(CMAKE_C_COMPILER "/usr/bin/clang-18")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++-18")
add_executable(swi "")
set_target_properties(swi PROPERTIES OUTPUT_NAME "swi")
set_target_properties(swi PROPERTIES RUNTIME_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>:-Ox -fp:fast>)
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
base
)
target_link_directories(swi PRIVATE
build/linux/x86_64/release
)
target_link_options(swi PRIVATE
-m64
)
target_sources(swi PRIVATE
repl/main.cpp
)