Luna/libluna/CMakeLists.txt

70 lines
2.0 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/CRC32.cpp
src/EscapeSequence.cpp
src/Format.cpp
2023-05-02 18:42:48 +00:00
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
2023-04-07 09:53:52 +00:00
src/StringBuilder.cpp
2023-03-29 15:43:10 +00:00
src/StringView.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
src/Spinlock.cpp
src/PathParser.cpp
2023-02-27 14:25:20 +00:00
src/UBSAN.cpp
src/Base64.cpp
2023-06-15 13:50:04 +00:00
src/Hash.cpp
2022-11-19 14:43:09 +00:00
)
set(SOURCES
${FREESTANDING_SOURCES}
2023-03-29 15:56:56 +00:00
src/CppABI.cpp
src/ImplPOSIX.cpp
2022-11-19 14:43:09 +00:00
)
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)
2022-11-19 14:43:09 +00:00
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})
target_compile_options(luna PRIVATE ${COMMON_FLAGS})
target_include_directories(luna PUBLIC include/)
2023-01-06 12:38:48 +00:00
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
)