Skip to content

Commit 29161bb

Browse files
Use json library from vcpkg (#88)
1 parent 2fc3982 commit 29161bb

File tree

11 files changed

+46
-7972
lines changed

11 files changed

+46
-7972
lines changed

CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ include(CTest)
1010

1111
set(WERROR true CACHE BOOL "Enable warnings as errors.")
1212
set(WALL true CACHE BOOL "Enable all warnings.")
13-
set(INCLUDE_JSONCPP true CACHE BOOL "Include jsoncpp source")
1413
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
1514

1615
if(NOT WIN32)
@@ -35,13 +34,11 @@ if(USE_CPPRESTSDK)
3534
set(CPPREST_LIB "cpprestsdk::cpprest")
3635
endif()
3736

38-
if(NOT INCLUDE_JSONCPP)
39-
find_package(jsoncpp REQUIRED)
40-
# jsoncpp has different target names depending on whether it
41-
# was built as a shared or static library. We make this override-able
42-
# so we can be resilient to the changes between versions.
43-
set(JSONCPP_LIB "jsoncpp_lib" CACHE STRING "jsoncpp target name")
44-
endif()
37+
find_package(jsoncpp REQUIRED)
38+
# jsoncpp has different target names depending on whether it
39+
# was built as a shared or static library. We make this override-able
40+
# so we can be resilient to the changes between versions.
41+
set(JSONCPP_LIB "jsoncpp_object" CACHE STRING "jsoncpp target name")
4542

4643
if(USE_MSGPACK)
4744
find_package(msgpack CONFIG REQUIRED)

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Below are instructions to build on different OS's. You can also use the followin
2222
| -DBUILD_TESTING | Builds the test project | true |
2323
| -DUSE_CPPRESTSDK | Includes the CppRestSDK (default http stack) (requires cpprestsdk to be installed) | false |
2424
| -DUSE_MSGPACK | Adds an option to use the MessagePack Hub Protocol (requires msgpack-c to be installed) | false |
25-
| -DINCLUDE_JSONCPP | Builds jsoncpp source code as part of the output binary | true |
2625
| -DWERROR | Enables warnings as errors | true |
2726
| -DWALL | Enables all warnings | true |
2827
| -DINJECT_HEADER_AFTER_STDAFX=`<header path>` | Adds the provided header to the library compilation in stdafx.cpp, intended to allow "new" and "delete" to be replaced. | `<none>` |
@@ -31,7 +30,7 @@ Below are instructions to build on different OS's. You can also use the followin
3130
```powershell
3231
PS> git submodule update --init
3332
PS> .\submodules\vcpkg\bootstrap-vcpkg.bat
34-
PS> .\submodules\vcpkg\vcpkg.exe install cpprestsdk[websockets]:x64-windows
33+
PS> .\submodules\vcpkg\vcpkg.exe install cpprestsdk[websockets]:x64-windows jsoncpp:x64-windows
3534
PS> mkdir build.release
3635
PS> cd build.release
3736
PS> cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE="..\submodules\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -DUSE_CPPRESTSDK=true
@@ -44,7 +43,7 @@ Output will be in `build.release\bin\Release\`
4443
$ git submodule update --init
4544
$ brew install gcc6
4645
$ ./submodules/vcpkg/bootstrap-vcpkg.sh
47-
$ ./submodules/vcpkg/vcpkg install cpprestsdk[websockets]
46+
$ ./submodules/vcpkg/vcpkg install cpprestsdk[websockets] jsoncpp
4847
$ mkdir build.release
4948
$ cd build.release
5049
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../submodules/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DUSE_CPPRESTSDK=true
@@ -57,7 +56,7 @@ Output will be in `build.release/bin/`
5756
```bash
5857
$ git submodule update --init
5958
$ ./submodules/vcpkg/bootstrap-vcpkg.sh
60-
$ ./submodules/vcpkg/vcpkg install cpprestsdk[websockets] boost-system boost-chrono boost-thread
59+
$ ./submodules/vcpkg/vcpkg install cpprestsdk[websockets] boost-system boost-chrono boost-thread jsoncpp
6160
$ mkdir build.release
6261
$ cd build.release
6362
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../submodules/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DUSE_CPPRESTSDK=true

azure-pipelines.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ stages:
3737
- powershell: "& ./submodules/vcpkg/bootstrap-vcpkg.bat"
3838
condition: ne(variables.CACHE_RESTORED, 'true')
3939
displayName: Bootstrap vcpkg
40-
- powershell: "& ./submodules/vcpkg/vcpkg.exe install cpprestsdk[websockets]:x64-windows msgpack:x64-windows --vcpkg-root ./submodules/vcpkg"
40+
- powershell: "& ./submodules/vcpkg/vcpkg.exe install cpprestsdk[websockets]:x64-windows msgpack:x64-windows jsoncpp:x64-windows --vcpkg-root ./submodules/vcpkg"
4141
condition: ne(variables.CACHE_RESTORED, 'true')
4242
displayName: vcpkg install dependencies
4343

@@ -50,7 +50,7 @@ stages:
5050
- bash: "./submodules/vcpkg/bootstrap-vcpkg.sh --allowAppleClang"
5151
condition: ne(variables.CACHE_RESTORED, 'true')
5252
displayName: Bootstrap vcpkg
53-
- bash: "./submodules/vcpkg/vcpkg install cpprestsdk[websockets] msgpack --vcpkg-root ./submodules/vcpkg"
53+
- bash: "./submodules/vcpkg/vcpkg install cpprestsdk[websockets] msgpack jsoncpp --vcpkg-root ./submodules/vcpkg"
5454
condition: ne(variables.CACHE_RESTORED, 'true')
5555
displayName: vcpkg install dependencies
5656

@@ -63,7 +63,7 @@ stages:
6363
- bash: "./submodules/vcpkg/bootstrap-vcpkg.sh"
6464
condition: ne(variables.CACHE_RESTORED, 'true')
6565
displayName: Bootstrap vcpkg
66-
- bash: "./submodules/vcpkg/vcpkg install cpprestsdk[websockets] boost-system boost-chrono boost-thread msgpack --vcpkg-root ./submodules/vcpkg"
66+
- bash: "./submodules/vcpkg/vcpkg install cpprestsdk[websockets] boost-system boost-chrono boost-thread msgpack jsoncpp --vcpkg-root ./submodules/vcpkg"
6767
condition: ne(variables.CACHE_RESTORED, 'true')
6868
displayName: vcpkg install dependencies
6969
- bash: "sudo apt-get update && sudo apt install valgrind"
@@ -78,7 +78,7 @@ stages:
7878
- bash: "./submodules/vcpkg/bootstrap-vcpkg.sh"
7979
condition: ne(variables.CACHE_RESTORED, 'true')
8080
displayName: Bootstrap vcpkg
81-
- bash: "./submodules/vcpkg/vcpkg install msgpack --vcpkg-root ./submodules/vcpkg"
81+
- bash: "./submodules/vcpkg/vcpkg install msgpack jsoncpp --vcpkg-root ./submodules/vcpkg"
8282
condition: ne(variables.CACHE_RESTORED, 'true')
8383
displayName: vcpkg install dependencies
8484
- bash: "sudo apt-get update && sudo apt install valgrind"
@@ -94,7 +94,7 @@ stages:
9494
- powershell: "& ./submodules/vcpkg/bootstrap-vcpkg.bat"
9595
condition: ne(variables.CACHE_RESTORED, 'true')
9696
displayName: Bootstrap vcpkg
97-
- powershell: "& ./submodules/vcpkg/vcpkg.exe install msgpack:x64-windows --vcpkg-root ./submodules/vcpkg"
97+
- powershell: "& ./submodules/vcpkg/vcpkg.exe install msgpack:x64-windows jsoncpp:x64-windows --vcpkg-root ./submodules/vcpkg"
9898
condition: ne(variables.CACHE_RESTORED, 'true')
9999
displayName: vcpkg install dependencies
100100

@@ -109,7 +109,7 @@ stages:
109109
- bash: "./submodules/vcpkg/bootstrap-vcpkg.sh"
110110
condition: ne(variables.CACHE_RESTORED, 'true')
111111
displayName: Bootstrap vcpkg
112-
- bash: "./submodules/vcpkg/vcpkg install msgpack --vcpkg-root ./submodules/vcpkg"
112+
- bash: "./submodules/vcpkg/vcpkg install msgpack jsoncpp --vcpkg-root ./submodules/vcpkg"
113113
condition: ne(variables.CACHE_RESTORED, 'true')
114114
displayName: vcpkg install dependencies
115115

src/signalrclient/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ else()
7171
target_compile_options(microsoft-signalr PRIVATE -Wextra -Wpedantic -Wno-unknown-pragmas)
7272
endif()
7373

74-
if(INCLUDE_JSONCPP)
75-
target_sources(microsoft-signalr PRIVATE ../../third_party_code/jsoncpp/jsoncpp.cpp)
76-
target_include_directories(microsoft-signalr PRIVATE ../../third_party_code/jsoncpp)
77-
else()
78-
target_link_libraries(microsoft-signalr PUBLIC ${JSONCPP_LIB})
79-
endif()
74+
target_link_libraries(microsoft-signalr PUBLIC ${JSONCPP_LIB})
8075

8176
if(NOT USE_CPPRESTSDK)
8277
target_link_libraries(microsoft-signalr)

src/signalrclient/microsoft-signalr-config.in.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ if(@USE_CPPRESTSDK@)
44
find_dependency(cpprestsdk)
55
endif()
66

7-
if(NOT @INCLUDE_JSONCPP@)
8-
find_dependency(@JSONCPP_LIB@)
9-
endif()
7+
find_dependency(@JSONCPP_LIB@)
108

119
if(@USE_MSGPACK@)
1210
find_dependency(msgpack)

test/signalrclienttests/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,7 @@ if(USE_MSGPACK)
8282
list (APPEND libraries ${MSGPACK_LIB})
8383
endif() # USE_MSGPACK
8484

85-
if(INCLUDE_JSONCPP)
86-
target_sources(signalrclienttests PRIVATE ../../third_party_code/jsoncpp/jsoncpp.cpp)
87-
target_include_directories(signalrclienttests PRIVATE ../../third_party_code/jsoncpp)
88-
else()
89-
list (APPEND libraries ${JSONCPP_LIB})
90-
endif()
85+
list (APPEND libraries ${JSONCPP_LIB})
9186

9287
list (APPEND libraries gtest)
9388

third-party-notices.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,32 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
5454
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
5555
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
5656
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57-
SOFTWARE.
57+
SOFTWARE.
58+
59+
License notice for msgpack-c
60+
------------------------------------------------------------------------------
61+
Copyright (C) 2008-2015 FURUHASHI Sadayuki
62+
63+
Boost Software License - Version 1.0 - August 17th, 2003
64+
65+
Permission is hereby granted, free of charge, to any person or organization
66+
obtaining a copy of the software and accompanying documentation covered by
67+
this license (the "Software") to use, reproduce, display, distribute,
68+
execute, and transmit the Software, and to prepare derivative works of the
69+
Software, and to permit third-parties to whom the Software is furnished to
70+
do so, all subject to the following:
71+
72+
The copyright notices in the Software and this entire statement, including
73+
the above license grant, this restriction and the following disclaimer,
74+
must be included in all copies of the Software, in whole or in part, and
75+
all derivative works of the Software, unless such copies or derivative
76+
works are solely in the form of machine-executable object code generated by
77+
a source language processor.
78+
79+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
80+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
81+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
82+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
83+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
84+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
85+
DEALINGS IN THE SOFTWARE.

third_party_code/jsoncpp/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)