Skip to content

small changes for building on macOS high sierra, mojave and catalina #16

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/FindJSONCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# also defined, but not for general use are
# JSONCPP_LIBRARIES, where to find the jsoncpp library.

FIND_PATH(JSONCPP_INCLUDE_DIRS json.h
FIND_PATH(JSONCPP_INCLUDE_DIRS json/json.h
/usr/include
/usr/local/include
${CMAKE_SOURCE_DIR}/win32-deps/include
Expand Down
32 changes: 24 additions & 8 deletions cmake/FindJSONRPCCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@ FIND_PATH(JSONRPCCPP_INCLUDE_DIRS client.h server.h
PATH_SUFFIXES jsonrpccpp
)

FIND_LIBRARY(JSONRPCCPP_LIBRARIES
FIND_LIBRARY(JSONRPCCPP_COMMON_LIBRARIES
NAMES
jsonrpccpp-common
PATHS
/usr/lib
/usr/local/lib
)

FIND_LIBRARY(JSONRPCCPP_CLIENT_LIBRARIES
NAMES
jsonrpccpp-client
PATHS
/usr/lib
/usr/local/lib
)

FIND_LIBRARY(JSONRPCCPP_SERVER_LIBRARIES
NAMES
jsonrpccpp-server
PATHS
/usr/lib
Expand All @@ -26,27 +40,29 @@ IF(NOT JSONRPCCPP_INCLUDE_DIRS)
MESSAGE("Could not find include dirs")
ENDIF(NOT JSONRPCCPP_INCLUDE_DIRS)

IF(NOT JSONRPCCPP_LIBRARIES)
IF(NOT JSONRPCCPP_COMMON_LIBRARIES)
MESSAGE("Could not find libraries")
ENDIF(NOT JSONRPCCPP_LIBRARIES)
ENDIF(NOT JSONRPCCPP_COMMON_LIBRARIES)

IF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_LIBRARIES)
IF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_COMMON_LIBRARIES)
SET(JSONRPCCPP_FOUND TRUE)
ENDIF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_LIBRARIES)
ENDIF(JSONRPCCPP_INCLUDE_DIRS AND JSONRPCCPP_COMMON_LIBRARIES)


IF(JSONRPCCPP_FOUND)
IF(NOT JSONRPCCPP_FIND_QUIETLY)
MESSAGE(STATUS "Found JSON-RPC-CPP: ${JSONRPCCPP_LIBRARIES}")
MESSAGE(STATUS "Found JSON-RPC-CPP: ${JSONRPCCPP_COMMON_LIBRARIES}")
ENDIF(NOT JSONRPCCPP_FIND_QUIETLY)
ELSE(JSONRPCCPP_FOUND)
IF(JSONRPCCPP_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find JSON-RPC-CPP library include: ${JSONRPCCPP_INCLUDE_DIRS}, lib: ${JSONRPCCPP_LIBRARIES}")
MESSAGE(FATAL_ERROR "Could not find JSON-RPC-CPP library include: ${JSONRPCCPP_INCLUDE_DIRS}, lib: ${JSONRPCCPP_COMMON_LIBRARIES}")
ENDIF(JSONRPCCPP_FIND_REQUIRED)
ENDIF(JSONRPCCPP_FOUND)

MARK_AS_ADVANCED(
JSONRPCCPP_INCLUDE_DIRS
JSONRPCCPP_LIBRARIES
JSONRPCCPP_COMMON_LIBRARIES
JSONRPCCPP_CLIENT_LIBRARIES
JSONRPCCPP_SERVER_LIBRARIES
)

15 changes: 9 additions & 6 deletions src/bitcoinapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ ADD_LIBRARY(bitcoinapi_static STATIC ${bitcoinapi_source})
# Set output name of static library
SET_TARGET_PROPERTIES(bitcoinapi_static PROPERTIES OUTPUT_NAME bitcoinapi)

TARGET_INCLUDE_DIRECTORIES(bitcoinapi PRIVATE ${JSONCPP_INCLUDE_DIRS} ${JSONRPCCPP_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(bitcoinapi_static PRIVATE ${JSONCPP_INCLUDE_DIRS} ${JSONRPCCPP_INCLUDE_DIRS})

# Link the library with json-rpc-cpp libs
TARGET_LINK_LIBRARIES(bitcoinapi
${CURL_LIBRARY}
${JSONCPP_LIBRARY}
jsonrpccpp-common
jsonrpccpp-client)
${JSONCPP_LIBRARIES}
${JSONRPCCPP_COMMON_LIBRARIES}
${JSONRPCCPP_CLIENT_LIBRARIES})

TARGET_LINK_LIBRARIES(bitcoinapi_static
${CURL_LIBRARY}
${JSONCPP_LIBRARY}
jsonrpccpp-common
jsonrpccpp-client)
${JSONCPP_LIBRARIES}
${JSONRPCCPP_COMMON_LIBRARIES}
${JSONRPCCPP_CLIENT_LIBRARIES})

# Set version settings
SET(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
Expand Down
6 changes: 3 additions & 3 deletions src/bitcoinapi/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <sstream>
#include <iostream>

#include <jsoncpp/json/json.h>
#include <jsoncpp/json/reader.h>
#include <jsoncpp/json/value.h>
#include <json/json.h>
#include <json/reader.h>
#include <json/value.h>
#include <jsonrpccpp/client.h>

using Json::Value;
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoinapi/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <string>
#include <vector>

#include <jsoncpp/json/json.h>
#include <json/json.h>

/* === General types === */
struct getinfo_t{
Expand Down