cmake: Fix build with SDL2 on Alpine Linux

Co-authored-by: Jakob Bornecrantz <jakob@collabora.com>
Co-authored-by: Rylie Pavlik <rylie.pavlik@collabora.com>
This commit is contained in:
Simon Zeni 2023-11-14 22:56:37 -05:00 committed by Jakob Bornecrantz
parent a349b757a7
commit 0fe8737ec5
2 changed files with 14 additions and 9 deletions

View file

@ -91,6 +91,18 @@ if(XRT_FEATURE_SLAM)
target_link_libraries(xrt-external-slam INTERFACE ${SLAM_LDFLAGS}) target_link_libraries(xrt-external-slam INTERFACE ${SLAM_LDFLAGS})
endif() endif()
# SDL
if(XRT_HAVE_SDL2)
add_library(xrt-external-sdl2 INTERFACE)
target_link_libraries(xrt-external-sdl2 INTERFACE SDL2::SDL2)
# Fix SDL2 build include for Alpine Linux
find_path(SDL2_DIRECTFB_INCLUDE_DIR directfb.h PATH_SUFFIXES directfb)
if(SDL2_DIRECTFB_INCLUDE_DIR)
target_include_directories(xrt-external-sdl2 INTERFACE ${SDL2_DIRECTFB_INCLUDE_DIR})
endif()
endif()
# STB # STB
add_library(xrt-external-stb INTERFACE) add_library(xrt-external-stb INTERFACE)
target_include_directories(xrt-external-stb SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/stb) target_include_directories(xrt-external-stb SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/stb)
@ -144,12 +156,7 @@ if(XRT_HAVE_OPENGL)
imgui/imgui/imgui_impl_sdl.h imgui/imgui/imgui_impl_sdl.h
) )
target_link_libraries( target_link_libraries(
xrt-external-imgui-sdl2 xrt-external-imgui-sdl2 PUBLIC xrt-external-imgui xrt-external-sdl2
PUBLIC xrt-external-imgui
PUBLIC SDL2::SDL2
)
target_include_directories(
xrt-external-imgui-sdl2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/imgui
) )
set_target_properties( set_target_properties(
xrt-external-imgui-sdl2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF xrt-external-imgui-sdl2 PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF

View file

@ -171,9 +171,7 @@ if(XRT_FEATURE_DEBUG_GUI)
endif() endif()
if(XRT_HAVE_SDL2) if(XRT_HAVE_SDL2)
target_link_libraries( target_link_libraries(aux_util_debug_gui PRIVATE st_gui xrt-external-imgui-sdl2)
aux_util_debug_gui PRIVATE st_gui xrt-external-imgui-sdl2 SDL2::SDL2
)
if(XRT_BUILD_DRIVER_QWERTY) if(XRT_BUILD_DRIVER_QWERTY)
target_link_libraries( target_link_libraries(