forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 6
Rebased cmake-staging branch (post PRs 17, 18, 19)
#31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
fa01d51
cmake: Add root `CMakeLists.txt` file
hebasto 60423ee
cmake: Warn about not encapsulated build properties
hebasto dc8810d
cmake: Add `config/bitcoin-config.h` support
hebasto 3bc406d
cmake: Add `cmake/introspection.cmake` file
hebasto 5091fbc
cmake: Check system headers
hebasto ce87cbc
cmake: Check system symbols
hebasto 82decc2
cmake: Check compiler features
hebasto ace12e4
cmake: Add position independent code support
hebasto dad4d7d
cmake: Build `crc32c` static library
hebasto e4bd403
cmake: Build `leveldb` static library
hebasto cbb978a
cmake: Add platform-specific definitions and properties
hebasto 667fbea
cmake: Build `minisketch` static library
hebasto 7e2143a
cmake: Build `secp256k1` static library
hebasto 60135b9
cmake: Build `univalue` static library
hebasto 59b404e
cmake: Build `bitcoin_crypto` library
hebasto 6b8120e
cmake: Build `bitcoin_util` static library
hebasto a8fdf47
cmake: Build `bitcoin_consensus` library
hebasto 6bf981a
cmake: Build `bitcoind` executable
hebasto 5e352f2
build: Generate `share/toolchain.cmake` in depends
hebasto d68d9fc
cmake: Add cross-compiling support
hebasto be6ec09
cmake: Add `TristateOption` module
hebasto 8444b4f
cmake: Add `ccache` support
hebasto 09f7a91
cmake: Add `libnatpmp` optional package support
hebasto 8002c68
cmake: Add `libminiupnpc` optional package support
hebasto 223c393
cmake: Add `libzmq` optional package support
hebasto 17fa954
cmake: Add `systemtap-sdt` optional package support
hebasto 604a21d
cmake: Build `bitcoin-cli` executable
hebasto ed36791
cmake: Build `bitcoin-tx` executable
hebasto f08381f
cmake: Build `bitcoin-util` executable
hebasto 5425fd0
cmake: Add wallet functionality
hebasto 8c90135
cmake: Add test config and runners
hebasto 5e000d1
cmake: Build `bench_bitcoin` executable
hebasto 85f96f4
cmake: Build `test_bitcoin` executable
hebasto 241fc3f
cmake: Include CTest
hebasto 72dbc2e
cmake: Add `TryAppendCXXFlags` module
hebasto c381343
cmake: Add `TryAppendLinkerFlag` module
hebasto 57705bd
cmake: Add platform-specific linker flags
hebasto c20de96
cmake: Redefine configuration flags
hebasto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Copyright (c) 2023 The Bitcoin Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| function(add_boost_if_needed) | ||
| #[=[ | ||
| TODO: Not all targets, which will be added in the future, require | ||
| Boost. Therefore, a proper check will be appropriate here. | ||
|
|
||
| Implementation notes: | ||
| Although only Boost headers are used to build Bitcoin Core, | ||
| we still leverage a standard CMake's approach to handle | ||
| dependencies, i.e., the Boost::headers "library". | ||
| A command target_link_libraries(target PRIVATE Boost::headers) | ||
| will propagate Boost::headers usage requirements to the target. | ||
| For Boost::headers such usage requirements is an include | ||
| directory and other added INTERFACE properties. | ||
| ]=] | ||
|
|
||
| set(Boost_NO_BOOST_CMAKE ON) | ||
| find_package(Boost 1.64.0 REQUIRED) | ||
| set_target_properties(Boost::boost PROPERTIES IMPORTED_GLOBAL TRUE) | ||
| target_compile_definitions(Boost::boost INTERFACE | ||
| # We don't use multi_index serialization. | ||
| BOOST_MULTI_INDEX_DISABLE_SERIALIZATION | ||
| ) | ||
| if(CMAKE_VERSION VERSION_LESS 3.15) | ||
| add_library(Boost::headers ALIAS Boost::boost) | ||
| endif() | ||
|
|
||
| mark_as_advanced(Boost_INCLUDE_DIR) | ||
| endfunction() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Copyright (c) 2023 The Bitcoin Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| # Check whether evhttp_connection_get_peer expects const char**. | ||
| # See https://github.com/libevent/libevent/commit/a18301a2bb160ff7c3ffaf5b7653c39ffe27b385 | ||
| macro(check_evhttp_connection_get_peer target) | ||
| cmake_push_check_state(RESET) | ||
| set(CMAKE_REQUIRED_LIBRARIES ${target}) | ||
| check_cxx_source_compiles(" | ||
| #include <cstdint> | ||
| #include <event2/http.h> | ||
|
|
||
| int main() | ||
| { | ||
| evhttp_connection* conn = (evhttp_connection*)1; | ||
| const char* host; | ||
| uint16_t port; | ||
| evhttp_connection_get_peer(conn, &host, &port); | ||
| } | ||
| " HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR | ||
| ) | ||
| cmake_pop_check_state() | ||
| target_compile_definitions(${target} INTERFACE | ||
| $<$<BOOL:${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR}>:HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR=1> | ||
| ) | ||
| endmacro() | ||
|
|
||
| function(add_libevent_if_needed) | ||
| # TODO: Not all targets, which will be added in the future, | ||
| # require libevent. Therefore, a proper check will be | ||
| # appropriate here. | ||
|
|
||
| set(libevent_minimum_version 2.1.8) | ||
|
|
||
| if(MSVC) | ||
| find_package(Libevent ${libevent_minimum_version} REQUIRED COMPONENTS extra CONFIG) | ||
| check_evhttp_connection_get_peer(libevent::extra) | ||
| add_library(libevent::libevent ALIAS libevent::extra) | ||
| return() | ||
| endif() | ||
|
|
||
| find_package(PkgConfig) | ||
| pkg_check_modules(libevent | ||
| REQUIRED IMPORTED_TARGET GLOBAL | ||
| libevent>=${libevent_minimum_version} | ||
| ) | ||
| check_evhttp_connection_get_peer(PkgConfig::libevent) | ||
| target_link_libraries(PkgConfig::libevent INTERFACE | ||
| $<$<BOOL:${MINGW}>:iphlpapi;ssp;ws2_32> | ||
| ) | ||
| add_library(libevent::libevent ALIAS PkgConfig::libevent) | ||
|
|
||
| if(NOT WIN32) | ||
| pkg_check_modules(libevent_pthreads | ||
| REQUIRED IMPORTED_TARGET GLOBAL | ||
| libevent_pthreads>=${libevent_minimum_version} | ||
| ) | ||
| endif() | ||
| endfunction() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is PRIVATE in the staging branch, and I don't see any explanation for the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Distinguishing
PRIVATEvsPUBLICvsINTERFACEscopes matters only for targets that have dependants.That is not the case for executable targets. Therefore,
target_link_librarieswith a simpler signature is used.This particular change has done for the sake of consistency with other similar cases.