Added Arch dev container + vscode Build task

This commit is contained in:
Ivan-lis 2024-09-15 20:50:01 +00:00
parent 99cc6d36f0
commit 7ad71120d7
6 changed files with 113 additions and 5 deletions

37
.devcontainer/Dockerfile Normal file
View file

@ -0,0 +1,37 @@
# Base image using Arch Linux
# Date: Sep10 2024
# Url: https://hub.docker.com/layers/library/archlinux/latest/images/sha256-a10e51dd0694d6c4142754e9d06cbce7baf91ace8031a30df37064d1091ab414?context=explore
FROM archlinux@sha256:a10e51dd0694d6c4142754e9d06cbce7baf91ace8031a30df37064d1091ab414
# Update the package database and install clang
RUN pacman -Syyu --noconfirm \
&& pacman -S --noconfirm git less vim sudo base-devel \
&& pacman -S --noconfirm clang cmake make ninja gtk4 gtkmm-4.0
# Create a non-root user 'dev'
RUN useradd -ms /bin/bash dev \
&& echo "dev ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/dev \
&& chmod 0440 /etc/sudoers.d/dev
# Add the custom bash prompt with branch info
RUN printf '\n\
function modify_prompt { \n\
local __user_and_host="\[\033[01;32m\]\u@\h" \n\
local __cur_location="\[\033[01;34m\]\w" \n\
local __git_branch_color="\[\033[31m\]" \n\
local __git_branch="\$(git branch 2> /dev/null | sed -e \'"'"'/^[^*]/d\'"'"' -e \'"'"'s/* \(.*\)/(\\1)/\'"'"')" \n\
local __prompt_tail="\[\033[00m\]$" \n\
export PS1="$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail " \n\
} \n\
modify_prompt\n' >> /home/dev/.bashrc
# Switch to the 'dev' user
USER dev
RUN git config --global core.editor vim
# Set the default working directory
WORKDIR /home/dev
# Set the default command
CMD ["/bin/bash"]

View file

@ -0,0 +1,17 @@
{
"name": "Arch Linux with GCC & Clang++",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {"vscode": {
"extensions": [
"llvm-vs-code-extensions.vscode-clangd",
"vadimcn.vscode-lldb",
"twxs.cmake",
"ms-vscode.cmake-tools",
"zxh404.vscode-proto3",
"ms-azuretools.vscode-docker"
]
}}
}

2
.gitignore vendored
View file

@ -24,4 +24,4 @@ examples/output
lib__cmake_cxx23.a
liblarra_xmpp.a
liblarra_xmpp.so
build
build*

51
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,51 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build Debug GCC",
"type": "shell",
"command": [
"cd ${workspaceFolder} &&",
"mkdir -p build && cd build &&",
"cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON .. &&",
"cmake --build . --parallel `nproc`",
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
],
"options": {
"env": {
}
},
"presentation": {
"clear": true
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Build Debug Clang",
"type": "shell",
"command": [
"cd ${workspaceFolder} &&",
"mkdir -p build_clang && cd build_clang &&",
"cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON .. &&",
"cmake --build . --parallel `nproc`",
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
],
"options": {
"env": {
"CC": "/usr/sbin/clang",
"CXX": "/usr/sbin/clang++",
}
},
"presentation": {
"clear": true
},
"problemMatcher": []
}
]
}

View file

@ -83,11 +83,12 @@ add_library(larra::larra_xmpp ALIAS larra_xmpp)
target_compile_features(larra_xmpp PUBLIC cxx_std_23)
target_compile_options(larra_xmpp PUBLIC -Wno-changes-meaning)
target_include_directories(larra_xmpp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/library/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
$<INSTALL_INTERFACE:CMAKE_INSTALL_INCLUDEDIR>)
@ -190,6 +191,8 @@ if(ENABLE_EXAMPLES)
set_property(TARGET ${EXAMPLE_NAME} PROPERTY CXX_STANDARD 23)
set_target_properties(${EXAMPLE_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/examples/output")
target_include_directories(${EXAMPLE_NAME} PRIVATE ${BOOST_LIBRARY_INCLUDES})
endforeach()
endif()

View file

@ -138,7 +138,7 @@ inline auto GenerateAuthScramMessageImpl(std::string_view password,
auto clientSignature = HmacImpl(ToCharStringView(storedKey), ToUnsignedCharStringView(authMessage), tag);
auto clientProof = std::views::zip(clientKey, clientSignature) | // No std::views::enumerate in libc++
std::views::transform([&](auto arg) {
return arg.first ^ arg.second;
return std::get<0>(arg) ^ std::get<1>(arg);
}) |
std::ranges::to<std::string>();
std::string serverKeyStr = "Server Key";