CMake: Use targets for all optionally-external dependencies

This commit is contained in:
TellowKrinkle 2023-04-16 00:57:34 -05:00
parent 63090d411d
commit 5b10a80401
25 changed files with 172 additions and 133 deletions

View File

@ -6,7 +6,7 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUBEB DEFAULT_MSG
CUBEB_INCLUDE_DIR CUBEB_LIBRARY)
if(CUBEB_FOUND AND NOT TARGET CUBEB)
if(CUBEB_FOUND AND NOT TARGET cubeb::cubeb)
add_library(cubeb::cubeb UNKNOWN IMPORTED)
set_target_properties(cubeb::cubeb PROPERTIES
IMPORTED_LOCATION "${CUBEB_LIBRARY}"

15
CMake/FindLZO.cmake Normal file
View File

@ -0,0 +1,15 @@
find_path(LZO_INCLUDE_DIR lzo/lzo1x.h)
find_library(LZO_LIBRARY lzo2)
mark_as_advanced(LZO_INCLUDE_DIR LZO_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZO DEFAULT_MSG
LZO_INCLUDE_DIR LZO_LIBRARY)
if(LZO_FOUND AND NOT TARGET LZO::LZO)
add_library(LZO::LZO UNKNOWN IMPORTED)
set_target_properties(LZO::LZO PROPERTIES
IMPORTED_LOCATION "${LZO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LZO_INCLUDE_DIR}"
)
endif()

View File

@ -40,4 +40,11 @@ elseif (NOT LIBUSB_FOUND)
mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
endif ()
if(LIBUSB_FOUND AND NOT TARGET LibUSB::LibUSB)
add_library(LibUSB::LibUSB UNKNOWN IMPORTED)
set_target_properties(LibUSB::LibUSB PROPERTIES
IMPORTED_LOCATION "${LIBUSB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}"
)
endif()

View File

@ -7,18 +7,53 @@ find_library(MBEDCRYPTO_LIBRARY mbedcrypto PATH_SUFFIXES mbedtls2)
set(MBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS})
check_cxx_source_compiles("
#include <mbedtls/version.h>
#if MBEDTLS_VERSION_NUMBER < 0x021C0000
#error \"Your mbed TLS version is too old.\"
#endif
int main() {}"
MBEDTLS_VERSION_OK)
unset(CMAKE_REQUIRED_INCLUDES)
if(NOT MBEDTLS_INCLUDE_DIR STREQUAL "MBEDTLS_INCLUDE_DIR-NOTFOUND")
if(EXISTS ${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h)
file(STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h MBEDTLS_VERSION_STR REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*")
else()
file(STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLS_VERSION_STR REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*")
endif()
string(REGEX REPLACE "^#define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"([.0-9]+)\".*" "\\1" MBEDTLS_VERSION ${MBEDTLS_VERSION_STR})
endif()
if(NOT MBEDTLS_INCLUDE_DIR STREQUAL "MBEDTLS_INCLUDE_DIR-NOTFOUND" AND MBEDTLS_VERSION VERSION_GREATER_EQUAL 3)
# Once CMake 3.19 is required, we can enable HANDLE_VERSION_RANGE and use that
if(MBEDTLS_FIND_REQUIRED)
set(type FATAL_ERROR)
else()
set(type STATUS)
endif()
if(MBEDTLS_FIND_REQUIRED OR NOT MBEDTLS_FIND_QUIETLY)
message(${type} "Could NOT find MBEDTLS: Found unsuitable version \"${MBEDTLS_VERSION}\", but a 2.x version is required (found ${MBEDTLS_INCLUDE_DIR})")
endif()
set(MBEDTLS_FOUND FALSE)
else()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY MBEDTLS_VERSION_OK)
find_package_handle_standard_args(MBEDTLS
REQUIRED_VARS MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY
VERSION_VAR MBEDTLS_VERSION)
endif()
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
if(MBEDTLS_FOUND)
add_library(MbedTLS::mbedcrypto UNKNOWN IMPORTED)
set_target_properties(MbedTLS::mbedcrypto PROPERTIES
IMPORTED_LOCATION "${MBEDCRYPTO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIR}"
)
add_library(MbedTLS::mbedx509 UNKNOWN IMPORTED)
set_target_properties(MbedTLS::mbedx509 PROPERTIES
IMPORTED_LOCATION "${MBEDX509_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES MbedTLS::mbedcrypto
)
add_library(MbedTLS::mbedtls UNKNOWN IMPORTED)
set_target_properties(MbedTLS::mbedtls PROPERTIES
IMPORTED_LOCATION "${MBEDTLS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES MbedTLS::mbedx509
)
endif()

View File

@ -5,14 +5,17 @@ find_path(MINIUPNPC_INCLUDE_DIR miniupnpc.h PATH_SUFFIXES miniupnpc)
find_library(MINIUPNPC_LIBRARY miniupnpc)
if(MINIUPNPC_INCLUDE_DIR)
file(STRINGS "${MINIUPNPC_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
if(MINIUPNPC_API_VERSION_STR)
string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)" "\\1" MINIUPNPC_API_VERSION ${MINIUPNPC_API_VERSION_STR})
file(STRINGS "${MINIUPNPC_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_VERSION[\t ]+.*")
if(MINIUPNPC_VERSION_STR)
string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_VERSION[\t ]+\"([.0-9]+)\"" "\\1" MINIUPNPC_VERSION ${MINIUPNPC_VERSION_STR})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MINIUPNPC DEFAULT_MSG MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY MINIUPNPC_API_VERSION)
find_package_handle_standard_args(MINIUPNPC
REQUIRED_VARS MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY
VERSION_VAR MINIUPNPC_VERSION
)
set(MINIUPNPC_LIBRARIES ${MINIUPNPC_LIBRARY})
set(MINIUPNPC_INCLUDE_DIRS ${MINIUPNPC_INCLUDE_DIR})

View File

@ -206,4 +206,20 @@ endif()
# handle success
if(SFML_FOUND)
message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}")
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
if(NOT TARGET sfml-${FIND_SFML_COMPONENT_LOWER})
add_library(sfml-${FIND_SFML_COMPONENT_LOWER} UNKNOWN IMPORTED)
set_target_properties(sfml-${FIND_SFML_COMPONENT_LOWER} PROPERTIES
IMPORTED_LOCATION "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIR}"
)
if(NOT ${FIND_SFML_COMPONENT_LOWER} STREQUAL system)
set_target_properties(sfml-${FIND_SFML_COMPONENT_LOWER} PROPERTIES
INTERFACE_LINK_LIBRARIES sfml-system
)
endif()
endif()
endforeach()
endif()

View File

@ -85,7 +85,6 @@ if(NOT ANDROID)
option(ENABLE_CLI_TOOL "Enable dolphin-tool, a CLI-based utility for functions such as managing disc images" ON)
endif()
option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF)
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(ENABLE_NOGUI "Enable NoGUI frontend" ON)
option(ENABLE_QT "Enable Qt (Default)" ON)
@ -645,26 +644,8 @@ if(ENABLE_SDL)
message(STATUS "Using system SDL2")
else()
message(STATUS "Using static SDL2 from Externals")
option(SDL2_DISABLE_SDL2MAIN "" ON)
option(SDL2_DISABLE_INSTALL "" ON)
option(SDL2_DISABLE_UNINSTALL "" ON)
set(SDL_SHARED OFF)
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
set(SDL_STATIC ON)
set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
set(SDL_TEST OFF)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
set(OPT_DEF_LIBC ON)
add_subdirectory(Externals/SDL/SDL)
if (TARGET SDL2)
dolphin_disable_warnings_msvc(SDL2)
add_subdirectory(Externals/SDL)
endif()
if (TARGET SDL2-static)
dolphin_disable_warnings_msvc(SDL2-static)
endif()
set(SDL2_FOUND TRUE)
endif()
add_definitions(-DHAVE_SDL2=1)
endif()
if(ENABLE_ANALYTICS)
@ -747,31 +728,13 @@ if(NOT pugixml_FOUND)
add_subdirectory(Externals/pugixml)
endif()
if(USE_SHARED_ENET)
check_lib(ENET libenet enet enet/enet.h QUIET)
include(CheckSymbolExists)
if (ENET_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${ENET_INCLUDE_DIRS})
# hack: LDFLAGS already contains -lenet but all flags but the first are
# dropped; ugh, cmake
set(CMAKE_REQUIRED_FLAGS ${ENET_LDFLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${ENET_LIBRARIES})
check_symbol_exists(enet_socket_get_address enet/enet.h ENET_HAVE_SGA)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
if (NOT ENET_HAVE_SGA)
# enet is too old
set(ENET_FOUND FALSE)
endif()
endif()
endif()
pkg_check_modules(ENET libenet>=1.3.8 IMPORTED_TARGET)
if(ENET_FOUND)
message(STATUS "Using shared enet")
dolphin_alias_library(enet::enet PkgConfig::ENET)
else()
check_vendoring_approved(enet)
message(STATUS "Using static enet from Externals")
include_directories(Externals/enet/include)
add_subdirectory(Externals/enet)
endif()
@ -813,37 +776,32 @@ endif()
add_subdirectory(Externals/zlib-ng)
pkg_check_modules(MINIZIP minizip>=3.0.0)
pkg_check_modules(MINIZIP minizip>=3.0.0 IMPORTED_TARGET)
if(MINIZIP_FOUND)
message(STATUS "Using shared minizip")
include_directories(${MINIZIP_INCLUDE_DIRS})
dolphin_alias_library(minizip::minizip PkgConfig::MINIZIP)
else()
check_vendoring_approved(minizip)
message(STATUS "Shared minizip not found, falling back to the static library")
add_subdirectory(Externals/minizip)
include_directories(External/minizip)
endif()
if(NOT APPLE)
check_lib(LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET)
endif()
find_package(LZO)
if(LZO_FOUND)
message(STATUS "Using shared lzo")
else()
check_vendoring_approved(lzo)
message(STATUS "Using static lzo from Externals")
add_subdirectory(Externals/LZO)
set(LZO lzo2)
add_subdirectory(Externals/LZO EXCLUDE_FROM_ALL)
endif()
pkg_check_modules(pc_spng IMPORTED_TARGET spng)
if (pc_spng_FOUND AND TARGET PkgConfig::pc_spng)
message(STATUS "Using the system libspng")
set(spng_target PkgConfig::pc_spng)
dolphin_alias_library(spng::spng PkgConfig::pc_spng)
else()
message(STATUS "Using static libspng from Externals")
add_subdirectory(Externals/libspng)
set(spng_target spng)
endif()
# Using static FreeSurround from Externals
@ -873,40 +831,28 @@ endif()
if(NOT ANDROID)
add_definitions(-D__LIBUSB__)
if(NOT APPLE)
find_package(LibUSB)
endif()
if(LIBUSB_FOUND AND NOT APPLE)
if(LIBUSB_FOUND)
message(STATUS "Using shared LibUSB")
include_directories(${LIBUSB_INCLUDE_DIR})
else()
check_vendoring_approved(libusb)
message(STATUS "Using static LibUSB from Externals")
add_subdirectory(Externals/libusb)
set(LIBUSB_LIBRARIES usb)
add_subdirectory(Externals/libusb EXCLUDE_FROM_ALL)
endif()
set(LIBUSB_FOUND true)
endif()
set(SFML_REQD_VERSION 2.1)
if(NOT APPLE)
find_package(SFML ${SFML_REQD_VERSION} COMPONENTS network system)
endif()
find_package(SFML 2.1 COMPONENTS network system)
if(SFML_FOUND)
message(STATUS "Using shared SFML")
else()
check_vendoring_approved(sfml)
message(STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals")
add_definitions(-DSFML_STATIC)
message(STATUS "Using static SFML from Externals")
add_subdirectory(Externals/SFML)
include_directories(BEFORE Externals/SFML/include)
endif()
if(USE_UPNP)
if(NOT APPLE)
find_package(MINIUPNPC)
endif()
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
find_package(MINIUPNPC 1.6)
if(MINIUPNPC_FOUND)
message(STATUS "Using shared miniupnpc")
else()
check_vendoring_approved(miniupnpc)
@ -916,30 +862,22 @@ if(USE_UPNP)
add_definitions(-DUSE_UPNP)
endif()
if(NOT APPLE)
find_package(MBEDTLS)
endif()
find_package(MBEDTLS 2.28)
if(MBEDTLS_FOUND)
message(STATUS "Using shared mbed TLS")
include_directories(${MBEDTLS_INCLUDE_DIRS})
else()
check_vendoring_approved(mbedtls)
message(STATUS "Using static mbed TLS from Externals")
set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509)
add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL)
include_directories(Externals/mbedtls/include)
endif()
find_package(CURL)
if(CURL_FOUND)
message(STATUS "Using shared libcurl")
include_directories(${CURL_INCLUDE_DIRS})
else()
check_vendoring_approved(curl)
message(STATUS "Using static libcurl from Externals")
add_subdirectory(Externals/curl)
set(CURL_LIBRARIES curl)
include_directories(BEFORE Externals/curl/include)
add_subdirectory(Externals/curl EXCLUDE_FROM_ALL)
endif()
if(NOT ANDROID)
@ -951,7 +889,7 @@ if(TARGET Iconv::Iconv)
else()
check_vendoring_approved(iconv)
message(STATUS "Using static iconv from Externals")
add_subdirectory(Externals/libiconv-1.14)
add_subdirectory(Externals/libiconv-1.14 EXCLUDE_FROM_ALL)
endif()
if(NOT ANDROID)

View File

@ -7,3 +7,4 @@ target_include_directories(lzo2
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(LZO::LZO ALIAS lzo2)

17
Externals/SDL/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,17 @@
option(SDL2_DISABLE_SDL2MAIN "" ON)
option(SDL2_DISABLE_INSTALL "" ON)
option(SDL2_DISABLE_UNINSTALL "" ON)
set(SDL_SHARED OFF)
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
set(SDL_STATIC ON)
set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
set(SDL_TEST OFF)
set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
set(OPT_DEF_LIBC ON)
add_subdirectory(SDL)
if (TARGET SDL2)
dolphin_disable_warnings_msvc(SDL2)
endif()
if (TARGET SDL2-static)
dolphin_disable_warnings_msvc(SDL2-static)
endif()

View File

@ -1,5 +1,3 @@
include_directories(BEFORE include src)
set(SRC_NETWORK
src/SFML/Network/Http.cpp
src/SFML/Network/IPAddress.cpp
@ -23,7 +21,11 @@ set(SRC_SYSTEM
src/SFML/System/Time.cpp
)
add_library(sfml-network ${SRC_NETWORK})
add_library(sfml-system ${SRC_SYSTEM})
add_library(sfml-network STATIC ${SRC_NETWORK})
add_library(sfml-system STATIC ${SRC_SYSTEM})
target_compile_definitions(sfml-system PUBLIC SFML_STATIC)
target_include_directories(sfml-system PUBLIC include PRIVATE src)
target_include_directories(sfml-network PUBLIC include PRIVATE src)
target_link_libraries(sfml-network PUBLIC sfml-system)
dolphin_disable_warnings_msvc(sfml-network)
dolphin_disable_warnings_msvc(sfml-system)

View File

@ -352,3 +352,4 @@ if(USE_AUDIOUNIT AND USE_AUDIOUNIT_RUST)
debug "${PROJECT_SOURCE_DIR}/cubeb/src/cubeb-coreaudio-rs/target/debug/libcubeb_coreaudio.a"
optimized "${PROJECT_SOURCE_DIR}/cubeb/src/cubeb-coreaudio-rs/target/release/libcubeb_coreaudio.a")
endif()
add_library(cubeb::cubeb ALIAS cubeb)

View File

@ -4,8 +4,6 @@ else()
add_definitions(-DHAVE_CONFIG_H)
endif()
include_directories(.)
file(GLOB SRCS *.c vauth/*.c vtls/*.c)
add_library(
curl
@ -14,5 +12,7 @@ add_library(
)
dolphin_disable_warnings_msvc(curl)
target_link_libraries(curl ${MBEDTLS_LIBRARIES} zlibstatic)
target_include_directories(curl PRIVATE . INTERFACE ../include)
target_link_libraries(curl MbedTLS::mbedtls zlibstatic)
target_compile_definitions(curl PUBLIC CURL_STATICLIB PRIVATE CURL_DISABLE_LDAP)
add_library(CURL::libcurl ALIAS curl)

View File

@ -59,8 +59,6 @@ if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()
include_directories(${PROJECT_SOURCE_DIR}/include)
set(INCLUDE_FILES_PREFIX include/enet)
set(INCLUDE_FILES
${INCLUDE_FILES_PREFIX}/callbacks.h
@ -92,8 +90,10 @@ add_library(enet STATIC
${INCLUDE_FILES}
${SOURCE_FILES}
)
target_include_directories(enet PUBLIC include)
dolphin_disable_warnings_msvc(enet)
add_library(enet::enet ALIAS enet)
if (MINGW)
target_link_libraries(enet winmm ws2_32)

View File

@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.0)
project(spng C)
add_library(spng STATIC ${CMAKE_CURRENT_LIST_DIR}/libspng/spng/spng.c)
add_library(spng STATIC libspng/spng/spng.c)
target_compile_definitions(spng PUBLIC SPNG_STATIC)
target_link_libraries(spng PUBLIC ZLIB::ZLIB)
target_include_directories(spng PUBLIC ${CMAKE_CURRENT_LIST_DIR}/libspng/spng/)
target_include_directories(spng PUBLIC libspng/spng)
dolphin_disable_warnings_msvc(spng)
add_library(spng::spng ALIAS spng)

View File

@ -125,3 +125,4 @@ check_include_files(sys/timerfd.h HAVE_TIMERFD)
check_include_files(unistd.h HAVE_UNISTD_H)
configure_file(config.h.in config.h)
add_library(LibUSB::LibUSB ALIAS usb)

View File

@ -222,6 +222,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY)
endif(USE_SHARED_MBEDTLS_LIBRARY)
foreach(target IN LISTS target_libraries)
add_library(MbedTLS::${target} ALIAS ${target}) # add_subdirectory support
# Include public header files from /include and other directories
# declared by /3rdparty/**/CMakeLists.txt. Include private header files
# from /library and others declared by /3rdparty/**/CMakeLists.txt.

View File

@ -67,4 +67,4 @@ endif()
target_link_libraries(minizip PUBLIC ZLIB::ZLIB)
add_library(minizip-ng ALIAS minizip)
add_library(minizip::minizip ALIAS minizip)

View File

@ -83,7 +83,7 @@ PUBLIC
common
PRIVATE
cubeb
cubeb::cubeb
SoundTouch
FreeSurround)

View File

@ -144,16 +144,17 @@ endif()
target_link_libraries(common
PUBLIC
${CMAKE_THREAD_LIBS_INIT}
enet
enet::enet
fmt::fmt
${MBEDTLS_LIBRARIES}
minizip-ng
MbedTLS::mbedtls
minizip::minizip
sfml-network
PRIVATE
${CURL_LIBRARIES}
CURL::libcurl
FatFs
Iconv::Iconv
${spng_target}
spng::spng
${VTUNE_LIBRARIES}
)

View File

@ -603,24 +603,23 @@ target_link_libraries(core
PUBLIC
audiocommon
common
cubeb
discio
enet
enet::enet
expr
inputcommon
${MBEDTLS_LIBRARIES}
MbedTLS::mbedtls
pugixml
RangeSet::RangeSet
sfml-network
sfml-system
videonull
videoogl
videosoftware
PRIVATE
cubeb::cubeb
FatFs
fmt::fmt
${LZO}
LZO::LZO
ZLIB::ZLIB
)
@ -644,9 +643,8 @@ elseif (ANDROID)
)
endif()
if(LIBUSB_FOUND)
# Using shared LibUSB
target_link_libraries(core PUBLIC ${LIBUSB_LIBRARIES})
if(TARGET LibUSB::LibUSB)
target_link_libraries(core PUBLIC LibUSB::LibUSB)
target_sources(core PRIVATE
IOS/USB/LibusbDevice.cpp
IOS/USB/LibusbDevice.h

View File

@ -75,7 +75,7 @@ PUBLIC
PRIVATE
fmt::fmt
minizip-ng
minizip::minizip
pugixml
ZLIB::ZLIB
)

View File

@ -81,7 +81,8 @@ PUBLIC
PRIVATE
fmt::fmt
${spng_target}
sfml-network
spng::spng
)
if(WIN32)
@ -146,7 +147,7 @@ elseif(ANDROID)
endif()
if(NOT ANDROID)
target_link_libraries(inputcommon PUBLIC ${LIBUSB_LIBRARIES})
target_link_libraries(inputcommon PUBLIC LibUSB::LibUSB)
endif()
if(LIBEVDEV_FOUND AND LIBUDEV_FOUND)
@ -174,12 +175,13 @@ if(UNIX)
)
endif()
if(SDL2_FOUND)
if(ENABLE_SDL)
target_sources(inputcommon PRIVATE
ControllerInterface/SDL/SDL.cpp
ControllerInterface/SDL/SDL.h
)
target_link_libraries(inputcommon PRIVATE SDL2::SDL2)
target_compile_definitions(inputcommon PUBLIC HAVE_SDL2=1)
endif()
if(MSVC)

View File

@ -29,7 +29,7 @@ target_link_libraries(uicommon
PUBLIC
common
cpp-optparse
minizip-ng
minizip::minizip
pugixml
PRIVATE
@ -48,8 +48,8 @@ if(ENABLE_X11 AND X11_FOUND)
target_link_libraries(uicommon PUBLIC ${XRANDR_LIBRARIES})
endif()
if(LIBUSB_FOUND)
target_link_libraries(uicommon PRIVATE ${LIBUSB_LIBRARIES})
if(TARGET LibUSB::LibUSB)
target_link_libraries(uicommon PRIVATE LibUSB::LibUSB)
endif()
if(ENABLE_LLVM)

View File

@ -6,7 +6,7 @@ add_library(updatercommon
target_link_libraries(updatercommon PRIVATE
uicommon
mbedtls
MbedTLS::mbedtls
ZLIB::ZLIB
ed25519
cpp-optparse

View File

@ -195,7 +195,7 @@ PUBLIC
core
PRIVATE
fmt::fmt
${spng_target}
spng::spng
xxhash
imgui
implot