From c79a4d88b84af03bd02b5e1f54e7be78b0c1f015 Mon Sep 17 00:00:00 2001 From: Harry Culpan Date: Thu, 23 Jul 2026 16:34:49 -0400 Subject: [PATCH] First commit, testing build system; just build hello world console app --- .gitignore | 2 ++ CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main.c | 5 +++++ 3 files changed, 54 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore index c8bb3af..67e6137 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +build/ + # ---> C # Prerequisites *.d diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..12b5924 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.24) +project(hello3d LANGUAGES C) + +set(CMAKE_C_STANDARD 17) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +include(FetchContent) + +# --- SDL3 --------------------------------------------------------------- +# Force static build (no shared .so/.dll), matching our earlier decision. +set(SDL_STATIC ON CACHE BOOL "" FORCE) +set(SDL_SHARED OFF CACHE BOOL "" FORCE) + +FetchContent_Declare( + SDL3 + GIT_REPOSITORY https://github.com/libsdl-org/SDL.git + GIT_TAG release-3.4.12 # pin to a known release tag; check GitHub for the current latest + GIT_SHALLOW TRUE +) +FetchContent_MakeAvailable(SDL3) + +# --- cglm ----------------------------------------------------------------- +set(CGLM_STATIC ON CACHE BOOL "" FORCE) +set(CGLM_SHARED OFF CACHE BOOL "" FORCE) + +FetchContent_Declare( + cglm + GIT_REPOSITORY https://github.com/recp/cglm.git + GIT_TAG v0.9.6 # pin to a known release tag; check GitHub for the current latest + GIT_SHALLOW TRUE +) +FetchContent_MakeAvailable(cglm) + +# --- Our executable --------------------------------------------------------- +add_executable(hello3d + src/main.c +) + +target_link_libraries(hello3d PRIVATE + SDL3::SDL3 + cglm +) + +target_compile_options(hello3d PRIVATE + $<$:-Wall -Wextra> +) diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..7c1035f --- /dev/null +++ b/src/main.c @@ -0,0 +1,5 @@ +#include + +int main() { + printf("Hello world!\n"); +}