-
Notifications
You must be signed in to change notification settings - Fork 6
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
cmake: Switch from tri-state options to boolean. Stage ONE #161
Changes from all commits
8fe37b0
63bbe26
dc20cdf
a4d6a0c
5bfecf4
732b4e9
df4e46b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,9 +70,32 @@ option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting execu | |
option(WERROR "Treat compiler warnings as errors." OFF) | ||
|
||
tristate_option(CCACHE "Use ccache for compiling." "if ccache is found." AUTO) | ||
tristate_option(WITH_NATPMP "Enable NAT-PMP." "if libnatpmp is found." AUTO) | ||
tristate_option(WITH_MINIUPNPC "Enable UPnP." "if libminiupnpc is found." AUTO) | ||
tristate_option(WITH_ZMQ "Enable ZMQ notifications." "if libzmq is found." AUTO) | ||
|
||
option(WITH_NATPMP "Enable NAT-PMP." OFF) | ||
if(WITH_NATPMP) | ||
find_package(NATPMP MODULE REQUIRED) | ||
endif() | ||
|
||
option(WITH_MINIUPNPC "Enable UPnP." OFF) | ||
if(WITH_MINIUPNPC) | ||
find_package(MiniUPnPc MODULE REQUIRED) | ||
endif() | ||
|
||
option(WITH_ZMQ "Enable ZMQ notifications." OFF) | ||
if(WITH_ZMQ) | ||
if(VCPKG_TARGET_TRIPLET) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is vcpkg being carved out here? Can just use the same logic for both until we can use the new logic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
find_package(ZeroMQ CONFIG REQUIRED) | ||
else() | ||
# The ZeroMQ project has provided config files since v4.2.2. | ||
# TODO: Switch to find_package(ZeroMQ) at some point in the future. | ||
include(CrossPkgConfig) | ||
cross_pkg_check_modules(libzmq REQUIRED IMPORTED_TARGET libzmq>=4) | ||
target_link_libraries(PkgConfig::libzmq INTERFACE | ||
$<$<PLATFORM_ID:Windows>:iphlpapi;ws2_32> | ||
) | ||
endif() | ||
endif() | ||
|
||
tristate_option(WITH_USDT | ||
"Enable tracepoints for Userspace, Statically Defined Tracing." | ||
"if sys/sdt.h is found." | ||
|
@@ -84,7 +107,12 @@ tristate_option(WITH_EXTERNAL_SIGNER | |
AUTO | ||
) | ||
tristate_option(WITH_QRENCODE "Enable QR code support." "if libqrencode is found." AUTO) | ||
tristate_option(MULTIPROCESS "Build multiprocess bitcoin-node, bitcoin-wallet, and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental." "if libmultiprocess is found." OFF) | ||
|
||
option(MULTIPROCESS "Build multiprocess bitcoin-node, bitcoin-wallet, and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental." OFF) | ||
if(MULTIPROCESS) | ||
find_package(Libmultiprocess CONFIG REQUIRED) | ||
find_package(LibmultiprocessGen CONFIG REQUIRED) | ||
endif() | ||
|
||
option(BUILD_TESTS "Build test_bitcoin executable." ON) | ||
cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_TESTS" OFF) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,60 +50,6 @@ if(CCACHE) | |
mark_as_advanced(CCACHE_COMMAND) | ||
endif() | ||
|
||
if(WITH_NATPMP) | ||
find_package(NATPMP MODULE) | ||
if(NATPMP_FOUND) | ||
set(WITH_NATPMP ON) | ||
elseif(WITH_NATPMP STREQUAL "AUTO") | ||
message(WARNING "libnatpmp not found, disabling.\n" | ||
"To skip libnatpmp check, use \"-DWITH_NATPMP=OFF\".\n") | ||
set(WITH_NATPMP OFF) | ||
else() | ||
message(FATAL_ERROR "libnatpmp requested, but not found.") | ||
endif() | ||
endif() | ||
|
||
if(WITH_MINIUPNPC) | ||
find_package(MiniUPnPc MODULE) | ||
if(MiniUPnPc_FOUND) | ||
set(WITH_MINIUPNPC ON) | ||
elseif(WITH_MINIUPNPC STREQUAL "AUTO") | ||
message(WARNING "libminiupnpc not found, disabling.\n" | ||
"To skip libminiupnpc check, use \"-DWITH_MINIUPNPC=OFF\".\n") | ||
set(WITH_MINIUPNPC OFF) | ||
else() | ||
message(FATAL_ERROR "libminiupnpc requested, but not found.") | ||
endif() | ||
endif() | ||
|
||
if(WITH_ZMQ) | ||
if(MSVC) | ||
find_package(ZeroMQ CONFIG) | ||
else() | ||
# The ZeroMQ project has provided config files since v4.2.2. | ||
# TODO: Switch to find_package(ZeroMQ) at some point in the future. | ||
include(CrossPkgConfig) | ||
cross_pkg_check_modules(libzmq IMPORTED_TARGET libzmq>=4) | ||
if(libzmq_FOUND AND TARGET PkgConfig::libzmq) | ||
target_compile_definitions(PkgConfig::libzmq INTERFACE | ||
$<$<PLATFORM_ID:Windows>:ZMQ_STATIC> | ||
) | ||
target_link_libraries(PkgConfig::libzmq INTERFACE | ||
$<$<PLATFORM_ID:Windows>:iphlpapi;ws2_32> | ||
) | ||
endif() | ||
endif() | ||
if(TARGET libzmq OR TARGET PkgConfig::libzmq) | ||
set(WITH_ZMQ ON) | ||
elseif(WITH_ZMQ STREQUAL "AUTO") | ||
message(WARNING "libzmq not found, disabling.\n" | ||
"To skip libzmq check, use \"-DWITH_ZMQ=OFF\".\n") | ||
set(WITH_ZMQ OFF) | ||
else() | ||
message(FATAL_ERROR "libzmq requested, but not found.") | ||
endif() | ||
endif() | ||
|
||
if(WITH_USDT) | ||
find_path(SystemTap_INCLUDE_DIR | ||
NAMES sys/sdt.h | ||
|
@@ -189,12 +135,13 @@ else() | |
endif() | ||
|
||
if(WITH_GUI AND WITH_QRENCODE) | ||
if(MSVC) | ||
if(VCPKG_TARGET_TRIPLET) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes an intention clearer because the logic is specific to vcpkg package manager, not to the MSVC compiler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is anyone using MSVC without vcpkg? Is this being done consistently? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think so. But vcpkg might be used on other OSes.
I hope it is consistent now in the staging branch. |
||
# TODO: vcpkg fails to build libqrencode package due to | ||
# the build error in its libiconv dependency. | ||
# See: https://github.com/microsoft/vcpkg/issues/36924. | ||
else() | ||
cross_pkg_check_modules(libqrencode libqrencode IMPORTED_TARGET) | ||
include(CrossPkgConfig) | ||
cross_pkg_check_modules(libqrencode IMPORTED_TARGET libqrencode) | ||
endif() | ||
if(TARGET PkgConfig::libqrencode) | ||
set_target_properties(PkgConfig::libqrencode PROPERTIES | ||
|
@@ -207,15 +154,3 @@ if(WITH_GUI AND WITH_QRENCODE) | |
message(FATAL_ERROR "libqrencode requested, but not found.") | ||
endif() | ||
endif() | ||
|
||
if(MULTIPROCESS) | ||
find_package(Libmultiprocess CONFIG) | ||
find_package(LibmultiprocessGen CONFIG) | ||
if(TARGET Libmultiprocess::multiprocess AND TARGET Libmultiprocess::mpgen) | ||
set(MULTIPROCESS ON) | ||
elseif(MULTIPROCESS STREQUAL "AUTO") | ||
set(MULTIPROCESS OFF) | ||
else() | ||
message(FATAL_ERROR "\"-DMULTIPROCESS=ON\" specified, but libmultiprocess library was not found.") | ||
endif() | ||
endif() |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -122,8 +122,10 @@ if(NOT WITH_QRENCODE AND "@no_qr@" STREQUAL "1") | |||||||||||||||||||||||
set(WITH_QRENCODE OFF CACHE STRING "Enable QR code support.") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if(NOT WITH_ZMQ AND "@no_zmq@" STREQUAL "1") | ||||||||||||||||||||||||
set(WITH_ZMQ OFF CACHE STRING "Enable ZMQ notifications.") | ||||||||||||||||||||||||
if("@no_zmq@") | ||||||||||||||||||||||||
set(WITH_ZMQ OFF CACHE BOOL "") | ||||||||||||||||||||||||
else() | ||||||||||||||||||||||||
set(WITH_ZMQ ON CACHE BOOL "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if(NOT ENABLE_WALLET AND "@no_wallet@" STREQUAL "1") | ||||||||||||||||||||||||
|
@@ -138,27 +140,31 @@ if(NOT WITH_SQLITE AND "@no_sqlite@" STREQUAL "1") | |||||||||||||||||||||||
set(WITH_SQLITE OFF CACHE STRING "Enable SQLite wallet support.") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if(NOT WITH_MINIUPNPC AND "@no_upnp@" STREQUAL "1") | ||||||||||||||||||||||||
set(WITH_MINIUPNPC OFF CACHE STRING "Enable UPnP.") | ||||||||||||||||||||||||
if("@no_upnp@") | ||||||||||||||||||||||||
set(WITH_MINIUPNPC OFF CACHE BOOL "") | ||||||||||||||||||||||||
Comment on lines
+143
to
+144
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how those There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Lines 288 to 298 in d66f911
You mean, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Either this or change the above to |
||||||||||||||||||||||||
else() | ||||||||||||||||||||||||
set(WITH_MINIUPNPC ON CACHE BOOL "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if(NOT WITH_NATPMP AND "@no_natpmp@" STREQUAL "1") | ||||||||||||||||||||||||
set(WITH_NATPMP OFF CACHE STRING "Enable NAT-PMP.") | ||||||||||||||||||||||||
if("@no_natpmp@") | ||||||||||||||||||||||||
set(WITH_NATPMP OFF CACHE BOOL "") | ||||||||||||||||||||||||
else() | ||||||||||||||||||||||||
set(WITH_NATPMP ON CACHE BOOL "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if(NOT WITH_USDT AND "@no_usdt@" STREQUAL "1") | ||||||||||||||||||||||||
set(WITH_USDT OFF CACHE STRING "Enable tracepoints for Userspace, Statically Defined Tracing.") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if(NOT HARDENING AND "@no_harden@" STREQUAL "1") | ||||||||||||||||||||||||
set(HARDENING OFF CACHE STRING "Attempt to harden the resulting executables.") | ||||||||||||||||||||||||
if("@no_harden@") | ||||||||||||||||||||||||
set(HARDENING OFF CACHE BOOL "") | ||||||||||||||||||||||||
else() | ||||||||||||||||||||||||
set(HARDENING ON CACHE BOOL "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if("@multiprocess@" STREQUAL "1") | ||||||||||||||||||||||||
if(NOT MULTIPROCESS) | ||||||||||||||||||||||||
set(MULTIPROCESS ON CACHE STRING "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
if(NOT LibmultiprocessGen_DIR) | ||||||||||||||||||||||||
set(LibmultiprocessGen_DIR "${CMAKE_FIND_ROOT_PATH}/native/lib/cmake/LibmultiprocessGen" CACHE PATH "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
set(MULTIPROCESS ON CACHE BOOL "") | ||||||||||||||||||||||||
set(LibmultiprocessGen_DIR "${CMAKE_FIND_ROOT_PATH}/native/lib/cmake/LibmultiprocessGen" CACHE PATH "") | ||||||||||||||||||||||||
else() | ||||||||||||||||||||||||
set(MULTIPROCESS OFF CACHE BOOL "") | ||||||||||||||||||||||||
endif() | ||||||||||||||||||||||||
hebasto marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Aren't we meant to be reming these, or is that happening at a later point?
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.
Yes, I'm going to rename all options at once at a later point.