mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-23 18:32:27 +02:00
kernel: create monolithic kernel static library
This commit is contained in:
committed by
Hennadii Stepanov
parent
75a5c8258e
commit
fdbade6f8d
@@ -7,5 +7,4 @@ Name: @CLIENT_NAME@ kernel library
|
||||
Description: Experimental library for the @CLIENT_NAME@ validation engine.
|
||||
Version: @CLIENT_VERSION_STRING@
|
||||
Libs: -L${libdir} -lbitcoinkernel
|
||||
Libs.private: -L${libdir} @LIBS_PRIVATE@
|
||||
Cflags: -I${includedir}
|
||||
|
@@ -79,20 +79,23 @@ add_library(bitcoinkernel
|
||||
../validation.cpp
|
||||
../validationinterface.cpp
|
||||
../versionbits.cpp
|
||||
$<TARGET_OBJECTS:bitcoin_clientversion>
|
||||
$<TARGET_OBJECTS:bitcoin_crypto>
|
||||
$<TARGET_OBJECTS:leveldb>
|
||||
$<TARGET_OBJECTS:crc32c>
|
||||
)
|
||||
target_link_libraries(bitcoinkernel
|
||||
PRIVATE
|
||||
core_interface
|
||||
bitcoin_clientversion
|
||||
bitcoin_crypto
|
||||
leveldb
|
||||
secp256k1
|
||||
secp256k1_objs
|
||||
$<$<PLATFORM_ID:Windows>:bcrypt>
|
||||
$<TARGET_NAME_IF_EXISTS:USDT::headers>
|
||||
PUBLIC
|
||||
Boost::headers
|
||||
)
|
||||
|
||||
target_include_directories(bitcoinkernel PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/leveldb/include>)
|
||||
|
||||
# libbitcoinkernel requires default symbol visibility, explicitly
|
||||
# specify that here so that things still work even when user
|
||||
# configures with -DREDUCE_EXPORTS=ON
|
||||
@@ -107,34 +110,6 @@ set_target_properties(bitcoinkernel PROPERTIES
|
||||
add_custom_target(libbitcoinkernel)
|
||||
add_dependencies(libbitcoinkernel bitcoinkernel)
|
||||
|
||||
# When building the static library, install all static libraries the
|
||||
# bitcoinkernel depends on.
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
# Recursively get all the static libraries a target depends on and put them in libs_out
|
||||
function(get_target_static_link_libs target libs_out)
|
||||
get_target_property(linked_libraries ${target} LINK_LIBRARIES)
|
||||
foreach(dep ${linked_libraries})
|
||||
if(TARGET ${dep})
|
||||
add_dependencies(libbitcoinkernel ${dep})
|
||||
get_target_property(dep_type ${dep} TYPE)
|
||||
if(dep_type STREQUAL "STATIC_LIBRARY")
|
||||
list(APPEND ${libs_out} ${dep})
|
||||
get_target_static_link_libs(${dep} ${libs_out})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${libs_out} ${${libs_out}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
set(all_kernel_static_link_libs "")
|
||||
get_target_static_link_libs(bitcoinkernel all_kernel_static_link_libs)
|
||||
|
||||
install(TARGETS ${all_kernel_static_link_libs} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libbitcoinkernel)
|
||||
list(TRANSFORM all_kernel_static_link_libs PREPEND "-l")
|
||||
# LIBS_PRIVATE is substituted in the pkg-config file.
|
||||
list(JOIN all_kernel_static_link_libs " " LIBS_PRIVATE)
|
||||
endif()
|
||||
|
||||
configure_file(${PROJECT_SOURCE_DIR}/libbitcoinkernel.pc.in ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/libbitcoinkernel.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT libbitcoinkernel)
|
||||
|
||||
|
Reference in New Issue
Block a user