-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (71 loc) · 1.57 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
cmake_minimum_required(VERSION 3.19)
project(bmmo_protocol_compiler LANGUAGES C)
# check bison and flex
find_package(FLEX REQUIRED)
find_package(BISON 3.6 REQUIRED)
# precompile some files
execute_process(
COMMAND
chmod +x "precompile.sh"
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(
COMMAND
"./precompile.sh"
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY
)
# prepare examples
execute_process(
COMMAND
cp -r -f "${PROJECT_SOURCE_DIR}/examples" "${PROJECT_BINARY_DIR}/examples"
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY
)
# find glib and try to link it
find_package(PkgConfig REQUIRED)
pkg_check_modules(Glib REQUIRED glib-2.0>=2.70 IMPORTED_TARGET)
set(CMAKE_C_STANDARD 99)
# set file collections
set(shared_c
src/bpc_cmd.c
src/bpc_fs.c
src/bpc_code_gen.c
src/bpc_semantic_values.c
src/bpc_encoding.c
src/bpc_error.c
src/snippets.c
src/codegen/codepy.c
src/codegen/codecs.c
src/codegen/codehpp.c
src/codegen/codecpp.c
src/codegen/codefbs.c
src/lex.yy.c
src/y.tab.c
)
set(compiler_c
src/bmmo_protocol_compiler.c
)
set(tests_c
tests/main.c
tests/tests_project.c
tests/tests_semantic_values.c
tests/tests_fs.c
tests/tests_cmd.c
)
# add the executable
add_executable(bmmo_protocol_compiler ${shared_c} ${compiler_c})
add_executable(bpc_test ${shared_c} ${tests_c})
# set include
target_link_libraries(bmmo_protocol_compiler
PRIVATE
PkgConfig::Glib
)
target_link_libraries(bpc_test
PRIVATE
PkgConfig::Glib
)