Some project structure fixes

This commit is contained in:
Colin Sames
2026-04-03 19:54:39 +02:00
parent ac9d2f8648
commit a321f757f2
7 changed files with 35 additions and 36 deletions

View File

@@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.18)
project(GameEngine VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# --- Validate preset variables ---
if(NOT DEFINED SDL_LINK_TYPE OR NOT SDL_LINK_TYPE MATCHES "^(static|dynamic)$")
message(FATAL_ERROR "SDL_LINK_TYPE must be 'static' or 'dynamic'. Use a CMake preset.")
@@ -19,11 +16,14 @@ message(STATUS "Build config: PLATFORM=${PLATFORM}, SDL_LINK_TYPE=${SDL_LINK_TYP
include(cmake/SDLSetup.cmake)
#include(cmake/SDLMixerSetup.cmake)
# --- Apply Linux dynamic RPATH globally so all targets can find shared libs
# at runtime. SDL_LINUX_RPATH is appended to by each Setup module.
# --- On Linux with dynamic linking, set an $ORIGIN-relative RPATH so the
# binary can find shared libs next to itself without needing LD_LIBRARY_PATH.
# SDL_LINUX_RPATH is still used at build time so the dev build works in-place.
if(DEFINED SDL_LINUX_RPATH)
message(STATUS "Setting CMAKE_BUILD_RPATH to: ${SDL_LINUX_RPATH}")
set(CMAKE_BUILD_RPATH "${SDL_LINUX_RPATH}")
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
endif()
# --- Subdirectories ---