Repository: microsoft/vcpkg
Pull request #44636: [libdmtx] Add new port
Author: login: sinfomicien
Labels: name: category:new-port
description: The issue is requesting a new library to be added; consider making a PR!
Created: 2025-03-26T23:18:53Z | Merged: 2025-03-27T17:01:55Z

Fixes #44635

- [X] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [X] The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
- [X] Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all `find_package` calls are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or disabled with [CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [X] The versioning scheme in `vcpkg.json` matches what upstream says.
- [X] The license declaration in `vcpkg.json` matches what upstream says.
- [X] The installed as the "copyright" file matches what upstream says.
- [X] The source code of the component installed comes from an authoritative source.
- [X] The generated "usage text" is accurate. See [adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md) for context.
- [X] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result.
- [X] Only one version is in the new port's versions file.
- [X] Only one version is added to each modified port's versions file.


Linked issue #44635: [New Port Request] libdmtx
### Library name

libdmtx

### Library description

libdmtx is a software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety.

### Source repository URL

https://github.com/dmtx/libdmtx

### Project homepage (if different from the source repository)

_No response_

### Anything else that is useful to know when adding (such as optional features the library may have that should be included)

_No response_

Diff:
diff --git a/ports/libdmtx/001-cmake-add-install-target.patch b/ports/libdmtx/001-cmake-add-install-target.patch
new file mode 100644
index 00000000000000..237dc95bac8c8f
--- /dev/null
+++ b/ports/libdmtx/001-cmake-add-install-target.patch
@@ -0,0 +1,30 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6420a813c1..749bd8d680 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.5)
+ project(DMTX VERSION 0.7.5 LANGUAGES C)
+ 
+ # DMTX library
+@@ -26,3 +26,19 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
+       add_subdirectory("test")
+     endif()
+ endif()
++
++# Add install rules
++if(DMTX_SHARED)
++  if(WIN32)
++    install(TARGETS dmtx
++            RUNTIME DESTINATION bin
++            ARCHIVE DESTINATION lib)
++  else()
++    install(TARGETS dmtx
++            LIBRARY DESTINATION lib)
++  endif()
++else()
++  install(TARGETS dmtx
++          ARCHIVE DESTINATION lib)
++endif()
++install(FILES "dmtx.h" "dmtxstatic.h" DESTINATION include)
diff --git a/ports/libdmtx/portfile.cmake b/ports/libdmtx/portfile.cmake
new file mode 100644
index 00000000000000..1bcf31ef524bce
--- /dev/null
+++ b/ports/libdmtx/portfile.cmake
@@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
+    OPTIONS_DEBUG
+        -DBUILD_TESTING=ON
+)
+
+set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled)
+
+vcpkg_cmake_install()
+
+vcpkg_copy_pdbs()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/ports/libdmtx/vcpkg.json b/ports/libdmtx/vcpkg.json
new file mode 100644
index 00000000000000..3acbbdcf1d7e71
--- /dev/null
+++ b/ports/libdmtx/vcpkg.json
@@ -0,0 +1,13 @@
+{
+  "name": "libdmtx",
+  "version": "0.7.7",
+  "description": "Software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety",
+  "homepage": "https://github.com/dmtx/libdmtx",
+  "license": "BSD-2-Clause",
+  "dependencies": [
+    {
+      "name": "vcpkg-cmake",
+      "host": true
+    }
+  ]
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index b53486b2a8ae67..b3efe2f46b6606 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -4520,6 +4520,10 @@
       "baseline": "0.24.3",
       "port-version": 0
     },
+    "libdmtx": {
+      "baseline": "0.7.7",
+      "port-version": 0
+    },
     "libdmx": {
       "baseline": "1.1.5",
       "port-version": 0
diff --git a/versions/l-/libdmtx.json b/versions/l-/libdmtx.json
new file mode 100644
index 00000000000000..f2afbd8ce12e2d
--- /dev/null
+++ b/versions/l-/libdmtx.json
@@ -0,0 +1,9 @@
+{
+  "versions": [
+    {
+      "git-tree": "2355c6d9951b9b34be9cbef758b59cb074067206",
+      "version": "0.7.7",
+      "port-version": 0
+    }
+  ]
+}


Reviews:
user: login: WangWeiLin-MV
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T09:54:06Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T10:20:45Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T10:20:55Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T10:21:44Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T10:23:30Z
user: login: dg0yt
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:06:05Z
user: login: dg0yt
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:06:25Z
user: login: dg0yt
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:06:54Z
user: login: dg0yt
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:07:16Z
user: login: dg0yt
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:29:24Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:49:27Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:50:57Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:51:53Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:53:06Z
user: login: sinfomicien
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:57:53Z

Review comments:
diff_hunk: @@ -0,0 +1,18 @@
+{
+  "name": "libdmtx",
+  "version": "0.7.7",
+  "description": "Software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety",
+  "homepage": "https://github.com/dmtx/libdmtx",
+  "license": "CC-BY-1.0",
path: ports/libdmtx/vcpkg.json
user: login: WangWeiLin-MV
body: It is not CC license.
created_at: 2025-03-27T09:52:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,18 @@
+{
+  "name": "libdmtx",
+  "version": "0.7.7",
+  "description": "Software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety",
+  "homepage": "https://github.com/dmtx/libdmtx",
+  "license": "CC-BY-1.0",
+  "dependencies": [
+    {
+      "name": "vcpkg-cmake",
+      "host": true
+    }
+  ],
+  "features": {
+    "example-feature": {
+      "description": ""
+    }
+  }
path: ports/libdmtx/vcpkg.json
user: login: WangWeiLin-MV
body: Please remove empty features.
created_at: 2025-03-27T09:52:18Z
author_association: CONTRIBUTOR
path: ports/libdmtx/portfile.cmake
user: login: WangWeiLin-MV
body: Please remove comments that no related with current port.
created_at: 2025-03-27T09:53:33Z
author_association: CONTRIBUTOR
path: ports/libdmtx/001-cmake-add-install-target
user: login: WangWeiLin-MV
body: If the file is patch, please add suffix with `.patch`
created_at: 2025-03-27T09:54:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,18 @@
+{
+  "name": "libdmtx",
+  "version": "0.7.7",
+  "description": "Software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety",
+  "homepage": "https://github.com/dmtx/libdmtx",
+  "license": "CC-BY-1.0",
path: ports/libdmtx/vcpkg.json
user: login: sinfomicien
body: Exact, this is a BSD-2-Clause, you’re right, i change it, thx
created_at: 2025-03-27T10:20:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,18 @@
+{
+  "name": "libdmtx",
+  "version": "0.7.7",
+  "description": "Software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety",
+  "homepage": "https://github.com/dmtx/libdmtx",
+  "license": "CC-BY-1.0",
+  "dependencies": [
+    {
+      "name": "vcpkg-cmake",
+      "host": true
+    }
+  ],
+  "features": {
+    "example-feature": {
+      "description": ""
+    }
+  }
path: ports/libdmtx/vcpkg.json
user: login: sinfomicien
body: Ok
created_at: 2025-03-27T10:20:55Z
author_association: CONTRIBUTOR
path: ports/libdmtx/portfile.cmake
user: login: sinfomicien
body: It was helpfull while working on it. But make sense to remove it now that the port works, and all tests are OK.
created_at: 2025-03-27T10:21:43Z
author_association: CONTRIBUTOR
path: ports/libdmtx/001-cmake-add-install-target
user: login: sinfomicien
body: Wow, i forgot it, thx for the review...
created_at: 2025-03-27T10:23:30Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,30 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6420a813c1..749bd8d680 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.5)
+ project(DMTX VERSION 0.7.5 LANGUAGES C)
+ 
+ # DMTX library
+@@ -26,3 +26,19 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
+       add_subdirectory("test")
+     endif()
+ endif()
++
++# Add install rules
++if(DMTX_SHARED)
++  if(WIN32)
++    install(TARGETS dmtx
++            RUNTIME DESTINATION bin
++            ARCHIVE DESTINATION lib)
++  else()
++    install(TARGETS dmtx
++            LIBRARY DESTINATION lib)
++  endif()
++else()
++  install(TARGETS dmtx
++          ARCHIVE DESTINATION lib)
++endif()
path: ports/libdmtx/001-cmake-add-install-target.patch
user: login: dg0yt
body: No such if/else needed. Just pass all destinations, or none.
created_at: 2025-03-27T17:06:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
path: ports/libdmtx/portfile.cmake
user: login: dg0yt
body: Deprecated function merged.
created_at: 2025-03-27T17:06:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
path: ports/libdmtx/portfile.cmake
user: login: dg0yt
body: `..` seriously? 
created_at: 2025-03-27T17:06:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
+    OPTIONS_DEBUG
+        -DBUILD_TESTING=ON
+)
+
+set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled)
path: ports/libdmtx/portfile.cmake
user: login: dg0yt
body: Why?
created_at: 2025-03-27T17:07:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
+    OPTIONS_DEBUG
+        -DBUILD_TESTING=ON
path: ports/libdmtx/portfile.cmake
user: login: dg0yt
body: Another option which is not allowed to pass review.
created_at: 2025-03-27T17:29:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
+    OPTIONS_DEBUG
+        -DBUILD_TESTING=ON
path: ports/libdmtx/portfile.cmake
user: login: sinfomicien
body: Rhaaa, my bad, was working on the base master branch of the lib at first, before considering using the released lib (0.7.7). I forgot to remove it.
created_at: 2025-03-27T17:49:27Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
+    OPTIONS_DEBUG
+        -DBUILD_TESTING=ON
+)
+
+set(VCPKG_POLICY_ALLOW_DEBUG_INCLUDE enabled)
path: ports/libdmtx/portfile.cmake
user: login: sinfomicien
body: Easy fix to some broken build on your CI. Let me find a better answer for it.
created_at: 2025-03-27T17:50:56Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
path: ports/libdmtx/portfile.cmake
user: login: sinfomicien
body: Discovered it on reading the code after your comment, let me correct it.
created_at: 2025-03-27T17:51:53Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+vcpkg_download_distfile(ARCHIVE
+    URLS "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz"
+    FILENAME "v0.7.7.tar.gz"
+    SHA512 802a697669afeb74da0cc3736fe7301fcc1653c1e3bebc343a8baf76e52226cc5509231519343267a92e22ebdfcc5b2825380339991340f054f0a6685d2ffcdc
+)
+
+vcpkg_extract_source_archive_ex(
+    OUT_SOURCE_PATH SOURCE_PATH
+    ARCHIVE "${ARCHIVE}"
+    PATCHES
+        001-cmake-add-install-target.patch
+)
+
+vcpkg_cmake_configure(
+    SOURCE_PATH "${SOURCE_PATH}"
+    OPTIONS
+        ..
path: ports/libdmtx/portfile.cmake
user: login: sinfomicien
body: Again, an option coming from the latest master branch of the project. No need for it at all on v0.7.7. Let me remove it
created_at: 2025-03-27T17:53:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,30 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6420a813c1..749bd8d680 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.5)
+ project(DMTX VERSION 0.7.5 LANGUAGES C)
+ 
+ # DMTX library
+@@ -26,3 +26,19 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
+       add_subdirectory("test")
+     endif()
+ endif()
++
++# Add install rules
++if(DMTX_SHARED)
++  if(WIN32)
++    install(TARGETS dmtx
++            RUNTIME DESTINATION bin
++            ARCHIVE DESTINATION lib)
++  else()
++    install(TARGETS dmtx
++            LIBRARY DESTINATION lib)
++  endif()
++else()
++  install(TARGETS dmtx
++          ARCHIVE DESTINATION lib)
++endif()
path: ports/libdmtx/001-cmake-add-install-target.patch
user: login: sinfomicien
body: Ok, let me remove all of this. I had some problems on CI, but i guess it’s coming from elsewhere, and i hope i already corrected it.
created_at: 2025-03-27T17:57:52Z
author_association: CONTRIBUTOR

PR comments:
user: login: sinfomicien
created_at: 2025-03-26T23:22:24Z
body: @microsoft-github-policy-service agree company="medadom"
author_association: CONTRIBUTOR
user: login: dg0yt
created_at: 2025-03-27T17:07:42Z
body: @vicroms Can this just be immediately reverted?
author_association: CONTRIBUTOR
user: login: sinfomicien
created_at: 2025-03-27T18:05:15Z
body: @dg0yt , i will open a new PR to correct all your remarks, as this one is closed
author_association: CONTRIBUTOR
user: login: dg0yt
created_at: 2025-03-27T18:07:19Z
body: I still think the merge should be reverted.
This PR wasn't even tagged as reviewed. 

author_association: CONTRIBUTOR
user: login: dg0yt
created_at: 2025-03-27T18:07:33Z
body: @vicroms ?
author_association: CONTRIBUTOR