forked from suyu/suyu
Merge pull request #9391 from abouvier/cmake-sdl
cmake: use sdl2 imported target
This commit is contained in:
commit
a225ba4cda
5 changed files with 7 additions and 35 deletions
|
@ -432,23 +432,13 @@ if (ENABLE_SDL2)
|
||||||
set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library")
|
set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library")
|
||||||
set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll")
|
set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll")
|
||||||
|
|
||||||
add_library(SDL2 INTERFACE)
|
add_library(SDL2::SDL2 INTERFACE IMPORTED)
|
||||||
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
|
target_link_libraries(SDL2::SDL2 INTERFACE "${SDL2_LIBRARY}")
|
||||||
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
|
target_include_directories(SDL2::SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
|
||||||
elseif (YUZU_USE_EXTERNAL_SDL2)
|
elseif (YUZU_USE_EXTERNAL_SDL2)
|
||||||
message(STATUS "Using SDL2 from externals.")
|
message(STATUS "Using SDL2 from externals.")
|
||||||
else()
|
else()
|
||||||
find_package(SDL2 2.0.18 REQUIRED)
|
find_package(SDL2 2.0.18 REQUIRED)
|
||||||
|
|
||||||
# Some installations don't set SDL2_LIBRARIES
|
|
||||||
if("${SDL2_LIBRARIES}" STREQUAL "")
|
|
||||||
message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
|
|
||||||
set(SDL2_LIBRARIES "SDL2::SDL2")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
|
|
||||||
add_library(SDL2 INTERFACE)
|
|
||||||
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -227,11 +227,7 @@ if(ENABLE_CUBEB)
|
||||||
target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1)
|
target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1)
|
||||||
endif()
|
endif()
|
||||||
if(ENABLE_SDL2)
|
if(ENABLE_SDL2)
|
||||||
if (YUZU_USE_EXTERNAL_SDL2)
|
target_link_libraries(audio_core PRIVATE SDL2::SDL2)
|
||||||
target_link_libraries(audio_core PRIVATE SDL2-static)
|
|
||||||
else()
|
|
||||||
target_link_libraries(audio_core PRIVATE SDL2)
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,7 @@ if (ENABLE_SDL2)
|
||||||
drivers/sdl_driver.cpp
|
drivers/sdl_driver.cpp
|
||||||
drivers/sdl_driver.h
|
drivers/sdl_driver.h
|
||||||
)
|
)
|
||||||
if (YUZU_USE_EXTERNAL_SDL2)
|
target_link_libraries(input_common PRIVATE SDL2::SDL2)
|
||||||
target_link_libraries(input_common PRIVATE SDL2-static)
|
|
||||||
else()
|
|
||||||
target_link_libraries(input_common PRIVATE SDL2)
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -391,11 +391,7 @@ if (YUZU_USE_BUNDLED_QT AND QT_VERSION VERSION_LESS 6)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_SDL2)
|
if (ENABLE_SDL2)
|
||||||
if (YUZU_USE_EXTERNAL_SDL2)
|
target_link_libraries(yuzu PRIVATE SDL2::SDL2)
|
||||||
target_link_libraries(yuzu PRIVATE SDL2-static)
|
|
||||||
else()
|
|
||||||
target_link_libraries(yuzu PRIVATE SDL2)
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(yuzu PRIVATE HAVE_SDL2)
|
target_compile_definitions(yuzu PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,7 @@ target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
|
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
|
||||||
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
|
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
|
||||||
|
|
||||||
target_link_libraries(yuzu-cmd PRIVATE Vulkan::Headers)
|
target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
|
||||||
|
|
||||||
if (YUZU_USE_EXTERNAL_SDL2)
|
|
||||||
target_link_libraries(yuzu-cmd PRIVATE SDL2-static)
|
|
||||||
else()
|
|
||||||
target_link_libraries(yuzu-cmd PRIVATE SDL2)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS yuzu-cmd)
|
install(TARGETS yuzu-cmd)
|
||||||
|
|
Loading…
Reference in a new issue