On 1.7.x branch: Merge 1.7.x-vcpkg branch:
  * Add vcpkg port files and GitHub Actions workflow to test it.

git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1917458 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml
new file mode 100644
index 0000000..aabc0ac
--- /dev/null
+++ b/.github/workflows/windows-vcpkg.yml
@@ -0,0 +1,44 @@
+name: Vcpkg (Windows)

+

+on:

+  push:

+    branches: [ "1.7.x*" ]

+

+jobs:

+  build:

+    strategy:

+      matrix:

+        os: [windows-latest]

+        triplet:

+        - x64-windows

+        - x64-windows-static

+        - x64-windows-static-md

+        - x86-windows

+        - x86-windows-static

+        port:

+        - apr

+        - apr[core]

+        - apr[private-headers]

+      fail-fast: false

+    

+    name: "${{ matrix.port }}:${{ matrix.triplet }} on ${{ matrix.os }}"

+    # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.

+    # You can convert this to a matrix build if you need cross-platform coverage.

+    # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix

+    runs-on: ${{ matrix.os }}

+

+    env: 

+      VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

+

+    steps:

+    - name: Export GitHub Actions cache environment variables

+      uses: actions/github-script@v7

+      with:

+        script: |

+          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');

+          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

+

+    - uses: actions/checkout@v3

+

+    - name: Vcpkg Install

+      run: C:\vcpkg\vcpkg.exe install ${{ matrix.port }} --head --overlay-ports ${{ github.workspace }}\build\vcpkg --triplet ${{ matrix.triplet }} --enforce-port-checks

diff --git a/build/vcpkg/apr/portfile.cmake b/build/vcpkg/apr/portfile.cmake
new file mode 100644
index 0000000..a0166c9
--- /dev/null
+++ b/build/vcpkg/apr/portfile.cmake
@@ -0,0 +1,53 @@
+set(VERSION 1.7.5)
+#
+# Modify REF to latest commit id from https://github.com/apache/apr
+# Update SHA512 with actual SHA512
+#
+vcpkg_from_github(
+    OUT_SOURCE_PATH SOURCE_PATH
+    REPO apache/apr
+    REF 6445e8804008922f8018aa238aa4d6bba608c49a
+    SHA512 0
+    HEAD_REF 1.7.x
+)
+
+if (VCPKG_TARGET_IS_WINDOWS)
+    vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+        FEATURES
+            private-headers INSTALL_PRIVATE_H
+    )
+
+    string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" APR_BUILD_STATIC)
+    string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" APR_BUILD_SHARED)
+
+    if (FEATURE_MINIMAL_BUILD)
+      set(APU_USE_EXPAT OFF)
+    else()
+      set(APU_USE_EXPAT ON)
+    endif()
+
+    vcpkg_cmake_configure(
+        SOURCE_PATH "${SOURCE_PATH}"
+        OPTIONS
+            -DAPR_BUILD_STATIC=${APR_BUILD_STATIC}
+            -DAPR_BUILD_SHARED=${APR_BUILD_SHARED}
+            -DAPR_BUILD_TESTAPR=OFF
+            -DINSTALL_PDB=OFF
+            -DAPR_INSTALL_PRIVATE_H=${INSTALL_PRIVATE_H}
+    )
+
+    vcpkg_cmake_install()
+    vcpkg_copy_pdbs()
+    vcpkg_cmake_config_fixup(PACKAGE_NAME "apr"
+                             CONFIG_PATH "lib/cmake/apr")
+
+    file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+else()
+    # In development
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
+
diff --git a/build/vcpkg/apr/vcpkg.json b/build/vcpkg/apr/vcpkg.json
new file mode 100644
index 0000000..cf044bb
--- /dev/null
+++ b/build/vcpkg/apr/vcpkg.json
@@ -0,0 +1,25 @@
+{
+  "name": "apr",
+  "version": "1.7.5",
+  "port-version": 5,
+  "description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.",
+  "homepage": "https://apr.apache.org/",
+  "supports": "!uwp",
+  "dependencies": [
+    {
+      "name": "vcpkg-cmake",
+      "host": true,
+      "platform": "windows"
+    },
+    {
+      "name": "vcpkg-cmake-config",
+      "host": true
+    }
+  ],
+  "features": {
+    "private-headers": {
+      "description": "Install non-standard files required for building Apache httpd"
+    }
+  },
+  "default-features": []
+}