Debian Codegraph @

cmake/tools/CMakeLists.txt

raw
1 cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
2 project(qvm_tools LANGUAGES C)
3
4 include(utils/set_output_dirs)
5
6 set(Q3ASM_SOURCES
7 ${SOURCE_DIR}/tools/asm/q3asm.c
8 ${SOURCE_DIR}/tools/asm/cmdlib.c
9 )
10
11 set(Q3LCC_SOURCES
12 ${SOURCE_DIR}/tools/lcc/etc/lcc.c
13 ${SOURCE_DIR}/tools/lcc/etc/bytecode.c
14 )
15
16 set(Q3RCC_SOURCES
17 ${SOURCE_DIR}/tools/lcc/src/alloc.c
18 ${SOURCE_DIR}/tools/lcc/src/bind.c
19 ${SOURCE_DIR}/tools/lcc/src/bytecode.c
20 ${SOURCE_DIR}/tools/lcc/src/dag.c
21 ${SOURCE_DIR}/tools/lcc/src/decl.c
22 ${SOURCE_DIR}/tools/lcc/src/enode.c
23 ${SOURCE_DIR}/tools/lcc/src/error.c
24 ${SOURCE_DIR}/tools/lcc/src/event.c
25 ${SOURCE_DIR}/tools/lcc/src/expr.c
26 ${SOURCE_DIR}/tools/lcc/src/gen.c
27 ${SOURCE_DIR}/tools/lcc/src/init.c
28 ${SOURCE_DIR}/tools/lcc/src/inits.c
29 ${SOURCE_DIR}/tools/lcc/src/input.c
30 ${SOURCE_DIR}/tools/lcc/src/lex.c
31 ${SOURCE_DIR}/tools/lcc/src/list.c
32 ${SOURCE_DIR}/tools/lcc/src/main.c
33 ${SOURCE_DIR}/tools/lcc/src/null.c
34 ${SOURCE_DIR}/tools/lcc/src/output.c
35 ${SOURCE_DIR}/tools/lcc/src/prof.c
36 ${SOURCE_DIR}/tools/lcc/src/profio.c
37 ${SOURCE_DIR}/tools/lcc/src/simp.c
38 ${SOURCE_DIR}/tools/lcc/src/stmt.c
39 ${SOURCE_DIR}/tools/lcc/src/string.c
40 ${SOURCE_DIR}/tools/lcc/src/sym.c
41 ${SOURCE_DIR}/tools/lcc/src/symbolic.c
42 ${SOURCE_DIR}/tools/lcc/src/trace.c
43 ${SOURCE_DIR}/tools/lcc/src/tree.c
44 ${SOURCE_DIR}/tools/lcc/src/types.c
45 )
46
47 set(Q3RCC_DAGCHECK_SOURCE ${SOURCE_DIR}/tools/lcc/src/dagcheck.md)
48
49 set(Q3CPP_SOURCES
50 ${SOURCE_DIR}/tools/lcc/cpp/cpp.c
51 ${SOURCE_DIR}/tools/lcc/cpp/lex.c
52 ${SOURCE_DIR}/tools/lcc/cpp/nlist.c
53 ${SOURCE_DIR}/tools/lcc/cpp/tokens.c
54 ${SOURCE_DIR}/tools/lcc/cpp/macro.c
55 ${SOURCE_DIR}/tools/lcc/cpp/eval.c
56 ${SOURCE_DIR}/tools/lcc/cpp/include.c
57 ${SOURCE_DIR}/tools/lcc/cpp/hideset.c
58 ${SOURCE_DIR}/tools/lcc/cpp/getopt.c
59 ${SOURCE_DIR}/tools/lcc/cpp/unix.c
60 )
61
62 set(LBURG_SOURCES
63 ${SOURCE_DIR}/tools/lcc/lburg/lburg.c
64 ${SOURCE_DIR}/tools/lcc/lburg/gram.c
65 )
66
67 add_executable(q3asm ${Q3ASM_SOURCES})
68 set_output_dirs(q3asm)
69 add_executable(q3lcc ${Q3LCC_SOURCES})
70 set_output_dirs(q3lcc)
71 add_dependencies(q3lcc q3rcc q3cpp)
72
73 if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "^(Apple)?Clang$")
74 add_compile_options(-fno-strict-aliasing -Wno-unused-result
75 -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
76 elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
77 add_compile_options(/wd4311 /wd4312)
78 endif()
79
80 add_executable(lburg ${LBURG_SOURCES})
81 set_output_dirs(lburg)
82 set(DAGCHECK_C ${CMAKE_BINARY_DIR}/dagcheck.c)
83 add_custom_command(
84 OUTPUT ${DAGCHECK_C}
85 COMMAND lburg ${Q3RCC_DAGCHECK_SOURCE} ${DAGCHECK_C}
86 DEPENDS lburg ${Q3RCC_DAGCHECK_SOURCE})
87
88 add_executable(q3rcc ${Q3RCC_SOURCES} ${DAGCHECK_C})
89 set_output_dirs(q3rcc)
90 target_include_directories(q3rcc PRIVATE ${SOURCE_DIR}/tools/lcc/src)
91
92 add_executable(q3cpp ${Q3CPP_SOURCES})
93 set_output_dirs(q3cpp)