-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
54 lines (44 loc) · 1.4 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
cmake_minimum_required(VERSION 3.16)
if (HYPER_PLATFORM)
string(TOLOWER ${HYPER_PLATFORM} HYPER_PLATFORM)
endif ()
if (HYPER_ARCH)
string(TOLOWER ${HYPER_ARCH} HYPER_ARCH)
endif ()
if (NOT HYPER_ARCH)
set(HYPER_ARCH "i686")
elseif ((NOT HYPER_ARCH STREQUAL "i686") AND
(NOT HYPER_ARCH STREQUAL "amd64") AND
(NOT HYPER_ARCH STREQUAL "aarch64"))
message(FATAL_ERROR "Unknown architecture '${HYPER_ARCH}'")
endif ()
if (NOT HYPER_PLATFORM)
if (HYPER_ARCH AND NOT HYPER_ARCH STREQUAL "i686")
set(HYPER_PLATFORM "uefi")
else ()
set(HYPER_ARCH "i686")
set(HYPER_PLATFORM "bios")
endif ()
elseif ((NOT HYPER_PLATFORM STREQUAL "bios") AND
(NOT HYPER_PLATFORM STREQUAL "uefi"))
message(FATAL_ERROR "Unknown platform '${HYPER_PLATFORM}'")
endif ()
if (HYPER_TOOLCHAIN)
string(TOLOWER ${HYPER_TOOLCHAIN} HYPER_TOOLCHAIN)
endif ()
if (NOT HYPER_TOOLCHAIN)
if ($ENV{CLION_IDE})
set(HYPER_TOOLCHAIN dummy)
message("Detected CLion, using a dummy toolchain file")
else ()
set(HYPER_TOOLCHAIN "gcc")
endif ()
endif ()
if (HYPER_TOOLCHAIN STREQUAL "gcc" OR HYPER_TOOLCHAIN STREQUAL "clang")
set(HYPER_TOOLCHAIN_DIR "${CMAKE_SOURCE_DIR}/toolchain")
include("${HYPER_TOOLCHAIN_DIR}/toolchain_${HYPER_TOOLCHAIN}.cmake")
else ()
include("${HYPER_TOOLCHAIN}")
endif()
project(Hyper C)
add_subdirectory(loader)