chore: import upstream snapshot with attribution
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user