-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (38 loc) · 1.86 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
cmake_minimum_required (VERSION 3.8)
project ("SmartIO")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSIO_DEBUG")
# Add all source code to the project
file(GLOB SmartIO_Src
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/util/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cl/*.cpp"
# Parser
"${CMAKE_CURRENT_SOURCE_DIR}/src/parser/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/parser/ast/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/parser/dfa/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/parser/util/*.cpp"
#Compiler
"${CMAKE_CURRENT_SOURCE_DIR}/src/compiler/*.cpp"
#Debugger
"${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/*.cpp"
#Runtime
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/*.cpp"
)
add_subdirectory(libs)
# Register static lib libffi
add_library(libffi STATIC IMPORTED)
set_target_properties(libffi PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/libs/libffi/libffi-8.lib)
# Add source to this project's executable.
add_executable (SmartIO "SmartIO.cpp" "SmartIO.h" ${SmartIO_Src})
target_include_directories(SmartIO PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_features(SmartIO PUBLIC cxx_std_23)
# Link libffi
target_link_libraries(SmartIO libffi)
target_include_directories(libffi INTERFACE ${CMAKE_CURRENT_LIST_DIR}/libs/libffi/includes)
target_link_libraries(SmartIO fmt::fmt)
#target_link_libraries(SmartIO stdc++fs) GNU/GCC (prior to 9.1) support for filesystem stuff -> argument parser use it
#https://en.cppreference.com/w/cpp/filesystem#Notes
#https://stackoverflow.com/questions/62468531/linking-to-stdcfs-with-c20-still-necessary-when-using-filesystem
# After build, copy the DDL to the output folder
add_custom_command(TARGET SmartIO POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/libs/libffi/libffi-8.dll ${CMAKE_CURRENT_BINARY_DIR}/libffi-8.dll)
# TODO: Add tests and install targets if needed.