From 1d661b79b3e2358cf1419362f3dcd5eaf9647584 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sun, 7 Jan 2024 20:57:06 +0000 Subject: [PATCH] Fix integration of vcpkg with CMake and VSCode --- .devcontainer/Dockerfile | 10 ---------- .vscode/c_cpp_properties.json | 16 ++++++++++++++++ CMakeLists.txt | 12 ++++++++++++ CMakePresets.json | 12 ++++++++++++ sdk/iggy_cmd.cc | 11 +++++++++++ vcpkg-configuration.json | 14 ++++++++++++++ vcpkg.json | 12 ++++++++++++ 7 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 CMakePresets.json create mode 100644 sdk/iggy_cmd.cc create mode 100644 vcpkg-configuration.json create mode 100644 vcpkg.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 67340d8..ad28474 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -17,16 +17,6 @@ RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ RUN sudo apt-get update \ && sudo apt-get install clang-format clang-tidy doxygen graphviz -y -# Install C++ dependencies using vcpkg -RUN vcpkg integrate install \ - && vcpkg install argh \ - && vcpkg install benchmark \ - && vcpkg install libuv \ - && vcpkg install nlohmann-json \ - && vcpkg install spdlog \ - && vcpkg install uwebsockets \ - && vcpkg install wolfssl - # Options for QUIC # ---------------- # lsquic (liblsquic in vcpkg) requires BoringSSL, which is quite large diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..f204457 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/clang", + "cStandard": "c17", + "intelliSenseMode": "linux-clang-x64", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 51159ed..2c61aef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,18 @@ add_library( sdk/models.cc ) +add_executable( + iggy_cmd + + sdk/iggy_cmd.cc +) +target_include_directories(iggy_cmd PRIVATE ${argh_INCLUDE_DIR}) +target_link_libraries( + iggy_cmd + + iggy +) + # set up GoogleTest include(FetchContent) FetchContent_Declare( diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..c7174cc --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,12 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + } + } + ] +} \ No newline at end of file diff --git a/sdk/iggy_cmd.cc b/sdk/iggy_cmd.cc new file mode 100644 index 0000000..9662d2f --- /dev/null +++ b/sdk/iggy_cmd.cc @@ -0,0 +1,11 @@ +#include +#include "argh.h" + +int main(int, char* argv[]) { + argh::parser cmdl(argv); + + if (cmdl[{"-v", "--verbose"}]) { + std::cout << "Verbose, I am.\n"; + } + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..fb5009b --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,14 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "42301df395852935d105799de93abf5481f34f1a", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..2882c45 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,12 @@ +{ + "dependencies": [ + "argh", + "benchmark", + "fmt", + "libuv", + "nlohmann-json", + "spdlog", + "uwebsockets", + "wolfssl" + ] +}