aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2022-03-12 11:33:38 +1000
committerfuzzard <fuzzard@kodi.tv>2022-03-12 19:59:15 +1000
commita22af94995f300288826fe991619ed66f1ff4b67 (patch)
tree20bd6b62315f3e3b71e6869071a5d0ec3cfe8efe
parente0cb6709900f352a5bb37352b05f7ed4d16e5be5 (diff)
[cmake] FindFMT enable ENABLE_INTERNAL_FMT for windows
-rw-r--r--cmake/modules/FindFmt.cmake11
-rw-r--r--tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch42
-rw-r--r--tools/depends/target/fmt/FMT-VERSION1
3 files changed, 54 insertions, 0 deletions
diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake
index aaf855ecbe..66c217a3ba 100644
--- a/cmake/modules/FindFmt.cmake
+++ b/cmake/modules/FindFmt.cmake
@@ -25,12 +25,23 @@ if(ENABLE_INTERNAL_FMT)
set(FMT_VERSION ${${MODULE}_VER})
+ if(WIN32 OR WINDOWS_STORE)
+ # find the path to the patch executable
+ find_program(PATCH_EXECUTABLE NAMES patch patch.exe REQUIRED)
+
+ set(patch ${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-windows-pdb-symbol-gen.patch)
+ PATCH_LF_CHECK(${patch})
+
+ set(PATCH_COMMAND ${PATCH_EXECUTABLE} -p1 -i ${patch})
+ endif()
+
set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_LIBDIR=lib
-DFMT_DOC=OFF
-DFMT_TEST=OFF
+ -DFMT_INSTALL=ON
"${EXTRA_ARGS}")
BUILD_DEP_TARGET()
diff --git a/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch b/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch
new file mode 100644
index 0000000000..fed1a83a89
--- /dev/null
+++ b/tools/depends/target/fmt/001-windows-pdb-symbol-gen.patch
@@ -0,0 +1,42 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -268,9 +268,20 @@
+
+ set(FMT_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.")
+
++if (WIN32 OR WINDOWS_STORE)
++ set_target_properties(fmt PROPERTIES
++ VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
++ OUTPUT_NAME fmt
++ OUTPUT_NAME_DEBUG fmt${FMT_DEBUG_POSTFIX}
++ COMPILE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
++ COMPILE_PDB_NAME fmt
++ COMPILE_PDB_NAME_DEBUG fmt${FMT_DEBUG_POSTFIX}
++ )
++else()
+ set_target_properties(fmt PROPERTIES
+ VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
+ 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.
+@@ -361,6 +372,18 @@
+ install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}
+ NAMESPACE fmt::)
+
++ # Install COMPILE_PDB Files for windows
++ if(NOT BUILD_SHARED_LIBS AND (WIN32 OR WINDOWS_STORE))
++ install(FILES ${PROJECT_BINARY_DIR}/RelWithDebInfo/fmt.pdb
++ DESTINATION lib
++ CONFIGURATIONS RelWithDebInfo
++ )
++ install(FILES ${PROJECT_BINARY_DIR}/Debug/fmtd.pdb
++ DESTINATION lib
++ CONFIGURATIONS Debug
++ )
++ endif()
++
+ install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}>
+ DESTINATION ${FMT_LIB_DIR} OPTIONAL)
+ install(FILES ${FMT_HEADERS} DESTINATION "${FMT_INC_DIR}/fmt")
diff --git a/tools/depends/target/fmt/FMT-VERSION b/tools/depends/target/fmt/FMT-VERSION
index dc41a75ec0..cbaa58dd7d 100644
--- a/tools/depends/target/fmt/FMT-VERSION
+++ b/tools/depends/target/fmt/FMT-VERSION
@@ -3,3 +3,4 @@ VERSION=8.0.1
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
SHA512=643e68d5b2e0e9c83231ab2b0036596a6297b1d9ed6bd7b1172bee4ff134c8af8f09174c06c94225132c1b635b0977ea4ce783748d7bd76a9a0b5ad597456c84
BYPRODUCT=libfmt.a
+BYPRODUCT_WIN=fmt.lib