Skip to content

Commit

Permalink
build: speedup by simplifying dependency graph
Browse files Browse the repository at this point in the history
Allow the objects of static libs to be built in parallel rather than serially
based on their dependency ordering.

For more detail, see:
https://cmake.org/cmake/help/latest/prop_tgt/OPTIMIZE_DEPENDENCIES.html
  • Loading branch information
theuni committed Sep 16, 2024
1 parent a39a915 commit aeccbb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
CMAKE_CXX_LINK_EXECUTABLE
)

# Flatten static lib dependencies.
# Without this, if libfoo.a depends on libbar.a, libfoo's objects can't begin
# to be compiled until libbar.a has been created.
set(CMAKE_OPTIMIZE_DEPENDENCIES TRUE)

project(BitcoinCore
VERSION ${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_BUILD}
DESCRIPTION "Bitcoin client software"
Expand Down
3 changes: 3 additions & 0 deletions src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL
../sync.cpp
)

# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/24058
set_target_properties(bitcoin_util PROPERTIES OPTIMIZE_DEPENDENCIES OFF)

target_link_libraries(bitcoin_util
PRIVATE
core_interface
Expand Down

0 comments on commit aeccbb4

Please sign in to comment.