2022-12-04 12:47:08 +01: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 13:00:22 +01:00
|
|
|
file(GLOB HEADERS include/luna/*.h)
|
|
|
|
|
2022-11-19 15:43:09 +01:00
|
|
|
set(FREESTANDING_SOURCES
|
2023-01-02 13:00:22 +01:00
|
|
|
${HEADERS}
|
2023-06-17 12:03:37 +02:00
|
|
|
src/CRC32.cpp
|
2023-09-02 19:35:42 +02:00
|
|
|
src/EscapeSequence.cpp
|
2022-12-04 12:42:43 +01:00
|
|
|
src/Format.cpp
|
2023-05-02 20:42:48 +02:00
|
|
|
src/Sort.cpp
|
2022-12-04 12:42:43 +01:00
|
|
|
src/NumberParsing.cpp
|
2022-12-16 20:40:04 +01:00
|
|
|
src/CString.cpp
|
2023-03-11 01:13:44 +01:00
|
|
|
src/CPath.cpp
|
2022-12-04 12:42:43 +01:00
|
|
|
src/Units.cpp
|
|
|
|
src/SystemError.cpp
|
2022-12-04 15:14:07 +01:00
|
|
|
src/Bitmap.cpp
|
2023-03-11 00:27:08 +01:00
|
|
|
src/Buffer.cpp
|
2023-09-02 15:48:58 +02:00
|
|
|
src/Scanf.cpp
|
2022-12-07 14:32:07 +01:00
|
|
|
src/Stack.cpp
|
2023-03-29 17:28:22 +02:00
|
|
|
src/String.cpp
|
2023-04-07 11:53:52 +02:00
|
|
|
src/StringBuilder.cpp
|
2023-03-29 17:43:10 +02:00
|
|
|
src/StringView.cpp
|
2022-12-18 13:04:40 +01:00
|
|
|
src/Utf8.cpp
|
2022-12-18 16:38:47 +01:00
|
|
|
src/TarStream.cpp
|
2022-12-22 18:00:35 +01:00
|
|
|
src/DebugLog.cpp
|
2023-01-13 19:27:53 +01:00
|
|
|
src/Heap.cpp
|
2023-02-25 17:09:03 +01:00
|
|
|
src/Spinlock.cpp
|
2023-03-10 22:17:03 +01:00
|
|
|
src/PathParser.cpp
|
2023-02-27 15:25:20 +01:00
|
|
|
src/UBSAN.cpp
|
2023-04-26 20:57:48 +02:00
|
|
|
src/Base64.cpp
|
2023-06-15 15:50:04 +02:00
|
|
|
src/Hash.cpp
|
2022-11-19 15:43:09 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
set(SOURCES
|
|
|
|
${FREESTANDING_SOURCES}
|
2023-03-29 17:56:56 +02:00
|
|
|
src/CppABI.cpp
|
2023-06-03 11:18:52 +02:00
|
|
|
src/ImplPOSIX.cpp
|
2022-11-19 15:43:09 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(luna-freestanding ${FREESTANDING_SOURCES})
|
|
|
|
target_compile_definitions(luna-freestanding PRIVATE USE_FREESTANDING)
|
2023-04-07 12:02:49 +02:00
|
|
|
target_compile_options(luna-freestanding PRIVATE ${COMMON_FLAGS})
|
|
|
|
target_compile_options(luna-freestanding PRIVATE -nostdlib -mcmodel=kernel -ffreestanding)
|
2022-11-19 15:43:09 +01:00
|
|
|
|
2022-12-04 12:42:43 +01:00
|
|
|
target_include_directories(luna-freestanding PUBLIC include/)
|
2023-01-13 19:27:53 +01:00
|
|
|
target_include_directories(luna-freestanding PRIVATE ${LUNA_ROOT}/kernel/src)
|
2022-11-19 15:43:09 +01:00
|
|
|
set_target_properties(luna-freestanding PROPERTIES CXX_STANDARD 20)
|
|
|
|
|
2023-01-06 13:31:14 +01:00
|
|
|
add_library(luna ${SOURCES})
|
2023-04-07 12:02:49 +02:00
|
|
|
target_compile_options(luna PRIVATE ${COMMON_FLAGS})
|
2023-01-06 13:31:14 +01:00
|
|
|
target_include_directories(luna PUBLIC include/)
|
2023-01-06 13:38:48 +01:00
|
|
|
target_include_directories(luna PUBLIC ${LUNA_BASE}/usr/include)
|
2022-12-05 16:36:41 +01:00
|
|
|
|
2023-01-21 22:44:16 +01:00
|
|
|
if("${LUNA_ARCH}" MATCHES "x86_64")
|
2022-12-05 16:36:41 +01:00
|
|
|
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)
|
2023-01-06 13:31:14 +01:00
|
|
|
target_compile_definitions(luna PUBLIC ARCH_X86_64)
|
2022-12-07 14:32:07 +01:00
|
|
|
endif()
|
2023-08-21 14:06:32 +02:00
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
TARGET luna
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_BINARY_DIR}/libluna.a ${LUNA_BASE}/usr/lib/libluna.a
|
|
|
|
)
|