-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
69 lines (53 loc) · 2.25 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
# ===============================================
# BUILD SYSTEM
# This is the root CMakeLists.txt that set ups
# the general environment.
# ===============================================
cmake_minimum_required(VERSION 3.16)
project(Memarena)
option(MEMARENA_BUILD_TEST "Build the tests of the Memarena library." ON)
option(MEMARENA_BUILD_BENCHMARKS "Build the benchmarks of the Memarena library." ON)
option(MEMARENA_CPPCHECK "Run the cppcheck static analyzer." ON)
# option(MEMARENA_BUILD_EXAMPLE "Build the example project that showcases how to use this library." ON)
set(CMAKE_CXX_STANDARD 20)
if (MEMARENA_CPPCHECK)
set(CMAKE_CXX_CPPCHECK "cppcheck")
endif()
add_library(${PROJECT_NAME} STATIC
"Source/Allocator.cpp"
"Source/AllocatorUtils.cpp"
"Source/MemoryTracker.cpp"
"Source/Utility/Alignment/Alignment.cpp"
"Source/Utility/VirtualMemory.cpp"
)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_precompile_headers(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Source/PCH.hpp")
target_compile_definitions(${PROJECT_NAME}
# PRIVATE
# _CRT_SECURE_NO_WARNINGS
PUBLIC
$<$<CONFIG:Debug>:MEMARENA_DEBUG>
$<$<CONFIG:RelWithDebInfo>:MEMARENA_DEBUG>
$<$<CONFIG:Release>:MEMARENA_RELEASE>
$<$<CONFIG:MinSizeRel>:MEMARENA_RELEASE>
)
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Include>
$<INSTALL_INTERFACE:Include>
)
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Source")
# target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Include/Memarena")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Vendor")
target_link_libraries(${PROJECT_NAME} PRIVATE "${CPP_LINKER_FLAGS}")
if (MEMARENA_BUILD_TEST OR MEMARENA_BUILD_BENCHMARKS)
enable_testing()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Tests")
endif()
if(MEMARENA_BUILD_BENCHMARKS)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Benchmarks")
endif()
# if (MEMARENA_BUILD_EXAMPLE)
# add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Vendor/benchmark")
# endif()