-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
69 lines (55 loc) · 1.51 KB
/
CMakeLists.txt
File metadata and controls
69 lines (55 loc) · 1.51 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
cmake_minimum_required(VERSION 3.16)
project(
zscript
VERSION 0.0.1
DESCRIPTION "Script for z of math"
LANGUAGES CXX
)
option(ZSCRIPT_BUILD_TEST "Enable unit testing" ON)
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG devel
)
FetchContent_MakeAvailable(Catch2)
set(Z_HEADERS
include/${PROJECT_NAME}/zAST/nodes.h
include/${PROJECT_NAME}/zparser/zlexer.h
include/${PROJECT_NAME}/zparser/zparser.h
include/${PROJECT_NAME}/zparser/ztoken.h
include/${PROJECT_NAME}/zutils/zmatrix.h
include/${PROJECT_NAME}/zparser/zinterpreter.h
)
set(Z_FLAGS
-std=c++23
-mavx2
-O2
# -fsanitize=address
)
add_compile_options(${Z_FLAGS})
add_link_options(${Z_FLAGS})
add_library(${PROJECT_NAME}_lib INTERFACE ${Z_HEADERS})
target_include_directories(${PROJECT_NAME}_lib INTERFACE include)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME}
PRIVATE
${PROJECT_NAME}_lib
)
if (ZSCRIPT_BUILD_TEST)
enable_testing()
include(CTest)
include(Catch)
set(TEST_SOURCES
# ztests/znodes_test.cpp
# ztests/zparser_test.cpp
ztests/zmatrix_test.cpp
)
add_executable(tests ${TEST_SOURCES})
target_link_libraries(tests
PRIVATE
${PROJECT_NAME}_lib
Catch2::Catch2WithMain
)
catch_discover_tests(tests)
endif ()