First commit, testing build system; just build hello world console app
This commit is contained in:
parent
449e518a54
commit
c79a4d88b8
3 changed files with 54 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
|||
build/
|
||||
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
|
|
|||
47
CMakeLists.txt
Normal file
47
CMakeLists.txt
Normal file
|
|
@ -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
|
||||
$<$<C_COMPILER_ID:GNU,Clang>:-Wall -Wextra>
|
||||
)
|
||||
5
src/main.c
Normal file
5
src/main.c
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello world!\n");
|
||||
}
|
||||
Loading…
Reference in a new issue