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