开发者

How to build Google RE2 for Windows?

开发者 https://www.devze.com 2023-03-01 12:04 出处:网络
How to build Google RE2 for Windows? Someb开发者_如何学JAVAody tried?I made a fork available at http://code.google.com/p/re2win you can download the source as a .zip file and open the .vcproj file and

How to build Google RE2 for Windows? Someb开发者_如何学JAVAody tried?


I made a fork available at http://code.google.com/p/re2win you can download the source as a .zip file and open the .vcproj file and compile in 'Release' mode.


UPDATE: found a Windows project which may or may not work better: https://code.google.com/p/re2win/

Old answer (non MSVC): https://groups.google.com/group/re2-dev/browse_thread/thread/0665d7e6693b4adb/54bae4e315a484e3


I bet it would build easily using Cygwin.


Since September 2015 a CMakeLists.txt was added to RE2 repository. So now you can use CMake to generate files for Visual Studio and then build like a normal Visual Studio project. I have written a simple step-by-step tutorial on how to build and integrate RE2 in your C++ project for Windows. Tested for VS 13 and 15.


You can build RE2 for Windows with Microsoft Visual Studio by the Bazel build tool https://bazel.build/

  1. Get the latest version of RE2 by git clone https://github.com/google/re2.git
  2. Download Bazel Windows binary at https://github.com/bazelbuild/bazel/releases (scroll down and look for an .exe file)
  3. Put the Bazel binary in the root directory of RE2, or add a directory with the Bazel binary to %PATH%.
  4. Run the Visual Studio command prompt from the Start Menu, e.g., the the "x64 Native Tools Command Prompt"
  5. In the command prompt, go to your RE2 root folder, e.g. cd c:\gitrepos\re2
  6. Run bazel.exe build :all
  7. Bazel will create the subdirectoris bazel-bin, bazel-out, bazel-re2, bazel-testlogs.
  8. You will find the compiled RE2 binaries, i.e. the library and the test programs (.lib, .pdb, .exe) at bazel-bin
  9. Optionally, you may run test programs, e.g. regexp_benchmark.exe. You will see the output like that:
Search_Easy0_CachedDFA/8    10000000           105 ns/op      75.71 MB/s
Search_Easy0_CachedDFA/16   20000000           107 ns/op     148.31 MB/s
Search_Easy0_CachedDFA/32   20000000           121 ns/op     262.31 MB/s
Search_Easy0_CachedDFA/64   20000000           122 ns/op     523.80 MB/s
Search_Easy0_CachedDFA/128  20000000           120 ns/op    1061.91 MB/s
Search_Easy0_CachedDFA/256  20000000           122 ns/op    2081.69 MB/s
Search_Easy0_CachedDFA/512  10000000           185 ns/op    2760.31 MB/s
Search_Easy0_CachedDFA/1K   10000000           270 ns/op    3786.29 MB/s
Search_Easy0_CachedDFA/2K    5000000           409 ns/op    4995.25 MB/s
Search_Easy0_CachedDFA/4K    5000000           573 ns/op    7143.45 MB/s
Search_Easy0_CachedDFA/8K    1000000          1144 ns/op    7159.05 MB/s
Search_Easy0_CachedDFA/16K   1000000          1887 ns/op    8680.17 MB/s
Search_Easy0_CachedDFA/32K    500000          3620 ns/op    9049.65 MB/s
Search_Easy0_CachedDFA/64K    500000          7411 ns/op    8842.68 MB/s

etc...
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号