Initial commit
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
|||||||
|
# C++ CMake template .gitignore
|
||||||
|
|
||||||
|
## 1. Ignore the Build Directory
|
||||||
|
# This is the most important rule. It excludes all generated Makefiles,
|
||||||
|
# project files, object files, and the final executable.
|
||||||
|
build/
|
||||||
|
_build/
|
||||||
|
out/
|
||||||
|
.cache/
|
||||||
|
|
||||||
|
## 2. Ignore IDE and Editor-Specific Files
|
||||||
|
# Prevents user-specific settings from being committed.
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# CLion / IntelliJ
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Visual Studio
|
||||||
|
*.sln
|
||||||
|
*.vcxproj*
|
||||||
|
.vs/
|
||||||
|
|
||||||
|
|
||||||
|
## 3. Ignore Common Compiled Files
|
||||||
|
# These are sometimes created outside the build directory.
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
*.so
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
|
||||||
|
## 4. Ignore Operating System Files
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Windows thumbnail cache
|
||||||
|
Thumbs.db
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "vendor/SDL"]
|
||||||
|
path = vendor/SDL
|
||||||
|
url = https://github.com/libsdl-org/SDL.git
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.24)
|
||||||
|
project(SDL3Starter)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
add_subdirectory(vendor)
|
||||||
|
add_subdirectory(src)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Building and Running
|
||||||
|
|
||||||
|
Follow these steps to compile and run the project from your terminal.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* A C++ compiler (like G++ or Clang)
|
||||||
|
* **CMake** (version 3.16 or higher)
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
## Step-by-Step Instructions
|
||||||
|
|
||||||
|
### 1\. Configure the Project (First Time Only)
|
||||||
|
|
||||||
|
First, create a `build` directory and run CMake to prepare the project for compilation. You only need to do this once.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2\. Compile the Code
|
||||||
|
|
||||||
|
Now, from within the `build` directory, you can compile the project. You'll repeat this step every time you make changes to the source code.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
This command is a platform-agnostic way to build the project and is preferred over running `make` directly.
|
||||||
|
|
||||||
|
### 3\. Run the Application
|
||||||
|
|
||||||
|
The final executable will be located in a subdirectory inside `build` that matches the source structure.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build/SDL3Starter
|
||||||
|
```
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
build/compile_commands.json
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
add_executable(${PROJECT_NAME})
|
||||||
|
|
||||||
|
target_sources(${PROJECT_NAME} PRIVATE main.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE vendor)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#include "SDL3/SDL.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
SDL_Log("%s", "Hello World!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
add_subdirectory(SDL)
|
||||||
|
|
||||||
|
add_library(vendor INTERFACE)
|
||||||
|
|
||||||
|
target_link_libraries(vendor INTERFACE SDL3::SDL3)
|
||||||
|
target_include_directories(vendor INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/SDL/include")
|
||||||
+1
Submodule vendor/SDL added at 44ce826b57
Reference in New Issue
Block a user