2021-11-21 15:27:33 +00:00
|
|
|
# Copyright 2015 The RE2 Authors. All Rights Reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
# This file was edited for ClickHouse
|
|
|
|
|
|
|
|
set(SRC_DIR "${ClickHouse_SOURCE_DIR}/contrib/re2")
|
|
|
|
|
|
|
|
set(RE2_SOURCES
|
|
|
|
${SRC_DIR}/re2/bitstate.cc
|
|
|
|
${SRC_DIR}/re2/compile.cc
|
|
|
|
${SRC_DIR}/re2/dfa.cc
|
|
|
|
${SRC_DIR}/re2/filtered_re2.cc
|
|
|
|
${SRC_DIR}/re2/mimics_pcre.cc
|
|
|
|
${SRC_DIR}/re2/nfa.cc
|
|
|
|
${SRC_DIR}/re2/onepass.cc
|
|
|
|
${SRC_DIR}/re2/parse.cc
|
|
|
|
${SRC_DIR}/re2/perl_groups.cc
|
|
|
|
${SRC_DIR}/re2/prefilter.cc
|
|
|
|
${SRC_DIR}/re2/prefilter_tree.cc
|
|
|
|
${SRC_DIR}/re2/prog.cc
|
|
|
|
${SRC_DIR}/re2/re2.cc
|
|
|
|
${SRC_DIR}/re2/regexp.cc
|
|
|
|
${SRC_DIR}/re2/set.cc
|
|
|
|
${SRC_DIR}/re2/simplify.cc
|
|
|
|
${SRC_DIR}/re2/stringpiece.cc
|
|
|
|
${SRC_DIR}/re2/tostring.cc
|
|
|
|
${SRC_DIR}/re2/unicode_casefold.cc
|
|
|
|
${SRC_DIR}/re2/unicode_groups.cc
|
|
|
|
${SRC_DIR}/util/rune.cc
|
|
|
|
${SRC_DIR}/util/strutil.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(re2 ${RE2_SOURCES})
|
|
|
|
target_include_directories(re2 PUBLIC "${SRC_DIR}")
|
|
|
|
|
|
|
|
|
2016-12-01 22:44:59 +00:00
|
|
|
# Building re2 which is thread-safe and re2_st which is not.
|
|
|
|
# re2 changes its state during matching of regular expression, e.g. creates temporary DFA.
|
|
|
|
# It uses RWLock to process the same regular expression object from different threads.
|
|
|
|
# In order to avoid redundant locks in some cases, we use not thread-safe version of the library (re2_st).
|
2017-01-16 19:47:11 +00:00
|
|
|
|
2021-11-21 15:27:33 +00:00
|
|
|
add_library(re2_st ${RE2_SOURCES})
|
2018-01-22 13:47:00 +00:00
|
|
|
target_compile_definitions (re2_st PRIVATE NDEBUG NO_THREADS re2=re2_st)
|
2018-08-10 02:24:10 +00:00
|
|
|
target_include_directories (re2_st PRIVATE .)
|
2021-11-21 15:27:33 +00:00
|
|
|
target_include_directories (re2_st SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${SRC_DIR})
|
2017-08-09 20:52:55 +00:00
|
|
|
|
2016-11-02 09:29:39 +00:00
|
|
|
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/re2_st)
|
2018-01-22 13:47:00 +00:00
|
|
|
foreach (FILENAME filtered_re2.h re2.h set.h stringpiece.h)
|
2018-07-30 18:11:31 +00:00
|
|
|
add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/re2_st/${FILENAME}"
|
2021-11-21 15:27:33 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -DSOURCE_FILENAME="${SRC_DIR}/re2/${FILENAME}"
|
2018-07-30 18:11:31 +00:00
|
|
|
-DTARGET_FILENAME="${CMAKE_CURRENT_BINARY_DIR}/re2_st/${FILENAME}"
|
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/re2_transform.cmake"
|
|
|
|
COMMENT "Creating ${FILENAME} for re2_st library.")
|
|
|
|
add_custom_target (transform_${FILENAME} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/re2_st/${FILENAME}")
|
|
|
|
add_dependencies (re2_st transform_${FILENAME})
|
2016-11-02 09:29:39 +00:00
|
|
|
endforeach ()
|
2018-02-12 02:41:50 +00:00
|
|
|
|
|
|
|
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/util)
|
|
|
|
foreach (FILENAME mutex.h)
|
2018-07-30 18:11:31 +00:00
|
|
|
add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/util/${FILENAME}"
|
2021-11-21 15:27:33 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -DSOURCE_FILENAME="${SRC_DIR}/util/${FILENAME}"
|
2018-07-30 18:11:31 +00:00
|
|
|
-DTARGET_FILENAME="${CMAKE_CURRENT_BINARY_DIR}/util/${FILENAME}"
|
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/re2_transform.cmake"
|
|
|
|
COMMENT "Creating ${FILENAME} for re2_st library.")
|
|
|
|
add_custom_target (transform_${FILENAME} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/util/${FILENAME}")
|
|
|
|
add_dependencies (re2_st transform_${FILENAME})
|
2018-02-12 02:41:50 +00:00
|
|
|
endforeach ()
|