Skip to main content

A C++ CMake project generator (using CMake ToolKit)

Project description

Concept

Python scripts which create C++ CMake projects based on CMTK (used as a git submodule).

See the task board for future updates and features.

Requirements

Binaries:

  • CMake 3.16 or later
  • git
  • python 3.6
  • python3-tkinter

Install

pip3 install cmtkgen

Scripts

Each script creates a C++ project according to the information provided by the user.

create_cpp_executable_project.py [project_name]

This scripts generates a CMake project with an executable target. This executable can be installed after being successfully built.

Questions asked to generate the project:

  • Project name (if not provided on command line)

  • Project version (default: 0.1.0)

  • Allowing CMake build-in tree? To allow the CMake configuration of the project directly in the source directory or in one of its sub-directory.

  • Which C++ version do you want to use? (11, 14, 17, 20)

  • Do you want a .gitignore file?

  • Do you want a License file? Which file name? Who are the copyright holders?

  • Do you want a Readme file?Which file name?

  • Do you want a version header file? (a version.hpp file will be created by CMTK during CMake configuration.)

Example of a full executable project named cpp_exec:

cpp_exec/
├── cmake
│   └── cmtk/...
├── include
│   └── cpp_exec
│       └── cpp_exec.hpp
├── src
│   ├── cpp_exec.cpp
│   └── main.cpp
├── CMakeLists.txt
├── cmake_quick_install.cmake
├── .gitignore
├── .gitmodules  # For CMTK
├── LICENSE.md
└── README.md

To configure, build and install such a project use [cmake_quick_install.cmake](#About cmake_quick_install.cmake) or execute the following commands:

cmake -S cpp_exec/ -B build
cmake --build build/
cmake --install build/

create_cpp_lib_project.py [project_name]

Questions asked to generate the project:

  • Project name (if not provided on command line)

  • Project version (default: 0.1.0)

  • Allowing CMake build-in tree? To allow the CMake configuration of the project directly in the source directory or in one of its sub-directory.

  • Which C++ version do you want to use? (11, 14, 17, 20)

  • Do you want a .gitignore file?

  • Do you want a License file? Which file name? Who are the copyright holders?

  • Do you want a Readme file?Which file name?

  • Do you want a version header file? (a version.hpp file will be created by CMTK during CMake configuration.)

  • Which type of package-config file do you want for your project, BASIC or VERBOSE? (a package-config.cmake will be created by CMTK during CMake configuration.)

Example of a full executable project named cpp_lib:

cpp_lib/
├── cmake
│   └── cmtk/...
├── example
│   ├── CMakeLists.txt
│   └── cpp_lib_example.cpp
├── include
│   └── cpp_lib
│       └── cpp_lib.hpp
├── src
│   └── cpp_lib.cpp
├── test
│   ├── CMakeLists.txt
│   └── cpp_lib_tests.cpp
├── CMakeLists.txt
├── cmake_quick_install.cmake
├── .gitignore
├── .gitmodules  # For CMTK
├── LICENSE.md
└── README.md

To configure, build and install such a project use [cmake_quick_install.cmake](#About cmake_quick_install.cmake) or execute the following commands:

cmake -S cpp_lib/ -B build
cmake --build build/
cmake --install build/

create_cpp_honly_lib_project.py [project_name]

Questions asked to generate the project:

  • Project name (if not provided on command line)

  • Project version (default: 0.1.0)

  • Allowing CMake build-in tree? To allow the CMake configuration of the project directly in the source directory or in one of its sub-directory.

  • Which C++ version do you want to use? (11, 14, 17, 20)

  • Do you want a .gitignore file?

  • Do you want a License file? Which file name? Who are the copyright holders?

  • Do you want a Readme file?Which file name?

  • Do you want a version header file? (a version.hpp file will be created by CMTK during CMake configuration.)

  • Which type of package-config file do you want for your project, BASIC or VERBOSE? (a package-config.cmake will be created by CMTK during CMake configuration.)

Example of a full executable project named cpp_honly:

cpp_honly/
├── cmake
│   └── cmtk/...
├── example
│   ├── CMakeLists.txt
│   └── cpp_honly_example.cpp
├── include
│   └── cpp_honly
│       └── cpp_honly.hpp
├── test
│   ├── CMakeLists.txt
│   └── cpp_honly_tests.cpp
├── CMakeLists.txt
├── cmake_quick_install.cmake
├── .gitignore
├── .gitmodules  # For CMTK
├── LICENSE.md
└── README.md

To configure, build and install such a project use [cmake_quick_install.cmake](#About cmake_quick_install.cmake) or execute the following commands:

cmake -S cpp_honly/ -B build
cmake --build build/
cmake --install build/

create_cpp_hello_world.py [project_name]

Questions asked to generate the project:

  • Project name (if not provided on command line)

  • Which C++ version do you want to use? (11, 14, 17, 20)

Example of a full executable project named cpp_hello_world:

cpp_hello_world/
├── cmake
│   └── cmtk/...
├── CMakeLists.txt
├── .gitmodules  # For CMTK
├── main.cpp
└── main.hpp

To configure and build such a project execute use the following commands:

cmake -S cpp_hello_world/ -B build
cmake --build build/

About cmake_quick_install.cmake

Executable and library projects have a cmake_quick_install.cmake script. It can be called with CMake like this:

cmake -P cmake_quick_install.cmake

It has optional parameters:

  • DIR: The install prefix directory.
  • BUILD: The build type. (default: Release)

Some examples:

cmake -P cmake_quick_install.cmake -- DIR ~/local/
cmake -P cmake_quick_install.cmake -- BUILD Debug
cmake -P cmake_quick_install.cmake -- DIR ~/local/ BUILD Debug

License

MIT License © cmtkgen

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmtkgen-0.9.tar.gz (10.7 kB view hashes)

Uploaded Source

Built Distribution

cmtkgen-0.9-py3-none-any.whl (17.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page