47 lines
1.3 KiB
CMake
47 lines
1.3 KiB
CMake
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>
|
|
)
|