diff options
author | Bertrand Jacquin <bertrand@jacquin.bzh> | 2020-05-03 00:48:24 +0100 |
---|---|---|
committer | Bertrand Jacquin <bertrand@jacquin.bzh> | 2020-05-03 00:48:24 +0100 |
commit | 4029d621150ffef5352953f6f8647958e628a1d1 (patch) | |
tree | c52dc12f94b7b4b8ac2e1e0e2a4a07e2d0784a09 | |
parent | Merge pull request #6451 (diff) | |
download | monero-dev/beber/pgm.tar.xz |
build: rely on pkg-config to find zmqdev/beber/pgm
if zmq was built with libnorm, libproto or libpgm, pkg-config can inform
us directly instead of having to find them.
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | contrib/brew/Brewfile | 1 | ||||
-rw-r--r-- | contrib/depends/toolchain.cmake.in | 1 | ||||
m--------- | external/trezor-common | 0 | ||||
-rw-r--r-- | src/daemon/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/net/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/rpc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/trezor/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/unit_tests/CMakeLists.txt | 2 |
10 files changed, 10 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d9ec866e4..3fa781ba3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ message(STATUS "CMake version ${CMAKE_VERSION}") project(monero) include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable. +find_package (PkgConfig REQUIRED) enable_language(C ASM) @@ -949,30 +950,13 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AN endif() find_path(ZMQ_INCLUDE_PATH zmq.h) -find_library(ZMQ_LIB zmq) -find_library(PGM_LIBRARY pgm) -find_library(NORM_LIBRARY norm) -find_library(PROTOLIB_LIBRARY protolib) -find_library(SODIUM_LIBRARY sodium) if(NOT ZMQ_INCLUDE_PATH) message(FATAL_ERROR "Could not find required header zmq.h") endif() -if(NOT ZMQ_LIB) - message(FATAL_ERROR "Could not find required libzmq") -endif() -if(PGM_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}") -endif() -if(NORM_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}") -endif() -if(PROTOLIB_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}") -endif() -if(SODIUM_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}") -endif() + +pkg_check_modules(ZMQ REQUIRED zmq) +pkg_check_modules(SODIUM REQUIRED sodium) add_subdirectory(contrib) add_subdirectory(src) @@ -164,8 +164,6 @@ library archives (`.a`). | Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries | | OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `libressl-devel` | `openssl-devel` | NO | sha256 sum | | libzmq | 3.0.0 | NO | `libzmq3-dev` | `zeromq` | `zeromq-devel` | `zeromq-devel` | NO | ZeroMQ library | -| OpenPGM | ? | NO | `libpgm-dev` | `libpgm` | | `openpgm-devel` | NO | For ZeroMQ | -| libnorm[2] | ? | NO | `libnorm-dev` | | | | YES | For ZeroMQ | | libunbound | 1.4.16 | YES | `libunbound-dev` | `unbound` | `unbound-devel` | `unbound-devel` | NO | DNS resolver | | libsodium | ? | NO | `libsodium-dev` | `libsodium` | `libsodium-devel` | `libsodium-devel` | NO | cryptography | | libunwind | any | NO | `libunwind8-dev` | `libunwind` | `libunwind-devel` | `libunwind-devel` | YES | Stack traces | @@ -185,11 +183,10 @@ library archives (`.a`). [1] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must build the library binary manually. This can be done with the following command ```sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ ``` -[2] libnorm-dev is needed if your zmq library was built with libnorm, and not needed otherwise Install all dependencies at once on Debian/Ubuntu: -``` sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libpgm-dev qttools5-dev-tools libhidapi-dev libusb-dev libprotobuf-dev protobuf-compiler ``` +``` sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz qttools5-dev-tools libhidapi-dev libusb-dev libprotobuf-dev protobuf-compiler ``` Install all dependencies at once on macOS with the provided Brewfile: ``` brew update && brew bundle --file=contrib/brew/Brewfile ``` diff --git a/contrib/brew/Brewfile b/contrib/brew/Brewfile index 1fdf45cfe..8459c41a1 100644 --- a/contrib/brew/Brewfile +++ b/contrib/brew/Brewfile @@ -20,7 +20,6 @@ brew "boost" brew "openssl" brew "hidapi" brew "zmq" -brew "libpgm" brew "unbound" brew "libsodium" brew "miniupnpc" diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 2634423ab..2a0fb261a 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -44,7 +44,6 @@ endif() endif() SET(ZMQ_INCLUDE_PATH @prefix@/include) -SET(ZMQ_LIB @prefix@/lib/libzmq.a) SET(Boost_IGNORE_SYSTEM_PATH ON) SET(BOOST_ROOT @prefix@) diff --git a/external/trezor-common b/external/trezor-common -Subproject bff7fdfe436c727982cc553bdfb29a9021b423b +Subproject 31a0073c62738827b48d725facd376687942912 diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index d9bfd9a20..1d5e3e85c 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -88,7 +88,7 @@ target_link_libraries(daemon ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} - ${ZMQ_LIB} + ${ZMQ_LIBRARIES} ${GNU_READLINE_LIBRARY} ${EXTRA_LIBRARIES} ${Blocks}) diff --git a/src/net/CMakeLists.txt b/src/net/CMakeLists.txt index 1ce7118ad..7a87f4d3d 100644 --- a/src/net/CMakeLists.txt +++ b/src/net/CMakeLists.txt @@ -32,5 +32,5 @@ set(net_headers dandelionpp.h error.h i2p_address.h parse.h socks.h socks_connec tor_address.h zmq.h) monero_add_library(net ${net_sources} ${net_headers}) -target_link_libraries(net common epee ${ZMQ_LIB} ${Boost_ASIO_LIBRARY}) +target_link_libraries(net common epee ${ZMQ_LIBRARIES} ${Boost_ASIO_LIBRARY}) diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt index fe5e5a85b..a6b035a2b 100644 --- a/src/rpc/CMakeLists.txt +++ b/src/rpc/CMakeLists.txt @@ -151,7 +151,7 @@ target_link_libraries(daemon_rpc_server ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} - ${ZMQ_LIB} + ${ZMQ_LIBRARIES} ${EXTRA_LIBRARIES}) target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH}) target_include_directories(obj_daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH}) diff --git a/tests/trezor/CMakeLists.txt b/tests/trezor/CMakeLists.txt index 15ed5668d..60fdb0d11 100644 --- a/tests/trezor/CMakeLists.txt +++ b/tests/trezor/CMakeLists.txt @@ -62,7 +62,7 @@ target_link_libraries(trezor_tests ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} - ${ZMQ_LIB} + ${ZMQ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBRARIES}) diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index 9c24a5ec7..28349a536 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -122,7 +122,7 @@ target_link_libraries(unit_tests ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBRARIES} - ${ZMQ_LIB}) + ${ZMQ_LIBRARIES}) set_property(TARGET unit_tests PROPERTY FOLDER "tests") |