C++ library for the Debug Adapter Protocol
Find a file
2025-02-22 17:18:35 -05:00
.github/workflows github actions: Update actions/upload-artifact@v4 (#142) 2025-01-31 17:40:47 -05:00
.vscode Add support for fuzzing cppdap 2020-06-05 10:53:52 +01:00
cmake Add options to link against external JSON libraries (#91) 2023-01-10 13:35:23 +00:00
examples Fix infinite loop when parsing invalid DAP message. 2023-07-05 20:12:05 +01:00
fuzz Update to 1.65.0 2024-04-10 08:59:08 +01:00
include/dap include/dap/network.h: add <stdint.h> include for gcc-15 (#133) 2024-08-02 11:38:40 -04:00
kokoro kokoro: use new cpp-builder image (#146) 2025-02-22 17:18:35 -05:00
src Reformat source (#144) 2025-02-22 04:28:29 -05:00
third_party update to cmake 3.22, update googletest (#138) 2024-12-23 16:17:52 -05:00
tools/protocol_gen Remove accidental commit 2023-06-09 14:50:18 +01:00
.clang-format Initial drop of cppdap 2019-11-08 21:58:50 +00:00
.gitattributes Fix CRLF EOL in config.cmake.in, add gitattributes 2023-01-06 15:54:31 +00:00
.gitignore Add support for fuzzing cppdap 2020-06-05 10:53:52 +01:00
.gitmodules Initial drop of cppdap 2019-11-08 21:58:50 +00:00
clang-format-all.sh Fix copyright owner on clang-format-all.sh (#145) 2025-02-22 04:24:57 -05:00
CMakeLists.txt update to cmake 3.22, update googletest (#138) 2024-12-23 16:17:52 -05:00
CONTRIBUTING Initial drop of cppdap 2019-11-08 21:58:50 +00:00
LICENSE Initial drop of cppdap 2019-11-08 21:58:50 +00:00
license-checker.cfg kokoro: update tooling, fix warnings 2024-12-16 10:51:28 -05:00
README.md Add support for JsonCpp 2023-05-19 17:15:11 +01:00

cppdap

About

cppdap is a C++11 library ("SDK") implementation of the Debug Adapter Protocol, providing an API for implementing a DAP client or server.

cppdap provides C++ type-safe structures for the full DAP specification, and provides a simple way to add custom protocol messages.

Fetching dependencies

cppdap provides CMake build files to build the library, unit tests and examples.

cppdap depends on the nlohmann/json library, and the unit tests depend on the googletest library. Both are referenced as a git submodules.

Before building, fetch the git submodules with:

cd <path-to-cppdap>
git submodule update --init

Alternatively, cppdap can use the RapidJSON library or the JsonCpp library for JSON serialization. Use the CPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE, CPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE, and CPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE CMake cache variables to select which library to use.

Building

Linux and macOS

Next, generate the build files:

cd <path-to-cppdap>
mkdir build
cd build
cmake ..

You may wish to suffix the cmake .. line with any of the following flags:

  • -DCPPDAP_BUILD_TESTS=1 - Builds the cppdap unit tests
  • -DCPPDAP_BUILD_EXAMPLES=1 - Builds the cppdap examples
  • -DCPPDAP_INSTALL_VSCODE_EXAMPLES=1 - Installs the cppdap examples as Visual Studio Code extensions
  • -DCPPDAP_WARNINGS_AS_ERRORS=1 - Treats all compiler warnings as errors.

Finally, build the project:

make

Windows

cppdap can be built using Visual Studio 2019's CMake integration.

Using cppdap in your CMake project

You can build and link cppdap using add_subdirectory() in your project's CMakeLists.txt file:

set(CPPDAP_DIR <path-to-cppdap>) # example <path-to-cppdap>: "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cppdap"
add_subdirectory(${CPPDAP_DIR})

This will define the cppdap library target, which you can pass to target_link_libraries():

target_link_libraries(<target> cppdap) # replace <target> with the name of your project's target

You may also wish to specify your own paths to the third party libraries used by cppdap. You can do this by setting any of the following variables before the call to add_subdirectory():

set(CPPDAP_THIRD_PARTY_DIR <third-party-root-directory>) # defaults to ${CPPDAP_DIR}/third_party
set(CPPDAP_JSON_DIR        <path-to-nlohmann-json>)      # defaults to ${CPPDAP_THIRD_PARTY_DIR}/json
set(CPPDAP_GOOGLETEST_DIR  <path-to-googletest>)         # defaults to ${CPPDAP_THIRD_PARTY_DIR}/googletest
add_subdirectory(${CPPDAP_DIR})

Note: This is not an officially supported Google product