Streamline SDL1/SDL2 propgation and handle it in one place rather than having it multiple times

in the cmake files.
master
Nicky 2022-08-04 00:46:42 +02:00
parent bd93044cbd
commit 3866fcfdc3
5 changed files with 13 additions and 49 deletions

View File

@ -4,6 +4,9 @@ include(Variables)
include(GLEXT)
include(Prebuilt)
include_guard()
add_library( sdl INTERFACE IMPORTED )
if (USESYSTEMLIBS)
include(FindSDL)
@ -18,11 +21,17 @@ else (USESYSTEMLIBS)
if( NOT USE_SDL2 )
use_prebuilt_binary(SDL)
set (SDL_FOUND TRUE)
set (SDL_LIBRARY SDL directfb fusion direct X11)
target_link_libraries (sdl INTERFACE SDL directfb fusion direct X11)
target_compile_definitions( sdl INTERFACE LL_SDL=1 )
else()
use_prebuilt_binary(SDL2)
set (SDL2_FOUND TRUE)
set (SDL_LIBRARY SDL2 SDL2_mixer X11)
target_link_libraries( sdl INTERFACE SDL2 X11 )
target_compile_definitions( sdl INTERFACE LL_SDL2=1 LL_SDL=1 )
endif()
endif (LINUX)

View File

@ -111,17 +111,6 @@ endif (BUILD_HEADLESS)
add_library (llrender ${llrender_SOURCE_FILES})
if (SDL_FOUND)
set_property(TARGET llrender
PROPERTY COMPILE_DEFINITIONS LL_SDL=1
)
endif (SDL_FOUND)
if (SDL2_FOUND)
set_property(TARGET llrender
PROPERTY COMPILE_DEFINITIONS LL_SDL2=1 LL_SDL=1
)
endif ()
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
target_link_libraries(llrender

View File

@ -76,7 +76,7 @@ if (LINUX)
#${LLWINDOW_LIBRARIES} # <FS:Ansariel> Don't link to itself - causes CMP0038
${LLXML_LIBRARIES}
${UI_LIBRARIES} # for GTK
${SDL_LIBRARY}
sdl
libfontconfig.a # For FCInit and other FC* functions.
libfreetype.a
)
@ -201,16 +201,5 @@ endif (llwindow_HEADER_FILES)
${viewer_SOURCE_FILES}
)
if (SDL_FOUND)
set_property(TARGET llwindow
PROPERTY COMPILE_DEFINITIONS LL_SDL=1
)
endif ()
if (SDL2_FOUND)
set_property(TARGET llwindow
PROPERTY COMPILE_DEFINITIONS LL_SDL2=1 LL_SDL=1
)
endif ()
target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})

View File

@ -87,18 +87,6 @@ add_library(media_plugin_cef
# ${MEDIA_PLUGIN_BASE_LIBRARIES}
#)
if (SDL_FOUND)
message("SDL_FOUND")
set_property(TARGET media_plugin_cef
PROPERTY COMPILE_DEFINITIONS LL_SDL=1
)
endif ()
if (SDL2_FOUND)
message("SDL2_FOUND")
set_property(TARGET media_plugin_cef
PROPERTY COMPILE_DEFINITIONS LL_SDL2=1 LL_SDL=1
)
endif ()
target_link_libraries(media_plugin_cef
${media_plugin_cef_LINK_LIBRARIES}

View File

@ -2207,17 +2207,6 @@ add_executable(${VIEWER_BINARY_NAME}
${viewer_SOURCE_FILES}
)
if (SDL_FOUND)
set_property(TARGET ${VIEWER_BINARY_NAME}
PROPERTY COMPILE_DEFINITIONS LL_SDL=1
)
endif (SDL_FOUND)
if (SDL2_FOUND)
set_property(TARGET ${VIEWER_BINARY_NAME}
PROPERTY COMPILE_DEFINITIONS LL_SDL2=1 LL_SDL=1
)
endif ()
if (USE_BUGSPLAT)
set_property(TARGET ${VIEWER_BINARY_NAME}
PROPERTY COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}")
@ -2531,7 +2520,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${GLOD_LIBRARIES} # <FS:Beq/> restore GLOD dependencies
${OPENGL_LIBRARIES}
${JSONCPP_LIBRARIES}
${SDL_LIBRARY}
#${SDL_LIBRARY}
${SMARTHEAP_LIBRARY}
${UI_LIBRARIES}
${WINDOWS_LIBRARIES}