Skip to content

Commit b8d6491

Browse files
authored
Merge branch 'master' into add-runtime-version
2 parents 8249f05 + 2179730 commit b8d6491

File tree

4 files changed

+47
-13
lines changed

4 files changed

+47
-13
lines changed

.github/workflows/amalgamate.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Amalgamation
2+
3+
on: [check_run, push, pull_request]
4+
5+
env:
6+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
7+
8+
jobs:
9+
amalgamation:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: checkout project
14+
uses: actions/checkout@v4
15+
16+
- name: setup python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.x'
20+
21+
- name: run amalgamate script
22+
run: |
23+
python amalgamate.py
24+
25+
- name: test compile amalgamated source
26+
run: |
27+
cat << 'EOF' > test_amalgamation.cpp
28+
#include "json/json.h"
29+
#include <iostream>
30+
31+
int main() {
32+
Json::Value root;
33+
root["hello"] = "world";
34+
std::cout << root.toStyledString() << std::endl;
35+
return 0;
36+
}
37+
EOF
38+
c++ -std=c++11 -I dist dist/jsoncpp.cpp test_amalgamation.cpp -o test_amalgamation
39+
./test_amalgamation

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,15 @@ meson wrap install jsoncpp
8888

8989
### Amalgamated source
9090

91-
> [!NOTE]
92-
> This approach may be outdated.
91+
For projects requiring a single-header approach, JsonCpp provides a script to generate an amalgamated source and header file.
92+
93+
You can generate the amalgamated files by running the following Python script from the top-level directory:
94+
95+
```sh
96+
python3 amalgamate.py
97+
```
9398

94-
For projects requiring a single-header approach, see the [Wiki entry](https://github.com/open-source-parsers/jsoncpp/wiki/Amalgamated-(Possibly-outdated)).
99+
This will generate a `dist` directory containing `jsoncpp.cpp`, `json/json.h`, and `json/json-forwards.h`. You can then drop these files directly into your project's source tree and compile `jsoncpp.cpp` alongside your other source files.
95100

96101
## Documentation
97102

src/lib_json/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ include(CheckIncludeFileCXX)
77
include(CheckTypeSize)
88
include(CheckStructHasMember)
99
include(CheckCXXSymbolExists)
10-
include(CheckCXXSourceCompiles)
1110

1211
check_include_file_cxx(clocale HAVE_CLOCALE)
1312
check_cxx_symbol_exists(localeconv clocale HAVE_LOCALECONV)
@@ -26,11 +25,6 @@ if(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALEC
2625
endif()
2726
endif()
2827

29-
check_cxx_source_compiles(
30-
"#include <string_view>
31-
int main() { std::string_view sv; return 0; }"
32-
JSONCPP_HAS_STRING_VIEW)
33-
3428
set(JSONCPP_INCLUDE_DIR ../../include)
3529

3630
set(PUBLIC_HEADERS

src/lib_json/json_value.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
#include <sstream>
1818
#include <utility>
1919

20-
#ifdef JSONCPP_HAS_STRING_VIEW
21-
#include <string_view>
22-
#endif
23-
2420
// Provide implementation equivalent of std::snprintf for older _MSC compilers
2521
#if defined(_MSC_VER) && _MSC_VER < 1900
2622
#include <stdarg.h>

0 commit comments

Comments
 (0)