-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (103 loc) · 2.05 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
cmake_minimum_required(VERSION 3.13)
project(jcc C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(
SOURCE_FILES
main.c
vector.c
hashtbl.c
deque.c
hash.c
bitset.c
alloc.c
log.c
graphwriter.c
compiler.c
diagnostics.c
lex.c
io.c
parse.c
preproc.c
program.c
link.c
lower.c
liveness.c
disasm.c
codegen.c
var_table.c
typechk.c
lsra.c
graphcol.c
ir/ir.c
ir/build.c
ir/var_refs.c
ir/eliminate_phi.c
ir/prettyprint.c
ir/validate.c
aarch64.c
aarch64/codegen.c
aarch64/lower.c
aarch64/emit.c
aarch64/emitter.c
rv32i.c
rv32i/codegen.c
rv32i/lower.c
rv32i/emit.c
rv32i/emitter.c
rv32i/object.c
# eep.c
# eep/codegen.c
# eep/lower.c
# eep/emit.c
# eep/emitter.c
# eep/object.c
# eep/disasm.c
macos/mach-o.c
linux/elf.c
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Debug build detected")
add_link_options(-fsanitize=address,undefined)
add_compile_options(-fsanitize=address,undefined)
endif()
if(MSVC)
add_compile_option(/W4 /WX)
elseif(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
message(STATUS "Building with AppleClang")
add_compile_options(
-Wall
-Wextra
-Wpedantic
-Weverything
-Werror
-Wno-error=unreachable-code-loop-increment
-Wno-error=unused-parameter
-Wno-error=covered-switch-default
-Wno-error=unreachable-code
-Wmissing-prototypes
-Wsign-conversion
-Wimplicit-fallthrough
-Wstrict-prototypes
-Wmissing-field-initializers
-Wno-missing-noreturn
-Wno-unused-macros
-Wno-switch-enum
-Wno-bad-function-cast
-Wno-undef
-Wno-padded
-Wno-declaration-after-statement
-Wno-class-varargs
-Wno-sign-conversion
-Wno-conditional-uninitialized
-Wno-shorten-64-to-32
-Wno-assign-enum
# TODO: remove binary literals in source
-Wno-gnu-binary-literal
)
else()
message(WARNING "Unknown compiler: ${CMAKE_C_COMPILER_ID}")
endif()
add_executable(jcc ${SOURCE_FILES})
target_link_libraries(jcc m)