set(SOURCES src/main.cpp src/luna/String.cpp src/Framebuffer.cpp src/MemoryManager.cpp src/Init.cpp src/arch/Serial.cpp src/luna/Format.cpp ) # x86-64 specific set(SOURCES ${SOURCES} src/arch/x86_64/IO.cpp src/arch/x86_64/Serial.cpp src/arch/x86_64/MMU.cpp src/arch/x86_64/CPU.cpp ) # x86-64 specific set(ASM_SOURCES src/arch/x86_64/CPU.asm ) add_library(moon-asm STATIC ${ASM_SOURCES}) add_executable(moon ${SOURCES}) target_link_libraries(moon moon-asm luna-freestanding) target_compile_definitions(moon PRIVATE IN_MOON) target_compile_options(moon PRIVATE -Os) target_compile_options(moon PRIVATE -Wall -Wextra -Werror -Wvla) target_compile_options(moon PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-self) target_compile_options(moon PRIVATE -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef) target_compile_options(moon PRIVATE -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Wconversion) target_compile_options(moon PRIVATE -fno-rtti -ffreestanding -fno-exceptions) target_compile_options(moon PRIVATE -fno-asynchronous-unwind-tables -fno-omit-frame-pointer) target_compile_options(moon PRIVATE -nostdlib -mcmodel=kernel) # x86-64 specific target_compile_options(moon PRIVATE -mno-red-zone) target_compile_options(moon PRIVATE -mno-80387 -mno-mmx -mno-sse -mno-sse2) target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel) # x86-64 specific target_link_options(moon PRIVATE -mno-red-zone) set_target_properties(moon PROPERTIES CXX_STANDARD 20) target_include_directories(moon PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src) target_link_options(moon PRIVATE LINKER:-T ${CMAKE_CURRENT_LIST_DIR}/moon.ld -nostdlib -nodefaultlibs) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/moon" DESTINATION ${LUNA_ROOT}/initrd/boot)