aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libredwg
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libredwg
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libredwg')
-rw-r--r--vcpkg/ports/libredwg/fix_arm64_build.patch14
-rw-r--r--vcpkg/ports/libredwg/fix_dependency.patch26
-rw-r--r--vcpkg/ports/libredwg/fix_install.patch45
-rw-r--r--vcpkg/ports/libredwg/portfile.cmake53
-rw-r--r--vcpkg/ports/libredwg/usage4
-rw-r--r--vcpkg/ports/libredwg/vcpkg.json25
6 files changed, 167 insertions, 0 deletions
diff --git a/vcpkg/ports/libredwg/fix_arm64_build.patch b/vcpkg/ports/libredwg/fix_arm64_build.patch
new file mode 100644
index 0000000..d27d692
--- /dev/null
+++ b/vcpkg/ports/libredwg/fix_arm64_build.patch
@@ -0,0 +1,14 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ec2ec1d..910f61c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -16,6 +16,9 @@ if(MSVC)
+ else()
+ set(redwg redwg)
+ endif()
++if(MSVC AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
++ add_compile_options(/Gy)
++endif()
+
+ if (EXISTS ".version")
+ file(READ .version NL_PACKAGE_VERSION)
diff --git a/vcpkg/ports/libredwg/fix_dependency.patch b/vcpkg/ports/libredwg/fix_dependency.patch
new file mode 100644
index 0000000..fea397b
--- /dev/null
+++ b/vcpkg/ports/libredwg/fix_dependency.patch
@@ -0,0 +1,26 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2e854f2..ec2ec1d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -282,6 +282,8 @@ target_include_directories(${redwg} PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>)
+
++find_path(JSMN_INCLUDE_DIRS "jsmn.h")
++target_include_directories(${redwg} PRIVATE ${JSMN_INCLUDE_DIRS})
+ link_libraries(${redwg} ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
+
+ if(NOT LIBREDWG_LIBONLY)
+diff --git a/src/in_json.c b/src/in_json.c
+index d66f1ab..724505b 100644
+--- a/src/in_json.c
++++ b/src/in_json.c
+@@ -51,7 +51,7 @@ static unsigned int loglevel;
+ // In strict mode an object or array can't become a key
+ // In strict mode primitives are: numbers and booleans
+ #undef JSMN_STRICT
+-#include "../jsmn/jsmn.h"
++#include "jsmn.h"
+
+ typedef struct jsmntokens
+ {
diff --git a/vcpkg/ports/libredwg/fix_install.patch b/vcpkg/ports/libredwg/fix_install.patch
new file mode 100644
index 0000000..fe5a11c
--- /dev/null
+++ b/vcpkg/ports/libredwg/fix_install.patch
@@ -0,0 +1,45 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cbf9341..2e854f2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -279,7 +279,8 @@ target_include_directories(${redwg} PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${CMAKE_CURRENT_BINARY_DIR}/src)
+ target_include_directories(${redwg} PUBLIC
+- ${CMAKE_CURRENT_SOURCE_DIR}/include)
++ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
++ $<INSTALL_INTERFACE:include>)
+
+ link_libraries(${redwg} ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
+
+@@ -390,6 +391,7 @@ add_custom_target(
+ DEPENDS ${SRCS}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
++if(0)
+ if(MSVC)
+ install(TARGETS ${redwg} RUNTIME PUBLIC_HEADER
+ DESTINATION libredwg-${PACKAGE_VERSION})
+@@ -411,6 +413,22 @@ else()
+ endif()
+ endif()
+ install(TARGETS RUNTIME)
++endif()
++
++include(GNUInstallDirs)
++install(
++ TARGETS ${redwg}
++ EXPORT libredwg-core
++ COMPONENT libredwg
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ PUBLIC_HEADER DESTINATION include/libredwg)
++if(NOT LIBREDWG_LIBONLY)
++ install(TARGETS ${executables_TARGETS}
++ DESTINATION "${CMAKE_INSTALL_BINDIR}")
++endif()
++install(EXPORT libredwg-core FILE unofficial-libredwg-config.cmake NAMESPACE unofficial::libredwg:: DESTINATION share/unofficial-libredwg)
+
+ if(WIN32)
+ add_custom_target(dist
diff --git a/vcpkg/ports/libredwg/portfile.cmake b/vcpkg/ports/libredwg/portfile.cmake
new file mode 100644
index 0000000..871bc43
--- /dev/null
+++ b/vcpkg/ports/libredwg/portfile.cmake
@@ -0,0 +1,53 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO LibreDWG/libredwg
+ REF "${VERSION}"
+ SHA512 cf0baf477d053eb6ab2feaeda187f2d92211c7d28aa50318c1c8d7acf1b9c463258fa3a388dddce266bf44e0d4e4cf1bd3aa591c918f8a253515919e5c1b3f57
+ HEAD_REF master
+ PATCHES
+ fix_install.patch
+ fix_dependency.patch
+ fix_arm64_build.patch
+)
+
+# If generate dwg manipulation tools
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ INVERTED_FEATURES
+ tools LIBREDWG_LIBONLY
+)
+
+# libredwg will read the version
+file(WRITE "${SOURCE_PATH}/.version" "${VERSION}")
+
+# Fix https://github.com/LibreDWG/libredwg/issues/652#issuecomment-1454035167
+vcpkg_replace_string("${SOURCE_PATH}/src/common.h"
+ [[defined(COMMON_TEST_C)]]
+ [[(defined COMMON_TEST_C || defined __APPLE__)]]
+)
+vcpkg_replace_string("${SOURCE_PATH}/src/common.c"
+ [[defined(COMMON_TEST_C)]]
+ [[(defined COMMON_TEST_C || defined __APPLE__)]]
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DBUILD_TESTING=OFF
+ -DDISABLE_WERROR=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libredwg CONFIG_PATH share/unofficial-libredwg)
+
+if("tools" IN_LIST FEATURES)
+ vcpkg_copy_tools(TOOL_NAMES dwg2dxf dwg2SVG dwgbmp dwggrep dwglayers dwgread dwgrewrite dwgwrite dxf2dwg AUTO_CLEAN)
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/libredwg/usage b/vcpkg/ports/libredwg/usage
new file mode 100644
index 0000000..7b14668
--- /dev/null
+++ b/vcpkg/ports/libredwg/usage
@@ -0,0 +1,4 @@
+libredwg provides CMake targets:
+
+ find_package(unofficial-libredwg CONFIG REQUIRED)
+ target_link_libraries(main unofficial::libredwg::libredwg)
diff --git a/vcpkg/ports/libredwg/vcpkg.json b/vcpkg/ports/libredwg/vcpkg.json
new file mode 100644
index 0000000..f80def8
--- /dev/null
+++ b/vcpkg/ports/libredwg/vcpkg.json
@@ -0,0 +1,25 @@
+{
+ "name": "libredwg",
+ "version": "0.13.3",
+ "port-version": 1,
+ "description": "GNU LibreDWG is a free C library to handle DWG files. It aims to be a free replacement for the OpenDWG libraries. DWG is the native file format of AutoCAD.",
+ "homepage": "https://www.gnu.org/software/libredwg/",
+ "license": "GPL-3.0",
+ "supports": "!xbox",
+ "dependencies": [
+ "jsmn",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "tools": {
+ "description": "Build dwg/dxf manipulation command-line tools"
+ }
+ }
+}