summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2022-02-09 08:14:10 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2022-02-09 08:14:10 +0900
commitd97bcaac29892fdfedf726d9127af64b98390d1c (patch)
tree8f764687bfd7711cd95e36af510868c311052385 /CMakeLists.txt
parent32cede6c351bcbe5a7b03028618a9cc807d707ad (diff)
downloadre2c-d97bcaac29892fdfedf726d9127af64b98390d1c.tar.gz
re2c-d97bcaac29892fdfedf726d9127af64b98390d1c.tar.bz2
re2c-d97bcaac29892fdfedf726d9127af64b98390d1c.zip
Imported Upstream version 3.0upstream/3.0
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt55
1 files changed, 49 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d281b81..2789ce6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12)
-project(re2c VERSION 2.2 HOMEPAGE_URL "https://re2c.org/")
+project(re2c VERSION 3.0 HOMEPAGE_URL "https://re2c.org/")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -42,6 +42,7 @@ endif()
option(RE2C_BUILD_LIBS "Build libraries" OFF)
option(RE2C_BUILD_RE2GO "Build re2go executable (an alias for `re2c --lang go`)" ON)
+option(RE2C_BUILD_RE2RUST "Build re2rust executable (an alias for `re2c --lang rust`)" ON)
option(RE2C_BUILD_BENCHMARKS "Build benchmarks" OFF)
option(RE2C_REGEN_BENCHMARKS "Regenerate C code for benchmarks" OFF)
@@ -145,6 +146,7 @@ set(re2c_sources
src/codegen/gen_program.cc
src/codegen/gen_state.cc
src/codegen/helpers.cc
+ src/codegen/remove_empty.cc
src/codegen/render.cc
src/options/opt.cc
src/options/symtab.cc
@@ -223,6 +225,12 @@ if (RE2C_BUILD_RE2GO)
target_compile_definitions(re2go PUBLIC "RE2C_LANG=LANG_GO")
endif()
+# re2rust
+if (RE2C_BUILD_RE2RUST)
+ add_executable(re2rust ${re2c_sources})
+ target_compile_definitions(re2rust PUBLIC "RE2C_LANG=LANG_RUST")
+endif()
+
re2c_bootstrap_lexer("src/parse/lex.re" "src/parse/lex.cc" "src/parse/lex.h")
re2c_bootstrap_lexer("src/parse/lex_conf.re" "src/parse/lex_conf.cc")
re2c_bootstrap_lexer("src/options/parse_opts.re" "src/options/parse_opts.cc")
@@ -233,6 +241,7 @@ re2c_bootstrap_parser("src/parse/parser.ypp" "src/parse/parser.cc" "src/parse/pa
set(re2c_docs_sources
"${re2c_manpage_source}"
"doc/manual/api/interface.rst_"
+ "doc/manual/conditions/blocks.rst_"
"doc/manual/conditions/conditions.rst_"
"doc/manual/configurations/configurations.rst_"
"doc/manual/directives/directives.rst_"
@@ -257,17 +266,22 @@ set(re2c_docs_sources
"doc/manual/state/state.rst_"
"doc/manual/submatch/submatch_example_mtags.rst_"
"doc/manual/submatch/submatch_example_posix.rst_"
- "doc/manual/submatch/submatch_example_stags.rst_"
"doc/manual/submatch/submatch_example_stags_fill.rst_"
+ "doc/manual/submatch/submatch_example_stags.rst_"
"doc/manual/submatch/submatch.rst_"
- "doc/manual/syntax/syntax.rst_"
+ "doc/manual/synopsis.rst_"
"doc/manual/syntax/api1.rst_"
"doc/manual/syntax/api2_c.rst_"
"doc/manual/syntax/api2_go.rst_"
+ "doc/manual/syntax/api2_rust.rst_"
"doc/manual/syntax/api3.rst_"
+ "doc/manual/syntax/intro.rst_"
+ "doc/manual/syntax/syntax.rst_"
"doc/manual/warnings/warnings_general.rst_"
"doc/manual/warnings/warnings_list.rst_"
"examples/c/01_basic.re"
+ "examples/c/01_basic.c"
+ "examples/c/conditions/parse_u32_blocks.re"
"examples/c/conditions/parse_u32_conditions.re"
"examples/c/encodings/unicode_identifier.re"
"examples/c/eof/01_sentinel.re"
@@ -277,17 +291,19 @@ set(re2c_docs_sources
"examples/c/fill/01_fill.re"
"examples/c/fill/02_fill.re"
"examples/c/headers/header.re"
- "examples/c/headers/src/lexer/lexer.h"
+ "examples/c/headers/lexer/state.h"
"examples/c/includes/include.re"
"examples/c/includes/definitions.h"
"examples/c/reuse/reuse.re"
"examples/c/reuse/usedir.re"
"examples/c/state/push.re"
- "examples/c/submatch/01_stags.re"
"examples/c/submatch/01_stags_fill.re"
+ "examples/c/submatch/01_stags.re"
"examples/c/submatch/02_mtags.re"
"examples/c/submatch/03_posix.re"
"examples/go/01_basic.re"
+ "examples/go/01_basic.go"
+ "examples/go/conditions/parse_u32_blocks.re"
"examples/go/conditions/parse_u32_conditions.re"
"examples/go/encodings/unicode_identifier.re"
"examples/go/eof/01_sentinel.re"
@@ -297,15 +313,38 @@ set(re2c_docs_sources
"examples/go/fill/01_fill.re"
"examples/go/fill/02_fill.re"
"examples/go/headers/header.re"
- "examples/go/headers/src/lexer/lexer.go"
+ "examples/go/headers/lexer/state.go"
"examples/go/includes/include.re"
"examples/go/includes/definitions.go"
"examples/go/reuse/reuse.re"
"examples/go/reuse/usedir.re"
"examples/go/state/push.re"
+ "examples/go/submatch/01_stags_fill.re"
"examples/go/submatch/01_stags.re"
"examples/go/submatch/02_mtags.re"
"examples/go/submatch/03_posix.re"
+ "examples/rust/01_basic.re"
+ "examples/rust/01_basic.rs"
+ "examples/rust/conditions/parse_u32_blocks.re"
+ "examples/rust/conditions/parse_u32_conditions.re"
+ "examples/rust/encodings/unicode_identifier.re"
+ "examples/rust/eof/01_sentinel.re"
+ "examples/rust/eof/02_bounds_checking.re"
+ "examples/rust/eof/03_eof_rule.re"
+ "examples/rust/eof/05_generic_api_eof_rule.re"
+ "examples/rust/fill/01_fill.re"
+ "examples/rust/fill/02_fill.re"
+ "examples/rust/headers/header.re"
+ "examples/rust/headers/lexer/state.rs"
+ "examples/rust/includes/include.re"
+ "examples/rust/includes/definitions.rs"
+ "examples/rust/reuse/reuse.re"
+ "examples/rust/reuse/usedir.re"
+ "examples/rust/state/push.re"
+ "examples/rust/submatch/01_stags_fill.re"
+ "examples/rust/submatch/01_stags.re"
+ "examples/rust/submatch/02_mtags.re"
+ "examples/rust/submatch/03_posix.re"
)
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_c}" "${re2c_manpage_bootstrap_c}" "c")
re2c_gen_manpage("${re2c_manpage_source}" "${re2c_manpage_go}" "${re2c_manpage_bootstrap_go}" "go")
@@ -321,6 +360,10 @@ if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
install(TARGETS re2go RUNTIME DESTINATION bin)
install(FILES "${re2c_manpage_go}" DESTINATION "share/man/man1")
endif()
+ if(RE2C_BUILD_RE2RUST)
+ install(TARGETS re2rust RUNTIME DESTINATION bin)
+ # TODO: add docs for Rust.
+ endif()
install(FILES include/unicode_categories.re DESTINATION "${RE2C_STDLIB_DIR}")
# rebuild all re2c sources using newly built re2c