(ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present

This commit is contained in:
Benjamin Sergeant 2019-12-03 16:01:46 -08:00
parent 2e1657167f
commit 5c5ea6dec1
16 changed files with 60 additions and 12 deletions

19
CMake/FindJsonCpp.cmake Normal file
View File

@ -0,0 +1,19 @@
# Find package structure taken from libcurl
include(FindPackageHandleStandardArgs)
find_path(JSONCPP_INCLUDE_DIRS json/json.h)
find_library(JSONCPP_LIBRARY jsoncpp)
find_package_handle_standard_args(JSONCPP
FOUND_VAR
JSONCPP_FOUND
REQUIRED_VARS
JSONCPP_LIBRARY
JSONCPP_INCLUDE_DIRS
FAIL_MESSAGE
"Could NOT find jsoncpp"
)
set(JSONCPP_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIRS})
set(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})

View File

@ -182,6 +182,7 @@ if (USE_TLS AND USE_OPEN_SSL)
endif()
if (USE_TLS AND USE_MBED_TLS)
# FIXME I'm not too sure that this USE_VENDORED_THIRD_PARTY thing works
if (USE_VENDORED_THIRD_PARTY)
set (ENABLE_PROGRAMS OFF)
add_subdirectory(third_party/mbedtls)

View File

@ -1 +1 @@
7.4.3
7.4.4

View File

@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.
## [7.4.4] - 2019-12-03
- (ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present
## [7.4.3] - 2019-12-03
- (http client) use std::unordered_map instead of std::map for HttpParameters and HttpFormDataParameters class aliases

View File

@ -24,7 +24,6 @@ set(IXCOBRA_INCLUDE_DIRS
.
..
../ixcore
../ixcrypto
../third_party)
../ixcrypto)
target_include_directories( ixcobra PUBLIC ${IXCOBRA_INCLUDE_DIRS} )

View File

@ -14,6 +14,7 @@
#include <cassert>
#include <cstring>
#include <iostream>
#include <sstream>
namespace ix

View File

@ -8,7 +8,7 @@
#include <ixwebsocket/IXWebSocketHttpHeaders.h>
#include <ixwebsocket/IXWebSocketPerMessageDeflateOptions.h>
#include <jsoncpp/json/json.h>
#include <json/json.h>
#include <memory>
#include <mutex>
#include <queue>

View File

@ -9,7 +9,7 @@
#include "IXCobraMetricsThreadedPublisher.h"
#include <atomic>
#include <chrono>
#include <jsoncpp/json/json.h>
#include <json/json.h>
#include <string>
#include <unordered_map>

View File

@ -13,6 +13,7 @@
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
namespace ix

View File

@ -9,7 +9,7 @@
#include "IXCobraConnection.h"
#include <atomic>
#include <condition_variable>
#include <jsoncpp/json/json.h>
#include <json/json.h>
#include <map>
#include <mutex>
#include <queue>

View File

@ -19,7 +19,6 @@ add_library(ixsentry STATIC
set(IXSENTRY_INCLUDE_DIRS
.
..
../ixcore
../third_party)
../ixcore)
target_include_directories( ixsentry PUBLIC ${IXSENTRY_INCLUDE_DIRS} )

View File

@ -9,6 +9,7 @@
#include <chrono>
#include <iostream>
#include <fstream>
#include <sstream>
#include <ixwebsocket/IXWebSocketHttpHeaders.h>
#include <ixcore/utils/IXCoreLogger.h>

View File

@ -8,7 +8,7 @@
#include <algorithm>
#include <ixwebsocket/IXHttpClient.h>
#include <jsoncpp/json/json.h>
#include <json/json.h>
#include <regex>
#include <memory>

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "7.4.3"
#define IX_WEBSOCKET_VERSION "7.4.4"

View File

@ -23,13 +23,20 @@ include_directories(
../ws
)
find_package(JsonCpp)
if (NOT JSONCPP_FOUND)
include_directories(../third_party/jsoncpp)
set(JSONCPP_SOURCES ../third_party/jsoncpp/jsoncpp.cpp)
endif()
# Shared sources
set (SOURCES
${JSONCPP_SOURCES}
test_runner.cpp
IXTest.cpp
IXGetFreePort.cpp
../third_party/msgpack11/msgpack11.cpp
../third_party/jsoncpp/jsoncpp.cpp
IXSocketTest.cpp
IXSocketConnectTest.cpp
@ -79,6 +86,11 @@ if (APPLE AND USE_TLS)
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
endif()
if (JSONCPP_FOUND)
target_include_directories(ixwebsocket_unittest PUBLIC ${JSONCPP_INCLUDE_DIRS})
target_link_libraries(ixwebsocket_unittest ${JSONCPP_LIBRARIES})
endif()
target_link_libraries(ixwebsocket_unittest ixsnake)
target_link_libraries(ixwebsocket_unittest ixcobra)
target_link_libraries(ixwebsocket_unittest ixwebsocket)

View File

@ -29,10 +29,16 @@ if (UNIX)
set( STATSD_CLIENT_SOURCES ../third_party/statsd-client-cpp/src/statsd_client.cpp)
endif()
find_package(JsonCpp)
if (NOT JSONCPP_FOUND)
include_directories(../third_party/jsoncpp)
set(JSONCPP_SOURCES ../third_party/jsoncpp/jsoncpp.cpp)
endif()
add_executable(ws
../third_party/msgpack11/msgpack11.cpp
../third_party/jsoncpp/jsoncpp.cpp
${STATSD_CLIENT_SOURCES}
${JSONCPP_SOURCES}
ws_http_client.cpp
ws_ping_pong.cpp
@ -74,4 +80,9 @@ if(NOT APPLE AND NOT USE_MBED_TLS)
target_link_libraries(ws ${OPENSSL_LIBRARIES})
endif()
if (JSONCPP_FOUND)
target_include_directories(ws PUBLIC ${JSONCPP_INCLUDE_DIRS})
target_link_libraries(ws ${JSONCPP_LIBRARIES})
endif()
install(TARGETS ws RUNTIME DESTINATION bin)