mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
CMake: Define an interface target for SDL2 definitions
This commit is contained in:
parent
34b6c8bd88
commit
776cb91785
|
@ -171,6 +171,13 @@ if (ENABLE_SDL2)
|
||||||
else()
|
else()
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (SDL2_FOUND)
|
||||||
|
# TODO(yuriks): Make FindSDL2.cmake export an IMPORTED library instead
|
||||||
|
add_library(SDL2 INTERFACE)
|
||||||
|
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
|
||||||
|
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(SDL2_FOUND NO)
|
set(SDL2_FOUND NO)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -32,7 +32,6 @@ include_directories(../../externals/soundtouch/include)
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
set(SRCS ${SRCS} sdl2_sink.cpp)
|
set(SRCS ${SRCS} sdl2_sink.cpp)
|
||||||
set(HEADERS ${HEADERS} sdl2_sink.h)
|
set(HEADERS ${HEADERS} sdl2_sink.h)
|
||||||
include_directories(${SDL2_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
@ -42,6 +41,6 @@ target_link_libraries(audio_core PUBLIC common core)
|
||||||
target_link_libraries(audio_core PRIVATE SoundTouch)
|
target_link_libraries(audio_core PRIVATE SoundTouch)
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
target_link_libraries(audio_core PRIVATE ${SDL2_LIBRARY})
|
target_link_libraries(audio_core PRIVATE SDL2)
|
||||||
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -15,15 +15,13 @@ set(HEADERS
|
||||||
|
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
|
||||||
include_directories(${SDL2_INCLUDE_DIR})
|
|
||||||
|
|
||||||
add_executable(citra ${SRCS} ${HEADERS})
|
add_executable(citra ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(citra PRIVATE common core input_common)
|
target_link_libraries(citra PRIVATE common core input_common)
|
||||||
target_link_libraries(citra PRIVATE ${SDL2_LIBRARY} inih glad)
|
target_link_libraries(citra PRIVATE inih glad)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_link_libraries(citra PRIVATE getopt)
|
target_link_libraries(citra PRIVATE getopt)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2 Threads::Threads)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
|
|
|
@ -13,7 +13,6 @@ set(HEADERS
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
set(SRCS ${SRCS} sdl/sdl.cpp)
|
set(SRCS ${SRCS} sdl/sdl.cpp)
|
||||||
set(HEADERS ${HEADERS} sdl/sdl.h)
|
set(HEADERS ${HEADERS} sdl/sdl.h)
|
||||||
include_directories(${SDL2_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
create_directory_groups(${SRCS} ${HEADERS})
|
create_directory_groups(${SRCS} ${HEADERS})
|
||||||
|
@ -22,6 +21,6 @@ add_library(input_common STATIC ${SRCS} ${HEADERS})
|
||||||
target_link_libraries(input_common PUBLIC core PRIVATE common)
|
target_link_libraries(input_common PUBLIC core PRIVATE common)
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY})
|
target_link_libraries(input_common PRIVATE SDL2)
|
||||||
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue