Skip to content
Merged
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
39 changes: 39 additions & 0 deletions .github/workflows/amalgamate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Amalgamation

on: [check_run, push, pull_request]

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
amalgamation:
runs-on: ubuntu-latest

steps:
- name: checkout project
uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: run amalgamate script
run: |
python amalgamate.py

- name: test compile amalgamated source
run: |
cat << 'EOF' > test_amalgamation.cpp
#include "json/json.h"
#include <iostream>

int main() {
Json::Value root;
root["hello"] = "world";
std::cout << root.toStyledString() << std::endl;
return 0;
}
EOF
c++ -std=c++11 -I dist dist/jsoncpp.cpp test_amalgamation.cpp -o test_amalgamation
./test_amalgamation
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ meson wrap install jsoncpp

### Amalgamated source

> [!NOTE]
> This approach may be outdated.
For projects requiring a single-header approach, JsonCpp provides a script to generate an amalgamated source and header file.

You can generate the amalgamated files by running the following Python script from the top-level directory:

```sh
python3 amalgamate.py
```

For projects requiring a single-header approach, see the [Wiki entry](https://github.com/open-source-parsers/jsoncpp/wiki/Amalgamated-(Possibly-outdated)).
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.

## Documentation

Expand Down
Loading