HomePhabricator

[CMAKE] Add support for Miniupnpc

Description

[CMAKE] Add support for Miniupnpc

Summary:
This diff adds support for UPnP and an option to disable it by setting
-DENABLE_UPNP=OFF on the cmake command line.

It also adds an option START_WITH_UPNP which can be turned ON to set
UPnP as the default to map ports (OFF by default).

Test Plan:
With libminiupnpc installed:

mkdir buildcmake && cd buildcmake
cmake -GNinja .. -DENABLE_UPNP=OFF
ninja
./src/qt/bitcoin-qt

Go to Settings->Options...
Click on the Network tab.
Check the Map port using UPnP checkbox is dimmed.
Close bitcoin-qt.

rm -rf *
cmake -GNinja ..
ninja
./src/qt/bitcoin-qt

Go to Settings->Options...
Click on the Network tab.
Check the Map port using UPnP checkbox is not dimmed.
Uncheck Map port using UPnP and close bitcoin-qt.

Remove the line fUseUPnP=false from ~/.config/BitcoinABC/BitcoinABC-Qt.conf.

rm -rf *
cmake -GNinja -DSTART_WITH_UPNP=ON ..
ninja
./src/qt/bitcoin-qt

Go to Settings->Options...
Click on the Network tab.
Check the Map port using UPnP checkbox is not dimmed and is checked.
Uncheck Map port using UPnP and close bitcoin-qt.

Uninstall libminiupnpc. On Debian sudo apt remove libminiupnpc*

rm -rf *
cmake -GNinja ..

Should return a CMake Error:

Could NOT find MiniUPnPc (missing: MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY)

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D2997

Details

Provenance
FabienAuthored on May 8 2019, 15:04
FabienPushed on May 28 2019, 08:51
Reviewer
Restricted Project
Differential Revision
D2997: [CMAKE] Add support for Miniupnpc
Parents
rABC588be01e6b9f: Implicitly know about P2WPKH redeemscripts
Branches
Unknown
Tags
Unknown