chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:25:07 +08:00
commit a26e856398
1681 changed files with 296950 additions and 0 deletions
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.7.2)
project(Boost-download NONE)
# Makes GIT_SUBMODULES "" in ExternalProject_Add skip initializing submodules
cmake_policy(SET CMP0097 NEW)
include(ExternalProject)
ExternalProject_Add(Boost
URL "https://sourceforge.net/projects/boost/files/boost/1.82.0/boost_1_82_0.tar.gz"
SOURCE_DIR "${CMAKE_BINARY_DIR}/Boost-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/Boost-build"
SOURCE_SUBDIR ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7.2)
project(pybind11-download NONE)
include(ExternalProject)
ExternalProject_Add(pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.10.4
SOURCE_DIR "${CMAKE_BINARY_DIR}/pybind11-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/pybind11-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.7.2)
project(arrow-download NONE)
# Makes GIT_SUBMODULES "" in ExternalProject_Add skip initializing submodules
cmake_policy(SET CMP0097 NEW)
include(ExternalProject)
ExternalProject_Add(apachearrow
GIT_REPOSITORY https://github.com/apache/arrow.git
GIT_TAG apache-arrow-18.1.0
GIT_SUBMODULES ""
GIT_SHALLOW TRUE
SOURCE_DIR "${CMAKE_BINARY_DIR}/arrow-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/arrow-build"
SOURCE_SUBDIR "cpp"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
# This patch is to work around https://github.com/apache/arrow/issues/44384
# It can be removed when a version of Arrow is released with https://github.com/apache/arrow/pull/44385
PATCH_COMMAND "${CMAKE_COMMAND}" -E chdir <SOURCE_DIR> git apply "${CMAKE_SOURCE_DIR}/patches/fix_arrow_libtool.patch" && "${CMAKE_COMMAND}" -E chdir <SOURCE_DIR> git apply "${CMAKE_SOURCE_DIR}/patches/arrow_strptime.patch"
)
+15
View File
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7.2)
project(date-download NONE)
include(ExternalProject)
ExternalProject_Add(date
GIT_REPOSITORY https://github.com/HowardHinnant/date.git
GIT_TAG v3.0.0
SOURCE_DIR "${CMAKE_BINARY_DIR}/date-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/date-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7.2)
project(exprtk-download NONE)
include(ExternalProject)
ExternalProject_Add(exprtk
GIT_REPOSITORY https://github.com/ArashPartow/exprtk.git
GIT_TAG 0.0.3
SOURCE_DIR "${CMAKE_BINARY_DIR}/exprtk-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/exprtk-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7.2)
project(hopscotch-download NONE)
include(ExternalProject)
ExternalProject_Add(hopscotch
GIT_REPOSITORY https://github.com/Tessil/hopscotch-map.git
GIT_TAG v2.3.1
SOURCE_DIR "${CMAKE_BINARY_DIR}/hopscotch-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/hopscotch-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,3 @@
CompileFlags:
@CLANGD_ADD_FLAGS@
CompilationDatabase: @CMAKE_BINARY_DIR@
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.7.2)
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColorReset "${Esc}[m")
set(Red "${Esc}[1;31m")
set(Green "${Esc}[1;32m")
set(Yellow "${Esc}[1;33m")
set(Blue "${Esc}[1;34m")
set(Magenta "${Esc}[1;35m")
set(Cyan "${Esc}[1;36m")
set(White "${Esc}[1;37m")
endif()
@@ -0,0 +1,76 @@
cmake_minimum_required(VERSION 3.7.2)
# Program: Visualization Toolkit
# Module: Copyright.txt
# Copyright (c) 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
# of any contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# - Try to find ExprTk lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(ExprTk 2.71828)
# to require version 2.71828 or newer of ExprTk.
#
# Once done this will define
#
# ExprTk_FOUND - system has eigen lib with correct version
# ExprTk_INCLUDE_DIRS - the eigen include directory
# ExprTk_VERSION - eigen version
#
# And the following imported target:
#
# ExprTk::ExprTk
find_path(ExprTk_INCLUDE_DIR
NAMES exprtk.hpp
DOC "Path to ExprTk header")
mark_as_advanced(ExprTk_INCLUDE_DIR)
if (ExprTk_INCLUDE_DIR)
file(STRINGS "${ExprTk_INCLUDE_DIR}/exprtk.hpp" _exprtk_version_header
REGEX "static \\* version")
string(REGEX MATCH "static \\* version = \"([0-9.]+)\"" _exprtk_version_match "${_exprtk_version_header}")
set(ExprTk_VERSION "${CMAKE_MATCH_1}")
unset(_exprtk_version_header)
unset(_exprtk_version_match)
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ExprTk
REQUIRED_VARS ExprTk_INCLUDE_DIR
VERSION_VAR ExprTk_VERSION)
if (ExprTk_FOUND)
set(ExprTk_INCLUDE_DIRS "${ExprTk_INCLUDE_DIR}")
if (NOT TARGET ExprTk::ExprTk)
add_library(ExprTk::ExprTk INTERFACE IMPORTED)
set_target_properties(ExprTk::ExprTk PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ExprTk_INCLUDE_DIR}")
endif ()
endif ()
@@ -0,0 +1,100 @@
cmake_minimum_required(VERSION 3.7.2)
# Workaround for: https://gitlab.kitware.com/cmake/cmake/-/issues/22740
set(D "$")
# ##################################################
# Helper to grab dependencies from remote sources #
# ##################################################
function(psp_build_dep name cmake_file)
if(EXISTS ${CMAKE_BINARY_DIR}/${name}-build)
psp_build_message("${Cyan}Dependency found - not rebuilding - ${CMAKE_BINARY_DIR}/${name}-build${ColorReset}")
elseif(NAME STREQUAL "Boost")
psp_build_message("${Cyan}Not building boost${ColorReset}")
else()
configure_file(${cmake_file} ${CMAKE_BINARY_DIR}/${name}-download/CMakeLists.txt)
set(_cwd ${CMAKE_BINARY_DIR}/${name}-download)
message(STATUS "Configuring ${name} in ${_cwd}")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
OUTPUT_VARIABLE cmd_output
ERROR_VARIABLE cmd_error
WORKING_DIRECTORY ${_cwd})
if(result)
message(FATAL_ERROR "CMake step for ${name} failed:\nSTDOUT:${cmd_output}\nSTDERR: ${cmd_error}")
endif()
message("${cmd_output}")
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${name}-download)
if(result)
message(FATAL_ERROR "Build step for ${name} failed: ${result}")
endif()
endif()
if(${name} STREQUAL arrow)
set(ARROW_DEFINE_OPTIONS ON)
set(ARROW_BUILD_SHARED OFF)
set(ARROW_BUILD_STATIC ON)
set(ARROW_BUILD_INTEGRATION OFF)
set(ARROW_JEMALLOC OFF)
set(ARROW_CSV ON)
set(ARROW_LZ4 ON)
set(ARROW_WITH_ZSTD ON)
set(ARROW_WITH_LZ4 ON)
set(ARROW_NO_EXPORT ON)
set(ARROW_CXXFLAGS " -Wno-documentation ")
set(ARROW_DEPENDENCY_SOURCE "BUNDLED" CACHE STRING "override arrow's dependency source" FORCE)
# if (PSP_ENABLE_WASM)
# set(ARROW_CXX_FLAGS_RELEASE " -msimd128 -mbulk-memory -mrelaxed-simd -s MEMORY64=1 " CACHE STRING "override arrow's dependency source" FORCE)
# set(ARROW_C_FLAGS_RELEASE " -msimd128 -mbulk-memory -mrelaxed-simd -s MEMORY64=1 " CACHE STRING "override arrow's dependency source" FORCE )
# endif()
if(PSP_WASM_BUILD)
set(ARROW_ENABLE_THREADING OFF)
else()
set(ARROW_ENABLE_THREADING ON)
endif()
add_subdirectory(${CMAKE_BINARY_DIR}/${name}-src/cpp/
${CMAKE_BINARY_DIR}/${name}-build
EXCLUDE_FROM_ALL
)
set(${name}_INCLUDE_DIRS
"${CMAKE_BINARY_DIR}/${name}-build/src" # needed for generated headers, e.g. <arrow/util/config.h>
"${CMAKE_BINARY_DIR}/${name}-src/cpp/src"
PARENT_SCOPE)
elseif(${name} STREQUAL re2)
# Overwrite re2's CMakeLists with our custom CMakeLists.
configure_file(${PSP_CMAKE_MODULE_PATH}/${name}/CMakeLists.txt ${CMAKE_BINARY_DIR}/${name}-src/ COPYONLY)
add_subdirectory(${CMAKE_BINARY_DIR}/${name}-src
${CMAKE_BINARY_DIR}/${name}-build
EXCLUDE_FROM_ALL)
set(${name}_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${name}-src PARENT_SCOPE)
elseif(${name} STREQUAL protobuf)
add_subdirectory(${CMAKE_BINARY_DIR}/${name}-src
${CMAKE_BINARY_DIR}/${name}-build
EXCLUDE_FROM_ALL)
set(${name}_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${name}-src/src PARENT_SCOPE)
elseif(${name} STREQUAL rapidjson)
set(RAPIDJSON_SSE42 ON CACHE BOOL "Enable RapidJSON SIMD")
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Disable rapidjson tests")
add_subdirectory(${CMAKE_BINARY_DIR}/${name}-src
${CMAKE_BINARY_DIR}/${name}-build
EXCLUDE_FROM_ALL)
set(${name}_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/${name}-src/include" PARENT_SCOPE)
# Header-only dependencies without a build step - no add_subdirectory()
elseif(${name} MATCHES "^(Boost|exprtk)")
set(${name}_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/${name}-src" PARENT_SCOPE)
elseif(${name} MATCHES "^(hopscotch|date|ordered-map)$")
set(${name}_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/${name}-src/include" PARENT_SCOPE)
else()
message(FATAL_ERROR "Unknown dependency `${name}`")
endif()
endfunction()
@@ -0,0 +1,126 @@
set(DEFAULT_PROTOBUF_VERSION "33.2")
option(PSP_PROTOC_PATH "Path to the protoc binary" "")
# Function to download and extract protoc
function(download_protoc VERSION DESTINATION)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(PROTOC_ZIP "protoc-${VERSION}-win64.zip")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(PROTOC_ZIP "protoc-${VERSION}-osx-x86_64.zip")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(PROTOC_ZIP "protoc-${VERSION}-linux-aarch_64.zip")
else()
set(PROTOC_ZIP "protoc-${VERSION}-linux-x86_64.zip")
endif()
else()
message(FATAL_ERROR "Unsupported host system: ${CMAKE_HOST_SYSTEM_NAME}")
endif()
set(PROTOC_URL "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/${PROTOC_ZIP}")
set(DOWNLOAD_PATH "${CMAKE_BINARY_DIR}/downloaded/${PROTOC_ZIP}")
file(DOWNLOAD ${PROTOC_URL} ${DOWNLOAD_PATH}
STATUS DOWNLOAD_STATUS
SHOW_PROGRESS)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
if(STATUS_CODE EQUAL 0)
message(STATUS "Downloaded protoc: ${DOWNLOAD_PATH}")
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_PATH} DESTINATION ${DESTINATION})
file(REMOVE ${DOWNLOAD_PATH})
else()
message(FATAL_ERROR "Failed to download protoc: Status code ${STATUS_CODE}")
endif()
endfunction()
find_program(Protobuf_EXECUTABLE NAMES protoc PATHS ${PSP_PROTOC_PATH} ENV PATH ${CMAKE_BINARY_DIR}/protoc-release/bin/)
if(NOT Protobuf_EXECUTABLE)
message(STATUS "Protobuf_EXECUTABLE not found, searching for protoc")
download_protoc(${DEFAULT_PROTOBUF_VERSION} ${CMAKE_BINARY_DIR}/protoc-release)
set(PROTOC_EXECUTABLE ${CMAKE_BINARY_DIR}/protoc-release/bin/protoc)
# find_program(PROTOC_EXECUTABLE NAMES protoc)
else()
message(STATUS "Using Protobuf_EXECUTABLE from parent scope")
set(PROTOC_EXECUTABLE ${Protobuf_EXECUTABLE})
endif()
if(NOT PROTOC_EXECUTABLE)
message(FATAL_ERROR "protoc not found")
set(Protoc_FOUND FALSE)
else()
set(Protoc_FOUND TRUE)
message(STATUS "Found protoc: ${PROTOC_EXECUTABLE}")
function(CHECK_PROTOC_VERSION)
execute_process(
COMMAND ${PROTOC_EXECUTABLE} --version
OUTPUT_VARIABLE PROTOC_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT PROTOC_VERSION_OUTPUT MATCHES "^libprotoc ([0-9]+)\\.([0-9]+)(:?\\.([0-9]+))?")
message(WARNING "Unable to determine protoc version")
return()
endif()
set(PROTOC_VERSION_MAJOR ${CMAKE_MATCH_1})
set(PROTOC_VERSION_MINOR ${CMAKE_MATCH_2})
set(PROTOC_VERSION_PATCH ${CMAKE_MATCH_4})
if (NOT PROTOC_VERSION_PATCH)
set(FOUND_VERSION "${PROTOC_VERSION_MAJOR}.${PROTOC_VERSION_MINOR}")
else()
set(FOUND_VERSION "${PROTOC_VERSION_MAJOR}.${PROTOC_VERSION_MINOR}.${PROTOC_VERSION_PATCH}")
endif()
# Force the external project to use the same version as our installed protoc CLI
set(LIBPROTOBUF_VERSION "v${FOUND_VERSION}" PARENT_SCOPE)
set(MIN_PROTOC_VERSION_MAJOR 3)
if(PROTOC_VERSION_MAJOR LESS MIN_PROTOC_VERSION_MAJOR)
message(FATAL_ERROR "protoc version ${FOUND_VERSION} is too old, at least ${MIN_PROTOC_VERSION_MAJOR}.x.x is required")
else()
message(STATUS "Found protoc version ${FOUND_VERSION}")
endif()
endfunction()
# Check the version of protoc
CHECK_PROTOC_VERSION()
endif()
function(protobuf_generate_cpp SRCS HDRS)
if(NOT ARGN)
message(SEND_ERROR "Error: protobuf_generate_cpp() called without any proto files")
return()
endif()
set(_PROTOBUF_GENERATE_CPP_SRCS)
set(_PROTOBUF_GENERATE_CPP_HDRS)
foreach(PROTO_FILE ${ARGN})
get_filename_component(PROTO_NAME ${PROTO_FILE} NAME_WE)
get_filename_component(PROTO_PATH ${PROTO_FILE} PATH)
set(GENERATED_SRC "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_NAME}.pb.cc")
set(GENERATED_HDR "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_NAME}.pb.h")
add_custom_command(
OUTPUT ${GENERATED_SRC} ${GENERATED_HDR}
COMMAND ${PROTOC_EXECUTABLE} --cpp_out ${CMAKE_CURRENT_BINARY_DIR} --proto_path ${PROTO_PATH} ${PROTO_FILE}
DEPENDS ${PROTO_FILE} ${PROTOC_EXECUTABLE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating ${GENERATED_SRC} and ${GENERATED_HDR} from ${PROTO_FILE}"
)
set_source_files_properties(${GENERATED_SRC} ${GENERATED_HDR} PROPERTIES GENERATED TRUE)
list(APPEND _PROTOBUF_GENERATE_CPP_SRCS ${GENERATED_SRC})
list(APPEND _PROTOBUF_GENERATE_CPP_HDRS ${GENERATED_HDR})
endforeach()
set(${SRCS} ${_PROTOBUF_GENERATE_CPP_SRCS} PARENT_SCOPE)
set(${HDRS} ${_PROTOBUF_GENERATE_CPP_HDRS} PARENT_SCOPE)
endfunction()
@@ -0,0 +1,70 @@
cmake_minimum_required(VERSION 3.7.2)
# Copyright 2017 gRPC authors.
#
# 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.
find_package(re2 QUIET CONFIG)
if(re2_FOUND)
message(STATUS "Found RE2 via CMake.")
return()
endif()
# As per https://github.com/grpc/grpc/issues/25434, idempotence is necessary
# because CMake fails when another target with the same name already exists.
if(TARGET re2::re2)
message(STATUS "Found RE2 via pkg-config already?")
return()
endif()
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
# TODO(junyer): Use the IMPORTED_TARGET option whenever CMake 3.6 (or newer)
# becomes the minimum required: that will take care of the add_library() and
# set_property() calls; then we can simply alias PkgConfig::RE2 as re2::re2.
# For now, we can only set INTERFACE_* properties that existed in CMake 3.5.
pkg_check_modules(RE2 QUIET re2)
endif()
if(RE2_FOUND)
set(re2_FOUND true)
add_library(re2::re2 INTERFACE IMPORTED)
if(RE2_INCLUDE_DIRS)
set_property(TARGET re2::re2 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${RE2_INCLUDE_DIRS}")
endif()
if(RE2_CFLAGS_OTHER)
# Filter out the -std flag, which is handled by CMAKE_CXX_STANDARD.
# TODO(junyer): Use the FILTER option whenever CMake 3.6 (or newer)
# becomes the minimum required: that will allow this to be concise.
foreach(flag IN LISTS RE2_CFLAGS_OTHER)
if("${flag}" MATCHES "^-std=")
list(REMOVE_ITEM RE2_CFLAGS_OTHER "${flag}")
endif()
endforeach()
set_property(TARGET re2::re2 PROPERTY
INTERFACE_COMPILE_OPTIONS "${RE2_CFLAGS_OTHER}")
endif()
if(RE2_LDFLAGS)
set_property(TARGET re2::re2 PROPERTY
INTERFACE_LINK_LIBRARIES "${RE2_LDFLAGS}")
endif()
message(STATUS "Found RE2 via pkg-config.")
return()
endif()
if(re2_FIND_REQUIRED)
message(WARNING "Failed to find RE2.")
endif()
@@ -0,0 +1,9 @@
set(LLVM_ROOT $ENV{LLVM_ROOT})
set(CMAKE_C_COMPILER "${LLVM_ROOT}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_ROOT}/bin/clang++")
set(CMAKE_AR "${LLVM_ROOT}/bin/llvm-ar")
set(CMAKE_RANLIB "${LLVM_ROOT}/bin/llvm-ranlib")
# include_directories(BEFORE SYSTEM "${LLVM_ROOT}/include")
# link_directories(BEFORE "${LLVM_ROOT}/lib")
@@ -0,0 +1,38 @@
if(NOT WORKSPACE_ROOT)
message(STATUS "${Yellow}WORKSPACE_ROOT not set, assuming ${CMAKE_CURRENT_SOURCE_DIR}/../../../..${ColorReset}")
set(WORKSPACE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(CLANGD_ADD_FLAGS "Add:
[
-target,
wasm32-unknown-emscripten,
--sysroot=${WORKSPACE_ROOT}/.emsdk/upstream/emscripten/cache/sysroot,
]")
else()
set(CLANGD_ADD_FLAGS "")
endif()
# Check for existence of .clangd file
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/.clangd.in)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "${Cyan}Found ${CMAKE_CURRENT_LIST_DIR}/.clangd.in${ColorReset}")
# Configure the .clangd file from the template
configure_file(
${CMAKE_CURRENT_LIST_DIR}/.clangd.in
${CMAKE_BINARY_DIR}/.clangd
@ONLY
)
# Symlink .clangd to the project root
execute_process(
COMMAND ln -sf ${CMAKE_BINARY_DIR}/.clangd ${WORKSPACE_ROOT}/.clangd
)
message(STATUS "${Cyan}Created ${CMAKE_BINARY_DIR}/.clangd${ColorReset}")
else()
message("${Cyan} ${CMAKE_CURRENT_SOURCE_DIR} is not the root of the project, skipping IDE setup${ColorReset}")
endif()
else()
message("${Yellow}No .clangd.in found, skipping IDE setup${ColorReset}")
endif()
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7.2)
project(ordered-map-download NONE)
include(ExternalProject)
ExternalProject_Add(ordered-map
GIT_REPOSITORY https://github.com/Tessil/ordered-map.git
GIT_TAG v1.0.0
SOURCE_DIR "${CMAKE_BINARY_DIR}/ordered-map-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/ordered-map-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.7.2)
project(protobuf-download NONE)
if("" STREQUAL "${LIBPROTOBUF_VERSION}")
set(LIBPROTOBUF_VERSION v33.2)
message(FATAL_ERROR "LIBPROTOBUF_VERSION not set, using default: ${D}{LIBPROTOBUF_VERSION}")
else()
set(LIBPROTOBUF_VERSION ${LIBPROTOBUF_VERSION})
message(STATUS "LIBPROTOBUF_VERSION set to: ${D}{LIBPROTOBUF_VERSION}")
endif()
include(ExternalProject)
ExternalProject_Add(protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG "${D}{LIBPROTOBUF_VERSION}"
SOURCE_DIR "${CMAKE_BINARY_DIR}/protobuf-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/protobuf-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7.2)
project(rapidjson-download NONE)
include(ExternalProject)
ExternalProject_Add(rapidjson
GIT_REPOSITORY https://github.com/tencent/rapidjson.git
GIT_TAG d621dc9e9c77f81e5c8a35b8dcc16dcd63351321
SOURCE_DIR "${CMAKE_BINARY_DIR}/rapidjson-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/rapidjson-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
+20
View File
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.7.2)
project(re2-download NONE)
# *******************************************************************
# NOTE: this depedency's CMakeLists.txt is overloaded, make sure to
# adjust if you update the tag
# *******************************************************************
include(ExternalProject)
ExternalProject_Add(re2
GIT_REPOSITORY https://github.com/google/re2.git
GIT_TAG 2021-11-01
SOURCE_DIR "${CMAKE_BINARY_DIR}/re2-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/re2-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@@ -0,0 +1,176 @@
# 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.
# Old enough to support Ubuntu Xenial.
cmake_minimum_required(VERSION 3.5.1)
project(RE2 CXX)
include(CTest)
include(GNUInstallDirs)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
option(BUILD_SHARED_LIBS "build shared libraries" OFF)
option(USEPCRE "use PCRE in tests and benchmarks" OFF)
# CMake seems to have no way to enable/disable testing per subproject,
# so we provide an option similar to BUILD_TESTING, but just for RE2.
option(RE2_BUILD_TESTING "enable testing for RE2" ON)
# ABI version
# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
set(SONAME 9)
set(EXTRA_TARGET_LINK_LIBRARIES)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(MSVC_VERSION LESS 1900)
message(FATAL_ERROR "you need Visual Studio 2015 or later")
endif()
if(BUILD_SHARED_LIBS)
# See http://www.kitware.com/blog/home/post/939 for details.
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
# CMake defaults to /W3, but some users like /W4 (or /Wall) and /WX,
# so we disable various warnings that aren't particularly helpful.
add_compile_options(/wd4100 /wd4201 /wd4456 /wd4457 /wd4702 /wd4815)
# Without a byte order mark (BOM), Visual Studio assumes that the source
# file is encoded using the current user code page, so we specify UTF-8.
add_compile_options(/utf-8)
endif()
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
# ************************************
# TKP NOTE: THIS SECTION IS CUSTOM
# ************************************
elseif(APPLE OR (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten"))
add_definitions(-DTARGET_OS_OSX=1)
# assume built-in pthreads on MacOS
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# ************************************
elseif(UNIX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
endif()
if(USEPCRE)
add_definitions(-DUSEPCRE)
list(APPEND EXTRA_TARGET_LINK_LIBRARIES pcre)
endif()
set(RE2_SOURCES
re2/bitstate.cc
re2/compile.cc
re2/dfa.cc
re2/filtered_re2.cc
re2/mimics_pcre.cc
re2/nfa.cc
re2/onepass.cc
re2/parse.cc
re2/perl_groups.cc
re2/prefilter.cc
re2/prefilter_tree.cc
re2/prog.cc
re2/re2.cc
re2/regexp.cc
re2/set.cc
re2/simplify.cc
re2/stringpiece.cc
re2/tostring.cc
re2/unicode_casefold.cc
re2/unicode_groups.cc
util/rune.cc
util/strutil.cc
)
add_library(re2 ${RE2_SOURCES})
target_include_directories(re2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
set_target_properties(re2 PROPERTIES SOVERSION ${SONAME} VERSION ${SONAME}.0.0)
add_library(re2::re2 ALIAS re2)
if(UNIX)
target_link_libraries(re2 PUBLIC Threads::Threads)
endif()
if(RE2_BUILD_TESTING)
set(TESTING_SOURCES
re2/testing/backtrack.cc
re2/testing/dump.cc
re2/testing/exhaustive_tester.cc
re2/testing/null_walker.cc
re2/testing/regexp_generator.cc
re2/testing/string_generator.cc
re2/testing/tester.cc
util/pcre.cc
)
add_library(testing STATIC ${TESTING_SOURCES})
target_link_libraries(testing PUBLIC re2)
set(TEST_TARGETS
charclass_test
compile_test
filtered_re2_test
mimics_pcre_test
parse_test
possible_match_test
re2_test
re2_arg_test
regexp_test
required_prefix_test
search_test
set_test
simplify_test
string_generator_test
dfa_test
exhaustive1_test
exhaustive2_test
exhaustive3_test
exhaustive_test
random_test
)
set(BENCHMARK_TARGETS
regexp_benchmark
)
foreach(target ${TEST_TARGETS})
add_executable(${target} re2/testing/${target}.cc util/test.cc)
target_link_libraries(${target} testing ${EXTRA_TARGET_LINK_LIBRARIES})
add_test(NAME ${target} COMMAND ${target})
endforeach()
foreach(target ${BENCHMARK_TARGETS})
add_executable(${target} re2/testing/${target}.cc util/benchmark.cc)
target_link_libraries(${target} testing ${EXTRA_TARGET_LINK_LIBRARIES})
endforeach()
endif()
set(RE2_HEADERS
re2/filtered_re2.h
re2/re2.h
re2/set.h
re2/stringpiece.h
)
install(FILES ${RE2_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/re2)
install(TARGETS re2 EXPORT re2Config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT re2Config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/re2 NAMESPACE re2::)
@@ -0,0 +1,24 @@
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
# ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
# ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
# ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
# ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
# ┃ Copyright (c) 2017, the Perspective Authors. ┃
# ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
# ┃ This file is part of the Perspective library, distributed under the terms ┃
# ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
# Minimal toolchain file to ensure that Arrow's bundled dependency builds use
# the correct architecture for Mac builds.
# (Arrow does not as of Oct 2024 pass on CMAKE_OSX_ARCHITECTURES to its
# dependencies if it is set, but does pass on a toolchain file)
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Target architecture for Mac builds")
# Arrow uses this to choose a `-march` flag
set(CMAKE_SYSTEM_PROCESSOR "arm64")
# Prevent cmake from overwriting CMAKE_SYSTEM_PROCESSOR
# https://github.com/apache/arrow/issues/44448#issuecomment-2418649378
set(CMAKE_SYSTEM_NAME "Darwin")
@@ -0,0 +1,24 @@
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
# ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
# ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
# ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
# ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
# ┃ Copyright (c) 2017, the Perspective Authors. ┃
# ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
# ┃ This file is part of the Perspective library, distributed under the terms ┃
# ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
# Minimal toolchain file to ensure that Arrow's bundled dependency builds use
# the correct architecture for Mac builds.
# (Arrow does not as of Oct 2024 pass on CMAKE_OSX_ARCHITECTURES to its
# dependencies if it is set, but does pass on a toolchain file)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target architecture for Mac builds")
# Arrow uses this to choose a `-march` flag
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
# Prevent cmake from overwriting CMAKE_SYSTEM_PROCESSOR
# https://github.com/apache/arrow/issues/44448#issuecomment-2418649378
set(CMAKE_SYSTEM_NAME "Darwin")