Skip to content

Commit

Permalink
Merge branch 'release/v0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
cinemast committed Jun 27, 2015
2 parents 47a85e5 + 3b6831e commit c6e3d71
Show file tree
Hide file tree
Showing 38 changed files with 1,346 additions and 683 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ xcuserdata
# svn & cvs
.svn
CVS

reports/*
doc/html
CMakeLists.txt.user*
src/examples/gen/*
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: cpp

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libcurl4-openssl-dev libjsoncpp-dev libargtable2-dev libboost-test-dev libgnutls-dev libgcrypt11-dev valgrind wget
- sudo apt-get install -qq libcurl4-openssl-dev libjsoncpp-dev libargtable2-dev libgnutls-dev libgcrypt11-dev valgrind wget
- wget ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.38.tar.gz
- tar -xvf libmicrohttpd-0.9.38.tar.gz
- cd libmicrohttpd-0.9.38
Expand Down
4 changes: 4 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Veselin Rachev <[email protected]>
Marek Kotewicz <[email protected]>
+ msvc support

Alexandre Poirot <[email protected]>
+ added client and server connectors that use Unix Domain Sockets
+ adapted build file to generate pkg-config file for this lib.

Bugfixes (chronological order)
==============================

Expand Down
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
Changes in v0.6.0
-----------------
- NEW: pkg-config files for all shared libraries
- NEW: UNIX Socket client + server connector
- NEW: multiarch support
- Change: unit testing framework to catch
- Change: allow disabling shared library build
- Change: split out shared/static library for stubgenerator

Changes in v0.5.0
-----------------
- added `--version` option to jsonrpcstub.
- added msvc support.
- added data field support for JsonRpcException.
- added contributions guide: https://github.com/cinemast/libjson-rpc-cpp#contributions
- Added `--version` option to jsonrpcstub.
- Added msvc support.
- Added data field support for JsonRpcException.
- Added contributions guide: https://github.com/cinemast/libjson-rpc-cpp#contributions
- HttpClient uses Http Keep-Alive, which improves performance drastically.
- Added `LIB_SUFFIX` to CMake to support multilib.
- Added multiarch support.
- Fixed building tests with examples disabled.
- Made static library build optional (via `BUILD_STATIC_LIBS`).
- Fixed unnecessary rebuilds of stubs on each `make` call.
Expand Down
43 changes: 19 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ if (${CMAKE_MAJOR_VERSION} GREATER 2)
endif()

set(MAJOR_VERSION 0)
set(MINOR_VERSION 5)
set(MINOR_VERSION 6)
set(PATCH_VERSION 0)
set(SO_VERSION 0)

set(BUILD_STATIC_LIBS NO CACHE BOOL "Build static libraries in addition to shared")
set(BUILD_SHARED_LIBS YES CACHE BOOL "Build shared libraries")
set(BUILD_STATIC_LIBS NO CACHE BOOL "Build static libraries")
set(LIB_SUFFIX "" CACHE STRING "Suffix for library directory (32/64)")

if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
message(FATAL_ERROR "Both BUILD_SHARED_LIBS and BUILD_STATIC_LIBS are disabled")
endif()

# defaults for modules that can be enabled/disabled
if(UNIX)
set(UNIX_DOMAIN_SOCKET_SERVER YES CACHE BOOL "Include Unix Domain Socket server")
set(UNIX_DOMAIN_SOCKET_CLIENT YES CACHE BOOL "Include Unix Domain Socket client")
endif(UNIX)
set(HTTP_SERVER YES CACHE BOOL "Include HTTP server using libmicrohttpd")
set(HTTP_CLIENT YES CACHE BOOL "Include HTTP client support using curl")
set(COMPILE_TESTS YES CACHE BOOL "Compile test framework")
Expand All @@ -28,6 +37,10 @@ set(COMPILE_EXAMPLES YES CACHE BOOL "Compile example programs")
# print actual settings
message(STATUS "HTTP_SERVER: ${HTTP_SERVER}")
message(STATUS "HTTP_CLIENT: ${HTTP_CLIENT}")
if(UNIX)
message(STATUS "UNIXDOMAINSOCKET_SERVER: ${UNIX_DOMAIN_SOCKET_SERVER}")
message(STATUS "UNIXDOMAINSOCKET_CLIENT: ${UNIX_DOMAIN_SOCKET_CLIENT}")
endif(UNIX)
message(STATUS "COMPILE_TESTS: ${COMPILE_TESTS}")
message(STATUS "COMPILE_STUBGEN: ${COMPILE_STUBGEN}")
message(STATUS "COMPILE_EXAMPLES: ${COMPILE_EXAMPLES}")
Expand Down Expand Up @@ -61,13 +74,13 @@ if (COMPILE_STUBGEN)
endif ()

# setup examples
if (HTTP_SERVER AND HTTP_CLIENT)
if (COMPILE_EXAMPLES)
add_subdirectory(src/examples)
endif()

# setup test suite
if (Boost_FOUND AND COMPILE_TESTS)
enable_testing()
if (COMPILE_TESTS)
enable_testing(true)
add_subdirectory(src/test)
endif()

Expand All @@ -92,22 +105,4 @@ add_custom_target(
)

# packaging stuff
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libjson-rpc-cpp")
set(CPACK_PACKAGE_VENDOR "Peter Spiess-Knafl <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")

if (WIN32 AND NOT UNIX)
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} libjson-rpc-cpp")
set(CPACK_NSIS_HELP_LINK "http://github.com/cinemast/libjson-rpc-cpp")
set(CPACK_NSIS_URL_INFO_ABOUT "http://github.com/cinemast/libjson-rpc-cpp")
set(CPACK_NSIS_CONTACT "[email protected]")
set(CPACK_NSIS_MODIFY_PATH ON)
endif(WIN32 AND NOT UNIX)
include(CPack)

include(CMakePackaging)
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ sudo make uninstall

Default configuration should be fine for most systems, but here are available compilation flags:

- `-DCOMPILE_TESTS=NO` disables unit test suite even if boost libraries are found.
- `-DCOMPILE_TESTS=NO` disables unit test suite.
- `-DCOMPILE_STUBGEN=NO` disables building the stubgenerator.
- `-DCOMPILE_EXAMPLES=NO` disables examples.
- `-DHTTP_SERVER=NO` disable the embedded mongoose webserver.
- `-DHTTP_SERVER=NO` disable the libmicrohttpd webserver.
- `-DHTTP_CLIENT=NO` disable the curl client.
- `-DUNIX_DOMAIN_SOCKET_SERVER=NO` disable the unix domain socket server connector.
- `-DUNIX_DOMAIN_SOCKET_CLIENT=NO` disable the unix domain socket client connector.

Using the framework
===================
Expand Down Expand Up @@ -310,21 +312,10 @@ This generates the Latex and HTML documentation into `build/doc`

Run the tests
-------------
For running the tests, the boost-test framework is required:
Simply run:

**Debian based systems**
```sh
cd build
sudo apt-get install libboost-test-dev
cmake .. && make test
```

**Mac OS X**
You need [Brew](http://brew.sh) installed and type the following commands
```sh
cd build
brew install boost
cmake .. && make test
make test
```

Testcoverage can be retrieved by invoking the [dev/testcoverage.sh script](https://github.com/cinemast/libjson-rpc-cpp/blob/master/dev/testcoverage.sh).
Testcoverage can be retrieved by invoking the [dev/testcoverage.sh script](https://github.com/cinemast/libjson-rpc-cpp/blob/master/dev/testcoverage.sh) inside the `dev` folder.
26 changes: 8 additions & 18 deletions cmake/CMakeDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,14 @@ endif()
# find doxygen
find_package(Doxygen)

# boost stuff

# left for backwards compatbility
if (WIN32)
set(BOOST_ROOT "C:/boost_1_57_0")
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")

set(Boost_USE_MULTITHREADED ON)
# TODO hanlde other msvc versions or it will fail find them
set(Boost_COMPILER -vc120)
# use static boost libraries *.lib
set(Boost_USE_STATIC_LIBS ON)
find_package(Catch)

if(NOT CATCH_FOUND)
message("Could not find catch, downloading it now")
# Includes Catch in the project:
add_subdirectory(${CMAKE_SOURCE_DIR}/src/catch)
include_directories(${CATCH_INCLUDE_DIR} ${COMMON_INCLUDES})
else()
INCLUDE_DIRECTORIES(${CATCH_INCLUDE_DIRS})
endif()

# TODO: add? appriopriate commands if it's found
find_package(Boost COMPONENTS unit_test_framework)


18 changes: 18 additions & 0 deletions cmake/CMakePackaging.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libjson-rpc-cpp")
set(CPACK_PACKAGE_VENDOR "Peter Spiess-Knafl <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")

if (WIN32 AND NOT UNIX)
set(CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} libjson-rpc-cpp")
set(CPACK_NSIS_HELP_LINK "http://github.com/cinemast/libjson-rpc-cpp")
set(CPACK_NSIS_URL_INFO_ABOUT "http://github.com/cinemast/libjson-rpc-cpp")
set(CPACK_NSIS_CONTACT "Peter Spiess-Knafl <[email protected]>")
set(CPACK_NSIS_MODIFY_PATH ON)
endif(WIN32 AND NOT UNIX)
include(CPack)
15 changes: 15 additions & 0 deletions cmake/FindCatch.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
find_path(
CATCH_INCLUDE_DIR
NAMES catch.hpp
DOC "catch include dir"
)


set(CATCH_INCLUDE_DIRS ${CATCH_INCLUDE_DIR})


include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(catch DEFAULT_MSG
CATCH_INCLUDE_DIR)
mark_as_advanced (CATCH_INCLUDE_DIR)

5 changes: 5 additions & 0 deletions cmake/libjsonrpccpp-client.pc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Name: libjsonrpccpp-client
Description: A C++ client implementation of json-rpc.
Version: ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
Libs: -L${FULL_PATH_LIBDIR} -ljsoncpp -ljsonrpccpp-common -ljsonrpccpp-client -lcurl
Cflags: -I${FULL_PATH_INCLUDEDIR}
5 changes: 5 additions & 0 deletions cmake/libjsonrpccpp-common.pc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Name: libjsonrpccpp-common
Description: Common libraries for libjson-rpc-cpp
Version: ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
Libs: -L${FULL_PATH_LIBDIR} -ljsoncpp
Cflags: -I${FULL_PATH_INCLUDEDIR}
5 changes: 5 additions & 0 deletions cmake/libjsonrpccpp-server.pc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Name: libjsonrpccpp-server
Description: A C++ server implementation of json-rpc.
Version: ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
Libs: -L${FULL_PATH_LIBDIR} -ljsoncpp -ljsonrpccpp-common -ljsonrpccpp-server -lmicrohttpd
Cflags: -I${FULL_PATH_INCLUDEDIR}
5 changes: 5 additions & 0 deletions cmake/libjsonrpccpp-stub.pc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Name: libjsonrpccpp-stub
Description: library for stub-generation of libjson-rpc-cpp servers/clients.
Version: ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
Libs: -L${FULL_PATH_LIBDIR} -ljsoncpp -ljsonrpccpp-common
Cflags: -I${FULL_PATH_INCLUDEDIR}
6 changes: 3 additions & 3 deletions dev/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cleanup() {
}
rm -rf reports
mkdir -p reports
build_configuration "-DCMAKE_BUILD_TYPE=Debug -DHTTP_SERVER=YES -DHTTP_CLIENT=YES -DCOMPILE_STUBGEN=YES -DCOMPILE_EXAMPLES=YES -DCOMPILE_TESTS=YES"
build_configuration "-DCMAKE_BUILD_TYPE=Debug -DHTTP_SERVER=YES -DHTTP_CLIENT=YES -DCOMPILE_STUBGEN=YES -DCOMPILE_EXAMPLES=YES -DCOMPILE_TESTS=YES -DUNIX_DOMAIN_SOCKET_SERVER=YES -DUNIX_DOMAIN_SOCKET_CLIENT=YES"
echo "Compiling examples"
cd build
g++ ../src/examples/simpleclient.cpp -Iroot/usr/local/include -Lroot/usr/local/lib -ljsonrpccpp-client -ljsoncpp -ljsonrpccpp-common -lcurl -o sampleclient
Expand All @@ -33,7 +33,7 @@ test -f sampleclient
test -f sampleserver

echo "Generating valgrind report"
valgrind --leak-check=full --xml=yes --xml-file=../reports/valgrind.xml ./bin/unit_testsuite --log_format=XML --log_sink=../reports/tests.xml --log_level=all --report_level=no
valgrind --leak-check=full --xml=yes --xml-file=../reports/valgrind.xml ./bin/unit_testsuite --reporter=junit --out=../reports/tests.xml


echo "Generating coverage report"
Expand All @@ -47,7 +47,7 @@ cd ..
echo "Cleanup that mess"
cleanup

build_configuration "-DCMAKE_BUILD_TYPE=Debug -DHTTP_SERVER=NO -DHTTP_CLIENT=NO -DCOMPILE_STUBGEN=YES -DCOMPILE_EXAMPLES=YES -DCOMPILE_TESTS=YES"
build_configuration "-DCMAKE_BUILD_TYPE=Debug -DHTTP_SERVER=NO -DHTTP_CLIENT=NO -DCOMPILE_STUBGEN=YES -DCOMPILE_EXAMPLES=YES -DCOMPILE_TESTS=YES -DUNIX_DOMAIN_SOCKET_SERVER=NO -DUNIX_DOMAIN_SOCKET_CLIENT=NO"
cleanup

echo "Integration successful"
2 changes: 1 addition & 1 deletion dev/codestyle/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
*************************************************************************
* @file %FILENAME%
* @date %DATE%
* @author Peter Spiess-Knafl <[email protected]>
* @author Peter Spiess-Knafl <[email protected]>
* @license See attached LICENSE.txt
************************************************************************/
3 changes: 3 additions & 0 deletions dev/installdeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

sudo apt-get install libmicrohttpd-dev libjsoncpp-dev libcurl4-openssl-dev cmake cppcheck valgrind gcovr
20 changes: 20 additions & 0 deletions src/catch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 2.8)
project(catch_builder CXX)
include(ExternalProject)
find_package(Git REQUIRED)

ExternalProject_Add(
catch
PREFIX ${CMAKE_BINARY_DIR}/catch
GIT_REPOSITORY https://github.com/philsquared/Catch.git
TIMEOUT 10
UPDATE_COMMAND ${GIT_EXECUTABLE} pull
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)

# Expose required variable (CATCH_INCLUDE_DIR) to parent scope
ExternalProject_Get_Property(catch source_dir)
set(CATCH_INCLUDE_DIR ${source_dir}/include CACHE INTERNAL "Path to include folder for Catch")
35 changes: 20 additions & 15 deletions src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,26 @@ include_directories(${CMAKE_BINARY_DIR})
include_directories(${JSONCPP_INCLUDE_DIRS})
include_directories(${MHD_INCLUDE_DIRS})

if (COMPILE_EXAMPLES)
add_executable(simpleserversample simpleserver.cpp)
target_link_libraries(simpleserversample jsonrpcserver)

add_executable(simpleclientsample simpleclient.cpp)
target_link_libraries(simpleclientsample jsonrpcclient)

if (COMPILE_STUBGEN)
add_executable(stubclientsample stubclient.cpp ${CMAKE_BINARY_DIR}/gen/stubclient.h)
target_link_libraries(stubclientsample jsonrpcclient)
if(HTTP_SERVER)
add_executable(simpleserversample simpleserver.cpp)
target_link_libraries(simpleserversample jsonrpcserver)
endif()

add_executable(stubserversample stubserver.cpp ${CMAKE_BINARY_DIR}/gen/abstractstubserver.h)
target_link_libraries(stubserversample jsonrpcserver)
if(HTTP_CLIENT)
add_executable(simpleclientsample simpleclient.cpp)
target_link_libraries(simpleclientsample jsonrpcclient)
endif()

add_executable(xbmcremote xbmcremote.cpp ${CMAKE_BINARY_DIR}/gen/xbmcremote.h)
target_link_libraries(xbmcremote jsonrpcclient)
endif()
if (COMPILE_STUBGEN)
if(HTTP_CLIENT)
add_executable(stubclientsample stubclient.cpp ${CMAKE_BINARY_DIR}/gen/stubclient.h)
target_link_libraries(stubclientsample jsonrpcclient)
add_executable(xbmcremote xbmcremote.cpp ${CMAKE_BINARY_DIR}/gen/xbmcremote.h)
target_link_libraries(xbmcremote jsonrpcclient)
endif()

if(HTTP_SERVER)
add_executable(stubserversample stubserver.cpp ${CMAKE_BINARY_DIR}/gen/abstractstubserver.h)
target_link_libraries(stubserversample jsonrpcserver)
endif()
endif()
2 changes: 2 additions & 0 deletions src/examples/simpleserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <iostream>
#include <jsonrpccpp/server.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <jsonrpccpp/server/connectors/unixdomainsocketserver.h>



using namespace jsonrpc;
Expand Down
Loading

0 comments on commit c6e3d71

Please sign in to comment.