-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
70 lines (54 loc) · 2.15 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
# Set the minimum version of CMake that can be used
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
# Set the project name and the languages
project(MaxOS C CXX ASM)
# Logs the compiler commands
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Dont enable runtime type information
set(CMAKE_SKIP_RPATH TRUE)
# Set the standard to C++17
set(CMAKE_CXX_STANDARD 17)
# Set where the libraries are located
INCLUDE_DIRECTORIES(libraries/)
# Tell the linker to look in the toolchain for libraries
LINK_DIRECTORIES(${TOOLCHAIN_ROOT_DIR}/lib/gcc/${TOOLCHAIN_PLATFORM}/${GCC_VER}/)
LINK_DIRECTORIES(${TOOLCHAIN_ROOT_DIR}/${TOOLCHAIN_PLATFORM}/lib/)
# Look to build in these directories
ADD_SUBDIRECTORY(kernel)
#ADD_SUBDIRECTORY(libraries)
#ADD_SUBDIRECTORY(programs)
#ADD_SUBDIRECTORY(ports)
ADD_CUSTOM_TARGET(image
# Create the disk image
COMMENT "Creating disk image"
COMMAND ${CMAKE_COMMAND} -E env "SOURCE_DIR=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/toolchain/create_disk_img.sh
BYPRODUCTS ${CMAKE_SOURCE_DIR}/MaxOS.img
BYPRODUCTS ${CMAKE_SOURCE_DIR}/filesystem/boot/MaxOSk64
# Copy the files to the disk image
COMMENT "Copying files to disk image"
COMMAND ${CMAKE_COMMAND} -E env "SOURCE_DIR=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/toolchain/copy_filesystem.sh
# Ensure it runs in the terminal
USES_TERMINAL
)
ADD_CUSTOM_TARGET(run
# Run qemu
COMMENT "Running qemu"
COMMAND ${CMAKE_COMMAND} -E env "SOURCE_DIR=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/toolchain/run_qemu.sh
# Ensure it runs in the terminal
USES_TERMINAL
)
ADD_CUSTOM_TARGET(debug
# Run qemu
COMMENT "Running qemu"
COMMAND ${CMAKE_COMMAND} -E env "SOURCE_DIR=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/toolchain/run_qemu.sh --debug
# Ensure it runs in the terminal
USES_TERMINAL
)
ADD_CUSTOM_TARGET(gdb
# Run GDB
COMMENT "Running GDB"
COMMAND ${CMAKE_COMMAND} -E env "SOURCE_DIR=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/toolchain/run_gdb.sh
BYPRODUCTS ${CMAKE_SOURCE_DIR}/MaxOS.sym
# Ensure it runs in the terminal
USES_TERMINAL
)