-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (42 loc) · 1.83 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
cmake_minimum_required(VERSION 3.20)
project(bondrewd CXX)
# set(CMAKE_CXX_COMPILER clang++-cl)
set(CMAKE_CXX_STANDARD_REQUIRED 20)
set(CMAKE_CXX_STANDARD 20)
# set(CMAKE_CXX_EXTENSIONS false)
set(CXX_WARNING_FLAGS "\
-Wall -Wno-multichar -Wno-c++98-compat-pedantic \
-Wno-shadow-field-in-constructor -Wno-old-style-cast \
-Wno-sign-conversion -Wno-extra-semi-stmt \
-Wno-gnu-zero-variadic-macro-arguments \
-Wno-covered-switch-default -Wno-exit-time-destructors \
-Wno-global-constructors -Wno-reserved-identifier \
-Wno-extra-semi -Wno-unreachable-code-break \
\
")
set(CXX_OPTIMIZE_FLAGS "-O2")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
# MSVC and clang-cl support
set(CXX_OS_FLAGS "/EHa")
else()
# Unix support
set(CXX_OS_FLAGS "-g")
endif()
set(CMAKE_CXX_FLAGS "${CXX_WARNING_FLAGS} -m64 -march=native ${CXX_OPTIMIZE_FLAGS} ${CXX_OS_FLAGS}")
get_filename_component(LIB_ROOT "." ABSOLUTE)
file(GLOB_RECURSE LIB_SOURCES ${LIB_ROOT}/src/*.cpp)
file(GLOB_RECURSE LIB_HEADERS_PUBLIC ${LIB_ROOT}/include/*.hpp)
file(GLOB_RECURSE LIB_HEADERS_PRIVATE ${LIB_ROOT}/src/*.hpp)
set(LIB_HEADERS ${LIB_HEADERS_PUBLIC} ${LIB_HEADERS_PRIVATE})
add_library(bondrewd-compiler STATIC ${LIB_SOURCES})
target_include_directories(bondrewd-compiler PUBLIC ${LIB_ROOT}/include)
target_include_directories(bondrewd-compiler PRIVATE ${LIB_ROOT}/src) # TODO: Do I need this?
set_target_properties(bondrewd-compiler PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${LIB_ROOT}/out"
ARCHIVE_OUTPUT_DIRECTORY "${LIB_ROOT}/out"
)
find_package(fmt CONFIG REQUIRED)
target_link_libraries(bondrewd-compiler PRIVATE fmt::fmt)
# find_package(Boost 1.81.0 REQUIRED COMPONENTS)
# target_link_libraries(bondrewd-compiler PRIVATE)
add_subdirectory(cli)