This is a lightweight and flexible C++ project template designed to kickstart development using Premake. It allows you to easily generate either Visual Studio or CMake project files depending on your workflow.
- Organized project structure
- Premake5 build configuration
- Support for both Visual Studio and CMake
- Simple script-based setup
- Clone the template repository (or use the "Use this template" button on GitHub to create your own copy).
- Open a terminal and run one of the setup scripts inside the
Scripts/directory.
cd Scripts
./Setup-Linux-cmake.sh # For CMakeOn Windows, use the
.batequivalents:
cd Scripts
./Setup-Windows-cmake.bat # For Visual Studio
./Setup-Windows-vs2022.bat # For CMakeChanging project names is as simple as going into the premake5.lua of the project and changing the project variable to whatever name you want.
Note: if you change rename any folders, remember to change the path in the root premake5.lua file and any other project that depends on that project.
Please refer to the Premake docs.
Cpp-TemplateProject/
├─ Core/
│ ├─ CoreProjectExample/
│ │ ├─ CoreProject/
│ │ ├─ Premake5.lua
├─ Dependencies/
├─ MainProject/
│ ├─ Premake5.lua
├─ premake-cmake/
├─ Scripts/
├─ Vendor/
├─ premake5.lua
-
Core/: Contains reusable core libraries.
- CoreProjectExample/: Example of a library setup. Each library has an outer folder (for build files) and an inner folder (
CoreProject/) with the actual source. premake5.lua: Premake configuration for the example library.
- CoreProjectExample/: Example of a library setup. Each library has an outer folder (for build files) and an inner folder (
-
Dependencies/: Placeholder for third-party dependencies (e.g., via Git submodules or external downloads). They are structured similarily to core libraries.
-
MainProject/: Your primary application or executable target.
premake5.lua: Premake configuration for the main project.
-
premake-cmake/: A CMake module that bridges CMake compatibility with Premake-generated builds.
-
Scripts/: Contains helper scripts to generate project files (e.g.,
Setup-Linux-cmake.sh,Setup-Windows-cmake.bat). -
Vendor/: Stores Premake binaries and example scripts or boilerplate for reference.
-
premake5.lua(root): Main workspace configuration file for Premake.
- C++ compiler (MSVC, GCC or Clang)
- CMake (if using CMake)
- (Optional) Visual Studio or CMake-compatible IDE
You can modify the premake5.lua scripts to:
- Add dependencies
- Change compiler/linker settings
- Configure additional projects or modules
MIT License