Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 235115d

Browse files
authored
Change Project Name - Update Dependencies
PR to update project name, but dependencies also needed to be updated to get CI passing again.
1 parent 43842e9 commit 235115d

File tree

7 files changed

+44
-43
lines changed

7 files changed

+44
-43
lines changed

.github/template/template_name

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cpp_boilerplate_project
1+
cmake_conan_boilerplate_template

.github/template/template_repository

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cpp-best-practices/cpp_boilerplate_project
1+
cpp-best-practices/cmake_conan_boilerplate_template

.github/workflows/ci.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414
CONAN_SYSREQUIRES_MODE: enabled
1515
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
1616
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
17+
CLANG_TIDY_VERSION: "13.0.0"
1718

1819
jobs:
1920
Test:
@@ -72,21 +73,25 @@ jobs:
7273
gcov_executable: gcov
7374
developer_mode: On
7475

76+
# Windows msvc builds
7577
- os: windows-2022
7678
compiler: msvc
7779
generator: "Visual Studio 17 2022"
7880
build_type: Debug
7981
developer_mode: On
82+
8083
- os: windows-2022
8184
compiler: msvc
8285
generator: "Visual Studio 17 2022"
8386
build_type: Release
8487
developer_mode: On
88+
8589
- os: windows-2022
8690
compiler: msvc
8791
generator: "Visual Studio 17 2022"
8892
build_type: Debug
8993
developer_mode: Off
94+
9095
- os: windows-2022
9196
compiler: msvc
9297
generator: "Visual Studio 17 2022"
@@ -95,10 +100,14 @@ jobs:
95100
package_generator: ZIP
96101

97102

98-
99-
100-
101103
steps:
104+
- name: Check for llvm version mismatches
105+
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }}
106+
uses: actions/github-script@v3
107+
with:
108+
script: |
109+
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')
110+
102111
- uses: actions/checkout@v2
103112

104113
- name: Setup Cache
@@ -120,7 +129,8 @@ jobs:
120129
conan: true
121130
vcpkg: false
122131
ccache: true
123-
clangtidy: true
132+
clangtidy: ${{ env.CLANG_TIDY_VERSION }}
133+
124134

125135
cppcheck: true
126136

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# cmake_conan_boilerplate_template
22

3-
[![ci](https://github.com/cpp-best-practices/cpp_boilerplate_project/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-best-practices/cpp_boilerplate_project/actions/workflows/ci.yml)
4-
[![codecov](https://codecov.io/gh/cpp-best-practices/cpp_boilerplate_project/branch/main/graph/badge.svg)](https://codecov.io/gh/cpp-best-practices/cpp_boilerplate_project)
5-
[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/cpp-best-practices/cpp_boilerplate_project)](https://lgtm.com/projects/g/cpp-best-practices/cpp_boilerplate_project/context:cpp)
6-
[![CodeQL](https://github.com/cpp-best-practices/cpp_boilerplate_project/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cpp-best-practices/cpp_boilerplate_project/actions/workflows/codeql-analysis.yml)
3+
[![ci](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/ci.yml)
4+
[![codecov](https://codecov.io/gh/cpp-best-practices/cmake_conan_boilerplate_template/branch/main/graph/badge.svg)](https://codecov.io/gh/cpp-best-practices/cmake_conan_boilerplate_template)
5+
[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/cpp-best-practices/cmake_conan_boilerplate_template)](https://lgtm.com/projects/g/cpp-best-practices/cmake_conan_boilerplate_template/context:cpp)
6+
[![CodeQL](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/codeql-analysis.yml)
77

88
## About cmake_conan_boilerplate_template
99

@@ -36,7 +36,7 @@ Ths Boilerplate project will merge new features first, then they will be merged
3636

3737
### Use the Github template
3838
First, click the green `Use this template` button near the top of this page.
39-
This will take you to Github's ['Generate Repository'](https://github.com/cpp-best-practices/cpp_boilerplate_project/generate) page.
39+
This will take you to Github's ['Generate Repository'](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/generate) page.
4040
Fill in a repository name and short description, and click 'Create repository from template'.
4141
This will allow you to create a new repository in your Github account,
4242
prepopulated with the contents of this project.

conanfile.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Docs at https://docs.conan.io/en/latest/reference/conanfile_txt.html
22

33
[requires]
4-
catch2/2.13.8
5-
docopt.cpp/0.6.3
6-
#fmt/8.1.1
7-
spdlog/1.9.2
4+
catch2/2.13.9
5+
cli11/2.2.0
6+
spdlog/1.10.0
87

98
[generators]
109
cmake_find_package_multi

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
find_package(fmt CONFIG REQUIRED)
22
find_package(spdlog CONFIG REQUIRED)
3-
find_package(docopt CONFIG REQUIRED)
3+
find_package(CLI11 CONFIG REQUIRED)
44

55
# Generic test that uses conan libs
66
add_executable(intro main.cpp)
77
target_link_libraries(
88
intro
99
PUBLIC project_options project_warnings
10-
PRIVATE docopt::docopt fmt::fmt spdlog::spdlog)
10+
PRIVATE CLI11::CLI11 fmt::fmt spdlog::spdlog)
1111

1212
target_include_directories(intro PRIVATE "${CMAKE_BINARY_DIR}/configured_files/include")

src/main.cpp

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,42 @@
11
#include <functional>
22
#include <iostream>
3+
#include <optional>
34

4-
#include <docopt/docopt.h>
5+
#include <CLI/CLI.hpp>
56
#include <spdlog/spdlog.h>
67

78
// This file will be generated automatically when you run the CMake configuration step.
89
// It creates a namespace called `myproject`.
910
// You can modify the source template at `configured_files/config.hpp.in`.
1011
#include <internal_use_only/config.hpp>
1112

12-
static constexpr auto USAGE =
13-
R"(Naval Fate.
14-
15-
Usage:
16-
naval_fate ship new <name>...
17-
naval_fate ship <name> move <x> <y> [--speed=<kn>]
18-
naval_fate ship shoot <x> <y>
19-
naval_fate mine (set|remove) <x> <y> [--moored | --drifting]
20-
naval_fate (-h | --help)
21-
naval_fate --version
22-
Options:
23-
-h --help Show this screen.
24-
--version Show version.
25-
--speed=<kn> Speed in knots [default: 10].
26-
--moored Moored (anchored) mine.
27-
--drifting Drifting mine.
28-
)";
2913

3014
// NOLINTNEXTLINE(bugprone-exception-escape)
3115
int main(int argc, const char **argv)
3216
{
3317
try {
34-
std::map<std::string, docopt::value> args = docopt::docopt(USAGE,
35-
{ std::next(argv), std::next(argv, argc) },
36-
true,// show help if requested
37-
fmt::format("{} {}",
38-
myproject::cmake::project_name,
39-
myproject::cmake::project_version));// version string, acquired from config.hpp via CMake
18+
CLI::App app{ fmt::format("{} version {}", myproject::cmake::project_name, myproject::cmake::project_version) };
4019

41-
for (auto const &arg : args) { std::cout << arg.first << "=" << arg.second << '\n'; }
20+
std::optional<std::string> message;
21+
app.add_option("-m,--message", message, "A message to print back out");
22+
bool show_version = false;
23+
app.add_flag("--version", show_version, "Show version information");
4224

25+
CLI11_PARSE(app, argc, argv);
26+
27+
if (show_version) {
28+
fmt::print("{}\n", myproject::cmake::project_version);
29+
return EXIT_SUCCESS;
30+
}
4331

4432
// Use the default logger (stdout, multi-threaded, colored)
4533
spdlog::info("Hello, {}!", "World");
4634

47-
fmt::print("Hello, from {}\n", "{fmt}");
35+
if (message) {
36+
fmt::print("Message: '{}'\n", *message);
37+
} else {
38+
fmt::print("No Message Provided :(\n");
39+
}
4840
} catch (const std::exception &e) {
4941
spdlog::error("Unhandled exception in main: {}", e.what());
5042
}

0 commit comments

Comments
 (0)