26 lines
832 B
CMake
26 lines
832 B
CMake
cmake_minimum_required(VERSION 3.00)
|
|
project(kernel)
|
|
set(C 99)
|
|
|
|
set(CMAKE_NASM_COMPILE_OBJECT "nasm <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
|
|
|
|
|
|
add_executable(kernel)
|
|
add_library (kernel_asm OBJECT)
|
|
target_include_directories(kernel PRIVATE inc)
|
|
file(GLOB_RECURSE kernel_src_c "src/**/*.c")
|
|
file(GLOB_RECURSE kernel_inc "inc/**/*.h")
|
|
file(GLOB_RECURSE kernel_src_asm "src/**/*.asm")
|
|
|
|
|
|
target_compile_options(kernel PRIVATE -g -fno-stack-protector -fno-stack-check -mno-red-zone -ffreestanding -m64 -march=x86-64 -mabi=sysv)
|
|
target_link_options(kernel PRIVATE -nostdlib -static -T "${CMAKE_CURRENT_LIST_DIR}/kernel.ld")
|
|
|
|
enable_language(ASM_NASM)
|
|
set(CAN_USE_ASSEMBLER TRUE)
|
|
|
|
target_sources(kernel_asm PRIVATE ${kernel_src_asm})
|
|
target_sources(kernel PRIVATE ${kernel_src_c} ${kernel_inc} $<TARGET_OBJECTS:kernel_asm>)
|
|
|
|
|