-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
55 lines (45 loc) · 1.42 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
cmake_minimum_required(VERSION 3.21)
include(FetchContent)
include(cmake/cargo.cmake)
# Fetch external CMake scripts.
FetchContent_Declare(
msvc
GIT_REPOSITORY https://github.com/MarkSchofield/WindowsToolchain.git
GIT_TAG v0.11.0
GIT_SHALLOW ON
)
FetchContent_MakeAvailable(msvc)
# Set project properties.
project(obliteration)
# Set warning level to highest. This will propagate to sub-directories too.
if(WIN32)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra)
endif()
# Fix warning for DOWNLOAD_EXTRACT_TIMESTAMP on ExternalProject.
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
# Setup Rust targets.
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
# Pre-compiled core crate for aarch64-unknown-none-softfloat does not support
# Position-Independent Executable so we need nightly toolchain for build-std feature to
# re-build core crate to support Position-Independent Executable.
set(kernel_env "softfloat")
set(kernel_toolchain "nightly")
set(kernel_opts -Z build-std=core,alloc)
else()
set(kernel_env "")
endif()
add_cargo(MANIFEST Cargo.toml)
add_crate(gui)
add_crate(obkrnl
TOOLCHAIN ${kernel_toolchain}
VENDOR "unknown"
OPERATING_SYSTEM "none"
ENVIRONMENT "${kernel_env}"
ARGS ${kernel_opts})
add_dependencies(gui obkrnl)
# Add GUI.
add_subdirectory(gui)