cmake: Switch from tri-state options to boolean. Stage ONE#161
Conversation
2c93976 to
d66f911
Compare
| - name: Generate build system | ||
| run: | | ||
| cmake -B build -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DBoost_INCLUDE_DIR="${PWD}/${{ matrix.conf.boost_archive }}" -DENABLE_WALLET=ON -DWITH_EXTERNAL_SIGNER=ON -DWITH_MINIUPNPC=ON -DWITH_NATPMP=ON -DWITH_ZMQ=ON -DWITH_USDT=ON -DWERROR=ON | ||
| cmake -B build --preset ci-linux -DWITH_GUI=OFF -DBoost_INCLUDE_DIR="${PWD}/${{ matrix.conf.boost_archive }}" |
There was a problem hiding this comment.
I would expect commit a12b692 cmake: Add CI-specific presets to just move options from the command line to the presets file, however this is not the case. I guess this is unintentional, or the commit message needs to be more elaborate on why those changes are made:
- removed from the command line, but not added to the presets file:
-DCMAKE_C_COMPILER=gcc-11-DCMAKE_CXX_COMPILER=g++-11-DENABLE_WALLET=ON
- added to the command line, not in the presets file before or after this commit (for Linux):
-DWITH_GUI=OFF-- why not have it in theci-linuxpreset?
There was a problem hiding this comment.
I would expect commit a12b692
cmake: Add CI-specific presetsto just move options from the command line to the presets file, however this is not the case.
Thanks! Reworked to meet expectations.
There was a problem hiding this comment.
Thanks! Do you think it makes sense to have all options in the presents file, so that they are not scattered between the command line and the presets file? Or would that be too un-flexible?
There was a problem hiding this comment.
I'm not sure. However, it won't affect flexibility, because there will be an opportunity to override any option in the command line.
| if("@no_upnp@") | ||
| set(WITH_MINIUPNPC OFF CACHE BOOL "") |
There was a problem hiding this comment.
I am not sure how those "@no_foo@" are generated, but there is some inconsistency between upnp and the others. For example, CMakeLists.txt defines WITH_NATPMP and in depends/toolchain.cmake.in the check is using no_natpmp. But for upnp: CMakeLists.txt: WITH_MINIUPNPC, depends/toolchain.cmake.in: no_upnp.
There was a problem hiding this comment.
I am not sure how those "@no_foo@" are generated...
Lines 288 to 298 in d66f911
... but there is some inconsistency between upnp and the others. For example,
CMakeLists.txtdefinesWITH_NATPMPand independs/toolchain.cmake.inthe check is usingno_natpmp. But for upnp:CMakeLists.txt:WITH_MINIUPNPC,depends/toolchain.cmake.in:no_upnp.
You mean, WITH_MINIUPNPC should be renamed to WITH_UPNP?
There was a problem hiding this comment.
You mean,
WITH_MINIUPNPCshould be renamed toWITH_UPNP?
Either this or change the above to -e 's|@no_miniupnpc@|$(NO_MINIUPNPC)|'. No strong opinion, but it is nice to be more consistent.
The `HARDENING` is a boolean option, not a string type.
d66f911 to
df4e46b
Compare
| 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) |
There was a problem hiding this comment.
Aren't we meant to be reming these, or is that happening at a later point?
There was a problem hiding this comment.
Yes, I'm going to rename all options at once at a later point.
|
|
||
| option(WITH_ZMQ "Enable ZMQ notifications." OFF) | ||
| if(WITH_ZMQ) | ||
| if(VCPKG_TARGET_TRIPLET) |
There was a problem hiding this comment.
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.
The find_package(ZeroMQ CONFIG) invocation is recommended by the vcpkg. I didn't test pkg-config approach for it.
|
|
||
| if(WITH_GUI AND WITH_QRENCODE) | ||
| if(MSVC) | ||
| if(VCPKG_TARGET_TRIPLET) |
There was a problem hiding this comment.
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.
Is anyone using MSVC without vcpkg? Is this being done consistently?
There was a problem hiding this comment.
Is anyone using MSVC without vcpkg?
I don't think so. But vcpkg might be used on other OSes.
Is this being done consistently?
I hope it is consistent now in the staging branch.
5de23c7 fixup! cmake: Add preset for MSVC build (Hennadii Stepanov) 09b1d5b fixup! ci: Test CMake edge cases (Hennadii Stepanov) 820a538 cmake [KILL 3-STATE]: Switch `WITH_QRENCODE` to boolean w/ default ON (Hennadii Stepanov) 017aeda cmake [FIXUP]: Move `find_program(brew)` out from introspection file (Hennadii Stepanov) Pull request description: This PR is a continuation of #161, #162 and #164 and tackles with the `WITH_QRENCODE` options. It becomes enabled when building GUI with the default value `ON`. Top commit has no ACKs. Tree-SHA512: 9cd923ef89e0a485330205db4389e42c001cbd6683a14b1e0c665d8e790e8bb2cae7b8b1929818443aea8eb5cbf6cafa79f4e44f41a893f54a5cdc09abc49dc1
598eda8 cmake [KILL 3-STATE]: Switch `WITH_USDT` to boolean w/ default OFF (Hennadii Stepanov) f3c2fea fixup! cmake: Add `systemtap-sdt` optional package support (Hennadii Stepanov) Pull request description: Same as #161, but USDT-specific with refactoring of the USDT search logic into its own "FindUSDT" module. The first commit is a pure refactoring. Top commit has no ACKs. Tree-SHA512: 2d67c7e72509fc78eb906a8af93e7525b8125bdeb38a5f45ceda1c0c75f300c74501402c39d8d17de2585b2ed2939de0009a33231d1164438ce929236d4b742a
This PR partially pulled from #83 with options, which default values seem non-controversial.
As a bonus, the help string duplication in
depends/toolchain.cmake.inhas been eliminated for the touched lines.The Autotools vs CMake Feature Parity Table has been updated as well.