A modern, cross-platform, and automated template for C++ projects.
To use this project, you must have the following tools installed and available in your system PATH
:
- Git
- GCC on Linux, Clang on MacOS and MSVC on Windows
Compiler | Version |
---|---|
GCC | 7.0 |
Clang | 5.0 |
MSVC | 19.11 (Visual Studio 2017 version 15.3) |
-
Clone this repository
git clone https://github.com/tGstep/PremakeNinjaVcpkg-ModernCpp.git cd PremakeNinjaVcpkg-ModernCpp
-
Install required tools
From the root directory, run the platform-specific script:- On Linux/macOS:
./scripts/install_tools.sh
- On Windows:
.\scripts\install_tools.ps1
- On Linux/macOS:
-
Install project dependencies
This installs packages defined invcpkg.json
.- On Linux/macOS:
./scripts/fetch_dependencies.sh
- On Windows:
.\scripts\fetch_dependencies.ps1
- On Linux/macOS:
-
Generate build files
premake5 ninja
-
Build the project
ninja -C build
.
├── .github/
│ └── workflows/
│ └── build.yml # GitHub Actions automatic build
├── build/ # Build output
├── external/
│ └── vcpkg/ # Auto-cloned C++ dependencies
├── scripts/ # Automation scripts
│ ├── install_tools.sh # Install dev tools (Linux/macOS)
│ ├── install_tools.ps1 # Install dev tools (Windows)
│ ├── fetch_dependencies.sh # Install vcpkg dependencies (Linux/macOS)
│ └── fetch_dependencies.ps1 # Install vcpkg dependencies (Windows)
├── src/
│ └── main.cpp # Your source code
├── premake5.lua # Premake5 configuration
├── vcpkg.json # Dependency list
└── README.md # This file