-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
72 lines (60 loc) · 2.32 KB
/
CMakeLists.txt
File metadata and controls
72 lines (60 loc) · 2.32 KB
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
cmake_minimum_required(VERSION 3.15)
project(qubic CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Force Clang >= 18
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
message(FATAL_ERROR "Clang version 18 or higher is required. Found: ${CMAKE_CXX_COMPILER_VERSION}")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# Note: AppleClang has different versioning.
# AppleClang 15 is roughly equivalent to LLVM Clang 16/17.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
message(FATAL_ERROR "AppleClang 15+ required for this project.")
endif()
else()
message(WARNING "You are not using Clang. This project is optimized for Clang 18+.")
endif()
# Include the centralized compiler detection module
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CompilerSetup)
# Build options
option(BUILD_TESTS "Build the test suite" ON)
option(BUILD_BENCHMARK "Build the EFI benchmark application" OFF)
option(BUILD_BINARY "Build the EFI application" ON)
option(USE_SANITIZER "Build test with sanitizer support (clang only)" ON)
if(IS_WINDOWS)
message(WARNING "Building on Windows using Visual Studio and CMake has undergone limited testing and is not officially supported at this time.")
if(USE_SANITIZER)
message(WARNING "Building tests with sanitizer support is not supported on Windows.")
endif()
endif()
# Always include platform_common as it's needed for both application and tests
add_subdirectory(lib/platform_common)
if(BUILD_BINARY OR BUILD_BENCHMARK)
add_subdirectory(lib/platform_efi)
endif()
# Build the tests first. On fail, the build will fail completely
if(BUILD_TESTS)
message(STATUS "--- Test suite ---")
enable_testing()
add_subdirectory(lib/platform_os)
# If we're not building the application, we still need src for tests
# but don't make it a default target
if(NOT BUILD_BINARY)
add_subdirectory(src EXCLUDE_FROM_ALL)
endif()
add_subdirectory(test)
endif()
# Build the application if requested
if(BUILD_BINARY)
message(STATUS "--- EFI Core application ---")
add_subdirectory(src)
endif()
# Add the UEFI m256i benchmark
if(BUILD_BENCHMARK)
message(STATUS "-- EFI Benchmark ---")
add_subdirectory(benchmark_uefi)
endif()