mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Merge pull request #11955 from TellowKrinkle/CMakeDependencies
CMake: Allow ignoring system packages
This commit is contained in:
commit
fa81006b51
@ -1,29 +0,0 @@
|
||||
# When packaging Dolphin for an OS distribution, distro vendors usually prefer
|
||||
# to limit vendored ("Externals") dependencies as much as possible, in favor of
|
||||
# using system provided libraries. This modules provides an option to allow
|
||||
# only specific vendored dependencies and error-out at configuration time for
|
||||
# non-approved ones.
|
||||
#
|
||||
# Usage:
|
||||
# $ cmake -D APPROVED_VENDORED_DEPENDENCIES="a;b;c;..."
|
||||
#
|
||||
# Unless the option is explicitly used, vendored dependencies control is
|
||||
# disabled.
|
||||
#
|
||||
# If you want to disallow all vendored dependencies, put "none" in the approved
|
||||
# dependencies list.
|
||||
|
||||
set(APPROVED_VENDORED_DEPENDENCIES "" CACHE STRING "\
|
||||
Semicolon separated list of approved vendored dependencies. See docstring in \
|
||||
CMake/CheckVendoringApproved.cmake.")
|
||||
|
||||
function(check_vendoring_approved dep)
|
||||
if(APPROVED_VENDORED_DEPENDENCIES)
|
||||
if(NOT dep IN_LIST APPROVED_VENDORED_DEPENDENCIES)
|
||||
message(SEND_ERROR "\
|
||||
Library ${dep} was not found systemwide and was not approved for vendoring. \
|
||||
Vendored dependencies control is enabled. Add \"${dep}\" to the \
|
||||
APPROVED_VENDORED_DEPENDENCIES list to bypass this error.")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
@ -18,3 +18,78 @@ function(dolphin_make_imported_target_if_missing target lib)
|
||||
add_library(${target} ALIAS _${lib})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(dolphin_optional_system_library library)
|
||||
string(TOUPPER ${library} upperlib)
|
||||
set(USE_SYSTEM_${upperlib} "" CACHE STRING "Use system ${library} instead of bundled. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled, blank - Delegate to USE_SYSTEM_LIBS. Default is blank.")
|
||||
if("${USE_SYSTEM_${upperlib}}" STREQUAL "")
|
||||
if(APPROVED_VENDORED_DEPENDENCIES)
|
||||
string(TOLOWER ${library} lowerlib)
|
||||
if(lowerlib IN_LIST APPROVED_VENDORED_DEPENDENCIES)
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} AUTO PARENT_SCOPE)
|
||||
else()
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} ON PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_LIBS} PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_${upperlib}} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(dolphin_add_bundled_library library bundled_path)
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if (${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO")
|
||||
message(STATUS "No system ${library} was found. Using static ${library} from Externals.")
|
||||
else()
|
||||
message(STATUS "Using static ${library} from Externals")
|
||||
endif()
|
||||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${bundled_path}/CMakeLists.txt")
|
||||
message(FATAL_ERROR "No bundled ${library} was found. Did you forget to checkout submodules?")
|
||||
endif()
|
||||
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
|
||||
endfunction()
|
||||
|
||||
function(dolphin_find_optional_system_library library bundled_path)
|
||||
dolphin_optional_system_library(${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if(RESOLVED_USE_SYSTEM_${upperlib})
|
||||
find_package(${library} ${ARGN})
|
||||
# Yay for cmake packages being inconsistent
|
||||
if(DEFINED ${library}_FOUND)
|
||||
set(prefix ${library})
|
||||
else()
|
||||
set(prefix ${upperlib})
|
||||
endif()
|
||||
if((NOT ${found}) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO"))
|
||||
message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
|
||||
endif()
|
||||
endif()
|
||||
if(${prefix}_FOUND)
|
||||
message(STATUS "Using system ${library}")
|
||||
set(${prefix}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_add_bundled_library(${library} ${bundled_path})
|
||||
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(dolphin_find_optional_system_library_pkgconfig library search alias bundled_path)
|
||||
dolphin_optional_system_library(${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if(RESOLVED_USE_SYSTEM_${upperlib})
|
||||
pkg_check_modules(${library} ${search} ${ARGN} IMPORTED_TARGET)
|
||||
if((NOT ${library}_FOUND) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO"))
|
||||
message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
|
||||
endif()
|
||||
endif()
|
||||
if(${library}_FOUND)
|
||||
message(STATUS "Using system ${library}")
|
||||
dolphin_alias_library(${alias} PkgConfig::${library})
|
||||
set(${library}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_add_bundled_library(${library} ${bundled_path})
|
||||
set(${library}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -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
15
CMake/FindLZO.cmake
Normal 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()
|
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
|
||||
MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY MBEDTLS_VERSION_OK)
|
||||
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
|
||||
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()
|
||||
|
@ -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})
|
||||
|
@ -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()
|
||||
|
241
CMakeLists.txt
241
CMakeLists.txt
@ -85,7 +85,11 @@ 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)
|
||||
|
||||
set(USE_SYSTEM_LIBS "AUTO" CACHE STRING "Use system libraries instead of bundled libraries. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled. Default is AUTO")
|
||||
if(APPROVED_VENDORED_DEPENDENCIES)
|
||||
message(WARNING "APPROVED_VENDORED_DEPENDENCIES is deprecated. Please migrate to setting USE_SYSTEM_LIBS to ON and setting USE_SYSTEM_<dependency> to either AUTO or OFF to allow bundled libs.")
|
||||
endif()
|
||||
option(USE_UPNP "Enables UPnP port mapping support" ON)
|
||||
option(ENABLE_NOGUI "Enable NoGUI frontend" ON)
|
||||
option(ENABLE_QT "Enable Qt (Default)" ON)
|
||||
@ -158,7 +162,6 @@ list(APPEND CMAKE_MODULE_PATH
|
||||
# Support functions
|
||||
include(CheckAndAddFlag)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckVendoringApproved)
|
||||
include(DolphinCompileDefinitions)
|
||||
include(DolphinDisableWarningsMSVC)
|
||||
include(DolphinLibraryTools)
|
||||
@ -586,32 +589,7 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SDL)
|
||||
find_package(SDL2)
|
||||
|
||||
if(SDL2_FOUND)
|
||||
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)
|
||||
endif()
|
||||
if (TARGET SDL2-static)
|
||||
dolphin_disable_warnings_msvc(SDL2-static)
|
||||
endif()
|
||||
set(SDL2_FOUND TRUE)
|
||||
endif()
|
||||
add_definitions(-DHAVE_SDL2=1)
|
||||
dolphin_find_optional_system_library(SDL2 Externals/SDL)
|
||||
endif()
|
||||
|
||||
if(ENABLE_ANALYTICS)
|
||||
@ -652,14 +630,8 @@ if (_M_X86)
|
||||
endif()
|
||||
add_subdirectory(Externals/cpp-optparse)
|
||||
|
||||
find_package(fmt 8)
|
||||
if(fmt_FOUND)
|
||||
message(STATUS "Using shared fmt ${fmt_VERSION}")
|
||||
else()
|
||||
check_vendoring_approved(fmt)
|
||||
message(STATUS "Using static fmt from Externals")
|
||||
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(fmt Externals/fmt 8)
|
||||
|
||||
add_subdirectory(Externals/imgui)
|
||||
add_subdirectory(Externals/implot)
|
||||
add_subdirectory(Externals/glslang)
|
||||
@ -687,111 +659,30 @@ if(NOT WIN32 OR (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")))
|
||||
add_definitions(-DHAS_OPENGL)
|
||||
endif()
|
||||
|
||||
find_package(pugixml)
|
||||
if(NOT pugixml_FOUND)
|
||||
check_vendoring_approved(pugixml)
|
||||
message(STATUS "Using static pugixml from Externals")
|
||||
add_subdirectory(Externals/pugixml)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(pugixml Externals/pugixml)
|
||||
|
||||
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()
|
||||
if (ENET_FOUND)
|
||||
message(STATUS "Using shared enet")
|
||||
else()
|
||||
check_vendoring_approved(enet)
|
||||
message(STATUS "Using static enet from Externals")
|
||||
include_directories(Externals/enet/include)
|
||||
add_subdirectory(Externals/enet)
|
||||
endif()
|
||||
dolphin_find_optional_system_library_pkgconfig(ENET libenet>=1.3.8 enet::enet Externals/enet)
|
||||
|
||||
if(NOT XXHASH_FOUND)
|
||||
message(STATUS "Using static xxhash from Externals")
|
||||
add_subdirectory(Externals/xxhash)
|
||||
endif()
|
||||
|
||||
find_package(BZip2)
|
||||
if(BZIP2_FOUND)
|
||||
message(STATUS "Using shared bzip2")
|
||||
else()
|
||||
check_vendoring_approved(bzip2)
|
||||
message(STATUS "Shared bzip2 not found, falling back to the static library")
|
||||
add_subdirectory(Externals/bzip2)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(BZip2 Externals/bzip2)
|
||||
|
||||
# macOS ships with liblzma.dylib but no headers, so check for the headers too
|
||||
find_package(LibLZMA)
|
||||
if(LIBLZMA_FOUND)
|
||||
# Imported target added in CMake 3.14
|
||||
dolphin_make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
|
||||
message(STATUS "Using shared lzma")
|
||||
else()
|
||||
check_vendoring_approved(lzma)
|
||||
message(STATUS "Shared lzma not found, falling back to the static library")
|
||||
add_subdirectory(Externals/liblzma)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(LibLZMA Externals/liblzma)
|
||||
# Imported target added in CMake 3.14
|
||||
dolphin_make_imported_target_if_missing(LibLZMA::LibLZMA LIBLZMA)
|
||||
|
||||
pkg_check_modules(ZSTD QUIET libzstd>=1.4.0 IMPORTED_TARGET)
|
||||
if(ZSTD_FOUND)
|
||||
message(STATUS "Using shared zstd version: " ${ZSTD_VERSION})
|
||||
dolphin_alias_library(zstd::zstd PkgConfig::ZSTD)
|
||||
else()
|
||||
check_vendoring_approved(zstd)
|
||||
message(STATUS "Shared zstd not found, falling back to the static library")
|
||||
add_subdirectory(Externals/zstd)
|
||||
endif()
|
||||
dolphin_find_optional_system_library_pkgconfig(ZSTD libzstd>=1.4.0 zstd::zstd Externals/zstd)
|
||||
|
||||
add_subdirectory(Externals/zlib-ng)
|
||||
|
||||
pkg_check_modules(MINIZIP minizip>=3.0.0)
|
||||
if(MINIZIP_FOUND)
|
||||
message(STATUS "Using shared minizip")
|
||||
include_directories(${MINIZIP_INCLUDE_DIRS})
|
||||
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()
|
||||
dolphin_find_optional_system_library_pkgconfig(MINIZIP minizip>=3.0.0 minizip::minizip Externals/minizip)
|
||||
|
||||
if(NOT APPLE)
|
||||
check_lib(LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET)
|
||||
endif()
|
||||
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)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(LZO Externals/LZO)
|
||||
|
||||
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)
|
||||
else()
|
||||
message(STATUS "Using static libspng from Externals")
|
||||
add_subdirectory(Externals/libspng)
|
||||
set(spng_target spng)
|
||||
endif()
|
||||
dolphin_find_optional_system_library_pkgconfig(SPNG spng spng::spng Externals/libspng)
|
||||
|
||||
# Using static FreeSurround from Externals
|
||||
# There is no system FreeSurround library.
|
||||
@ -809,105 +700,33 @@ endif()
|
||||
add_subdirectory(Externals/soundtouch)
|
||||
include_directories(Externals/soundtouch)
|
||||
|
||||
find_package(CUBEB)
|
||||
if(CUBEB_FOUND)
|
||||
message(STATUS "Using the system cubeb")
|
||||
else()
|
||||
check_vendoring_approved(cubeb)
|
||||
message(STATUS "Using static cubeb from Externals")
|
||||
add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(CUBEB Externals/cubeb)
|
||||
|
||||
if(NOT ANDROID)
|
||||
dolphin_find_optional_system_library(LibUSB Externals/libusb)
|
||||
add_definitions(-D__LIBUSB__)
|
||||
if(NOT APPLE)
|
||||
find_package(LibUSB)
|
||||
endif()
|
||||
if(LIBUSB_FOUND AND NOT APPLE)
|
||||
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)
|
||||
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()
|
||||
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)
|
||||
add_subdirectory(Externals/SFML)
|
||||
include_directories(BEFORE Externals/SFML/include)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(SFML Externals/SFML 2.1 COMPONENTS network system)
|
||||
|
||||
if(USE_UPNP)
|
||||
if(NOT APPLE)
|
||||
find_package(MINIUPNPC)
|
||||
endif()
|
||||
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
|
||||
message(STATUS "Using shared miniupnpc")
|
||||
else()
|
||||
check_vendoring_approved(miniupnpc)
|
||||
message(STATUS "Using static miniupnpc from Externals")
|
||||
add_subdirectory(Externals/miniupnpc)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(MINIUPNPC Externals/miniupnpc 1.6)
|
||||
add_definitions(-DUSE_UPNP)
|
||||
endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
find_package(MBEDTLS)
|
||||
endif()
|
||||
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()
|
||||
dolphin_find_optional_system_library(MBEDTLS Externals/mbedtls 2.28)
|
||||
|
||||
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)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(CURL Externals/curl)
|
||||
|
||||
if(NOT ANDROID)
|
||||
find_package(Iconv)
|
||||
endif()
|
||||
|
||||
if(TARGET Iconv::Iconv)
|
||||
message(STATUS "Using shared iconv")
|
||||
dolphin_find_optional_system_library(Iconv Externals/libiconv-1.14)
|
||||
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)
|
||||
find_package(HIDAPI)
|
||||
if(NOT HIDAPI_FOUND)
|
||||
check_vendoring_approved(hidapi)
|
||||
message(STATUS "Using static HIDAPI from Externals")
|
||||
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(HIDAPI Externals/hidapi)
|
||||
endif()
|
||||
|
||||
if(USE_DISCORD_PRESENCE)
|
||||
@ -920,11 +739,7 @@ if(NOT ENABLE_QT)
|
||||
set(USE_MGBA 0)
|
||||
endif()
|
||||
if(USE_MGBA)
|
||||
find_package(LIBMGBA)
|
||||
if(NOT LIBMGBA_FOUND)
|
||||
message(STATUS "Using static libmgba from Externals")
|
||||
add_subdirectory(Externals/mGBA)
|
||||
endif()
|
||||
dolphin_find_optional_system_library(LIBMGBA Externals/mGBA)
|
||||
endif()
|
||||
|
||||
find_package(SYSTEMD)
|
||||
|
1
Externals/LZO/CMakeLists.txt
vendored
1
Externals/LZO/CMakeLists.txt
vendored
@ -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
17
Externals/SDL/CMakeLists.txt
vendored
Normal 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()
|
10
Externals/SFML/CMakeLists.txt
vendored
10
Externals/SFML/CMakeLists.txt
vendored
@ -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)
|
||||
|
1
Externals/cubeb/CMakeLists.txt
vendored
1
Externals/cubeb/CMakeLists.txt
vendored
@ -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)
|
||||
|
6
Externals/curl/lib/CMakeLists.txt
vendored
6
Externals/curl/lib/CMakeLists.txt
vendored
@ -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)
|
||||
|
4
Externals/enet/CMakeLists.txt
vendored
4
Externals/enet/CMakeLists.txt
vendored
@ -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)
|
||||
|
5
Externals/libspng/CMakeLists.txt
vendored
5
Externals/libspng/CMakeLists.txt
vendored
@ -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)
|
||||
|
1
Externals/libusb/CMakeLists.txt
vendored
1
Externals/libusb/CMakeLists.txt
vendored
@ -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)
|
||||
|
1
Externals/mbedtls/library/CMakeLists.txt
vendored
1
Externals/mbedtls/library/CMakeLists.txt
vendored
@ -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.
|
||||
|
2
Externals/minizip/CMakeLists.txt
vendored
2
Externals/minizip/CMakeLists.txt
vendored
@ -67,4 +67,4 @@ endif()
|
||||
|
||||
target_link_libraries(minizip PUBLIC ZLIB::ZLIB)
|
||||
|
||||
add_library(minizip-ng ALIAS minizip)
|
||||
add_library(minizip::minizip ALIAS minizip)
|
||||
|
@ -83,7 +83,7 @@ PUBLIC
|
||||
common
|
||||
|
||||
PRIVATE
|
||||
cubeb
|
||||
cubeb::cubeb
|
||||
SoundTouch
|
||||
FreeSurround)
|
||||
|
||||
|
@ -147,16 +147,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}
|
||||
)
|
||||
|
||||
|
@ -605,24 +605,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
|
||||
)
|
||||
|
||||
@ -646,9 +645,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
|
||||
|
@ -75,7 +75,7 @@ PUBLIC
|
||||
|
||||
PRIVATE
|
||||
fmt::fmt
|
||||
minizip-ng
|
||||
minizip::minizip
|
||||
pugixml
|
||||
ZLIB::ZLIB
|
||||
)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -6,7 +6,7 @@ add_library(updatercommon
|
||||
|
||||
target_link_libraries(updatercommon PRIVATE
|
||||
uicommon
|
||||
mbedtls
|
||||
MbedTLS::mbedtls
|
||||
ZLIB::ZLIB
|
||||
ed25519
|
||||
cpp-optparse
|
||||
|
@ -195,7 +195,7 @@ PUBLIC
|
||||
core
|
||||
PRIVATE
|
||||
fmt::fmt
|
||||
${spng_target}
|
||||
spng::spng
|
||||
xxhash
|
||||
imgui
|
||||
implot
|
||||
|
Loading…
Reference in New Issue
Block a user