LibC: Also build a static version of libc

This commit is contained in:
Itamar 2020-11-20 14:18:53 +02:00 committed by Andreas Kling
parent d89858f42a
commit 0220b5361e
Notes: sideshowbarker 2024-07-19 00:50:23 +09:00
2 changed files with 15 additions and 0 deletions

View File

@ -147,6 +147,16 @@ function(serenity_libc target_name fs_name)
serenity_generated_sources(${target_name})
endfunction()
function(serenity_libc_static target_name fs_name)
serenity_install_headers("")
serenity_install_sources("Libraries/LibC")
add_library(${target_name} ${SOURCES})
install(TARGETS ${target_name} ARCHIVE DESTINATION usr/lib)
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
target_link_directories(${target_name} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
serenity_generated_sources(${target_name})
endfunction()
function(serenity_bin target_name)
add_executable(${target_name} ${SOURCES})
target_sources(${target_name} PRIVATE ${CMAKE_SOURCE_DIR}/Libraries/LibC/crt0_shared.cpp)

View File

@ -66,6 +66,11 @@ add_custom_command(
)
set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES})
serenity_libc_static(LibCStatic c)
target_link_libraries(LibCStatic crt0)
add_dependencies(LibCStatic LibM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
serenity_libc(LibC c)
target_link_libraries(LibC crt0)