Skip to content

Alextibtab/cxx-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Project Template with CMake

Welcome to the C++ Project Template! This repository provides a basic setup for a C++ project using CMake. It includes scripts for both PowerShell (Windows) and Bash (Linux) to streamline the build process.

Directory Structure

C++-Project-Template/
├── build/ # Directory where build artifacts will be generated
├── src/ # Directory containing the source code
├── scripts/
│ ├── build.ps1 # PowerShell script for building on Windows
│ └── build.sh # Bash script for building on Linux
├── CMakeLists.txt # CMake configuration file
└── README.md # This file

Prerequisites

  • CMake: Make sure CMake is installed on your system. You can download it from here.

Building the Project

On Windows

  1. Open PowerShell.
  2. Navigate to the project directory.
  3. Run the PowerShell build script:
    ./scripts/build.ps1
  4. Navigate to the build directory:
    cd build
  5. Run make to build the project:
    mingw32-make
  6. Run the output binary:
    ./output_binary.exe

On Linux

  1. Open a terminal.
  2. Navigate to the project directory.
  3. Make the Bash script executable (only required once):
    chmod +x scripts/build.sh
  4. Run the Bash build script:
    ./scripts/build.sh
  5. Navigate to the build directory:
    cd build
  6. Run make to build the project:
    make
  7. Run the output binary:
    ./output_binary

Customizing the Project

  • Add your C++ source files to the src directory.
  • Modify the CMakeLists.txt file to include your source files and any necessary libraries or dependencies.

Troubleshooting

  • Ensure CMake is installed and added to your system's PATH.
  • Check the output of the build scripts for any errors or warnings.
  • Make sure you have the necessary build tools installed (mingw32-make for Windows and make for Linux).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages