aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/duckx
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/duckx')
-rw-r--r--vcpkg/ports/duckx/fix_dependencies.patch66
-rw-r--r--vcpkg/ports/duckx/portfile.cmake26
-rw-r--r--vcpkg/ports/duckx/vcpkg.json20
3 files changed, 112 insertions, 0 deletions
diff --git a/vcpkg/ports/duckx/fix_dependencies.patch b/vcpkg/ports/duckx/fix_dependencies.patch
new file mode 100644
index 0000000..c48daac
--- /dev/null
+++ b/vcpkg/ports/duckx/fix_dependencies.patch
@@ -0,0 +1,66 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f45218659..1ec4250c0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,9 +9,11 @@ endif()
+ option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
+ option(BUILD_SAMPLE "Build provided sample" OFF)
+
+-set(HEADERS src/duckx.hpp src/zip.h src/miniz.h
+- src/pugixml.hpp src/pugiconfig.hpp)
+-set(SOURCES src/duckx.cpp src/zip.c src/pugixml.cpp)
++find_package(libzip REQUIRED)
++find_package(pugixml REQUIRED)
++
++set(HEADERS src/duckx.hpp)
++set(SOURCES src/duckx.cpp)
+
+ if(BUILD_SHARED_LIBS)
+ add_library(duckx SHARED ${HEADERS} ${SOURCES})
+@@ -19,6 +21,8 @@ else()
+ add_library(duckx STATIC ${HEADERS} ${SOURCES})
+ endif()
+
++target_link_libraries(duckx PUBLIC libzip::zip pugixml::pugixml)
++
+ add_library(duckx::duckx ALIAS duckx)
+
+ target_include_directories(duckx PUBLIC
+@@ -38,12 +42,22 @@ endif()
+ include(GNUInstallDirs)
+ install(
+ TARGETS duckx
+- EXPORT duckxConfig
++ EXPORT duckxTargets
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${INSTALL_SUFFIX}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${INSTALL_SUFFIX}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
+-install(EXPORT duckxConfig NAMESPACE duckx:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/duckx)
++install(EXPORT duckxTargets NAMESPACE duckx:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/duckx)
++include(CMakePackageConfigHelpers)
++configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/duckxConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/duckxConfig.cmake"
++ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/duckx"
++ NO_SET_AND_CHECK_MACRO
++ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
++write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/duckxConfigVersion.cmake" COMPATIBILITY ExactVersion)
++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/duckxConfig.cmake"
++ "${CMAKE_CURRENT_BINARY_DIR}/duckxConfigVersion.cmake"
++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/duckx")
++
+ install(FILES ${HEADERS} DESTINATION include)
+
+
+diff --git a/duckxConfig.cmake.in b/duckxConfig.cmake.in
+new file mode 100644
+index 000000000..960b03b3b
+--- /dev/null
++++ b/duckxConfig.cmake.in
+@@ -0,0 +1,6 @@
++@PACKAGE_INIT@
++
++include(CMakeFindDependencyMacro)
++find_dependency(libzip)
++find_dependency(pugixml)
++include("${CMAKE_CURRENT_LIST_DIR}/duckxTargets.cmake")
+\ No newline at end of file
diff --git a/vcpkg/ports/duckx/portfile.cmake b/vcpkg/ports/duckx/portfile.cmake
new file mode 100644
index 0000000..9ee068c
--- /dev/null
+++ b/vcpkg/ports/duckx/portfile.cmake
@@ -0,0 +1,26 @@
+if (VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO amiremohamadi/DuckX
+ REF v1.2.2
+ SHA512 3f1e626973b4638adaffcc0a20f59791f3a70abda1d2d09fddca9312014cef86d097f24873e74ef58c775b27c71a637e44f340da01a301b00ef334600bd412d6
+ PATCHES fix_dependencies.patch
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DBUILD_TESTING=OFF
+)
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/duckx)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(COPY "${SOURCE_PATH}/README.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/duckx/vcpkg.json b/vcpkg/ports/duckx/vcpkg.json
new file mode 100644
index 0000000..36de4be
--- /dev/null
+++ b/vcpkg/ports/duckx/vcpkg.json
@@ -0,0 +1,20 @@
+{
+ "name": "duckx",
+ "version": "1.2.2",
+ "port-version": 1,
+ "description": "DuckX is a library for creation of Office docx files.",
+ "homepage": "https://github.com/amiremohamadi/DuckX",
+ "license": "MIT",
+ "dependencies": [
+ "libzip",
+ "pugixml",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}