Luna/luna/CMakeLists.txt

61 lines
2.7 KiB
CMake
Raw Normal View History

2022-12-04 11:47:08 +00:00
# The miscellaneous library shared between the Luna kernel and userspace, with stuff such as custom types, common routines and data structures.
2023-01-02 12:00:22 +00:00
file(GLOB HEADERS include/luna/*.h)
2022-11-19 14:43:09 +00:00
set(FREESTANDING_SOURCES
2023-01-02 12:00:22 +00:00
${HEADERS}
src/Format.cpp
src/NumberParsing.cpp
src/CString.cpp
src/Units.cpp
src/SystemError.cpp
src/Bitmap.cpp
src/Stack.cpp
src/OwnedStringView.cpp
2022-12-18 12:04:40 +00:00
src/Utf8.cpp
src/TarStream.cpp
2022-12-22 17:00:35 +00:00
src/DebugLog.cpp
src/Heap.cpp
2022-11-19 14:43:09 +00:00
)
set(SOURCES
${FREESTANDING_SOURCES}
src/Check.cpp
2022-11-19 14:43:09 +00:00
)
add_library(luna-freestanding ${FREESTANDING_SOURCES})
target_compile_definitions(luna-freestanding PRIVATE USE_FREESTANDING)
2023-01-10 17:13:21 +00:00
target_compile_options(luna-freestanding PRIVATE -Os -Wall -Wextra -Werror -Wvla)
target_compile_options(luna-freestanding PRIVATE -Wdisabled-optimization -Wformat=2 -Winit-self -Wsign-conversion)
2022-11-19 14:43:09 +00:00
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/)
target_include_directories(luna-freestanding PRIVATE ${LUNA_ROOT}/kernel/src)
2022-11-19 14:43:09 +00:00
set_target_properties(luna-freestanding PROPERTIES CXX_STANDARD 20)
add_library(luna ${SOURCES})
2023-01-10 17:13:21 +00:00
target_compile_options(luna PRIVATE -Os -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)
2023-01-06 23:21:08 +00:00
target_compile_options(luna PRIVATE -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -std=c++20 -fno-rtti -fno-exceptions)
target_include_directories(luna PUBLIC include/)
2023-01-06 12:38:48 +00:00
target_include_directories(luna PUBLIC ${LUNA_BASE}/usr/include)
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()