mirror of
https://github.com/KjellKod/g3log.git
synced 2024-12-12 10:23:50 +01:00
c2661853d0
* adding example vs code launch file
4.0 KiB
4.0 KiB
Codespaces
You can experiment with codespaces and g3log.
Learn about Github Codespaces
For an introduction to codespaces you can check out example c++ codespace and using-github-codespaces-with-github-cli
Commandline codespaces Quick Reference
- List all your codespaces
gh codespace list
- Create a new codespace
gh codespace create -r OWNER/REPO_NAME [-b BRANCH]
. Ref docs/github: Creating a codespace for a repository - View codebase details
gh codespace view
- Stop
gh codespace stop -c CODESPACE-NAME
- Delete
gh codespace delete -c CODESPACE-NAME
- Rebuild
gh codespace rebuild
- Rename
gh codespace edit -c CODESPACE-NAME -d DISPLAY-NAME
- SSH into REMOTE codespace
gh codespace ssh -c CODESPACE-NAME
- Open a remote codespace in CVisual Studio
gh codespace code -c CODESPACE-NAME
(ref: github:doc cs studio) - Copy local file to/from codespace
gh codespace cp [-r] SOURCE(S) DESTINATION
. Example: Copy a file from the local machine to the $HOME directory of a codespace:gh codespace cp myfile.txt remote:
. Example Copy a file from a codespace to the current directory on the local machine:gh codespace cp remote:myfile.txt .
(more information available here)
Try g3log in a local dev container.
Please note that this will build g3log as if it's on a Debian Linux platform.
- Clone this repository to your local filesystem.
- Start Visual Studio Code. Press F1 and select the
Dev Containers: Open Folder in Container...
command. - Select the cloned copy of this g3log folder, wait for the container to start, and try things out! You should have debian C++ environment at hand.
Example cmake configuration and build
Open a terminal in Visual Studio Code
mkdir debianbuild
cd debianbuild
cmake -DADD_G3LOG_UNIT_TEST=ON -DADD_G3LOG_BENCH_PERFORMANCE=ON ..
make -j
Example runs
- performance test in the container
./g3log-performance-threaded_mean 4
- unit tests
ctest -v
- Try a fatal example with dumped stack trace
./g3log-FATAL-contract
Example with Debugging.
Without any need to set up environment on your local machine you can also use Codespaces to debug examples, unit tests etc of g3log.
The pesky thing with VSCode, especially with cmake is to set up the launh.json.
It's a little bit easier if you open a VSCode terminal and do the cmake configuration and build there. Then the launch.json
only needs to
contain information about the pecific executable.
Here we try out the g3log-FATAL-contract
after cmake configure with -DCMAKE_BUILD_TYPE=Debug
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// Remember to build the specific part of cmake with
// "cmake -DCMAKE_BUILD_TYPE=Debug" if you want to be able to debug it.
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Start",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/g3log-FATAL-contract",
"MIMode": "gdb",
"cwd": "${workspaceFolder}/build"
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}