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
|
# Support functions
|
||||||
include(CheckAndAddFlag)
|
include(CheckAndAddFlag)
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
|
include(CheckVendoringApproved)
|
||||||
include(DolphinCompileDefinitions)
|
include(DolphinCompileDefinitions)
|
||||||
|
|
||||||
# Enable folders for IDE
|
# Enable folders for IDE
|
||||||
|
@ -536,6 +537,7 @@ find_package(fmt 6.0)
|
||||||
if(fmt_FOUND)
|
if(fmt_FOUND)
|
||||||
message(STATUS "Using shared fmt ${fmt_VERSION}")
|
message(STATUS "Using shared fmt ${fmt_VERSION}")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(fmt)
|
||||||
message(STATUS "Using static fmt from Externals")
|
message(STATUS "Using static fmt from Externals")
|
||||||
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
|
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
@ -544,6 +546,7 @@ add_subdirectory(Externals/imgui)
|
||||||
|
|
||||||
find_package(pugixml)
|
find_package(pugixml)
|
||||||
if(NOT pugixml_FOUND)
|
if(NOT pugixml_FOUND)
|
||||||
|
check_vendoring_approved(pugixml)
|
||||||
message(STATUS "Using static pugixml from Externals")
|
message(STATUS "Using static pugixml from Externals")
|
||||||
add_subdirectory(Externals/pugixml)
|
add_subdirectory(Externals/pugixml)
|
||||||
endif()
|
endif()
|
||||||
|
@ -570,6 +573,7 @@ endif()
|
||||||
if (ENET_FOUND)
|
if (ENET_FOUND)
|
||||||
message(STATUS "Using shared enet")
|
message(STATUS "Using shared enet")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(enet)
|
||||||
message(STATUS "Using static enet from Externals")
|
message(STATUS "Using static enet from Externals")
|
||||||
include_directories(Externals/enet/include)
|
include_directories(Externals/enet/include)
|
||||||
add_subdirectory(Externals/enet)
|
add_subdirectory(Externals/enet)
|
||||||
|
@ -584,6 +588,7 @@ find_package(BZip2)
|
||||||
if(BZIP2_FOUND)
|
if(BZIP2_FOUND)
|
||||||
message(STATUS "Using shared bzip2")
|
message(STATUS "Using shared bzip2")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(bzip2)
|
||||||
message(STATUS "Shared bzip2 not found, falling back to the static library")
|
message(STATUS "Shared bzip2 not found, falling back to the static library")
|
||||||
add_subdirectory(Externals/bzip2)
|
add_subdirectory(Externals/bzip2)
|
||||||
endif()
|
endif()
|
||||||
|
@ -594,6 +599,7 @@ check_include_file(lzma.h HAVE_LZMA_H)
|
||||||
if(LIBLZMA_FOUND AND HAVE_LZMA_H)
|
if(LIBLZMA_FOUND AND HAVE_LZMA_H)
|
||||||
message(STATUS "Using shared lzma")
|
message(STATUS "Using shared lzma")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(lzma)
|
||||||
if(LIBLZMA_FOUND AND NOT HAVE_LZMA_H)
|
if(LIBLZMA_FOUND AND NOT HAVE_LZMA_H)
|
||||||
message(STATUS "Shared lzma found but lacks headers, falling back to the static library")
|
message(STATUS "Shared lzma found but lacks headers, falling back to the static library")
|
||||||
else()
|
else()
|
||||||
|
@ -606,6 +612,7 @@ find_package(ZLIB)
|
||||||
if(ZLIB_FOUND)
|
if(ZLIB_FOUND)
|
||||||
message(STATUS "Using shared zlib")
|
message(STATUS "Using shared zlib")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(zlib)
|
||||||
message(STATUS "Shared zlib not found, falling back to the static library")
|
message(STATUS "Shared zlib not found, falling back to the static library")
|
||||||
add_subdirectory(Externals/zlib)
|
add_subdirectory(Externals/zlib)
|
||||||
endif()
|
endif()
|
||||||
|
@ -614,6 +621,7 @@ pkg_check_modules(MINIZIP minizip>=2.0.0)
|
||||||
if(MINIZIP_FOUND)
|
if(MINIZIP_FOUND)
|
||||||
message(STATUS "Using shared minizip")
|
message(STATUS "Using shared minizip")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(minizip)
|
||||||
message(STATUS "Shared minizip not found, falling back to the static library")
|
message(STATUS "Shared minizip not found, falling back to the static library")
|
||||||
add_subdirectory(Externals/minizip)
|
add_subdirectory(Externals/minizip)
|
||||||
include_directories(External/minizip)
|
include_directories(External/minizip)
|
||||||
|
@ -625,6 +633,7 @@ endif()
|
||||||
if(LZO_FOUND)
|
if(LZO_FOUND)
|
||||||
message(STATUS "Using shared lzo")
|
message(STATUS "Using shared lzo")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(lzo)
|
||||||
message(STATUS "Using static lzo from Externals")
|
message(STATUS "Using static lzo from Externals")
|
||||||
add_subdirectory(Externals/LZO)
|
add_subdirectory(Externals/LZO)
|
||||||
set(LZO lzo2)
|
set(LZO lzo2)
|
||||||
|
@ -636,6 +645,7 @@ endif()
|
||||||
if (PNG_FOUND)
|
if (PNG_FOUND)
|
||||||
message(STATUS "Using shared libpng")
|
message(STATUS "Using shared libpng")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(libpng)
|
||||||
message(STATUS "Using static libpng from Externals")
|
message(STATUS "Using static libpng from Externals")
|
||||||
add_subdirectory(Externals/libpng)
|
add_subdirectory(Externals/libpng)
|
||||||
set(PNG png)
|
set(PNG png)
|
||||||
|
@ -661,6 +671,7 @@ find_package(Cubeb)
|
||||||
if(CUBEB_FOUND)
|
if(CUBEB_FOUND)
|
||||||
message(STATUS "Using the system cubeb")
|
message(STATUS "Using the system cubeb")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(cubeb)
|
||||||
message(STATUS "Using static cubeb from Externals")
|
message(STATUS "Using static cubeb from Externals")
|
||||||
add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL)
|
add_subdirectory(Externals/cubeb EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
@ -674,6 +685,7 @@ if(NOT ANDROID)
|
||||||
message(STATUS "Using shared LibUSB")
|
message(STATUS "Using shared LibUSB")
|
||||||
include_directories(${LIBUSB_INCLUDE_DIR})
|
include_directories(${LIBUSB_INCLUDE_DIR})
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(libusb)
|
||||||
message(STATUS "Using static LibUSB from Externals")
|
message(STATUS "Using static LibUSB from Externals")
|
||||||
add_subdirectory(Externals/libusb)
|
add_subdirectory(Externals/libusb)
|
||||||
set(LIBUSB_LIBRARIES usb)
|
set(LIBUSB_LIBRARIES usb)
|
||||||
|
@ -688,6 +700,7 @@ endif()
|
||||||
if(SFML_FOUND)
|
if(SFML_FOUND)
|
||||||
message(STATUS "Using shared SFML")
|
message(STATUS "Using shared SFML")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(sfml)
|
||||||
message(STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals")
|
message(STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals")
|
||||||
add_definitions(-DSFML_STATIC)
|
add_definitions(-DSFML_STATIC)
|
||||||
add_subdirectory(Externals/SFML)
|
add_subdirectory(Externals/SFML)
|
||||||
|
@ -701,6 +714,7 @@ if(USE_UPNP)
|
||||||
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
|
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
|
||||||
message(STATUS "Using shared miniupnpc")
|
message(STATUS "Using shared miniupnpc")
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(miniupnpc)
|
||||||
message(STATUS "Using static miniupnpc from Externals")
|
message(STATUS "Using static miniupnpc from Externals")
|
||||||
add_subdirectory(Externals/miniupnpc)
|
add_subdirectory(Externals/miniupnpc)
|
||||||
endif()
|
endif()
|
||||||
|
@ -714,6 +728,7 @@ if(MBEDTLS_FOUND)
|
||||||
message(STATUS "Using shared mbed TLS")
|
message(STATUS "Using shared mbed TLS")
|
||||||
include_directories(${MBEDTLS_INCLUDE_DIRS})
|
include_directories(${MBEDTLS_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(mbedtls)
|
||||||
message(STATUS "Using static mbed TLS from Externals")
|
message(STATUS "Using static mbed TLS from Externals")
|
||||||
set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509)
|
set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509)
|
||||||
add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL)
|
add_subdirectory(Externals/mbedtls/ EXCLUDE_FROM_ALL)
|
||||||
|
@ -725,6 +740,7 @@ if(CURL_FOUND)
|
||||||
message(STATUS "Using shared libcurl")
|
message(STATUS "Using shared libcurl")
|
||||||
include_directories(${CURL_INCLUDE_DIRS})
|
include_directories(${CURL_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(curl)
|
||||||
message(STATUS "Using static libcurl from Externals")
|
message(STATUS "Using static libcurl from Externals")
|
||||||
add_subdirectory(Externals/curl)
|
add_subdirectory(Externals/curl)
|
||||||
set(CURL_LIBRARIES curl)
|
set(CURL_LIBRARIES curl)
|
||||||
|
@ -739,6 +755,7 @@ endif()
|
||||||
if (NOT ANDROID AND ICONV_LIBRARIES AND ICONV_INCLUDE_DIR)
|
if (NOT ANDROID AND ICONV_LIBRARIES AND ICONV_INCLUDE_DIR)
|
||||||
mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARIES)
|
mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARIES)
|
||||||
else()
|
else()
|
||||||
|
check_vendoring_approved(iconv)
|
||||||
message(STATUS "Using static iconv from Externals")
|
message(STATUS "Using static iconv from Externals")
|
||||||
include_directories(Externals/libiconv-1.14/include)
|
include_directories(Externals/libiconv-1.14/include)
|
||||||
add_subdirectory(Externals/libiconv-1.14)
|
add_subdirectory(Externals/libiconv-1.14)
|
||||||
|
@ -748,6 +765,7 @@ endif()
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
find_package(HIDAPI)
|
find_package(HIDAPI)
|
||||||
if(NOT HIDAPI_FOUND)
|
if(NOT HIDAPI_FOUND)
|
||||||
|
check_vendoring_approved(hidapi)
|
||||||
message(STATUS "Using static HIDAPI from Externals")
|
message(STATUS "Using static HIDAPI from Externals")
|
||||||
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL)
|
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue