Merge pull request #8806 from delroth/cmake-vendoring
cmake: add an option to control dependencies vendoring
This commit is contained in:
commit
6705fd808b
|
@ -0,0 +1,29 @@
|
|||
# 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()
|
|
@ -88,6 +88,7 @@ list(APPEND CMAKE_MODULE_PATH
|
|||
# Support functions
|
||||
include(CheckAndAddFlag)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckVendoringApproved)
|
||||
include(DolphinCompileDefinitions)
|
||||
|
||||
# Enable folders for IDE
|
||||
|
@ -536,6 +537,7 @@ find_package(fmt 6.0)
|
|||
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()
|
||||
|
@ -544,6 +546,7 @@ add_subdirectory(Externals/imgui)
|
|||
|
||||
find_package(pugixml)
|
||||
if(NOT pugixml_FOUND)
|
||||
check_vendoring_approved(pugixml)
|
||||
message(STATUS "Using static pugixml from Externals")
|
||||
add_subdirectory(Externals/pugixml)
|
||||
endif()
|
||||
|
@ -570,6 +573,7 @@ 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)
|
||||
|
@ -584,6 +588,7 @@ 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()
|
||||
|
@ -594,6 +599,7 @@ check_include_file(lzma.h HAVE_LZMA_H)
|
|||
if(LIBLZMA_FOUND AND HAVE_LZMA_H)
|
||||
message(STATUS "Using shared lzma")
|
||||
else()
|
||||
check_vendoring_approved(lzma)
|
||||
if(LIBLZMA_FOUND AND NOT HAVE_LZMA_H)
|
||||
message(STATUS "Shared lzma found but lacks headers, falling back to the static library")
|
||||
else()
|
||||
|
@ -606,6 +612,7 @@ find_package(ZLIB)
|
|||
if(ZLIB_FOUND)
|
||||
message(STATUS "Using shared zlib")
|
||||
else()
|
||||
check_vendoring_approved(zlib)
|
||||
message(STATUS "Shared zlib not found, falling back to the static library")
|
||||
add_subdirectory(Externals/zlib)
|
||||
endif()
|
||||
|
@ -614,6 +621,7 @@ pkg_check_modules(MINIZIP minizip>=2.0.0)
|
|||
if(MINIZIP_FOUND)
|
||||
message(STATUS "Using shared 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)
|
||||
|
@ -625,6 +633,7 @@ 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)
|
||||
|
@ -636,6 +645,7 @@ endif()
|
|||
if (PNG_FOUND)
|
||||
message(STATUS "Using shared libpng")
|
||||
else()
|
||||
check_vendoring_approved(libpng)
|
||||
message(STATUS "Using static libpng from Externals")
|
||||
add_subdirectory(Externals/libpng)
|
||||
set(PNG png)
|
||||
|
@ -661,6 +671,7 @@ 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()
|
||||
|
@ -674,6 +685,7 @@ if(NOT ANDROID)
|
|||
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)
|
||||
|
@ -688,6 +700,7 @@ 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)
|
||||
|
@ -701,6 +714,7 @@ if(USE_UPNP)
|
|||
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()
|
||||
|
@ -714,6 +728,7 @@ 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)
|
||||
|
@ -725,6 +740,7 @@ 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)
|
||||
|
@ -739,6 +755,7 @@ endif()
|
|||
if (NOT ANDROID AND ICONV_LIBRARIES AND ICONV_INCLUDE_DIR)
|
||||
mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARIES)
|
||||
else()
|
||||
check_vendoring_approved(iconv)
|
||||
message(STATUS "Using static iconv from Externals")
|
||||
include_directories(Externals/libiconv-1.14/include)
|
||||
add_subdirectory(Externals/libiconv-1.14)
|
||||
|
@ -748,6 +765,7 @@ 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()
|
||||
|
|
Loading…
Reference in New Issue