Skip to content

Commit 7994c97

Browse files
Use a local port of re2 with a patch to work with cmake 3.29.1 (#440)
See google/re2#488 Co-authored-by: Jonathan Giannuzzi <[email protected]>
1 parent f149974 commit 7994c97

File tree

7 files changed

+66
-3
lines changed

7 files changed

+66
-3
lines changed

.devcontainer/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ FROM cpp AS vcpkg
4646

4747
USER vscode
4848

49-
# Copy our vcpkg manifest
49+
# Copy our vcpkg manifest and ports
5050
COPY --chown=vscode:vscode vcpkg.json /tmp/build/
51+
COPY --chown=vscode:vscode ports /tmp/build/ports
5152

5253
# Install vcpkg
5354
RUN sudo mkdir -p $VCPKG_ROOT \

.dockerignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
**
22
!vcpkg.json
3-
!*/*.csproj
3+
!ports
4+
!*/*.csproj

.github/workflows/devcontainer.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- "vcpkg.json"
1010
- "*/*.csproj"
1111
- ".github/workflows/devcontainer.yml"
12+
- "ports/**"
1213
pull_request:
1314
branches: [master]
1415
paths:
@@ -17,6 +18,7 @@ on:
1718
- "vcpkg.json"
1819
- "*/*.csproj"
1920
- ".github/workflows/devcontainer.yml"
21+
- "ports/**"
2022
# Run once a week
2123
schedule:
2224
- cron: "34 2 * * 2"

ports/re2/portfile.cmake

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO google/re2
4+
REF "${VERSION}"
5+
SHA512 b033bb38020947cce49f7fa27c711a49bd147a0286993852ed7fea6f653af5b2f48b8de9dae324596e44a1731e8747382a4151f6f5d44b1d92ce2748b83ca85c
6+
HEAD_REF master
7+
PATCHES
8+
remove_include_dir.patch
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}"
13+
OPTIONS
14+
-DRE2_BUILD_TESTING=OFF
15+
)
16+
17+
vcpkg_cmake_install()
18+
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
19+
vcpkg_fixup_pkgconfig()
20+
21+
vcpkg_copy_pdbs()
22+
23+
# Handle copyright
24+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
25+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

ports/re2/remove_include_dir.patch

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/re2Config.cmake.in b/re2Config.cmake.in
2+
index 6a177c6..be7b6bc 100644
3+
--- a/re2Config.cmake.in
4+
+++ b/re2Config.cmake.in
5+
@@ -6,8 +6,6 @@
6+
7+
include(CMakeFindDependencyMacro)
8+
9+
-set_and_check(re2_INCLUDE_DIR ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@)
10+
-
11+
if(UNIX)
12+
set(THREADS_PREFER_PTHREAD_FLAG ON)
13+
find_dependency(Threads REQUIRED)

ports/re2/vcpkg.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "re2",
3+
"version-date": "2023-07-01",
4+
"description": "RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python. It is a C++ library.",
5+
"homepage": "https://github.com/google/re2",
6+
"license": "BSD-3-Clause",
7+
"dependencies": [
8+
"abseil",
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
]
18+
}

vcpkg.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"name": "arrow",
1212
"version": "15.0.2"
1313
}
14-
]
14+
],
15+
"vcpkg-configuration": {
16+
"overlay-ports": ["./ports"]
17+
}
1518
}

0 commit comments

Comments
 (0)