https://github.com/caiorss/cpp-project-templates
C++ CPP project templates with CMake + Conan
https://github.com/caiorss/cpp-project-templates
cmake cpp project scaffolding template
Last synced: 11 months ago
JSON representation
C++ CPP project templates with CMake + Conan
- Host: GitHub
- URL: https://github.com/caiorss/cpp-project-templates
- Owner: caiorss
- Created: 2019-10-06T18:50:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T00:38:32.000Z (almost 6 years ago)
- Last Synced: 2025-04-18T15:17:35.923Z (12 months ago)
- Topics: cmake, cpp, project, scaffolding, template
- Language: C++
- Size: 49.8 KB
- Stars: 15
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* C++ CMake (+) Conan Project Templates
** Overview
This project many C++ CMake and Conan project templates which can make
easier for creating new projects instead of starting everything from
scratch.
*Project Templates Provided:*
Basic CMake Projects:
+ Basic CMake Project with 2 executables.
+ Directory: [[file:basic-cmake-project][file:basic-cmake-project]]
Command Line Application with Subcommands akin to GIT (CLI11 Library)
+ CLI11 sample project
+ Directory: [[file:command-line-app-cli11][file:command-line-app-cli11]]
+ Description: Command line application with multiple subcommands
akin to busybox or GIT (git commit, git log, git push, ...)
OpenGL / Computer Graphics
+ Basic OpenGL Project
+ Directory: [[file:basic-opengl-project][file:basic-opengl-project]]
+ Description: Minimal OpenGL project with CMake.
Boost Libraries / ASIO - Asynchrnous IO Framework
+ Boost Asio Project
+ Directory: [[file:boost-asio-basic][file:boost-asio-basic]]
+ Description: Minimal [[https://www.boost.org/doc/libs/1_71_0/doc/html/boost_asio.html][Boost.Asio]] project.
Pybind11
+ Python Pybind11 native module.
+ Directory: [[file:python-module-pybind11][file:python-module-pybind11]]
+ Note a Python native module is a shared library - aka *.pyd
(DLL) or *.so on Windows.
QT Cross Platform - Graphical User Interface Framework
+ Qt5 Widgets + Dynamically Loaded Form
+ Directory: [[file:qt5-qtwidgets-dynamically-loaded][file:qt5-qtwidgets-dynamically-loaded]]
+ Description: Sample project with Qt5 Widgets dynamically
loaded. It doesn't not use code generation from the form file,
instead it loads the form file from the compiled resource at
runtime. This approach is similar to use QML for describing the
UI, but unlike QML, the control logic is entirely in C++.
+ Qt5 QtQuick QML
+ Directory: [[file:qt5-qtquick-qml][file:qt5-qtquick-qml]]
+ Description: Basic Q5/QML project with CMake.
WX Widgets - Cross Platform GUI Toolkit Library
+ Wxwidgets
+ Directory: [[file:wxwidgets][file:wxwidgets]]
+ Description: Sample CMake+Conan project with WxWidgets
containing two targets, a sample application with multiple files
and an application with a single file.
+ Note: WxWidget has a more permissive license than QT for static
linking. However, it has a more scattered documentation and
lacks good *GUI designer* such as QTCreator.
*Usage:*
Just copy the project template directory to a new location, open it in
any IDE which supports CMake, namely, Clion, Visual Studio, QTCreator
or KDevelop, and modify it.
Example:
+ 1 => Clone the repository:
#+BEGIN_SRC sh
$ mkdir -p /tmp/temp && cd /tmp/temp
$ git clone https://github.com/caiorss/cpp-project-templates
#+END_SRC
+ 2 => Copy the project template directory.
#+BEGIN_SRC sh
# Create my-opengll-project from template:
$ cp -rv cpp-project-templates/basic-opengl-project my-opengl-project
'cpp-project-templates/basic-opengl-project' -> 'my-opengl-project'
'cpp-project-templates/basic-opengl-project/CMakeLists.txt' -> 'my-opengl-project/CMakeLists.txt'
'cpp-project-templates/basic-opengl-project/README.org' -> 'my-opengl-project/README.org'
'cpp-project-templates/basic-opengl-project/opengl1.cpp' -> 'my-opengl-project/opengl1.cpp'
#+END_SRC
+ 3 => Open the project with Visual Studio, QTCreator, CLion,
KDevelop or any other supported IDE. Or generate the IDE-specific
configuration files with CMake.
#+BEGIN_SRC sh
# Edit the new project with CMake
$ qtcreator my-opengl-project/CMakeLists.txt &
#+END_SRC
+ 3 => Or compile and build from command line.
#+BEGIN_SRC sh
$ cd my-opengl1-project
$ cmake -H. -B_build -G Ninja -DCMAKE_BUILD_TYPE=Release
$ cmake --build _build --target
[2/2] Linking CXX executable openglDemo1.bin
# Run program:
$ _build/openglDemo1.bin
#+END_SRC
*Repository*
+ https://github.com/caiorss/cpp-project-templates
** Dependencies configuration
*Conan*
Install Conan via PIP:
#+BEGIN_SRC sh
$ pip install --user conan
#+END_SRC
After the installation of Conan, add the following repositories:
#+BEGIN_SRC sh
$ conan remote add conan-center https://conan.bintray.com
$ conan remote add conan-community https://api.bintray.com/conan/conan-community/conan
$ conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
#+END_SRC
*Dependency for Pybind11* (building Python Modules)
+ Note: Anaconda or Miniconda Python distributions already comes
with Pythonb development headers or (SDK - Software Development
Kit).
#+BEGIN_SRC sh
$ dnf install python3-devel
#+END_SRC
*Dependencies for OpenGL projects*
Fedora Linux or Red-hat derivates:
#+BEGIN_SRC sh
$ dnf install -y freeglut-devel gl-manpages.noarch
#+END_SRC
*Dependencies for WXWidgets projects on Fedora Linux*
#+BEGIN_SRC sh
$ dnf install -y gtk2-devel.x86_64
$ dnf install -y gtk+extra-devel.x86_64
$ dnf install -y SDL-devel.x86_64
$ dnf install -y SDL2-devel.x86_64
$ dnf install -y libXtst-devel.x86_64
$ dnf install -y libXt-devel.x86_6
$ dnf install -y compat-wxGTK3-gtk2.x86_64
#+END_SRC