2023-04-02 04:07:27 +03:00
|
|
|
cmake_minimum_required(VERSION 3.26)
|
|
|
|
|
2023-05-10 22:35:20 +03:00
|
|
|
project(libc CXX ASM)
|
2023-04-02 04:07:27 +03:00
|
|
|
|
2023-04-07 02:27:15 +03:00
|
|
|
set(LIBC_SOURCES
|
2023-05-26 22:21:07 +03:00
|
|
|
assert.cpp
|
2023-04-07 02:27:15 +03:00
|
|
|
ctype.cpp
|
2023-06-11 00:19:20 +03:00
|
|
|
dirent.cpp
|
2023-04-23 14:32:37 +03:00
|
|
|
fcntl.cpp
|
2023-05-10 02:00:28 +03:00
|
|
|
printf_impl.cpp
|
2023-04-07 02:27:15 +03:00
|
|
|
stdio.cpp
|
|
|
|
stdlib.cpp
|
|
|
|
string.cpp
|
2023-06-05 14:36:17 +03:00
|
|
|
sys/stat.cpp
|
2023-06-04 17:59:13 +03:00
|
|
|
sys/wait.cpp
|
2023-05-16 19:22:10 +03:00
|
|
|
termios.cpp
|
2023-04-07 02:27:15 +03:00
|
|
|
unistd.cpp
|
2023-05-10 22:35:20 +03:00
|
|
|
math.S
|
2023-06-02 17:49:21 +03:00
|
|
|
icxxabi.cpp
|
2023-04-07 02:27:15 +03:00
|
|
|
)
|
|
|
|
|
2023-04-06 00:23:02 +03:00
|
|
|
add_custom_target(libc-headers
|
2023-04-10 20:27:20 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include ${BANAN_INCLUDE}
|
2023-04-02 04:07:27 +03:00
|
|
|
DEPENDS sysroot
|
|
|
|
)
|
2023-04-06 00:23:02 +03:00
|
|
|
|
2023-04-07 02:27:15 +03:00
|
|
|
add_library(libc ${LIBC_SOURCES})
|
2023-04-10 20:27:20 +03:00
|
|
|
add_dependencies(libc headers crt0)
|
2023-04-07 02:27:15 +03:00
|
|
|
|
2023-04-06 00:23:02 +03:00
|
|
|
add_custom_target(libc-install
|
2023-04-07 02:27:15 +03:00
|
|
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/
|
|
|
|
DEPENDS libc
|
2023-05-31 22:40:15 +03:00
|
|
|
BYPRODUCTS ${BANAN_LIB}/libc.a
|
2023-04-06 00:23:02 +03:00
|
|
|
)
|
|
|
|
|
2023-04-07 02:27:15 +03:00
|
|
|
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|