-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (70 loc) · 2.73 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
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.10)
project(AxleCompiler)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
foreach(config_type ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config_type} config_upper)
if(NOT DEFINED "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${config_upper}")
set("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${config_upper}" "${PROJECT_BINARY_DIR}/out")
endif()
if(NOT DEFINED "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${config_upper}")
set("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${config_upper}" "${PROJECT_BINARY_DIR}/out")
endif()
if(NOT DEFINED "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config_upper}")
set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config_upper}" "${PROJECT_BINARY_DIR}/out")
endif()
endforeach()
option(AxleTRACING "Enable tracing" OFF)
if(NOT DEFINED AxleUtilINCLUDE)
message(FATAL_ERROR "Requires AxleUtilINCLUDE to compile")
endif()
if(NOT DEFINED AxleUtilBIN)
message(FATAL_ERROR "Requires AxleUtilBIN to compile")
endif()
set(AxleINCLUDE "${PROJECT_SOURCE_DIR}/include")
set(AxleSRC "${PROJECT_SOURCE_DIR}/src")
set(AxleHeaders
"${AxleINCLUDE}/Axle/comp_utilities.h"
"${AxleINCLUDE}/Axle/api.h"
"${AxleINCLUDE}/Axle/calling_convention.h"
"${AxleINCLUDE}/Axle/backends/x64_backend.h"
"${AxleINCLUDE}/Axle/backends/PE_file_format.h")
add_library(AxleCompiler STATIC)
set_target_properties(AxleCompiler PROPERTIES OUTPUT_NAME "AxleCompiler$<CONFIG>")
target_sources(AxleCompiler PRIVATE
FILE_SET HEADERS
BASE_DIRS ${AxleINCLUDE}
FILES ${AxleHeaders}
)
if(MSVC)
target_compile_options(AxleCompiler PUBLIC /W4 /WX /permissive-)
else()
target_compile_options(AxleCompiler PUBLIC -Wall -Wextra -Wpedantic -Werror)
endif()
target_link_libraries(AxleCompiler PUBLIC "${AxleUtilBIN}/AxleUtil$<CONFIG>.lib")
target_include_directories(AxleCompiler PUBLIC ${AxleINCLUDE})
target_include_directories(AxleCompiler PUBLIC "${PROJECT_SOURCE_DIR}/src" ${AxleUtilINCLUDE})
if(AxleTRACING)
if(NOT DEFINED TracerINCLUDE)
message(FATAL_ERROR "Requires TracerINCLUDE to compile if you're tracing")
endif()
target_compile_definitions(AxleCompiler PRIVATE TRACING_ENABLE AXLE_TRAXING)
if(NOT DEFINED TracerBIN)
message(FATAL_ERROR "Requires TracerBIN to compile if you're tracing")
endif()
target_link_libraries(AxleCompiler "${TracerBIN}/Tracer.lib")
endif()
add_subdirectory(src)
option(BUILD_SANDBOX "Build sandbox" OFF)
if(BUILD_SANDBOX)
message(NOTICE "Sandbox Enabled")
add_subdirectory(sandbox)
endif()
option(BUILD_TESTS "Build tests" OFF)
if(BUILD_TESTS)
message(NOTICE "Tests Enabled")
set(TesterINCLUDE "${PROJECT_SOURCE_DIR}/lib_include" CACHE STRING "" FORCE)
set(TesterBIN "${PROJECT_SOURCE_DIR}/lib" CACHE STRING "" FORCE)
add_subdirectory(unit_tests)
add_subdirectory(integration_tests)
endif()