Luna/libluna/CMakeLists.txt
apio 53f8a583dc
Some checks failed
Build and test / build (push) Failing after 1m21s
libluna+libos+libui: Move Action to libluna and make it usable in the kernel
This commit adds an error-propagating constructor for Action and Function, which makes them usable in the kernel.
2024-10-19 21:25:17 +02:00

70 lines
2.0 KiB
CMake

# 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/CRC32.cpp
src/EscapeSequence.cpp
src/Format.cpp
src/Sort.cpp
src/NumberParsing.cpp
src/CString.cpp
src/CPath.cpp
src/Units.cpp
src/SystemError.cpp
src/Bitmap.cpp
src/Buffer.cpp
src/Scanf.cpp
src/SHA.cpp
src/Stack.cpp
src/String.cpp
src/RefString.cpp
src/StringBuilder.cpp
src/StringView.cpp
src/Utf8.cpp
src/TarStream.cpp
src/DebugLog.cpp
src/Heap.cpp
src/Spinlock.cpp
src/PathParser.cpp
src/UBSAN.cpp
src/Base64.cpp
src/Hash.cpp
)
set(SOURCES
${FREESTANDING_SOURCES}
src/CppABI.cpp
src/ImplPOSIX.cpp
)
add_library(luna-freestanding ${FREESTANDING_SOURCES})
target_compile_definitions(luna-freestanding PUBLIC USE_FREESTANDING)
target_compile_options(luna-freestanding PRIVATE ${COMMON_FLAGS})
target_compile_options(luna-freestanding PRIVATE -nostdlib -mcmodel=kernel -ffreestanding)
target_include_directories(luna-freestanding PUBLIC include/)
target_include_directories(luna-freestanding PRIVATE ${LUNA_ROOT}/kernel/src)
set_target_properties(luna-freestanding PROPERTIES CXX_STANDARD 20)
add_library(luna ${SOURCES})
target_compile_options(luna PRIVATE ${COMMON_FLAGS})
target_include_directories(luna PUBLIC include/)
target_include_directories(luna PUBLIC ${LUNA_BASE}/usr/include)
if(DEFINED LIBC_BOOTSTRAP)
target_compile_definitions(luna PUBLIC LIBC_BOOTSTRAP)
endif()
if("${LUNA_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()
add_custom_command(
TARGET luna
COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_BINARY_DIR}/libluna.a ${LUNA_BASE}/usr/lib/libluna.a
)