-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
91 lines (79 loc) · 2.42 KB
/
CMakeLists.txt
File metadata and controls
91 lines (79 loc) · 2.42 KB
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
cmake_minimum_required(VERSION 3.25)
project(pxkorka
VERSION 0.1.0
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# --- OPTIONS ---
option(ENABLE_TESTS "Build tests" ON)
# Enable all warnings
if (MSVC)
add_compile_options(/W4 /WX /permissive-)
else ()
add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wshadow -Wunused)
endif ()
# Dependencies
include(cmake/CPM.cmake)
if (ENABLE_TESTS)
CPMAddPackage("gh:catchorg/Catch2@3.13.0")
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)
include(Catch)
endif ()
add_library(korka_lib
include/korka/vm/vm_runtime.hpp src/vm/vm_runtime.cpp
include/korka/vm/op_codes.hpp
include/korka/vm/bytecode_builder.hpp
include/korka/vm/options.hpp
include/korka/utils/byte_writer.hpp
include/korka/compiler/parser.hpp
include/korka/shared.hpp
include/korka/compiler/ast_walker.hpp
include/korka/shared/error.hpp
include/korka/compiler/lex_token.hpp
include/korka/utils/const_format.hpp
include/korka/compiler/compiler.hpp
include/korka/utils/overloaded.hpp
include/korka/shared/types.hpp
include/korka/shared/flat_map.hpp
include/korka/utils/frozen_hash_string_view.hpp
include/korka/utils/byte_reader.hpp
include/korka/utils/function_traits.hpp
include/korka/compiler/binding.hpp
include/korka/compiler/info.hpp
include/korka/vm/value.hpp
include/korka/compiler/result.hpp
include/korka/compiler/binding_wrapper.hpp
include/korka/vm/context_base.hpp
)
target_include_directories(korka_lib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
INTERFACE
3party
src
)
add_executable(pxkorka main.cpp)
target_link_libraries(pxkorka PRIVATE korka_lib)
# Ignore unused-but-set-variable shadow
target_compile_options(korka_lib PUBLIC -Wno-error=unused-but-set-variable -Wno-error=shadow)
# --- TESTS ---
#if (ENABLE_TESTS)
# enable_testing()
#
# add_executable(pxkorka_tests
# test/lexer.cpp
# test/bytecode_builder.cpp
# test/parser.cpp
# )
#
# target_link_libraries(pxkorka_tests
# PRIVATE
# korka_lib
# Catch2WithMain
# )
#
# catch_discover_tests(pxkorka_tests)
#endif ()