aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2020-05-03 00:48:24 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2020-05-03 01:39:46 +0100
commiteb8c550cbc9fe4abfb3002d81f07be6dfbabc5a4 (patch)
tree73990f8934ace74060c192bf817474e701aebeb1
parenthttps://sourceware.org/bugzilla/show_bug.cgi?id=25210 (diff)
downloadmonero-eb8c550cbc9fe4abfb3002d81f07be6dfbabc5a4.tar.xz
build: rely on pkg-config to find zmq and sodiumv0.15.0.5
if zmq was built with libnorm, libproto or libpgm, pkg-config can inform us directly instead of having to find them. The location of zmq.h can be obtained the same way motivation is to remove opengpm from the list of mandatory dependencies when monero does not have direct dependency on opengpm, but only when zeromq is buily with pgm support which itself has hard dependency on pyton2 which is now EOL.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt30
-rw-r--r--README.md5
-rw-r--r--contrib/brew/Brewfile1
-rw-r--r--contrib/depends/toolchain.cmake.in3
-rw-r--r--src/crypto/CMakeLists.txt1
-rw-r--r--src/daemon/CMakeLists.txt1
-rw-r--r--src/device_trezor/CMakeLists.txt1
-rw-r--r--src/net/CMakeLists.txt2
-rw-r--r--src/rpc/CMakeLists.txt7
-rw-r--r--tests/trezor/CMakeLists.txt1
-rw-r--r--tests/unit_tests/CMakeLists.txt3
11 files changed, 12 insertions, 43 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cbf7232bd..4fddc2d4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,8 @@ project(monero)
enable_language(C ASM)
+find_package (PkgConfig REQUIRED)
+
function (die msg)
if (NOT WIN32)
string(ASCII 27 Esc)
@@ -932,31 +934,11 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AN
endif()
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)
+pkg_check_modules(ZMQ REQUIRED libzmq)
+list(APPEND EXTRA_LIBRARIES ${ZMQ_LIBRARIES})
-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(SODIUM REQUIRED libsodium)
+list(APPEND EXTRA_LIBRARIES ${SODIUM_LIBRARIES})
add_subdirectory(contrib)
add_subdirectory(src)
diff --git a/README.md b/README.md
index 8a59bab10..941284ae4 100644
--- a/README.md
+++ b/README.md
@@ -184,8 +184,6 @@ library archives (`.a`).
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | NO | C++ libraries |
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | NO | sha256 sum |
| libzmq | 3.0.0 | NO | `libzmq3-dev` | `zeromq` | `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` | NO | DNS resolver |
| libsodium | ? | NO | `libsodium-dev` | `libsodium` | `libsodium-devel` | NO | cryptography |
| libunwind | any | NO | `libunwind8-dev` | `libunwind` | `libunwind-devel` | YES | Stack traces |
@@ -205,11 +203,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..cb1aafeeb 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -43,9 +43,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@)
SET(BOOST_INCLUDEDIR @prefix@/include)
diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt
index 80f1e5d7e..d66b7d9dd 100644
--- a/src/crypto/CMakeLists.txt
+++ b/src/crypto/CMakeLists.txt
@@ -91,7 +91,6 @@ target_link_libraries(cncrypto
epee
randomx
${Boost_SYSTEM_LIBRARY}
- ${SODIUM_LIBRARY}
PRIVATE
${EXTRA_LIBRARIES})
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index d9bfd9a20..bf373029d 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -88,7 +88,6 @@ target_link_libraries(daemon
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
- ${ZMQ_LIB}
${GNU_READLINE_LIBRARY}
${EXTRA_LIBRARIES}
${Blocks})
diff --git a/src/device_trezor/CMakeLists.txt b/src/device_trezor/CMakeLists.txt
index 250939da7..293d80fd9 100644
--- a/src/device_trezor/CMakeLists.txt
+++ b/src/device_trezor/CMakeLists.txt
@@ -88,7 +88,6 @@ if(DEVICE_TREZOR_READY)
ringct_basic
cryptonote_core
common
- ${SODIUM_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Protobuf_LIBRARY}
${TREZOR_LIBUSB_LIBRARIES}
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 ebb1e767f..57408140c 100644
--- a/src/rpc/CMakeLists.txt
+++ b/src/rpc/CMakeLists.txt
@@ -26,7 +26,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-include_directories(SYSTEM ${ZMQ_INCLUDE_PATH})
+include_directories(SYSTEM ${ZMQ_INCLUDE_DIRS})
set(rpc_base_sources
rpc_args.cpp
@@ -148,7 +148,6 @@ target_link_libraries(daemon_rpc_server
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
- ${ZMQ_LIB}
${EXTRA_LIBRARIES})
-target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
-target_include_directories(obj_daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH})
+target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_DIRS})
+target_include_directories(obj_daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_DIRS})
diff --git a/tests/trezor/CMakeLists.txt b/tests/trezor/CMakeLists.txt
index 15ed5668d..0de7de53e 100644
--- a/tests/trezor/CMakeLists.txt
+++ b/tests/trezor/CMakeLists.txt
@@ -62,7 +62,6 @@ target_link_libraries(trezor_tests
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SYSTEM_LIBRARY}
- ${ZMQ_LIB}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index 17d6dfd9f..ce593e375 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -119,8 +119,7 @@ target_link_libraries(unit_tests
${Boost_THREAD_LIBRARY}
${GTEST_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
- ${EXTRA_LIBRARIES}
- ${ZMQ_LIB})
+ ${EXTRA_LIBRARIES})
set_property(TARGET unit_tests
PROPERTY
FOLDER "tests")