This commit is contained in:
Alug committed 2025-12-01 16:03:12 +01:00
1 parent 8fdaf61d4d
commit 7bec44fc33
4 files changed
+33 -27

No files matched your search

+20 -20
View File
@@ -1,43 +1,43 @@
# Find SDL2
# Find SDL3
# Once done, this will define
#
# SDL2_FOUND - system has SDL2
# SDL2_INCLUDE_DIRS - SDL2 include directories
# SDL2_LIBRARIES - link libraries
# SDL3_FOUND - system has SDL3
# SDL3_INCLUDE_DIRS - SDL3 include directories
# SDL3_LIBRARIES - link libraries
include(LibFindMacros)
libfind_pkg_check_modules(SDL2_PKGCONF SDL2)
libfind_pkg_check_modules(SDL3_PKGCONF SDL3)
# includes
find_path(SDL2_INCLUDE_DIR
find_path(SDL3_INCLUDE_DIR
NAMES SDL.h
PATHS
${SDL2_PKGCONF_INCLUDE_DIRS}
"/usr/include/SDL2"
"/usr/local/include/SDL2"
${SDL3_PKGCONF_INCLUDE_DIRS}
"/usr/include/SDL3"
"/usr/local/include/SDL3"
)
# library
find_library(SDL2_LIBRARY
NAMES SDL2
find_library(SDL3_LIBRARY
NAMES SDL3
PATHS
${SDL2_PKGCONF_LIBRARY_DIRS}
${SDL3_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
# set include dir variables
set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR)
set(SDL2_PROCESS_LIBS SDL2_LIBRARY)
libfind_process(SDL2)
set(SDL3_PROCESS_INCLUDES SDL3_INCLUDE_DIR)
set(SDL3_PROCESS_LIBS SDL3_LIBRARY)
libfind_process(SDL3)
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
if(SDL3_FOUND AND NOT TARGET SDL3::SDL3)
add_library(SDL3::SDL3 UNKNOWN IMPORTED)
set_target_properties(
SDL2::SDL2
SDL3::SDL3
PROPERTIES
IMPORTED_LOCATION "${SDL2_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}"
IMPORTED_LOCATION "${SDL3_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}"
)
endif()
+2
View File
@@ -125,6 +125,8 @@ if(SRB2_CONFIG_ENABLE_DISCORDRPC)
target_sources(SRB2SDL2 PRIVATE discord.c)
endif()
target_sources(SRB2SDL2 PRIVATE stun.c)
if(${SRB2_CONFIG_LIBBACKTRACE})
target_link_libraries(SRB2SDL2 PRIVATE libbacktrace)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_LIBBACKTRACE)
+1 -1
View File
@@ -3,7 +3,7 @@ hw_draw.c
hw_main.cpp
hw_clip.c
hw_md2.c
hw_cache.c
hw_cache.cpp
hw_md2load.c
hw_md3load.c
hw_model.c
+10 -6
View File
@@ -51,11 +51,14 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
)
endif()
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2-static SDL2_mixer::SDL2_mixer-static)
else()
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2 SDL2_mixer::SDL2_mixer)
endif()
#if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
# target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2-static SDL2_mixer::SDL2_mixer-static)
#else()
# target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2 SDL2_mixer::SDL2_mixer)
#endif()
target_sources(SRB2SDL2 PRIVATE sdl_sound.c)
target_link_libraries(SRB2SDL2 PRIVATE SDL3::SDL3 sndfile)
if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
target_link_libraries(SRB2SDL2 PRIVATE m rt)
@@ -70,7 +73,8 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
)
endif()
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
#target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
target_compile_definitions(SRB2SDL2 PRIVATE -DSOUND=SOUND_SDL)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_SDL)
#### Installation ####