diff --git a/CMake/resolve_dependency_modules/hyperscan.cmake b/CMake/resolve_dependency_modules/hyperscan.cmake new file mode 100644 index 000000000000..2b79441e0b93 --- /dev/null +++ b/CMake/resolve_dependency_modules/hyperscan.cmake @@ -0,0 +1,52 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +include_guard(GLOBAL) + +if(DEFINED ENV{VELOX_HYPERSCAN_URL}) + set(VELOX_HYPERSCAN_SOURCE_URL "$ENV{VELOX_HYPERSCAN_URL}") +else() + set(VELOX_HYPERSCAN_VERSION v5.4.2) + set(VELOX_HYPERSCAN_SOURCE_URL + "https://github.com/intel/hyperscan/archive/refs/tags/${VELOX_HYPERSCAN_VERSION}.tar.gz" + ) + set(VELOX_HYPERSCAN_BUILD_SHA256_CHECKSUM + 32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99) +endif() + +message(STATUS "Building hyperscan from source") +FetchContent_Declare( + hyperscan + URL ${VELOX_HYPERSCAN_SOURCE_URL} + URL_HASH SHA256=${VELOX_HYPERSCAN_BUILD_SHA256_CHECKSUM}) + +set(CMAKE_CXX_STANDARD_BACKUP ${CMAKE_CXX_STANDARD}) +# C++ 17 is not supported. +set(CMAKE_CXX_STANDARD 11) +set(BUILD_EXAMPLES FALSE) +#set(BUILD_AVX512 ON) +FetchContent_MakeAvailable(hyperscan) +set(CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD_BACKUP}) +# if(ICU_SOURCE) +# # empty var will cause a syntax error +# if(${ICU_SOURCE} STREQUAL "BUNDLED") +# # build re2 after icu so the files are available +# add_dependencies(re2 ICU ICU::uc) +# endif() +# endif() + +# set(re2_LIBRARIES ${re2_BINARY_DIR}/libre2.a) +# set(re2_INCLUDE_DIRS ${re2_SOURCE_DIR}) + +# set(RE2_ROOT ${re2_BINARY_DIR}) +# set(re2_ROOT ${re2_BINARY_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 692b4d8d5b25..13f96e149d9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,6 +428,9 @@ endif() set_source(re2) resolve_dependency(re2) +set_source(hyperscan) +resolve_dependency(hyperscan 5.4.2) + if(${VELOX_BUILD_PYTHON_PACKAGE}) set_source(pybind11) resolve_dependency(pybind11 2.10.0)