aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt24
-rw-r--r--cmake/modules/FindFmt.cmake44
-rw-r--r--cmake/modules/FindSpdlog.cmake13
-rw-r--r--cmake/scripts/common/DependencyOptions.cmake23
-rw-r--r--cmake/scripts/common/ModuleHelpers.cmake24
-rw-r--r--project/BuildDependencies/scripts/0_package.target-win10-arm.list2
-rw-r--r--project/BuildDependencies/scripts/0_package.target-win10-win32.list2
-rw-r--r--project/BuildDependencies/scripts/0_package.target-win10-x64.list2
-rw-r--r--project/BuildDependencies/scripts/0_package.target-win32.list2
-rw-r--r--project/BuildDependencies/scripts/0_package.target-x64.list2
-rw-r--r--tools/depends/target/Makefile3
-rw-r--r--tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch9
12 files changed, 108 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44f994bfd3..19881e4708 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ include(cmake/scripts/common/PathSetup.cmake)
include(cmake/scripts/common/CompilerSettings.cmake)
include(ExternalProject)
include(CMakeDependentOption)
+include(cmake/scripts/common/DependencyOptions.cmake)
# general
option(VERBOSE "Enable verbose output?" OFF)
@@ -58,28 +59,29 @@ option(ENABLE_PYTHON "Enable python support?" ON)
option(ENABLE_TESTING "Enable testing support?" ON)
# Internal Depends - supported on all platforms
+
+# These are required enabled for all CI platforms, and recommended for all builds
option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON)
+option(ENABLE_INTERNAL_RapidJSON "Enable internal rapidjson?" ON)
+
# use ffmpeg from depends or system
option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" OFF)
-option(ENABLE_INTERNAL_RapidJSON "Enable internal rapidjson?" ON)
-cmake_dependent_option(ENABLE_INTERNAL_FLATBUFFERS "Enable internal flatbuffers?" OFF "DEFINED USE_INTERNAL_LIBS;NOT USE_INTERNAL_LIBS" ON)
-cmake_dependent_option(ENABLE_INTERNAL_NFS "Enable internal libnfs?" OFF "DEFINED USE_INTERNAL_LIBS;NOT USE_INTERNAL_LIBS" ON)
-cmake_dependent_option(ENABLE_INTERNAL_PCRE "Enable internal pcre?" OFF "DEFINED USE_INTERNAL_LIBS;NOT USE_INTERNAL_LIBS" ON)
-cmake_dependent_option(ENABLE_INTERNAL_TAGLIB "Enable internal taglib?" OFF "DEFINED USE_INTERNAL_LIBS;NOT USE_INTERNAL_LIBS" ON)
+
+# These are built for all platforms not using system libs or disabled by user
+dependent_option(ENABLE_INTERNAL_FLATBUFFERS "Enable internal flatbuffers?")
+dependent_option(ENABLE_INTERNAL_FMT "Enable internal fmt?")
+dependent_option(ENABLE_INTERNAL_NFS "Enable internal libnfs?")
+dependent_option(ENABLE_INTERNAL_PCRE "Enable internal pcre?")
+dependent_option(ENABLE_INTERNAL_SPDLOG "Enable internal spdlog?")
+dependent_option(ENABLE_INTERNAL_TAGLIB "Enable internal taglib?")
# Internal Depends - supported on UNIX platforms
if(UNIX)
option(FFMPEG_PATH "Path to external ffmpeg?" "")
- option(ENABLE_INTERNAL_FMT "Enable internal fmt?" OFF)
option(ENABLE_INTERNAL_FSTRCMP "Enable internal fstrcmp?" OFF)
option(ENABLE_INTERNAL_DAV1D "Enable internal dav1d?" OFF)
option(ENABLE_INTERNAL_GTEST "Enable internal gtest?" OFF)
option(ENABLE_INTERNAL_UDFREAD "Enable internal udfread?" OFF)
- option(ENABLE_INTERNAL_SPDLOG "Enable internal spdlog?" OFF)
-
- if(ENABLE_INTERNAL_SPDLOG)
- set(ENABLE_INTERNAL_FMT ON CACHE BOOL "" FORCE)
- endif()
endif()
# prefer kissfft from xbmc/contrib but let use system one on unices
cmake_dependent_option(ENABLE_INTERNAL_KISSFFT "Enable internal kissfft?" ON "UNIX" ON)
diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake
index 32af4a21a1..abecba501f 100644
--- a/cmake/modules/FindFmt.cmake
+++ b/cmake/modules/FindFmt.cmake
@@ -12,11 +12,20 @@
#
# fmt::fmt - The Fmt library
+define_property(TARGET PROPERTY LIB_BUILD
+ BRIEF_DOCS "This target will be compiling the library"
+ FULL_DOCS "This target will be compiling the library")
+
+set(FORCE_BUILD OFF)
+
# If target exists, no need to rerun find
# Allows a module that may be a dependency for multiple libraries to just be executed
# once to populate all required variables/targets
-if(NOT TARGET fmt::fmt)
- if(ENABLE_INTERNAL_FMT)
+if((NOT TARGET fmt::fmt OR Fmt_FIND_REQUIRED) AND NOT TARGET fmt)
+
+ # Build if ENABLE_INTERNAL_FMT, or if required version in find_package call is greater
+ # than already found FMT_VERSION from a previous find_package call
+ if(ENABLE_INTERNAL_FMT OR (Fmt_FIND_REQUIRED AND FMT_VERSION VERSION_LESS Fmt_FIND_VERSION))
include(cmake/scripts/common/ModuleHelpers.cmake)
@@ -27,7 +36,16 @@ if(NOT TARGET fmt::fmt)
# Check for existing FMT. If version >= FMT-VERSION file version, dont build
find_package(FMT CONFIG QUIET)
- if(FMT_VERSION VERSION_LESS ${${MODULE}_VER})
+ if(Fmt_FIND_VERSION)
+ if(FMT_VERSION VERSION_LESS ${Fmt_FIND_VERSION})
+ set(FORCE_BUILD ON)
+ endif()
+ endif()
+
+ if(${FORCE_BUILD} OR FMT_VERSION VERSION_LESS ${${MODULE}_VER})
+
+ # Set FORCE_BUILD to enable fmt::fmt property that build will occur
+ set(FORCE_BUILD ON)
if(APPLE)
set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
@@ -88,8 +106,16 @@ if(NOT TARGET fmt::fmt)
set(FMT_LIBRARIES ${FMT_LIBRARY})
set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR})
+ # Reorder this to allow handling of FMT_FORCE_BUILD and not duplicate in property
if(NOT TARGET fmt::fmt)
- add_library(fmt::fmt UNKNOWN IMPORTED)
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP fmt::fmt)
+ endif()
+
+ if(NOT TARGET fmt::fmt OR FORCE_BUILD)
+ if(NOT TARGET fmt::fmt)
+ add_library(fmt::fmt UNKNOWN IMPORTED)
+ endif()
+
if(FMT_LIBRARY_RELEASE)
set_target_properties(fmt::fmt PROPERTIES
IMPORTED_CONFIGURATIONS RELEASE
@@ -102,11 +128,19 @@ if(NOT TARGET fmt::fmt)
endif()
set_target_properties(fmt::fmt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIR}")
+
+ # If a force build is done, let any calling packages know they may want to rebuild
+ if(FORCE_BUILD)
+ set_target_properties(fmt::fmt PROPERTIES LIB_BUILD ON)
+ endif()
endif()
if(TARGET fmt)
add_dependencies(fmt::fmt fmt)
endif()
- set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP fmt::fmt)
+ else()
+ if(FMT_FIND_REQUIRED)
+ message(FATAL_ERROR "Fmt lib not found. Maybe use -DENABLE_INTERNAL_FMT=ON")
+ endif()
endif()
mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY)
diff --git a/cmake/modules/FindSpdlog.cmake b/cmake/modules/FindSpdlog.cmake
index fca6437388..23c8617db0 100644
--- a/cmake/modules/FindSpdlog.cmake
+++ b/cmake/modules/FindSpdlog.cmake
@@ -14,21 +14,22 @@
# Spdlog::Spdlog - The Spdlog library
if(ENABLE_INTERNAL_SPDLOG)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
- # Check for dependencies
- find_package(Fmt MODULE QUIET)
+ # Check for dependencies - Must be done before SETUP_BUILD_VARS
+ get_libversion_data("fmt" "target")
+ find_package(Fmt ${LIB_FMT_VER} MODULE REQUIRED)
- include(cmake/scripts/common/ModuleHelpers.cmake)
+ # Check if we want to force a build due to a dependency rebuild
+ get_property(LIB_FORCE_REBUILD TARGET fmt::fmt PROPERTY LIB_BUILD)
set(MODULE_LC spdlog)
-
SETUP_BUILD_VARS()
# Check for existing SPDLOG. If version >= SPDLOG-VERSION file version, dont build
find_package(SPDLOG CONFIG QUIET)
- if(SPDLOG_VERSION VERSION_LESS ${${MODULE}_VER})
-
+ if(SPDLOG_VERSION VERSION_LESS ${${MODULE}_VER} OR LIB_FORCE_REBUILD)
if(APPLE)
set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
endif()
diff --git a/cmake/scripts/common/DependencyOptions.cmake b/cmake/scripts/common/DependencyOptions.cmake
new file mode 100644
index 0000000000..a45dcec553
--- /dev/null
+++ b/cmake/scripts/common/DependencyOptions.cmake
@@ -0,0 +1,23 @@
+# Set Option varname based on USE_INTERNAL_LIBS status
+#
+# Alternative to cmake_dependent_option
+# cmake_dependent_option is restrictive, in the fact that we cannot override the
+# set option value as a cache variable (-Dvar=foo)
+#
+# This allows us to have the same outcome as cmake_dependent_option whilst still allowing
+# user to override for platforms that would normally be forced ON
+#
+function(dependent_option varname optionmessage)
+
+ # If varname already set, accept that, as it was provided by the user
+ if(NOT DEFINED ${varname})
+ # Generally we only define USE_INTERNAL_LIBS as the exception for platforms
+ # we explicitly dont want to build internal libs (eg Linux/Freebsd)
+ if(NOT DEFINED USE_INTERNAL_LIBS)
+ option(${varname} ${optionmessage} ON)
+ else()
+ # Respect Value of USE_INTERNAL_LIBS for ON/OFF
+ option(${varname} ${optionmessage} ${USE_INTERNAL_LIBS})
+ endif()
+ endif()
+endfunction()
diff --git a/cmake/scripts/common/ModuleHelpers.cmake b/cmake/scripts/common/ModuleHelpers.cmake
index 472cdbd92b..e9657cea1e 100644
--- a/cmake/scripts/common/ModuleHelpers.cmake
+++ b/cmake/scripts/common/ModuleHelpers.cmake
@@ -67,6 +67,30 @@ function(get_versionfile_data)
endif()
endfunction()
+# Parse and set Version from VERSION dependency file
+# Used for retrieving version numbers for dependency libs to allow setting
+# a required version for find_package call
+# On return:
+# LIB_MODULENAME_VER will be set to parent scope (eg LIB_FMT_VER)
+function(get_libversion_data module libtype)
+
+ # Dependency path
+ set(LIB_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/depends/${libtype}/${module}")
+ string(TOUPPER ${module} MOD_UPPER)
+
+ if(NOT EXISTS "${LIB_MODULE_PATH}/${MOD_UPPER}-VERSION")
+ MESSAGE(FATAL_ERROR "${MOD_UPPER}-VERSION does not exist at ${LIB_MODULE_PATH}.")
+ else()
+ set(${MOD_UPPER}_FILE "${LIB_MODULE_PATH}/${MOD_UPPER}-VERSION")
+ endif()
+
+ file(STRINGS ${${MOD_UPPER}_FILE} ${MOD_UPPER}_VER REGEX "^[ \t]*VERSION=")
+
+ string(REGEX REPLACE ".*VERSION=([^ \t]*).*" "\\1" ${MOD_UPPER}_VER "${${MOD_UPPER}_VER}")
+
+ set(LIB_${MOD_UPPER}_VER ${${MOD_UPPER}_VER} PARENT_SCOPE)
+endfunction()
+
# Function to loop through list of patch files (full path)
# Sets to a PATCH_COMMAND variable and set to parent scope (caller)
# Used to test windows line endings and set appropriate patch commands
diff --git a/project/BuildDependencies/scripts/0_package.target-win10-arm.list b/project/BuildDependencies/scripts/0_package.target-win10-arm.list
index f091203ac2..eb88e90dad 100644
--- a/project/BuildDependencies/scripts/0_package.target-win10-arm.list
+++ b/project/BuildDependencies/scripts/0_package.target-win10-arm.list
@@ -8,7 +8,6 @@
;PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER!
curl-7.67.0-win10-arm-v141-20200105.7z
dav1d-0.8.2-win10-arm-v142-20210314.7z
-fmt-6.1.2-win10-arm-v141-20200105.7z
freetype-2.10.1-win10-arm-v141-20200105.7z
fstrcmp-0.7-win10-arm-v141-20200105.7z
GoogleTest-1.10.0-win10-arm-v141-20200410.7z
@@ -32,7 +31,6 @@ openssl-1.1.1d-win10-arm-v141-20200105.7z
pillow-6.2.1-win10-arm-v142-20200803.7z
pycryptodome-3.9.4-win10-arm-v142-20200803.7z
python-3.8.5-win10-arm-v142-20210211.7z
-spdlog-1.5.0-win10-arm-v141-20200320-2.7z
sqlite-3300100-win10-arm-v141-20200105.7z
tinyxml-2.6.2-win10-arm-v141-20200105.7z
zlib-1.2.11-win10-arm-v141-20200105.7z
diff --git a/project/BuildDependencies/scripts/0_package.target-win10-win32.list b/project/BuildDependencies/scripts/0_package.target-win10-win32.list
index 5e8495e135..7c202a3b87 100644
--- a/project/BuildDependencies/scripts/0_package.target-win10-win32.list
+++ b/project/BuildDependencies/scripts/0_package.target-win10-win32.list
@@ -8,7 +8,6 @@
;PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER!
curl-7.67.0-win10-win32-v141-20200105.7z
dav1d-0.8.2-win10-win32-v142-20210314.7z
-fmt-6.1.2-win10-win32-v141-20200105.7z
freetype-2.10.1-win10-win32-v141-20200105.7z
fstrcmp-0.7-win10-win32-v141-20200105.7z
GoogleTest-1.10.0-win10-win32-v141-20200410.7z
@@ -32,7 +31,6 @@ openssl-1.1.1d-win10-win32-v141-20200105.7z
pillow-6.2.1-win10-win32-v142-20200803.7z
pycryptodome-3.9.4-win10-win32-v142-20200803.7z
python-3.8.5-win10-win32-v142-20210211.7z
-spdlog-1.5.0-win10-win32-v141-20200320-2.7z
sqlite-3300100-win10-win32-v141-20200105.7z
tinyxml-2.6.2-win10-win32-v141-20200105.7z
zlib-1.2.11-win10-win32-v141-20200105.7z
diff --git a/project/BuildDependencies/scripts/0_package.target-win10-x64.list b/project/BuildDependencies/scripts/0_package.target-win10-x64.list
index bce4a1fe45..c14b573c8a 100644
--- a/project/BuildDependencies/scripts/0_package.target-win10-x64.list
+++ b/project/BuildDependencies/scripts/0_package.target-win10-x64.list
@@ -8,7 +8,6 @@
;PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER!
curl-7.67.0-win10-x64-v141-20200105.7z
dav1d-0.8.2-win10-x64-v142-20210314.7z
-fmt-6.1.2-win10-x64-v141-20200105.7z
freetype-2.10.1-win10-x64-v141-20200105.7z
fstrcmp-0.7-win10-x64-v141-20200105.7z
GoogleTest-1.10.0-win10-x64-v141-20200410.7z
@@ -32,7 +31,6 @@ openssl-1.1.1d-win10-x64-v141-20200105.7z
pillow-6.2.1-win10-x64-v142-20200803.7z
pycryptodome-3.9.4-win10-x64-v142-20200803.7z
python-3.8.5-win10-x64-v142-20210211.7z
-spdlog-1.5.0-win10-x64-v141-20200320.7z
sqlite-3300100-win10-x64-v141-20200105.7z
tinyxml-2.6.2-win10-x64-v141-20200105.7z
zlib-1.2.11-win10-x64-v141-20200105.7z
diff --git a/project/BuildDependencies/scripts/0_package.target-win32.list b/project/BuildDependencies/scripts/0_package.target-win32.list
index ae8d7b4f70..1b5603bf40 100644
--- a/project/BuildDependencies/scripts/0_package.target-win32.list
+++ b/project/BuildDependencies/scripts/0_package.target-win32.list
@@ -10,7 +10,6 @@ curl-7.67.0-win32-v141-20200105.7z
dav1d-0.8.2-win32-v142-20210314.7z
detours-64ec13-win32-v141-20200105.7z
dnssd-878.260.1-win32-v141-20200105.7z
-fmt-6.1.2-win32-v141-20200105.7z
freetype-2.10.1-win32-v141-20200105.7z
fstrcmp-0.7-win32-v141-20200105.7z
giflib-5.2.1-win32-v141-20200105.7z
@@ -40,7 +39,6 @@ pillow-6.2.1-win32-v142-20200803.7z
pycryptodome-3.9.4-win32-v142-20200803.7z
python-3.8.5-win32-v142-20210211.7z
shairplay-ce80e00-win32-v141-20200105.7z
-spdlog-1.5.0-win32-v141-20200320-2.7z
sqlite-3300100-win32-v141-20200105.7z
tinyxml-2.6.2-win32-v141-20200105.7z
zlib-1.2.11-win32-v141-20200105.7z
diff --git a/project/BuildDependencies/scripts/0_package.target-x64.list b/project/BuildDependencies/scripts/0_package.target-x64.list
index 3d1eaf90b8..00f1b6311e 100644
--- a/project/BuildDependencies/scripts/0_package.target-x64.list
+++ b/project/BuildDependencies/scripts/0_package.target-x64.list
@@ -10,7 +10,6 @@ curl-7.67.0-x64-v141-20200105.7z
dav1d-0.8.2-x64-v142-20210314.7z
detours-64ec13-x64-v141-20200105.7z
dnssd-878.260.1-x64-v141-20200105.7z
-fmt-6.1.2-x64-v141-20200105.7z
freetype-2.10.1-x64-v141-20200105.7z
fstrcmp-0.7-x64-v141-20200105.7z
GoogleTest-1.10.0-x64-v141-20200410.7z
@@ -37,7 +36,6 @@ pillow-6.2.1-x64-v142-20200803.7z
pycryptodome-3.9.4-x64-v142-20200803.7z
python-3.8.5-x64-v142-20210211.7z
shairplay-ce80e00-x64-v141-20200105.7z
-spdlog-1.5.0-x64-v141-20200320.7z
sqlite-3300100-x64-v141-20200105.7z
tinyxml-2.6.2-x64-v141-20200105.7z
zlib-1.2.11-x64-v141-20200105.7z
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile
index efaa4e5c7e..243479fdf9 100644
--- a/tools/depends/target/Makefile
+++ b/tools/depends/target/Makefile
@@ -11,7 +11,6 @@ DEPENDS = \
dav1d \
expat \
ffmpeg \
- fmt \
fontconfig \
freetype2 \
freetype2-noharfbuzz \
@@ -46,7 +45,6 @@ DEPENDS = \
pythonmodule-pil \
pythonmodule-pycryptodome \
pythonmodule-setuptools \
- spdlog \
sqlite3 \
tinyxml \
udfread \
@@ -148,7 +146,6 @@ libinput: mtdev libevdev meson-cross-file
libmicrohttpd: gnutls libgcrypt libgpg-error
libplist: $(ZLIB)
libpng: $(ZLIB)
-spdlog: fmt
libva: libdrm $(LIBVA_DEPS)
libxml2: $(ZLIB)
libxslt: libgcrypt libxml2
diff --git a/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch b/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch
index d4429afe05..7722f13dd3 100644
--- a/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch
+++ b/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch
@@ -1,6 +1,6 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -249,10 +249,21 @@
+@@ -249,6 +249,16 @@
set(FMT_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.")
@@ -13,15 +13,10 @@
+ COMPILE_PDB_NAME fmt
+ COMPILE_PDB_NAME_DEBUG fmt${FMT_DEBUG_POSTFIX}
+ )
-+else()
++endif()
set_target_properties(fmt PROPERTIES
VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
PUBLIC_HEADER "${FMT_HEADERS}"
- DEBUG_POSTFIX "${FMT_DEBUG_POSTFIX}")
-+endif()
-
- # Set FMT_LIB_NAME for pkg-config fmt.pc. We cannot use the OUTPUT_NAME target
- # property because it's not set by default.
@@ -339,6 +350,18 @@
install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}
NAMESPACE fmt::)