Genivia / RE-flex

A high-performance C++ regex library and lexical analyzer generator with Unicode support. Extends Flex++ with Unicode support, indent/dedent anchors, lazy quantifiers, functions for lex and syntax error reporting and more. Seamlessly integrates with Bison and other parsers.
https://www.genivia.com/doc/reflex/html
BSD 3-Clause "New" or "Revised" License
520 stars 85 forks source link

Build tests with CMake #192

Closed szhorvat closed 1 year ago

szhorvat commented 1 year ago

This is a request to make it possible to build the tests (and examples) with CMake.

Since RE/flex can be built either with CMake or autotools, is there a recommendation on which one to use when packaging this tool? See this PR to add RE/flex to MacPorts (comments welcome).

genivia-inc commented 1 year ago

Thank you for your comments and suggestions.

I prefer autotools, simply because I've been using those for a long time. CMake is a fine tool too. I have some basic-level experience with it, but it will take me quite a bit of effort to rewrite the configuration and installation. The autoconf script checks for architectural features by running some custom autoconf-generated code to check for SSE2/AVX2/AArch64. This was tricky to write to work with clang and GCC and with various OS. See the configure.ac script to see what I mean. Doing this again for cmake and test it all out with various OS, clang and GCC, is not something that can be done overnight.

szhorvat commented 1 year ago

Thanks for the response. All I needed was clarity on which build system to prefer when including RE/flex in a repo like MacPorts and this makes it clear.

Once the PR I referred to is merged, you might consider adding MacPorts installation instructions to the README, along with the Homebrew ones. The command will be sudo port install re-flex. But let's wait until the PR is merged.

A question regarding packaging RE/flex: I notice that Homebrew adds pcre2 as a dependency, and Nix adds boost. As far as I can tell, these are unnecessary either for building or using RE/flex. They are optional when linking the code produced by RE/flex. Can you confirm that my understanding is correct?

genivia-inc commented 1 year ago

A question regarding packaging RE/flex: I notice that Homebrew adds pcre2 as a dependency, and Nix adds boost. As far as I can tell, these are unnecessary either for building or using RE/flex. They are optional when linking the code produced by RE/flex. Can you confirm that my understanding is correct?

There are no dependencies. You're right about linking the generated code optionally with PCRE2 or Boost. So, by default, there are no dependencies at all. RE/flex has a POSIX-compliant regex pattern engine that is compatible with Flex which means nothing needs to be added by default. Only if the user wants to use PCRE2 or Boost then he/she can do so at any time later. RE/flex also includes a "flexible" regex engine API abstraction layer which wraps PCRE2 and Boost, but that is optional too.

genivia-inc commented 1 year ago

I am working today on an update v3.4.1 with one minor improvement related to support for word boundaries (\b \B \< \<). This RE/flex update is already used by ugrep. I will add MacPorts installation instructions to RE/flex, perhaps though it might be a bit too early, but then I don't need to release RE/flex later again.

genivia-inc commented 1 year ago

Thank you for your help!

szhorvat commented 1 year ago

FYI the MacPorts PR is finally merged, RE/flex is now available in MacPorts.

I think we can close this issue now, since you answered my question.