Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
franneck94 committed Mar 5, 2024
1 parent 763e22d commit f68f055
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
- name: install
run: |
sudo apt-get install gcovr lcov
pip install --user -U gcovr
- name: prepare
run: |
make prepare
Expand Down
62 changes: 62 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
}
],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
}
],
"externalConsole": true,
"MIMode": "lldb"
},
{
"name": "(msvc) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "PATH",
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
}
],
"externalConsole": true
}
]
}
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ option(ENABLE_WARNINGS "Enable to add warnings to a target." ON)
option(ENABLE_WARNINGS_AS_ERRORS "Enable to treat warnings as errors." OFF)

option(ENABLE_TESTING "Enable a Unit Testing build." ON)
option(ENABLE_COVERAGE "Enable a Code Coverage build." OFF)
option(ENABLE_COVERAGE "Enable a Code Coverage build." ON)

option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF)

Expand All @@ -35,8 +35,6 @@ option(ENABLE_CMAKE_FORMAT "Enable to add cmake-format." OFF)
option(ENABLE_LTO "Enable to add Link Time Optimization." ON)

# Project/Library Names
set(LIB_FOO_NAME "foo")
set(LIB_BAR_NAME "bar")
set(EXECUTABLE_NAME "main")

# CMAKE MODULES
Expand All @@ -53,9 +51,12 @@ endif()
add_cmake_format_target()
add_clang_format_target()

if(ENABLE_SANITIZE_ADDR OR ENABLE_SANITIZE_UNDEF)
if(ENABLE_SANITIZE_ADDR
OR ENABLE_SANITIZE_UNDEF
OR ENABLE_SANITIZE_LEAK
OR ENABLE_SANITIZE_THREAD)
include(Sanitizer)
add_sanitizer_flags(ENABLE_SANITIZE_ADDR ENABLE_SANITIZE_UNDEF)
add_sanitizer_flags()
endif()

if(ENABLE_TESTING AND ENABLE_COVERAGE)
Expand Down Expand Up @@ -157,6 +158,6 @@ install(
RUNTIME DESTINATION bin)

install(
TARGETS ${LIB_FOO_NAME} ${LIB_BAR_NAME}
TARGETS "LibFoo" "LibBar"
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Library code goes into [src/](src/), main program code in [app/](app) and tests
- Doxygen
- Conan or VCPKG
- MSVC 2017 (or higher), G++9 (or higher), Clang++9 (or higher)
- Optional: Code Coverage (only on GNU|Clang): lcov, gcovr
- Optional: Code Coverage (only on GNU|Clang): gcovr
- Optional: Makefile, Doxygen, Conan, VCPKG

## Building
Expand Down
1 change: 0 additions & 1 deletion Testing/Temporary/CTestCostData.txt

This file was deleted.

3 changes: 2 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ add_executable(${EXECUTABLE_NAME} ${APP_SOURCES})

target_link_libraries(
${EXECUTABLE_NAME}
PRIVATE ${LIB_FOO_NAME}
PRIVATE "LibFoo"
"LibBar"
nlohmann_json::nlohmann_json
fmt::fmt
spdlog::spdlog
Expand Down
4 changes: 2 additions & 2 deletions app/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ int main(int argc, char **argv)
// std::int32_t i = 0;

// Adress Sanitizer should see this
// int *x = new int[42];
// x[100] = 5; // Boom!
// char x[10];
// x[11] = 1;

const auto welcome_message =
fmt::format("Welcome to {} v{}\n", project_name, project_version);
Expand Down
Loading

0 comments on commit f68f055

Please sign in to comment.