Skip to content

Commit

Permalink
Fix integration of vcpkg with CMake and VSCode
Browse files Browse the repository at this point in the history
  • Loading branch information
0xg0nz0 committed Jan 7, 2024
1 parent 317dd0e commit 1d661b7
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 10 deletions.
10 changes: 0 additions & 10 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -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
}
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 12 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
]
}
11 changes: 11 additions & 0 deletions sdk/iggy_cmd.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <iostream>
#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;
}
14 changes: 14 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
12 changes: 12 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"dependencies": [
"argh",
"benchmark",
"fmt",
"libuv",
"nlohmann-json",
"spdlog",
"uwebsockets",
"wolfssl"
]
}

0 comments on commit 1d661b7

Please sign in to comment.