Skip to content

Commit

Permalink
Merge #34: cmake: Avoid overlinking
Browse files Browse the repository at this point in the history
8342981 fixup! cmake: Build `test_bitcoin` executable (Hennadii Stepanov)
ab9853a fixup! cmake: Build `bench_bitcoin` executable (Hennadii Stepanov)
9a0a914 fixup! cmake: Add wallet functionality (Hennadii Stepanov)
e4b4fdd fixup! cmake: Add `libzmq` optional package support (Hennadii Stepanov)
0f0dcca fixup! cmake: Build `bitcoin_util` static library (Hennadii Stepanov)

Pull request description:

  Additionally, this PR fixes "ld: warning: ignoring duplicate libraries" on macOS:

  ```
  [....] Linking CXX executable test_bitcoin
  ld: warning: ignoring duplicate libraries: '../../libleveldb.a', '../libbitcoin_common.a', '../univalue/libunivalue.a', '../util/libbitcoin_util.a'
  ```
  ```
  [....] Linking CXX executable bench_bitcoin
  ld: warning: ignoring duplicate libraries: '../../libleveldb.a', '../univalue/libunivalue.a', '../wallet/libbitcoin_wallet.a'
  ```

  The third [commit](aaf50ac) makes the `bitcoin_wallet` library a direct dependency of `bitcoind` rather `bitcoin_node`, that is outlined in  https://github.com/bitcoin/bitcoin/blob/master/doc/design/libraries.md.

ACKs for top commit:
  theuni:
    ACK 8342981

Tree-SHA512: 0f83b10771d22b93ce23122867f2dc2915c39fe2a892b7140aa4d79a21ec5c5eb98431fa1174b1b0b8786ffae6b0f29020d4dac0d7505971cbed0c263593e5fd
  • Loading branch information
hebasto committed Nov 9, 2023
2 parents bef9a2f + 8342981 commit d3f3967
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 38 deletions.
9 changes: 3 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,9 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL
validation.cpp
validationinterface.cpp
versionbits.cpp
$<$<TARGET_EXISTS:bitcoin_wallet>:wallet/init.cpp>
$<$<NOT:$<TARGET_EXISTS:bitcoin_wallet>>:dummywallet.cpp>
)
if(ENABLE_WALLET)
target_sources(bitcoin_node PRIVATE wallet/init.cpp)
target_link_libraries(bitcoin_node PRIVATE bitcoin_wallet)
else()
target_sources(bitcoin_node PRIVATE dummywallet.cpp)
endif()
target_link_libraries(bitcoin_node
PRIVATE
core
Expand All @@ -250,6 +246,7 @@ if(BUILD_DAEMON)
target_link_libraries(bitcoind
core
bitcoin_node
$<TARGET_NAME_IF_EXISTS:bitcoin_wallet>
)
list(APPEND installable_targets bitcoind)
endif()
Expand Down
7 changes: 3 additions & 4 deletions src/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023 The Bitcoin Core developers
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# file COPYING or https://opensource.org/license/mit/.

include(GenerateHeaders)
generate_header_from_raw(data/block413567.raw)
Expand Down Expand Up @@ -52,8 +52,7 @@ add_executable(bench_bitcoin
target_link_libraries(bench_bitcoin
core
test_util
leveldb
univalue
bitcoin_node
Boost::headers
)

Expand Down
9 changes: 2 additions & 7 deletions src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023 The Bitcoin Core developers
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# file COPYING or https://opensource.org/license/mit/.

include(GenerateHeaders)
generate_header_from_json(data/base58_encode_decode.json)
Expand Down Expand Up @@ -140,13 +140,8 @@ target_link_libraries(test_bitcoin
test_util
bitcoin_cli
bitcoin_node
bitcoin_common
bitcoin_util
minisketch
leveldb
univalue
Boost::headers
libevent::libevent
)

if(ENABLE_WALLET)
Expand Down
21 changes: 6 additions & 15 deletions src/test/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023 The Bitcoin Core developers
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# file COPYING or https://opensource.org/license/mit/.

add_library(test_util STATIC EXCLUDE_FROM_ALL
blockfilter.cpp
Expand All @@ -17,22 +17,13 @@ add_library(test_util STATIC EXCLUDE_FROM_ALL
transaction_utils.cpp
txmempool.cpp
validation.cpp
$<$<BOOL:${ENABLE_WALLET}>:${PROJECT_SOURCE_DIR}/src/wallet/test/util.cpp>
)

target_link_libraries(test_util
PRIVATE
core
bitcoin_common
bitcoin_node
leveldb
univalue
Boost::headers
PUBLIC
univalue
)

if(ENABLE_WALLET)
target_sources(test_util
PRIVATE
../../wallet/test/util.cpp
)
endif()

target_link_libraries(test_util PRIVATE core)
5 changes: 2 additions & 3 deletions src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023 The Bitcoin Core developers
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# file COPYING or https://opensource.org/license/mit/.

add_library(bitcoin_util STATIC EXCLUDE_FROM_ALL
asmap.cpp
Expand Down Expand Up @@ -53,7 +53,6 @@ target_link_libraries(bitcoin_util
PRIVATE
core
bitcoin_crypto
univalue
Threads::Threads
$<$<BOOL:${MINGW}>:ws2_32>
)
5 changes: 2 additions & 3 deletions src/zmq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023 The Bitcoin Core developers
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# file COPYING or https://opensource.org/license/mit/.

add_library(bitcoin_zmq STATIC
zmqabstractnotifier.cpp
Expand All @@ -16,7 +16,6 @@ target_compile_definitions(bitcoin_zmq
target_link_libraries(bitcoin_zmq
PRIVATE
core
leveldb
univalue
$<TARGET_NAME_IF_EXISTS:libzmq>
$<TARGET_NAME_IF_EXISTS:PkgConfig::libzmq>
Expand Down

0 comments on commit d3f3967

Please sign in to comment.