-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·29 lines (22 loc) · 1014 Bytes
/
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
cmake_minimum_required (VERSION 3.8)
PROJECT (kernel)
INCLUDE_DIRECTORIES (include)
SET (CMAKE_CXX_FLAGS "-m32 -ffreestanding -fno-rtti -fno-exceptions -nostdlib -nostdinc -fno-stack-protector")
SET (CMAKE_C_FLAGS "-m32 -ffreestanding -fno-exceptions -nostdlib -nostdinc -fno-stack-protector")
#SET (CMAKE_EXE_LINKER_FLAGS "-m elf_i386 -T${CMAKE_CURRENT_LIST_DIR}/link.ld")
SET (CMAKE_ASM_NASM_OBJECT_FORMAT "elf")
ENABLE_LANGUAGE (ASM_NASM)
add_compile_options(-I ${CMAKE_CURRENT_SOURCE_DIR}/boot )
FILE (GLOB_RECURSE kernel_LIB_SOURCES "libc/*.cpp")
FILE (GLOB_RECURSE kernel_ASM_SOURCES "boot/*.asm")
FILE (GLOB_RECURSE kernel_C_SOURCES "kernel/*.c")
FILE (GLOB_RECURSE kernel_CPP_SOURCES "kernel/*.cpp")
ADD_LIBRARY (kernel.img STATIC
${kernel_ASM_SOURCES}
${kernel_C_SOURCES}
${kernel_CPP_SOURCES}
${kernel_LIB_SOURCES}
)
ADD_CUSTOM_COMMAND (TARGET kernel.img
POST_BUILD
COMMAND ld -m elf_i386 -T${CMAKE_CURRENT_LIST_DIR}/link.ld -o ../kernel.bin ${CMAKE_BINARY_DIR}/libkernel.img.a)