From ca945804d50fd52e1baaa9e3cba6ed7fd2042b69 Mon Sep 17 00:00:00 2001 From: Brody Brooks Date: Thu, 20 Aug 2026 15:50:46 -0400 Subject: [PATCH] Initial commit --- .gitignore | 50 +++++++++++++++++++++++++++++++++++++++++++ .gitmodules | 3 +++ CMakeLists.txt | 10 +++++++++ README.md | 40 ++++++++++++++++++++++++++++++++++ compile_commands.json | 1 + src/CMakeLists.txt | 5 +++++ src/main.cpp | 6 ++++++ vendor/CMakeLists.txt | 6 ++++++ vendor/SDL | 1 + 9 files changed, 122 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 README.md create mode 120000 compile_commands.json create mode 100644 src/CMakeLists.txt create mode 100644 src/main.cpp create mode 100644 vendor/CMakeLists.txt create mode 160000 vendor/SDL diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c15954 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..432c63f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/SDL"] + path = vendor/SDL + url = https://github.com/libsdl-org/SDL.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..566f789 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/README.md b/README.md new file mode 100644 index 0000000..b23d912 --- /dev/null +++ b/README.md @@ -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 +``` diff --git a/compile_commands.json b/compile_commands.json new file mode 120000 index 0000000..25eb4b2 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1 @@ +build/compile_commands.json \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..6b853c0 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(${PROJECT_NAME}) + +target_sources(${PROJECT_NAME} PRIVATE main.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE vendor) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..8f7ac65 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,6 @@ +#include "SDL3/SDL.h" + +int main() { + SDL_Log("%s", "Hello World!"); + return 0; +} diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt new file mode 100644 index 0000000..9aca47b --- /dev/null +++ b/vendor/CMakeLists.txt @@ -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") diff --git a/vendor/SDL b/vendor/SDL new file mode 160000 index 0000000..44ce826 --- /dev/null +++ b/vendor/SDL @@ -0,0 +1 @@ +Subproject commit 44ce826b57f2d19a4df2de5dc3fe6a3a062dee1f