Skip to content

Add google RE2 #1583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add google RE2 #1583

wants to merge 1 commit into from

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Apr 22, 2025

It depends on abseil, not sure if this is going to work as is.

It depends on abseil, not sure if this is going to work as is
@partouf
Copy link
Member

partouf commented Apr 22, 2025

Thanks for the PR! I will take a look at this next week probably

@jmarrec
Copy link
Contributor Author

jmarrec commented Apr 22, 2025

Locally I checked out abseil-cpp and re2 into a google subdirectory.

I build abseil-cpp.

cmake -G Ninja -DCMAKE_BUILD_TYPE:String=Release -DBUILD_TESTING:BOOL=OFF \
      -DCMAKE_INSTALL_PREFIX=$(pwd)/install ..
ninja install

I build re2.

cmake -G Ninja -DCMAKE_BUILD_TYPE:String=Release -DBUILD_TESTING:BOOL=OFF \
      -DCMAKE_INSTALL_PREFIX=$(pwd)/install \
      -Dabsl_DIR=$HOME/google/abseil-cpp/build/install/lib/cmake/absl/ ..
ninja install

Test program

#include <re2/re2.h>
#include <cassert>

int main() {
  assert(RE2::FullMatch("hello", "h.*o"));
}

A CMakeLists.txt if needed:

cmake_minimum_required(VERSION 3.31)

project(test)

find_package(re2 REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE re2::re2)

I build it via

cmake -G Ninja -DCMAKE_BUILD_TYPE:String=Release -DBUILD_TESTING:BOOL=OFF \
      -DCMAKE_INSTALL_PREFIX=$(pwd)/install \
      -Dabsl_DIR=$HOME/google/abseil-cpp/build/install/lib/cmake/absl/ \
      -Dre2_DIR=$HOME/google/re2/build/install/lib/cmake/re ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants