# The miscellaneous library shared between the Luna kernel and userspace, with stuff such as custom types, common routines and data structures. file(GLOB HEADERS include/luna/*.h) set(FREESTANDING_SOURCES ${HEADERS} src/Format.cpp src/NumberParsing.cpp src/CString.cpp src/Units.cpp src/SystemError.cpp src/Bitmap.cpp src/Stack.cpp src/Alloc.cpp src/OwnedStringView.cpp src/Utf8.cpp src/TarStream.cpp src/DebugLog.cpp ) set(SOURCES ${FREESTANDING_SOURCES} src/Check.cpp ) add_library(luna-freestanding ${FREESTANDING_SOURCES}) target_compile_definitions(luna-freestanding PRIVATE USE_FREESTANDING) target_compile_options(luna-freestanding PRIVATE -Wall -Wextra -Werror -Wvla) target_compile_options(luna-freestanding PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-self -Wsign-conversion) target_compile_options(luna-freestanding PRIVATE -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef) target_compile_options(luna-freestanding PRIVATE -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Wconversion) target_compile_options(luna-freestanding PRIVATE -fno-rtti -ffreestanding -fno-exceptions) target_compile_options(luna-freestanding PRIVATE -fno-asynchronous-unwind-tables -fno-omit-frame-pointer) target_compile_options(luna-freestanding PRIVATE -nostdlib -mcmodel=kernel) target_include_directories(luna-freestanding PUBLIC include/) set_target_properties(luna-freestanding PROPERTIES CXX_STANDARD 20) #add_library(luna ${SOURCES}) #target_compile_options(luna PRIVATE -Wall -Wextra -Werror -Wvla) #target_compile_options(luna PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-self) #target_compile_options(luna PRIVATE -Wmissing-include-dirs -Wswitch-default -Wcast-qual -Wundef) #target_compile_options(luna PRIVATE -Wcast-align -Wwrite-strings -Wlogical-op -Wredundant-decls -Wshadow -Wconversion) #target_compile_options(luna PRIVATE -fno-asynchronous-unwind-tables -fno-omit-frame-pointer) #target_include_directories(luna PUBLIC include/) #set_target_properties(luna PROPERTIES CXX_STANDARD 20) if("${ARCH}" MATCHES "x86_64") target_compile_options(luna-freestanding PRIVATE -mno-red-zone) target_compile_options(luna-freestanding PRIVATE -mno-80387 -mno-mmx -mno-sse -mno-sse2) target_compile_definitions(luna-freestanding PUBLIC ARCH_X86_64) #target_compile_definitions(luna PUBLIC ARCH_X86_64) endif() if(LUNA_DEBUG_SYMBOLS) message(STATUS "Building Luna with debug symbols") #target_compile_options(luna PRIVATE -ggdb) target_compile_options(luna-freestanding PRIVATE -ggdb) endif()