diff --git a/ports/zstd/0001-export-zstd-config.patch b/ports/zstd/0001-export-zstd-config.patch new file mode 100644 index 00000000000..43b39d4937c --- /dev/null +++ b/ports/zstd/0001-export-zstd-config.patch @@ -0,0 +1,93 @@ +diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt +index 7adca875..8835d1c6 100644 +--- a/build/cmake/lib/CMakeLists.txt ++++ b/build/cmake/lib/CMakeLists.txt +@@ -78,20 +78,20 @@ endif () + + # Split project to static and shared libraries build + if (ZSTD_BUILD_SHARED) +- add_library(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources}) ++ add_library(libzstd SHARED ${Sources} ${Headers} ${PlatformDependResources}) + if (ZSTD_MULTITHREAD_SUPPORT) +- set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") ++ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") + if (UNIX) +- target_link_libraries(libzstd_shared ${THREADS_LIBS}) ++ target_link_libraries(libzstd ${THREADS_LIBS}) + endif () + endif() + endif () + if (ZSTD_BUILD_STATIC) +- add_library(libzstd_static STATIC ${Sources} ${Headers}) ++ add_library(libzstd STATIC ${Sources} ${Headers}) + if (ZSTD_MULTITHREAD_SUPPORT) +- set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") ++ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") + if (UNIX) +- target_link_libraries(libzstd_static ${THREADS_LIBS}) ++ target_link_libraries(libzstd ${THREADS_LIBS}) + endif () + endif () + endif () +@@ -99,16 +99,16 @@ endif () + # Add specific compile definitions for MSVC project + if (MSVC) + if (ZSTD_BUILD_SHARED) +- set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS") ++ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS") + endif () + if (ZSTD_BUILD_STATIC) +- set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS") ++ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS") + endif () + endif () + + # With MSVC static library needs to be renamed to avoid conflict with import library + if (MSVC) +- set(STATIC_LIBRARY_BASE_NAME zstd_static) ++ set(STATIC_LIBRARY_BASE_NAME zstd) + else () + set(STATIC_LIBRARY_BASE_NAME zstd) + endif () +@@ -116,7 +116,7 @@ endif () + # Define static and shared library names + if (ZSTD_BUILD_SHARED) + set_target_properties( +- libzstd_shared ++ libzstd + PROPERTIES + OUTPUT_NAME zstd + VERSION ${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH} +@@ -125,7 +125,7 @@ endif () + + if (ZSTD_BUILD_STATIC) + set_target_properties( +- libzstd_static ++ libzstd + PROPERTIES + OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME}) + endif () +@@ -154,12 +154,14 @@ install(FILES + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + + if (ZSTD_BUILD_SHARED) +- install(TARGETS libzstd_shared RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ install(TARGETS libzstd EXPORT zstd-config ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + endif() + if (ZSTD_BUILD_STATIC) +- install(TARGETS libzstd_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") ++ install(TARGETS libzstd EXPORT zstd-config ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + endif () + + # uninstall target +@@ -172,3 +174,6 @@ if (NOT TARGET uninstall) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + endif () ++ ++target_include_directories(libzstd PUBLIC $) ++install(EXPORT zstd-config DESTINATION share/cmake/zstd) diff --git a/ports/zstd/CONTROL b/ports/zstd/CONTROL index 1aa448753fc..84911e6b8d8 100644 --- a/ports/zstd/CONTROL +++ b/ports/zstd/CONTROL @@ -1,4 +1,4 @@ Source: zstd -Version: 1.4.4 +Version: 1.4.4-1 Description: Zstandard - Fast real-time compression algorithm Homepage: https://facebook.github.io/zstd/ diff --git a/ports/zstd/portfile.cmake b/ports/zstd/portfile.cmake index ba97cd4b43e..c4159020174 100644 --- a/ports/zstd/portfile.cmake +++ b/ports/zstd/portfile.cmake @@ -5,6 +5,8 @@ vcpkg_from_github( REF 10f0e6993f9d2f682da6d04aa2385b7d53cbb4ee # v1.4.4 SHA512 869eb031d2f8cfd9d93502835a373f6f2ec39dc1f41dd5fd0463d3d442c153915987d00bc862ae66bded5c5697e1803a1e68491803bd1a7b358397e6eba58f64 HEAD_REF dev + PATCHES + 0001-export-zstd-config.patch ) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") @@ -37,6 +39,8 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/zstd) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) if((VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME) AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")