-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
107 lines (84 loc) · 3.36 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.12)
project(reaveros-meta C CXX)
set(REAVEROS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(REAVEROS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(REAVEROS_C_STANDARD "11")
set(REAVEROS_CXX_STANDARD "20")
option(REAVEROS_USE_CACHE "Enable the use of a cache program in builds." ON)
set(REAVEROS_CACHE_PROGRAM "ccache" CACHE STRING "Name of the cache program to use (defaults to ccache).")
set(REAVEROS_CMAKE ${REAVEROS_BINARY_DIR}/install/toolchain/cmake/bin/cmake)
set(REAVEROS_CTEST ${REAVEROS_BINARY_DIR}/install/toolchain/cmake/bin/ctest)
set(REAVEROS_THORN ${REAVEROS_BINARY_DIR}/install/toolchain/thorn/bin/thorn)
if (REAVEROS_USE_CACHE)
find_program(_cache_program ${REAVEROS_CACHE_PROGRAM})
if (_cache_program)
set(CMAKE_C_COMPILER_LAUNCHER ${_cache_program})
set(CMAKE_CXX_COMPILER_LAUNCHER ${_cache_program})
endif()
mark_as_advanced(_cache_program)
endif()
if (NOT GIT_EXECUTABLE OR NOT GIT_VERSION_STRING)
find_package(Git QUIET)
if (NOT GIT_EXECUTABLE)
message(FATAL_ERROR "error: could not find git")
endif()
endif()
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.19)
cmake_policy(SET CMP0114 OLD)
endif()
include(ExternalProject)
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.20)
set(_REAVEROS_CONFIGURE_HANDLED_BY_BUILD CONFIGURE_HANDLED_BY_BUILD TRUE)
else()
set(_REAVEROS_CONFIGURE_HANDLED_BY_BUILD "")
endif()
set(REAVEROS_ARCHITECTURES "amd64" CACHE STRING "List of architectures to build for. Possible values: amd64.")
set(REAVEROS_LOADERS "uefi" CACHE STRING "List of loaders to build images with. Possible values: uefi (amd64 only).")
include(cmake/target_functions.cmake)
reaveros_add_aggregate_targets("")
add_custom_target(all-toolchain)
option(REAVEROS_ENABLE_UNIT_TESTS OFF)
if (REAVEROS_ENABLE_UNIT_TESTS)
set(_REAVEROS_TEST_TARGET test)
endif()
reaveros_add_aggregate_targets(kernels)
reaveros_add_aggregate_targets_with_modes(libraries)
add_subdirectory(toolchain)
set(_saved "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/kernel")
reaveros_include_component(kernel "" kernels)
set(CMAKE_CURRENT_BINARY_DIR "${_saved}")
add_subdirectory(libraries)
add_subdirectory(loaders)
add_subdirectory(userspace)
add_subdirectory(images)
if (REAVEROS_ENABLE_UNIT_TESTS)
enable_testing()
set(_trampoline "${CMAKE_CURRENT_BINARY_DIR}/ctest_trampoline.cmake")
get_property(components GLOBAL PROPERTY _REAVEROS_COMPONENTS)
set(properties_for_trampoline "")
foreach (component IN LISTS components)
ExternalProject_Get_Property(${component} BINARY_DIR)
get_property(labels TARGET ${component} PROPERTY _REAVEROS_COMPONENT_LABELS)
get_property(display_name TARGET ${component} PROPERTY _REAVEROS_COMPONENT_TEST_NAME)
set(properties_for_trampoline
"${properties_for_trampoline}
set(component_directory_${component} ${BINARY_DIR})
set(component_labels_${component} ${labels})
set(component_names_${component} ${display_name})
"
)
endforeach()
configure_file(
"${CMAKE_CURRENT_LIST_DIR}/cmake/ctest_trampoline.cmake.in"
"${_trampoline}"
@ONLY
)
set_property(
DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
PROPERTY
TEST_INCLUDE_FILE "${_trampoline}"
)
add_custom_target(run-tests ctest .)
add_dependencies(run-tests all-build-tests)
endif()