cpp-best-practices / cmake_conan_boilerplate_template Goto Github PK
View Code? Open in Web Editor NEWMinimized version of cpp_starter_project
License: The Unlicense
Minimized version of cpp_starter_project
License: The Unlicense
bash-3.2$ cmake --preset=unixlike-gcc-release
Preset CMake variables:
CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_CXX_COMPILER="g++"
CMAKE_C_COMPILER="gcc"
CMAKE_INSTALL_PREFIX:PATH="/Users/clausklein/Workspace/cpp/cpp_boilerplate_project/out/install/unixlike-gcc-release"
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Developer mode is ON. For production, use `-DENABLE_DEVELOPER_MODE:BOOL=OFF`. Building the project for the developer...
-- The default CMAKE_C_STANDARD used by external targets and tools is not set yet. Using the latest supported C standard that is 17
-- /usr/local/bin/ccache found and enabled
-- Downloading conan.cmake from https://github.com/conan-io/cmake-conan
-- Conan: Adding cci remote repository (https://center.conan.io) verify ssl (True)
-- Conan: Adding bincrafters remote repository (https://bincrafters.jfrog.io/artifactory/api/conan/public-conan) verify ssl (True)
-- Single configuration build!
-- Running Conan for build type 'RelWithDebInfo'
-- Conan: checking conan executable
-- Conan: Found program /usr/local/bin/conan
-- Conan: Version found Conan version 1.47.0
-- Conan executing: /usr/local/bin/conan install /Users/clausklein/Workspace/cpp/cpp_boilerplate_project --build missing --env CC=/usr/bin/gcc --env CXX=/usr/bin/g++ --settings build_type=RelWithDebInfo --settings compiler=apple-clang --settings compiler.version=13.1 --settings compiler.libcxx=libc++ --settings compiler.cppstd=20
-- Dependency fmt already found
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Library docopt found /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
-- Found: /Users/clausklein/.conan/data/docopt.cpp/0.6.3/_/_/package/5daf637a62aba772e1702099bde4503471cf3546/lib/libdocopt.dylib
CMake Warning (dev) at CMakeLists.txt:129 (message):
Building Tests. Be sure to check out test/constexpr_tests.cpp for
constexpr testing
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Workspace/cpp/cpp_boilerplate_project/out/build/unixlike-gcc-release
bash-3.2$ cmake --build --preset=unixlike-gcc-release
CMake Error: No such build preset in /Users/clausklein/Workspace/cpp/cpp_boilerplate_project: "unixlike-gcc-release"
########################################################################################
bash-3.2$ ctest --build --preset=unixlike-gcc-release
CMake Error: No such test preset in /Users/clausklein/Workspace/cpp/cpp_boilerplate_project: "unixlike-gcc-release"
Available test presets:
"test-windows-msvc-debug-developer-mode" - Strict
"test-windows-msvc-release-developer-mode" - Strict
"test-windows-clang-debug" - Strict
"test-windows-clang-release" - Strict
"test-unixlike-gcc-debug" - Strict
"test-unixlike-gcc-release" - Strict
"test-unixlike-clang-debug" - Strict
"test-unixlike-clang-release" - Strict
bash-3.2$
Seems they can be enabled with cmakepresets settings, or we can use the Ninja support for them. Need to pick one or the other, but not both.
https://docs.microsoft.com/en-us/cpp/build/cmake-presets-json-reference?view=msvc-170
From this discussion on Discord: https://discord.com/channels/773320866993012746/954385320336556042/958776874895556698
A user encountered the error:
CMake Error at build/_deps/_project_options-src/src/PackageProject.cmake:4 (cmake_policy):
Policy "CMP0103" is not known to this version of CMake.
That policy was added in CMake 3.18, but this project's main CMakeLists.txt uses cmake_minimum_required(VERSION 3.16)
.
The FuzzTest example provided with this project is concerned with undefined behavior due to signed integer overflow. I ran the example and got several overflows ("negative sums") but no warning or error as a result.
Should the fuzzer be able to detect this case of UB? If yes, how should one run it to make sure it does (are the newest versions required, or similar)? If no, perhaps a different fuzzing example might be more instructive?
Hi!
Last year i used a Kotlin project template from Jetbrains for the Advent of Code. It had a nice feature:
After creating my project from the template it automatically committed a clean-up change, that exchanged the template readme with a readme that was more tailored for the project.
Are there any plans to add such thing to this project template? Here is the workflow they used in their project template on github.
Some things are always bothering me, when i setup my project through the template:
Following things i can think of that always have to change:
Following things could be changed sometimes according to what the user wants. Those are probably not easy, maybe impossible to do:
Removing the unwanted examples or dependencies is sometimes anoying because removing one example cannot be done from github directly without branching or multiple commits --> Deprecated because of new template project
For private projects i'm sometimes not interested in MacOS. Maybe it is possible to disable one or many of the CI Matrix entries? --> not sure if this is sensibel to do
If this has any chances of beeing excepted i could invest some time in creating the worklfow for at least "fixing" the links of the build badges?
There is a conan.exe available here: https://conan.io/downloads.html
https://github.com/lefticus/tools/blob/main/CMakeLists.txt#L73-L92
Include syntaxError
as well
Because the project name is used in C++ code, this becomes converted to an invalid identifier in the namespace project-name::value
is not valid C++.
We should try to see if we can fix-up -
to _
at template janitor time.
Re: @LtdSauce
Current command line arguments are a copy-paste from the docopt documentation. They should be updated to be more realistic.
Also, consider moving to a different option parser at the same time
The version of clang-tidy should be specified in ci.yml to prevent it from changing. For example, clangtidy: 13.0.0
instead of clangtidy: true
To prevent it from being clobbered by the compiler setup, it should be the same as the clang/LLVM version.
Hello, I was wondering how someone that used this template to create his own project can benefit from the development of this template in the long run. For example, given that this template will handle most of the devops functionalities I would like to update/rebase my existing project one year after its creation, taking advantage of all the nifty updates that have been introduced since then. So, one solution I came up with is that this could be a submodule on the actual repository that can be updated on demand. However, I am not sure if this can work with the CI that needs a specific folder structure. Another approach would be to package the required files and modify them accordingly using a package manager like vcpkg or conan that can also leverage the python utils. I would prefer the first approach since there is no standardized package management in cpp. Any thoughts on that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.