28 Commits

Author SHA1 Message Date
Ben McMorran
13de893d55 Address PR comments 2023-05-19 17:15:11 +01:00
Ben McMorran
6a3c173aab Add support for JsonCpp 2023-05-19 17:15:11 +01:00
Brad King
558886e7e0
cmake: Avoid exposing implementation dependencies publicly (#102)
The `CPPDAP_JSON_{NLOHMANN,RAPID}` compile definition is used only in
cppdap's implementation sources, and does not need to be defined by
dependents including our headers.

Also avoid exposing `nlohmann_json::nlohmann_json` as a public link
dependency of our installed package.  It is used only when compiling
cppdap.
2023-03-23 17:56:22 +00:00
nikitalita
d9041149a8
Auto-update cmakelists on protocol sync, update to 1.59.0 (#93)
* CMake: Fix target options

* update CMake package version after protocol sync

* Update protocol to 1.59.0

* protocol_gen: change OneOf to `object` type

The DAP spec introduces ambiguities with its particular uses of OneOf,
which means that we can't deserialize the variants generated from it.
Just set OneOf to an `object` type, like godap does.
2023-02-13 22:55:48 +00:00
nikitalita
0a340c6d71
Add options to link against external JSON libraries (#91)
Add options to link against external JSON libraries

This adds two options to the CMake config:

`CPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE` and `CPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE`
If either of these is set, instead of using the json submodule, the build will be configured by using `find_package()` and linking against the specified JSON library.
2023-01-10 13:35:23 +00:00
nikitalita
5b796454c1 Bump required CMake to 3.11 2023-01-05 12:40:05 +00:00
nikitalita
7c31141c5a White space fixes 2023-01-05 12:40:05 +00:00
nikitalita
a25be1fa0b cmakelists.txt: add destinations to install targets
Add proper ARCHIVE, LIBRARY, and INCLUDES to install target
2023-01-05 12:40:05 +00:00
nikitalita
eedb5e02b6 add license header to config.in, bump copyright date 2023-01-05 12:40:05 +00:00
nikitalita
22779a0052 bump cmake package version 2023-01-05 12:40:05 +00:00
nikitalita
ebdcc5b9b4 fix semver require, config template 2023-01-05 12:40:05 +00:00
nikitalita
fe8695c502 Add package install and config 2023-01-05 12:40:05 +00:00
Ben Clayton
03e975779e Add a simple network client / server example
Issue: #77
2023-01-04 10:48:24 +00:00
Ben Clayton
51cf2951d0 CMake: Remove installation target
CMake installation target has been broken for years.
cppdap is only internally used and tested as a library that is included as a sub-module of another project.

In order for a package to be installable, it really needs a stable ABI / API, which we've made no explicit guarantees about.
cppdap is small enough that it can easily be included in a third_party directory of another project.

Remove the broken, unmaintained installation rules.

Fixes: #54
2021-09-07 18:52:14 +01:00
Ben Clayton
2a3ba20937
Merge pull request #58 from ben-clayton/response-callbacks
Add Session::registerHandler() overloads that support response callbacks
2021-02-03 19:08:27 +00:00
Ben Clayton
6d6cbf17d7 Add support for rapidjson as the JSON library
nlohmann is still the default, but if `CPPDAP_JSON_DIR` points to rapidjson, then this will be used instead

Most of this was upstreamed from:
https://fuchsia-review.googlesource.com/c/third_party/github.com/google/cppdap/+/456566
2020-12-02 17:44:24 +00:00
Ben Clayton
9d3f5c8f1d clang: Enable -Weverything, fix all warnings
This change fixes the following warnings:

```
    -Wc++98-compat-extra-semi
    -Wc++98-compat-local-type-template-args
    -Wc++98-compat-pedantic
    -Wc++98-compat
    -Wcomma
    -Wdeprecated-copy-dtor
    -Wexit-time-destructors
    -Wextra-semi-stmt
    -Wextra-semi
    -Wfloat-conversion
    -Wfloat-equal
    -Wformat-nonliteral
    -Wglobal-constructors
    -Winconsistent-missing-destructor-override
    -Wnon-virtual-dtor
    -Wold-style-cast
    -Wpadded
    -Wreturn-std-move-in-c++11
    -Wshadow-field-in-constructor
    -Wshadow-uncaptured-local
    -Wshift-sign-overflow
    -Wsign-conversion
    -Wundef
    -Wunreachable-code-return
    -Wused-but-marked-unused
    -Wweak-vtables
    -Wzero-as-null-pointer-constant
```
2020-06-10 15:10:57 +01:00
Ben Clayton
53a62fd794 Add dap::RWMutex. A read / write mutex.
Also known as a shared mutex.
`std::shared_mutex` was introduced in C++17, but cppdap is C++11.

To be used to fix #35.
2020-06-08 21:32:05 +01:00
Ben Clayton
78dd3ab57a CMake: Handle building fuzzer with sanitizers
If any of the `CPPDAP_?SAN` sanitizers are enabled, then the build would fail as the compile flags would collide with hard-coded use of address sanitizer for the fuzzer.

Don't hard code address sanitizer for the fuzzer - just use the CMake flag options.
2020-06-08 21:32:05 +01:00
Ben Clayton
13c9e7d465 Implement timeouts for dap::Socket::connect
Fixes: #24
2020-06-08 20:22:05 +01:00
Ben Clayton
773f0dff68 Add support for fuzzing cppdap
Add build rules, scripts, basic corpus, and dictionary.
Currently requires recent clang toolchain.
2020-06-05 10:53:52 +01:00
Ben Clayton
cc93ba9747 Add the ability to derive message types from one another.
`DAP_IMPLEMENT_STRUCT_TYPEINFO_EXT` and `DAP_STRUCT_TYPEINFO_EXT` are two new flavors of `DAP_IMPLEMENT_STRUCT_TYPEINFO` and `DAP_STRUCT_TYPEINFO` that allow you to derive message types.

This involved a bit of reworking on the serializer interfaces.

Added test.

Issue: #32
2020-06-02 17:18:32 +01:00
Ben Clayton
3e6cfd6c2f CMake: Make the cppdap target's include directory public
Avoids having to pull this in as an explicit include directory for projects that depend on cppdap.
2020-01-24 12:53:20 +00:00
Ben Clayton
93b861004e examples: Suffix package exe with .exe on Windows
Without this the vscode extension cannot find the example executable, and the example fails.

Also use $USERPROFILE instead of  $HOME for finding the `.vscode` user directory for installing the extension.

Bug: #12
2020-01-17 20:07:55 +00:00
Ben Clayton
cc7b68a365 CMakeLists.txt: Make it easier to control options from dependee projects. 2019-12-02 13:55:45 +00:00
Ben Clayton
dc3b3eaeb3 CMakeLists.txt: Disable MSVC warning from third_party
`nlohmann/json` raises a `size_t` to `int` MSVC warning that will fail the build if `CPPDAP_WARNINGS_AS_ERRORS` is enabled.
Given that this is not our code, the best we can do is to make an exception for this warning.
2019-11-26 17:59:58 +00:00
Ben Clayton
010e3e3c86 CMakeLists.txt: Make it easier to specify third_party vars.
Only set the third_party directory variables if they're not already set
(by the dependee project).
2019-11-18 13:00:26 +00:00
Ben Clayton
2dfd15462f Initial drop of cppdap 2019-11-08 21:58:50 +00:00