Skip to content

Commit 0b7e5d2

Browse files
authored
Merge pull request #28 from LLNL/sbromberger/cmake-readme-and-license
Sbromberger/cmake readme and license
2 parents 10e9644 + 6b84037 commit 0b7e5d2

File tree

8 files changed

+26
-32
lines changed

8 files changed

+26
-32
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
working-directory: cpp
1818
run: |
1919
cmake --preset=default
20-
cd build && make
20+
cd build/release && make
2121
2222
- name: Test JL code
23-
working-directory: cpp/build
23+
working-directory: cpp/build/release
2424
run: make test

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
.vscode-old/
21
.DS_Store
32
CMakeFiles/
4-
build/
3+
**/build/
54
.cache/
65
CMakeCache.txt
76
Makefile
87
*.cmake
98
*.so
109
testeval.bin
1110
__pycache__
12-
**/build*
1311
venv
1412
*.core
1513
setup.cfg

cpp/.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Debug Benchmark",
66
"type": "cppdbg",
77
"request": "launch",
8-
"program": "${workspaceFolder}/build-debug/bench/${input:benchmarkExecutable}",
8+
"program": "${workspaceFolder}/build/debug/bench/${input:benchmarkExecutable}",
99
"args": [],
1010
"stopAtEntry": false,
1111
"cwd": "${workspaceFolder}",

cpp/.vscode/settings.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
// CMake configuration for this project
66
"cmake.generator": "Unix Makefiles",
7-
"cmake.buildDirectory": "${workspaceFolder}/build",
7+
"cmake.buildDirectory": "${workspaceFolder}/build/release",
88

99
// Clangd configuration specific to this project
1010
"clangd.arguments": [
1111
"-j=4",
1212
"--background-index",
13-
"--compile-commands-dir=${workspaceFolder}/build",
13+
"--compile-commands-dir=${workspaceFolder}",
1414
"--clang-tidy",
1515
"--completion-style=detailed",
1616
"--header-insertion=iwyu",
@@ -23,14 +23,12 @@
2323

2424
// Project-specific search exclusions
2525
"search.exclude": {
26-
"**/build/**": true,
27-
"**/build-*/**": true
26+
"**/build/**": true
2827
},
2928

3029
// Project-specific file watcher exclusions
3130
"files.watcherExclude": {
32-
"**/build/**": true,
33-
"**/build-*/**": true
31+
"**/build/**": true
3432
},
3533

3634
// Project-specific spell checker words

cpp/CMakePresets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"JSONLOGIC_ENABLE_TESTS": "ON"
1313
},
1414
"generator": "Unix Makefiles",
15-
"binaryDir": "${sourceDir}/build"
15+
"binaryDir": "${sourceDir}/build/release"
1616
},
1717
{
1818
"name": "debug",
@@ -25,7 +25,7 @@
2525
"JSONLOGIC_ENABLE_TESTS": "ON"
2626
},
2727
"generator": "Unix Makefiles",
28-
"binaryDir": "${sourceDir}/build-debug"
28+
"binaryDir": "${sourceDir}/build/debug"
2929
},
3030

3131
{
@@ -39,7 +39,7 @@
3939
"JSONLOGIC_ENABLE_TESTS": "ON"
4040
},
4141
"generator": "Unix Makefiles",
42-
"binaryDir": "${sourceDir}/build-relwithdebinfo"
42+
"binaryDir": "${sourceDir}/build/relwithdebinfo"
4343
}
4444
],
4545
"buildPresets": [

cpp/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
# JsonLogic for C++
22

3-
This is an implementation for [JsonLogic](https://jsonlogic.com/) for C++. The API uses the Boost
4-
JSON implementation (e.g.,
3+
This is an implementation for [JsonLogic](https://jsonlogic.com/) for C++. The API uses the Boost JSON implementation (e.g.,
54
[Boost 1.82](https://www.boost.org/doc/libs/1_82_0/libs/json/doc/html/index.html)).
65

7-
The library is designed to follow the type conversion rules of the reference JsonLogic
8-
implementation.
6+
The library is designed to follow the type conversion rules of the reference JsonLogic implementation.
97

108
## Compile and Install
119

12-
The library can be installed using cmake.
13-
14-
mkdir build
15-
cd build
16-
cmake ..
10+
The library can be installed using cmake. From the top-level directory,
11+
cmake --preset=default
12+
cd build/release
1713
make
1814

1915
## Use
2016

2117
The simplest way is to create Json rule and data options and call jsonlogic::apply.
22-
18+
```cpp
2319
#include <jsonlogic/logic.hpp>
2420

2521
boost::json::value rule = ..;
2622
boost::json::value data = ..;
2723
jsonlogic::any_expr res = jsonlogic::apply(rule, data);
2824
std::cout << res << std::endl;
25+
```
2926

30-
See examples/testeval.cc for the complete sample code.
27+
See `examples/testeval.cc` for the complete sample code.
3128

32-
To evaluate a rule multiple times, it may be beneficial to convert the Json object into JsonLogic's
33-
internal expression representation.
29+
To evaluate a rule multiple times, it may be beneficial to convert the Json object into JsonLogic's internal expression representation.
3430

31+
```cpp
3532
#include <jsonlogic/logic.hpp>
3633

3734
boost::json::value rule = ..;
@@ -44,6 +41,7 @@ internal expression representation.
4441

4542
std::cout << jsonlogic.apply(logic.syntax_tree(), std::move(varlookup)) << std::endl;
4643
}
44+
```
4745
4846
## Python Companion
4947
@@ -53,10 +51,11 @@ that can be evaluated by JsonLogic.
5351
## Authors
5452
5553
Peter Pirkelbauer (pirkelbauer2 at llnl dot gov)
54+
Seth Bromberger (seth at llnl dot gov)
5655
5756
## License
5857
59-
CLIPPy is distributed under the MIT license.
58+
JsonLogic is distributed under the MIT license.
6059
6160
See LICENSE-MIT, NOTICE, and COPYRIGHT for details.
6261

cpp/compile_commands.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

cpp/tests/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ function run {
1818

1919
# test using apply(rule, variant_vector)
2020
# with apply(rule, data) as fallback
21-
TESTBIN="../build/tests/testeval"
21+
TESTBIN="./tests/testeval"
2222
run
2323

2424
# test using always apply(rule, data)
25-
TESTBIN="../build/tests/testeval -s"
25+
TESTBIN="./tests/testeval -s"
2626
run
2727

2828
echo "All tests passed."

0 commit comments

Comments
 (0)