-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
29 lines (22 loc) · 1.04 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
cmake_minimum_required (VERSION 2.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)
FILE (GLOB_RECURSE kernel_C_SOURCES "kernel/*.c")
FILE (GLOB_RECURSE kernel_CPP_SOURCES "kernel/*.cpp")
FILE (GLOB_RECURSE kernel_ASM_SOURCES "arch/x86/asm/*.nasm")
FILE (GLOB_RECURSE kernel_ARCH_C_SOURCES "arch/x86/*.c")
FILE (GLOB_RECURSE kernel_ARCH_CPP_SOURCES "arch/x86/*cpp")
ADD_LIBRARY (kernel.img STATIC
${kernel_C_SOURCES}
${kernel_CPP_SOURCES}
${kernel_ARCH_C_SOURCES}
${kernel_ARCH_CPP_SOURCES}
${kernel_ASM_SOURCES})
ADD_CUSTOM_COMMAND (TARGET kernel.img
POST_BUILD
COMMAND "/usr/bin/ld -m elf_i386 -T${CMAKE_CURRENT_LIST_DIR}/link.ld -o phOS.img ${CMAKE_BINARY_DIR}/libkernel.img.a")