Compare commits

...
5 Commits
Author SHA1 Message Date
Ulya Trofimovich 4424a0dd1e CMake: set C++17 standard for benchmarks (required by newer re2). 2023-07-24 08:05:35 +01:00
Ulya Trofimovich 96104a6526 CMakeLists.txt: make C++11 standard required (not optional).
This fixes https://github.com/skvadrik/re2c/issues/455 "Test for C++11
compiler at configure time".
2023-07-21 22:29:45 +01:00
Ulya Trofimovich 59c56044b9 configure.ac: make C++ compiler flag -std=c++11 required (not optional).
This fixes https://github.com/skvadrik/re2c/issues/455 "Test for C++11
compiler at configure time".
2023-07-21 22:15:34 +01:00
Ulya Trofimovich 3841e83f85 Makefile.am: add missing files to distribution.
This fixes https://github.com/skvadrik/re2c/issues/454 "BUILD.md not
present in tarball".
2023-07-21 21:42:54 +01:00
Ulya Trofimovich 7d6641778c BUILD.md: document C++11 requirement.
This fixes https://github.com/skvadrik/re2c/issues/453 "Document C++11
compiler requirement in BUILD.md".
2023-07-21 21:32:51 +01:00
6 changed files with 28 additions and 5 deletions
+3 -3
View File
@@ -5,9 +5,9 @@ How to build
Dependencies
------------
To build re2c from a release tarball one needs only a C++ compiler and Python 3
(for build-time scripts and for testing). Building on Windows additionally
requires either CMake or a Mingw build environment.
To build re2c from a release tarball one needs only a C++ compiler (supporting
at least C++11) and Python 3 for build-time scripts and for testing. Building on
Windows additionally requires either CMake or a Mingw build environment.
To develop re2c one also needs CMake or Autotools (both build systems are
maintained). Other dependencies include Bison (to rebuild parsers), Python 3
+1
View File
@@ -53,6 +53,7 @@ endif()
# -std=gnu++11, not -std=c++11. Extensions are needed to enable POSIX functions on
# Cygwin and NetBSD.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # fail if the C++ compiler does not support this standard
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # make sure object libraries work with shared libraries
# needed for POSIX file API
+11
View File
@@ -311,17 +311,28 @@ man_MANS = $(DOCS)
# include files (stdlib)
dist_stdlib_DATA = include/unicode_categories.re
BAZELFILES := \
BUILD.bazel \
WORKSPACE \
bazel
CMAKEFILES := \
CMakeLists.txt \
CMakePresets.json \
cmake
EXTRA_DIST = \
$(re2c_BOOT) \
$(re2c_CUSTOM) \
$(re2c_SRC_DOC_EXT) \
$(BAZELFILES) \
$(CMAKEFILES) \
BUILD.md \
CHANGELOG \
CONTRIBUTING.md \
IDEAS.md \
LICENSE \
MAINTAINERS.md \
NO_WARRANTY \
README.md \
autogen.sh \
@@ -12,6 +12,9 @@ target_link_libraries(bench_submatch_dfa_jit benchmark::benchmark)
find_path(RE2_INCLUDE_DIRECTORY "re2/re2.h")
find_library(RE2_LIBRARY re2)
if(RE2_INCLUDE_DIRECTORY AND RE2_LIBRARY)
set_target_properties(bench_submatch_dfa_jit PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
target_compile_definitions(bench_submatch_dfa_jit PRIVATE "HAVE_RE2_RE2_H=1")
target_include_directories(bench_submatch_dfa_jit PRIVATE "${RE2_INCLUDE_DIRECTORY}")
target_link_libraries(bench_submatch_dfa_jit "${RE2_LIBRARY}")
+3
View File
@@ -12,6 +12,9 @@ target_link_libraries(bench_submatch_nfa benchmark::benchmark)
find_path(RE2_INCLUDE_DIRECTORY "re2/re2.h")
find_library(RE2_LIBRARY re2)
if(RE2_INCLUDE_DIRECTORY AND RE2_LIBRARY)
set_target_properties(bench_submatch_nfa PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
target_compile_definitions(bench_submatch_nfa PRIVATE "HAVE_RE2_RE2_H=1")
target_include_directories(bench_submatch_nfa PRIVATE "${RE2_INCLUDE_DIRECTORY}")
target_link_libraries(bench_submatch_nfa "${RE2_LIBRARY}")
+7 -2
View File
@@ -124,13 +124,18 @@ AC_DEFUN([TRY_CXXFLAG], [
AS_VAR_SET([TRY_CXXFLAG_RESULT], [yes])
AS_VAR_SET([CXXFLAGSDEFAULT], ["$CXXFLAGSDEFAULT $1 $2"])
],
[AS_VAR_SET([TRY_CXXFLAG_RESULT], [no])]
[
AS_VAR_SET([TRY_CXXFLAG_RESULT], [no])
AS_IF([test "x$3" = "xrequired"], [
AC_MSG_ERROR([C++ compiler flag $1 is required to build re2c])
])
]
)
AC_LANG_POP([C++])
AS_VAR_SET([CXXFLAGS], ["$CXXFLAGS_BACKUP"])
AC_MSG_RESULT([$TRY_CXXFLAG_RESULT])
])
TRY_CXXFLAG([-std=c++11])
TRY_CXXFLAG([-std=c++11], [], [required])
TRY_CXXFLAG([-W])
TRY_CXXFLAG([-Wall])
TRY_CXXFLAG([-Wextra])