Skip to content

Commit 4e030dd

Browse files
committed
Switch to nlohmann json
1 parent 2f6c635 commit 4e030dd

253 files changed

Lines changed: 23310 additions & 231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
BasedOnStyle: LLVM
2-
Language: Cpp
3-
Standard: c++20
4-
5-
ColumnLimit: 140
1+
BasedOnStyle: Google
62
IndentWidth: 4
3+
TabWidth: 4
74
UseTab: Never
8-
PointerAlignment: Left
5+
ContinuationIndentWidth: 4
6+
AlignAfterOpenBracket: Align
7+
AllowShortFunctionsOnASingleLine: InlineOnly
8+
ColumnLimit: 130
9+
BreakBeforeBraces: Attach
10+
DerivePointerAlignment: false
11+
PointerAlignment: Left
12+
SpacesBeforeTrailingComments: 1
13+
SpaceAfterCStyleCast: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ CMakeUserPresets.json
162162
# External projects
163163
*-prefix/
164164

165+
build
166+
.vscode
167+
.idea
168+
165169
# End of https://www.toptal.com/developers/gitignore/api/c,cmake,jetbrains+all,clion+all
166170

167171
wss-js/node_modules/**

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ project(wss)
33

44
set(CMAKE_CXX_STANDARD 23)
55
set(CMAKE_AUTOMOC ON)
6+
set(JSON_BuildTests OFF CACHE INTERNAL "")
67

78
find_package(sdbus-c++ REQUIRED)
89
find_package(LayerShellQt REQUIRED)
@@ -12,9 +13,11 @@ pkg_check_modules(GTK4 REQUIRED IMPORTED_TARGET gtk4)
1213
pkg_check_modules(WEBKITGTK REQUIRED webkitgtk-6.0)
1314
pkg_check_modules(JSONC REQUIRED json-c)
1415
pkg_check_modules(SOUP REQUIRED libsoup-3.0)
16+
pkg_check_modules(GIOMM REQUIRED giomm-2.4)
1517

1618
add_subdirectory(lib/spdlog)
1719
add_subdirectory(lib/tomlplusplus)
20+
add_subdirectory(lib/nlohmann_json)
1821

1922
include_directories(/usr/include/gtk4-layer-shell)
2023
link_directories(/usr/lib)
@@ -55,27 +58,32 @@ target_include_directories(${PROJECT_NAME} PRIVATE
5558
lib/tomlplusplus/include
5659
lib/uWebSockets/src
5760
lib/uWebSockets/uSockets/src
61+
lib/nlohmann_json/include
5862
${GTK4_INCLUDE_DIRS}
5963
${WEBKITGTK_INCLUDE_DIRS}
6064
${JSONC_INCLUDE_DIRS}
6165
${SOUP_INCLUDE_DIRS}
66+
${GIOMM_INCLUDE_DIRS}
6267
)
6368

6469
target_link_libraries(${PROJECT_NAME} PRIVATE
70+
${CMAKE_SOURCE_DIR}/lib/uWebSockets/uSockets/uSockets.a
6571
/usr/lib/libz.so
6672
gtk4-layer-shell
6773
${GTK4_LIBRARIES}
6874
${WEBKITGTK_LIBRARIES}
6975
${JSONC_LIBRARIES}
7076
${SOUP_LIBRARIES}
7177
${WAYLAND_LIBRARIES}
78+
${GIOMM_LIBRARIES}
7279
spdlog
7380
tomlplusplus::tomlplusplus
7481
SDBusCpp::sdbus-c++
7582
Qt6::Widgets
7683
Qt6::WebEngineWidgets
7784
LayerShellQt::Interface
78-
${CMAKE_SOURCE_DIR}/lib/uWebSockets/uSockets/uSockets.a
85+
${NLOHMANN_JSON_TARGET_NAME}
86+
7987
)
8088
target_compile_options(${PROJECT_NAME} PRIVATE
8189
${WEBKIT2GTK_CFLAGS_OTHER}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: nlohmann
2+
custom: https://paypal.me/nlohmann
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]
2+
3+
- [ ] The changes are described in detail, both the what and why.
4+
- [ ] If applicable, an [existing issue](https://github.com/nlohmann/json/issues) is referenced.
5+
- [ ] The [Code coverage](https://coveralls.io/github/nlohmann/json) remained at 100%. A test case for every new line of code.
6+
- [ ] If applicable, the [documentation](https://json.nlohmann.me) is updated.
7+
- [ ] The source code is amalgamated by running `make amalgamate`.
8+
9+
Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
version: '{build}'
2+
3+
# only build PRs and commits to develop branch
4+
# (see https://help.appveyor.com/discussions/questions/55079-two-builds-per-commit-to-pull-request)
5+
branches:
6+
only:
7+
- develop
8+
9+
only_commits:
10+
files:
11+
- .github/external_ci/appveyor.yml
12+
- cmake/
13+
- include/
14+
- tests/
15+
- CMakeLists.txt
16+
17+
environment:
18+
matrix:
19+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
20+
configuration: Debug
21+
platform: x86
22+
CXX_FLAGS: "/W4 /WX"
23+
CMAKE_OPTIONS: ""
24+
GENERATOR: Visual Studio 14 2015
25+
26+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
27+
configuration: Release
28+
platform: x86
29+
CXX_FLAGS: "/W4 /WX"
30+
CMAKE_OPTIONS: ""
31+
GENERATOR: Visual Studio 14 2015
32+
33+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
34+
configuration: Release
35+
platform: x86
36+
name: with_win_header
37+
CXX_FLAGS: "/W4 /WX"
38+
CMAKE_OPTIONS: ""
39+
GENERATOR: Visual Studio 14 2015
40+
41+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
42+
configuration: Release
43+
platform: x86
44+
CXX_FLAGS: "/permissive- /std:c++17 /utf-8 /W4 /WX"
45+
CMAKE_OPTIONS: ""
46+
GENERATOR: Visual Studio 15 2017
47+
48+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
49+
configuration: Release
50+
platform: x86
51+
CXX_FLAGS: "/W4 /WX"
52+
CMAKE_OPTIONS: "-DJSON_ImplicitConversions=OFF"
53+
GENERATOR: Visual Studio 16 2019
54+
55+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
56+
configuration: Release
57+
platform: x64
58+
CXX_FLAGS: "/W4 /WX"
59+
CMAKE_OPTIONS: ""
60+
GENERATOR: Visual Studio 14 2015
61+
62+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
63+
configuration: Release
64+
platform: x64
65+
CXX_FLAGS: "/permissive- /std:c++17 /Zc:__cplusplus /utf-8 /W4 /WX"
66+
CMAKE_OPTIONS: ""
67+
GENERATOR: Visual Studio 15 2017
68+
69+
init:
70+
- cmake --version
71+
- msbuild /version
72+
73+
install:
74+
- if "%platform%"=="x86" set GENERATOR_PLATFORM=Win32
75+
76+
before_build:
77+
# for with_win_header build, inject the inclusion of Windows.h to the single-header library
78+
- ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" }
79+
- ps: if ($env:name -Eq "with_win_header") { "#include <Windows.h>`n" + (Get-Content $header_path | Out-String) | Set-Content $header_path }
80+
- cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On "%CMAKE_OPTIONS%"
81+
82+
build_script:
83+
- cmake --build . --config "%configuration%" --parallel 2
84+
85+
test_script:
86+
- if "%configuration%"=="Release" ctest -C "%configuration%" --parallel 2 --output-on-failure
87+
# On Debug builds, skip test-unicode_all
88+
# as it is extremely slow to run and cause
89+
# occasional timeouts on AppVeyor.
90+
# More info: https://github.com/nlohmann/json/pull/1570
91+
- if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode" -C "%configuration%" --parallel 2 --output-on-failure
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CIFuzz
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
Fuzzing:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Harden Runner
12+
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
13+
with:
14+
egress-policy: audit
15+
16+
- name: Build Fuzzers
17+
id: build
18+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@57fe4475324c5506adbfecdcdd2917f65c86ee9e # master
19+
with:
20+
oss-fuzz-project-name: 'json'
21+
dry-run: false
22+
language: c++
23+
- name: Run Fuzzers
24+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@57fe4475324c5506adbfecdcdd2917f65c86ee9e # master
25+
with:
26+
oss-fuzz-project-name: 'json'
27+
fuzz-seconds: 300
28+
dry-run: false
29+
language: c++
30+
- name: Upload Crash
31+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
32+
if: failure() && steps.build.outcome == 'success'
33+
with:
34+
name: artifacts
35+
path: ./out/artifacts
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: macOS
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
- release/*
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
# macos-11 is deprecated
21+
# macos-11:
22+
# runs-on: macos-11
23+
# strategy:
24+
# matrix:
25+
# xcode: ['11.7', '12.4', '12.5.1', '13.0']
26+
# env:
27+
# DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
28+
#
29+
# steps:
30+
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
# - name: Run CMake
32+
# run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
33+
# - name: Build
34+
# run: cmake --build build --parallel 10
35+
# - name: Test
36+
# run: cd build ; ctest -j 10 --output-on-failure
37+
38+
# macos-12 is deprecated (https://github.com/actions/runner-images/issues/10721)
39+
# macos-12:
40+
# runs-on: macos-12 # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
41+
# strategy:
42+
# matrix:
43+
# xcode: ['13.1', '13.2.1', '13.3.1', '13.4.1', '14.0', '14.0.1', '14.1']
44+
# env:
45+
# DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
46+
#
47+
# steps:
48+
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
# - name: Run CMake
50+
# run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
51+
# - name: Build
52+
# run: cmake --build build --parallel 10
53+
# - name: Test
54+
# run: cd build ; ctest -j 10 --output-on-failure
55+
56+
macos-13:
57+
runs-on: macos-13 # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
58+
strategy:
59+
matrix:
60+
xcode: ['14.1', '14.2', '14.3', '14.3.1', '15.0.1', '15.1', '15.2']
61+
env:
62+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
63+
64+
steps:
65+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66+
- name: Run CMake
67+
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
68+
- name: Build
69+
run: cmake --build build --parallel 10
70+
- name: Test
71+
run: cd build ; ctest -j 10 --output-on-failure
72+
73+
macos-14:
74+
runs-on: macos-14 # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
75+
strategy:
76+
matrix:
77+
xcode: ['15.3', '15.4']
78+
env:
79+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
80+
81+
steps:
82+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83+
- name: Run CMake
84+
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
85+
- name: Build
86+
run: cmake --build build --parallel 10
87+
- name: Test
88+
run: cd build ; ctest -j 10 --output-on-failure
89+
90+
macos-15:
91+
runs-on: macos-15 # https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
92+
strategy:
93+
matrix:
94+
xcode: ['16.0', '16.1', '16.2']
95+
env:
96+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
97+
98+
steps:
99+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
100+
- name: Run CMake
101+
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
102+
- name: Build
103+
run: cmake --build build --parallel 10
104+
- name: Test
105+
run: cd build ; ctest -j 10 --output-on-failure
106+
107+
xcode_standards:
108+
runs-on: macos-latest
109+
strategy:
110+
matrix:
111+
standard: [11, 14, 17, 20, 23, 26]
112+
113+
steps:
114+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115+
- name: Run CMake
116+
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_TestStandards=${{ matrix.standard }}
117+
- name: Build
118+
run: cmake --build build --parallel 10
119+
- name: Test
120+
run: cd build ; ctest -j 10 --output-on-failure

0 commit comments

Comments
 (0)