-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (63 loc) · 1.96 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
cmake_minimum_required(VERSION 3.26)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Do not build in-source. Please remove CMakeCache.txt and the CMakeFiles/ directory. Then build out-of-source.")
endif()
project(
"Abyss Lisp"
VERSION 0.2.0
LANGUAGES CXX
)
#set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a")
#set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS True)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#add_compile_options( /FAu /Fa /utf-8 )
add_compile_options( $<$<CONFIG:Release>:/GL> $<$<CONFIG:Release>:/Gy> )
add_link_options( $<$<CONFIG:Release>:/LTCG> )
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/lex/re2c.cpp
COMMAND re2c -W ${CMAKE_CURRENT_SOURCE_DIR}/src/lex/re2c.txt -o ${CMAKE_CURRENT_SOURCE_DIR}/src/lex/re2c.cpp
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/lex/re2c.txt
)
add_custom_target(gen-re2c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/lex/re2c.cpp
)
add_executable(abyss-lex)
add_dependencies(abyss-lex gen-re2c)
target_sources(abyss-lex PRIVATE
src/lex/cli.cpp
src/lex/re2c.cpp
)
add_executable(abyss-parse)
add_dependencies(abyss-parse gen-re2c)
target_sources(abyss-parse PRIVATE
src/parse/cli.cpp
src/lex/re2c.cpp
src/lex/tokenize.cpp
src/parse/parse.cpp
)
add_executable(abyss-ffi-enum-gen)
target_sources(abyss-ffi-enum-gen PRIVATE
src/ffi/enum-gen.cpp
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/ffi/enums.lisp
COMMAND abyss-ffi-enum-gen
DEPENDS abyss-ffi-enum-gen
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(gen-enums
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/ffi/enums.lisp
)
add_library(abyss SHARED)
add_dependencies(abyss gen-re2c gen-enums)
target_sources(abyss PRIVATE
src/ffi/frontend.cpp
src/lex/re2c.cpp
src/lex/tokenize.cpp
src/parse/parse.cpp
)