-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
59 lines (52 loc) · 1.59 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
cmake_minimum_required(VERSION 3.10)
project(Kinoko CXX)
# Compiler and flags
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Common flags
set(COMMON_CXX_FLAGS
-DREVOLUTION
-fno-asynchronous-unwind-tables
-fno-exceptions
-fno-rtti
-fshort-wchar
-fstack-protector-strong
-Wall
-Werror
-Wextra
-Wno-delete-non-virtual-dtor
-Wno-packed-bitfield-compat
-Wsuggest-override
)
set(RK_INCLUDE_DIRS
include
source
)
# Source files
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/**/*.cc)
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*/host/main\\.cc$")
add_library(libkinoko ${SOURCE_FILES})
target_include_directories(libkinoko SYSTEM
PUBLIC ${RK_INCLUDE_DIRS}
)
target_compile_options(libkinoko PRIVATE ${COMMON_CXX_FLAGS})
target_compile_features(libkinoko PUBLIC cxx_std_23)
# Create targets
add_executable(kinoko source/host/main.cc)
target_link_libraries(kinoko libkinoko)
target_compile_options(kinoko PRIVATE ${COMMON_CXX_FLAGS})
# Add a custom target to generate testCases.json
set(TEST_JSON ${CMAKE_CURRENT_SOURCE_DIR}/testCases.json)
set(TEST_BIN ${CMAKE_CURRENT_BINARY_DIR}/testCases.bin)
add_custom_command(
OUTPUT ${TEST_BIN} # The file generated by this rule
DEPENDS ${TEST_JSON} # Dependency
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/tools/generate_tests.py ${TEST_JSON} ${TEST_BIN}
COMMENT "Running generate_tests.py to create test cases"
)
add_custom_target(
GenerateTestCases
ALL
DEPENDS ${TEST_BIN} # Ensures this target depends on the generated file
)