-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
132 lines (121 loc) · 4.11 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
cmake_minimum_required(VERSION 3.14)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(paw
LANGUAGES C
VERSION 0.0.1)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED On)
set(MAIN_PROJECT Off)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MAIN_PROJECT On)
endif()
option(PAW_BuildFuzzers "Build the fuzz targets" Off)
option(PAW_BuildTests "Build the tests" ${MAIN_PROJECT})
set(PAW_STRESS 0 CACHE STRING
"Enable expensive checks (supports up to level 2)")
add_library(paw_context INTERFACE)
if(${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
target_compile_options(paw_context
INTERFACE /W2)
else()
target_compile_options(paw_context
INTERFACE -Wall -Wextra -Wpedantic
-Wsign-conversion)
target_link_libraries(paw_context
INTERFACE m)
endif()
set(PAW_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
add_library(paw STATIC)
target_sources(paw
PUBLIC ${PAW_SOURCE_DIR}/alloc.h
${PAW_SOURCE_DIR}/api.h
${PAW_SOURCE_DIR}/ast.h
${PAW_SOURCE_DIR}/auxlib.h
${PAW_SOURCE_DIR}/call.h
${PAW_SOURCE_DIR}/code.h
${PAW_SOURCE_DIR}/compile.h
${PAW_SOURCE_DIR}/debug.h
${PAW_SOURCE_DIR}/env.h
${PAW_SOURCE_DIR}/gc.h
${PAW_SOURCE_DIR}/hir.h
${PAW_SOURCE_DIR}/ir_type.h
${PAW_SOURCE_DIR}/lex.h
${PAW_SOURCE_DIR}/lib.h
${PAW_SOURCE_DIR}/map.h
${PAW_SOURCE_DIR}/match.h
${PAW_SOURCE_DIR}/mem.h
${PAW_SOURCE_DIR}/mir.h
${PAW_SOURCE_DIR}/opcode.h
${PAW_SOURCE_DIR}/os.h
${PAW_SOURCE_DIR}/parse.h
${PAW_SOURCE_DIR}/prefix.h
${PAW_SOURCE_DIR}/rt.h
${PAW_SOURCE_DIR}/str.h
${PAW_SOURCE_DIR}/type.h
${PAW_SOURCE_DIR}/type_folder.h
${PAW_SOURCE_DIR}/unify.h
${PAW_SOURCE_DIR}/util.h
${PAW_SOURCE_DIR}/value.h
PRIVATE ${PAW_SOURCE_DIR}/alloc.c
${PAW_SOURCE_DIR}/api.c
${PAW_SOURCE_DIR}/ast.c
${PAW_SOURCE_DIR}/auxlib.c
${PAW_SOURCE_DIR}/call.c
${PAW_SOURCE_DIR}/code.c
${PAW_SOURCE_DIR}/codegen.c
${PAW_SOURCE_DIR}/collect_items.c
${PAW_SOURCE_DIR}/compile.c
${PAW_SOURCE_DIR}/debug.c
${PAW_SOURCE_DIR}/decision.c
${PAW_SOURCE_DIR}/env.c
${PAW_SOURCE_DIR}/exhaustiveness.c
${PAW_SOURCE_DIR}/gc.c
${PAW_SOURCE_DIR}/hir.c
${PAW_SOURCE_DIR}/import.c
${PAW_SOURCE_DIR}/instantiate.c
${PAW_SOURCE_DIR}/iomod.c
${PAW_SOURCE_DIR}/ir_type.c
${PAW_SOURCE_DIR}/lex.c
${PAW_SOURCE_DIR}/list.c
${PAW_SOURCE_DIR}/lib.c
${PAW_SOURCE_DIR}/lookup.c
${PAW_SOURCE_DIR}/lower_ast.c
${PAW_SOURCE_DIR}/lower_hir.c
${PAW_SOURCE_DIR}/lower_type.c
${PAW_SOURCE_DIR}/map.c
${PAW_SOURCE_DIR}/mathmod.c
${PAW_SOURCE_DIR}/mem.c
${PAW_SOURCE_DIR}/mir.c
${PAW_SOURCE_DIR}/monomorphize.c
${PAW_SOURCE_DIR}/os.c
${PAW_SOURCE_DIR}/parse.c
${PAW_SOURCE_DIR}/regalloc.c
${PAW_SOURCE_DIR}/resolve.c
${PAW_SOURCE_DIR}/rt.c
${PAW_SOURCE_DIR}/str.c
${PAW_SOURCE_DIR}/type.c
${PAW_SOURCE_DIR}/type_folder.c
${PAW_SOURCE_DIR}/unify.c
${PAW_SOURCE_DIR}/util.c
${PAW_SOURCE_DIR}/value.c)
target_include_directories(paw
PUBLIC ${PAW_SOURCE_DIR})
target_compile_definitions(paw
PUBLIC PAW_STRESS=${PAW_STRESS})
add_executable(pawc
${PAW_SOURCE_DIR}/paw.c)
target_link_libraries(pawc
PRIVATE paw_context paw)
set_property(TARGET pawc
PROPERTY OUTPUT_NAME paw)
if(PAW_BuildTests)
# Speed up stack overflow test
target_compile_definitions(paw
PRIVATE PAW_STACK_MAX=10000)
include(CTest)
enable_testing()
add_subdirectory(test)
endif()
if(PAW_BuildFuzzers)
add_subdirectory(fuzz)
endif()