mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-18 11:23:38 +00:00
Merge pull request #14224 from JoshuaVandaele/windows-mz-ng-fix
Externals: Fix clashing dependencies
This commit is contained in:
commit
a28fff3f00
@ -50,6 +50,17 @@ function(dolphin_add_bundled_library library use_system bundled_path)
|
||||
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
|
||||
endfunction()
|
||||
|
||||
function(dolphin_set_library_type library type)
|
||||
if(DEFINED ${library}_TYPE AND NOT ${${library}_TYPE} STREQUAL "${type}")
|
||||
message(FATAL_ERROR
|
||||
"The selection for ${library} changed from '${${library}_TYPE}' to '${type}' after configuration.\n"
|
||||
"Please delete the build directory (or at least CMakeCache.txt) and reconfigure."
|
||||
)
|
||||
endif()
|
||||
|
||||
set(${library}_TYPE "${type}" CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
function(dolphin_find_optional_system_library library bundled_path)
|
||||
dolphin_optional_system_library(use_system ${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
@ -101,11 +112,11 @@ function(dolphin_find_optional_system_library library bundled_path)
|
||||
endif()
|
||||
endif()
|
||||
if(${prefix}_FOUND)
|
||||
dolphin_set_library_type(${library} "System")
|
||||
message(STATUS "Using system ${library}")
|
||||
set(${prefix}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_set_library_type(${library} "Bundled")
|
||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -119,11 +130,11 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
|
||||
endif()
|
||||
endif()
|
||||
if(${library}_FOUND)
|
||||
dolphin_set_library_type(${library} "System")
|
||||
message(STATUS "Using system ${library}")
|
||||
dolphin_alias_library(${alias} PkgConfig::${library})
|
||||
set(${library}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_set_library_type(${library} "Bundled")
|
||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||
set(${library}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -11,8 +11,15 @@
|
||||
if(ANDROID)
|
||||
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "libusb-1.0 not found.")
|
||||
elseif (NOT LIBUSB_FOUND)
|
||||
pkg_check_modules (LIBUSB_PKG libusb-1.0)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(TARGET LibUSB::LibUSB)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT LIBUSB_FOUND)
|
||||
pkg_check_modules(LIBUSB_PKG libusb-1.0)
|
||||
|
||||
find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
|
||||
PATHS
|
||||
@ -30,21 +37,19 @@ elseif (NOT LIBUSB_FOUND)
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
|
||||
else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "libusb-1.0 not found.")
|
||||
endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
|
||||
endif ()
|
||||
if(LIBUSB_FOUND AND NOT TARGET LibUSB::LibUSB)
|
||||
endif()
|
||||
|
||||
|
||||
if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
add_library(LibUSB::LibUSB UNKNOWN IMPORTED)
|
||||
set_target_properties(LibUSB::LibUSB PROPERTIES
|
||||
IMPORTED_LOCATION "${LIBUSB_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}"
|
||||
)
|
||||
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
|
||||
else()
|
||||
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "libusb-1.0 not found.")
|
||||
endif()
|
||||
|
||||
|
||||
@ -582,10 +582,6 @@ if(UNIX)
|
||||
add_definitions(-DUSE_MEMORYWATCHER=1)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SDL)
|
||||
dolphin_find_optional_system_library(SDL3 Externals/SDL 3.2.0)
|
||||
endif()
|
||||
|
||||
if(ENABLE_ANALYTICS)
|
||||
message(STATUS "Enabling analytics collection (subject to end-user opt-in)")
|
||||
add_definitions(-DUSE_ANALYTICS=1)
|
||||
@ -658,6 +654,13 @@ if(NOT (WIN32 AND _M_ARM_64))
|
||||
add_definitions(-DHAS_OPENGL)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
if(ANDROID)
|
||||
set(USE_SYSTEM_Iconv OFF)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(Iconv Externals/libiconv 1.14)
|
||||
endif()
|
||||
|
||||
dolphin_find_optional_system_library(pugixml Externals/pugixml)
|
||||
|
||||
dolphin_find_optional_system_library_pkgconfig(ENET libenet>=1.3.18 enet::enet Externals/enet)
|
||||
@ -701,12 +704,14 @@ if(ENABLE_CUBEB)
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID)
|
||||
dolphin_find_optional_system_library_pkgconfig(
|
||||
LibUSB libusb-1.0 LibUSB::LibUSB Externals/libusb
|
||||
)
|
||||
dolphin_find_optional_system_library(LibUSB Externals/libusb)
|
||||
add_definitions(-D__LIBUSB__)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SDL)
|
||||
dolphin_find_optional_system_library(SDL3 Externals/SDL 3.2.0)
|
||||
endif()
|
||||
|
||||
dolphin_find_optional_system_library(SFML Externals/SFML 3.0 COMPONENTS Network System)
|
||||
|
||||
if(USE_UPNP)
|
||||
@ -718,15 +723,6 @@ dolphin_find_optional_system_library(MBEDTLS Externals/mbedtls 2.28)
|
||||
|
||||
dolphin_find_optional_system_library(CURL Externals/curl)
|
||||
|
||||
if(NOT WIN32)
|
||||
if(NOT ANDROID)
|
||||
dolphin_find_optional_system_library(Iconv Externals/libiconv 1.14)
|
||||
else()
|
||||
message(STATUS "Using static iconv from Externals")
|
||||
add_subdirectory(Externals/libiconv EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID)
|
||||
dolphin_find_optional_system_library(HIDAPI Externals/hidapi)
|
||||
endif()
|
||||
|
||||
5
Externals/SDL/CMakeLists.txt
vendored
5
Externals/SDL/CMakeLists.txt
vendored
@ -20,6 +20,11 @@ if(CCACHE_BIN)
|
||||
set(CCACHE_BINARY ${CCACHE_BIN})
|
||||
endif()
|
||||
|
||||
if(LibUSB_TYPE STREQUAL Bundled)
|
||||
set(LibUSB_FOUND TRUE)
|
||||
set(SDL_HIDAPI_LIBUSB_SHARED OFF)
|
||||
endif()
|
||||
|
||||
add_subdirectory(SDL)
|
||||
|
||||
if (TARGET SDL3)
|
||||
|
||||
4
Externals/curl/CMakeLists.txt
vendored
4
Externals/curl/CMakeLists.txt
vendored
@ -13,7 +13,9 @@ set(HTTP_ONLY ON)
|
||||
set(CURL_USE_LIBPSL OFF)
|
||||
set(CURL_USE_LIBSSH2 OFF)
|
||||
set(CURL_ZLIB OFF CACHE BOOL "" FORCE)
|
||||
set(CURL_ZSTD OFF)
|
||||
set(CURL_ZSTD OFF CACHE BOOL "" FORCE)
|
||||
set(ZLIB_FOUND FALSE) # TODO: Remove once we update to cURL >=8.17.1 https://github.com/curl/curl/pull/20147
|
||||
set(ZSTD_FOUND FALSE) # TODO: Same as above
|
||||
set(USE_LIBIDN2 OFF)
|
||||
set(USE_NGHTTP2 OFF)
|
||||
|
||||
|
||||
13
Externals/libusb/CMakeLists.txt
vendored
13
Externals/libusb/CMakeLists.txt
vendored
@ -125,4 +125,15 @@ 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)
|
||||
|
||||
# We don't create an ALIAS here so that dependencies (SDL) that try_compile libusb
|
||||
# don't fail due to LibUSB::LibUSB being an alias target
|
||||
add_library(LibUSB::LibUSB INTERFACE IMPORTED GLOBAL)
|
||||
target_link_libraries(LibUSB::LibUSB
|
||||
INTERFACE
|
||||
usb
|
||||
)
|
||||
target_include_directories(LibUSB::LibUSB
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libusb/libusb
|
||||
)
|
||||
|
||||
35
Externals/minizip-ng/CMakeLists.txt
vendored
35
Externals/minizip-ng/CMakeLists.txt
vendored
@ -3,7 +3,42 @@ set(MZ_BUILD_TESTS OFF)
|
||||
set(MZ_BUILD_UNIT_TESTS OFF)
|
||||
set(MZ_BUILD_FUZZ_TESTS OFF)
|
||||
set(MZ_CODE_COVERAGE OFF)
|
||||
set(MZ_FETCH_LIBS OFF)
|
||||
set(MZ_BZIP2 OFF)
|
||||
set(MZ_PKCRYPT OFF)
|
||||
set(MZ_WZAES OFF)
|
||||
set(MZ_OPENSSL OFF)
|
||||
set(MZ_LIBBSD OFF)
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
|
||||
if(Iconv_TYPE STREQUAL Bundled)
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_Iconv TRUE)
|
||||
set(Iconv_FOUND TRUE)
|
||||
set(Iconv_LIBRARIES Iconv::Iconv)
|
||||
get_target_property(Iconv_INCLUDE_DIRS ${Iconv_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
if(LibLZMA_TYPE STREQUAL Bundled)
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_LibLZMA TRUE)
|
||||
set(LIBLZMA_FOUND TRUE)
|
||||
set(LIBLZMA_LIBRARIES LibLZMA::LibLZMA)
|
||||
get_target_property(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
if(ZLIB_TYPE STREQUAL Bundled)
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB TRUE)
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_LIBRARIES ZLIB::ZLIB)
|
||||
get_target_property(ZLIB_INCLUDE_DIRS ${ZLIB_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
if(ZSTD_TYPE STREQUAL Bundled)
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_ZSTD TRUE)
|
||||
set(ZSTD_FOUND TRUE)
|
||||
set(ZSTD_LIBRARIES zstd::zstd)
|
||||
get_target_property(ZSTD_INCLUDE_DIRS ${ZSTD_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
|
||||
# minizip-ng otherwise uses system libraries when we provide them above
|
||||
set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig TRUE)
|
||||
set(PKGCONFIG_FOUND FALSE)
|
||||
|
||||
add_subdirectory(minizip-ng)
|
||||
dolphin_disable_warnings(minizip-ng)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user