diff --git a/README.md b/README.md index 55e2f5ce..b87efa77 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,16 @@ upstreaming. It moves the P4-specific components of the architecture from `ovs-vswitchd` to a separate process called `infrap4d`. -## Upcoming changes +## Breaking changes -The Stratum dependencies will be moving from the `setup` directory to -a separate `stratum-deps` repository towards the end of October 2023. +The Stratum dependencies have moved from the `setup` directory to a new + repository. -See the setup directory's [README file](setup/README.md) for more information. +This allows the dependencies to be updated and built independently of +P4 Control Plane. + +See the [README](https://github.com/ipdk-io/stratum-deps/blob/main/README.md) +file for more information. ## Source code diff --git a/setup/.gitignore b/setup/.gitignore deleted file mode 100644 index 503f3203..00000000 --- a/setup/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# generated files -grpc.patch - -# build directories -/build -/host-deps -/install - -# download directories -/abseil-cpp -/c-ares -/cctz -/gflags -/glog -/gmock-gbl -/grpc -/gtest -/json -/protobuf -/zlib diff --git a/setup/CMakeLists.txt b/setup/CMakeLists.txt deleted file mode 100644 index e6611d77..00000000 --- a/setup/CMakeLists.txt +++ /dev/null @@ -1,423 +0,0 @@ -# Downloads and builds dependencies -# -# Copyright 2022-2023 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -# Version 3.15 is the baseline for P4 Control Plane. -cmake_minimum_required(VERSION 3.15) - -project(stratum-deps VERSION 1 LANGUAGES C CXX) - -include(ExternalProject) -include(CMakePrintHelpers) -include(GNUInstallDirs) - -# Define git repository tags and urls. -include(cmake/deps.cmake) - -# Define default CXX standard -if(NOT CMAKE_CROSSCOMPILING) - include(cmake/cxx_standard.cmake) -endif() - -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.24 AND - ${CMAKE_VERSION} VERSION_LESS 3.26) - message(STATUS "CMake version is ${CMAKE_VERSION}") - message(STATUS "Protobuf build is broken in CMake 3.24.x and 3.25.x") - message(STATUS "Versions 3.16 through 3.22 and 3.26.1 and above are recommended") - message(FATAL_ERROR "Invalid CMake version") -endif() - -option(DOWNLOAD "Download repositories" TRUE) -option(FORCE_PATCH "Specify -f when patching" FALSE) -option(ON_DEMAND "Build targets on demand" FALSE) -option(USE_LDCONFIG "Use ldconfig when installing" FALSE) - -# Note: USE_SUDO should be DISABLED by default. -# This is in keeping with the following security principles: -# - Principle of Least Privilege -# - Secure By Default -option(USE_SUDO "Use sudo when installing" FALSE) - -if(USE_SUDO) - set(SUDO_CMD "sudo" "-E") - if(USE_LDCONFIG) - set(LDCONFIG_CMD COMMAND sudo ldconfig) - endif() -endif() - -if(FORCE_PATCH) - set(FORCE_OPTION "-f") -endif() - -if(CMAKE_CROSSCOMPILING) - list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_INSTALL_PREFIX}) - if(NOT HOST_DEPEND_DIR STREQUAL "") - list(APPEND CMAKE_PREFIX_PATH ${HOST_DEPEND_DIR}) - endif() -else() - list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) -endif() - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the build type." FORCE) -endif() - -set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug;Release;RelWithDebInfo") - -if(NOT CMAKE_BUILD_TYPE STREQUAL "") - set(deps_BUILD_TYPE "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") -endif() - -cmake_print_variables(CMAKE_BUILD_TYPE) -cmake_print_variables(CMAKE_FIND_ROOT_PATH) -cmake_print_variables(CMAKE_INSTALL_PREFIX) -cmake_print_variables(CMAKE_PREFIX_PATH) -cmake_print_variables(CMAKE_TOOLCHAIN_FILE) - -########################## -# Set CMAKE_CXX_STANDARD # -########################## - -if(CXX_STANDARD) - set(_CXX_CURRENT_STANDARD ${CXX_STANDARD}) -endif() - -if(DEFINED _CXX_CURRENT_STANDARD) - set(version_ABSL_CXX_STANDARD -DABSL_CXX_STANDARD=${_CXX_CURRENT_STANDARD}) - set(version_CMAKE_CXX_STANDARD -DCMAKE_CXX_STANDARD=${_CXX_CURRENT_STANDARD}) -endif() - -################### -# GetDownloadSpec # -################### - -# Generates the ExternalProject_Add() parameters needed to Download -# a git repository and returns them in the VAR parameter. Returns an -# empty string if the DOWNLOAD option is false. -function(GetDownloadSpec VAR _url _tag) - if(DOWNLOAD) - set(_spec - GIT_REPOSITORY ${_url} - GIT_TAG ${_tag} - GIT_PROGRESS ON - ) - else() - set(_spec "") - endif() - set(${VAR} ${_spec} PARENT_SCOPE) -endfunction(GetDownloadSpec) - -########## -# ABSEIL # -########## - -# Recommended for CMake 3.8 and up -set(ABSL_CXX_PROPAGATE_CXX_STD ON) - -GetDownloadSpec(DOWNLOAD_ABSL ${ABSEIL_GIT_URL} ${ABSEIL_GIT_TAG}) - -ExternalProject_Add(abseil-cpp - ${DOWNLOAD_ABSL} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/abseil-cpp - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - ${version_ABSL_CXX_STANDARD} - ${version_CMAKE_CXX_STANDARD} - -DCMAKE_POSITION_INDEPENDENT_CODE=on - -DCMAKE_INSTALL_RPATH=$ORIGIN - -DBUILD_SHARED_LIBS=on - -DBUILD_TESTING=off - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(abseil-cpp PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -######## -# ZLIB # -######## - -GetDownloadSpec(DOWNLOAD_ZLIB ${ZLIB_GIT_URL} ${ZLIB_GIT_TAG}) - -ExternalProject_Add(zlib - ${DOWNLOAD_ZLIB} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/zlib - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -########## -# C-ARES # -########## - -GetDownloadSpec(DOWNLOAD_CARES ${CARES_GIT_URL} ${CARES_GIT_TAG}) - -ExternalProject_Add(cares - ${DOWNLOAD_CARES} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/c-ares - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(cares PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -############ -# PROTOBUF # -############ - -GetDownloadSpec(DOWNLOAD_PROTOBUF ${PROTOBUF_GIT_URL} ${PROTOBUF_GIT_TAG}) - -ExternalProject_Add(protobuf - ${DOWNLOAD_PROTOBUF} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/protobuf - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_POSITION_INDEPENDENT_CODE=on - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - -DBUILD_SHARED_LIBS=on - -Dprotobuf_BUILD_TESTS=off - SOURCE_SUBDIR - cmake - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} - DEPENDS - zlib -) -if(ON_DEMAND) - set_target_properties(protobuf PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -######## -# GRPC # -######## - -# Patch the gRPC build script to set the RUNPATH of the installed -# Protobuf compiler plugins to the relative paths of the library -# directories. -set(GRPC_INSTALL_RPATH $ORIGIN/../lib64:$ORIGIN/../lib) -configure_file(cmake/grpc.patch.in ${CMAKE_SOURCE_DIR}/grpc.patch @ONLY) - -if(CMAKE_CROSSCOMPILING) - # If we're cross-compiling for the target system, don't build the - # gRPC code generation executables. - set(gRPC_BUILD_CODEGEN_OPTION -DgRPC_BUILD_CODEGEN=off) -endif() - -GetDownloadSpec(DOWNLOAD_GRPC ${GRPC_GIT_URL} ${GRPC_GIT_TAG}) - -ExternalProject_Add(grpc - ${DOWNLOAD_GRPC} - - PATCH_COMMAND - # Set RUNPATH in gRPC executables. - patch -i ${CMAKE_SOURCE_DIR}/grpc.patch -p1 ${FORCE_OPTION} - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/grpc - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_INSTALL_RPATH=$ORIGIN - -DCMAKE_POSITION_INDEPENDENT_CODE=on - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - ${version_CMAKE_CXX_STANDARD} - -DBUILD_SHARED_LIBS=on - -DgRPC_ABSL_PROVIDER=package - -DgRPC_CARES_PROVIDER=package - -DgRPC_PROTOBUF_PROVIDER=package - # gRPC builds BoringSSL, which is incompatible with libpython. - # We use whatever version of OpenSSL is installed instead. - -DgRPC_SSL_PROVIDER=package - -DgRPC_ZLIB_PROVIDER=package - -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=off - -DgRPC_BUILD_GRPC_NODE_PLUGIN=off - -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=off - -DgRPC_BUILD_GRPC_PHP_PLUGIN=off - -DgRPC_BUILD_GRPC_RUBY_PLUGIN=off - -DgRPC_BUILD_TESTS=off - -DgRPC_INSTALL=on - ${gRPC_BUILD_CODEGEN_OPTION} - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} - DEPENDS - abseil-cpp - cares - protobuf - zlib -) -if(ON_DEMAND) - set_target_properties(grpc PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -######## -# CCTZ # -######## - -GetDownloadSpec(DOWNLOAD_CCTZ ${CCTZ_GIT_URL} ${CCTZ_GIT_TAG}) - -ExternalProject_Add(cctz - ${DOWNLOAD_CCTZ} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/cctz - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - -DCMAKE_POSITION_INDEPENDENT_CODE=on - -DBUILD_TESTING=off - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(cctz PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -########## -# GFLAGS # -########## - -GetDownloadSpec(DOWNLOAD_GFLAGS ${GFLAGS_GIT_URL} ${GFLAGS_GIT_TAG}) - -ExternalProject_Add(gflags - ${DOWNLOAD_GFLAGS} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/gflags - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - -DBUILD_SHARED_LIBS=on - -DBUILD_TESTING=off - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(gflags PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -######## -# GLOG # -######## - -GetDownloadSpec(DOWNLOAD_GLOG ${GLOG_GIT_URL} ${GLOG_GIT_TAG}) - -ExternalProject_Add(glog - ${DOWNLOAD_GLOG} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/glog - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH} - -DCMAKE_INSTALL_RPATH=$ORIGIN - -DWITH_GTEST=OFF - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} - DEPENDS - gflags -) -if(ON_DEMAND) - set_target_properties(glog PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -######### -# GTEST # -######### - -GetDownloadSpec(DOWNLOAD_GTEST ${GTEST_GIT_URL} ${GTEST_GIT_TAG}) - -ExternalProject_Add(gtest - ${DOWNLOAD_GTEST} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/gtest - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_INSTALL_RPATH=$ORIGIN - -DBUILD_SHARED_LIBS=on - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(gtest PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() - -######## -# JSON # -######## - -GetDownloadSpec(DOWNLOAD_JSON ${JSON_GIT_URL} ${JSON_GIT_TAG}) - -ExternalProject_Add(json - ${DOWNLOAD_JSON} - - SOURCE_DIR - ${CMAKE_SOURCE_DIR}/json - CMAKE_ARGS - ${deps_BUILD_TYPE} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DJSON_BuildTests=off - INSTALL_COMMAND - ${SUDO_CMD} ${CMAKE_MAKE_PROGRAM} install - ${LDCONFIG_CMD} -) -if(ON_DEMAND) - set_target_properties(json PROPERTIES EXCLUDE_FROM_ALL TRUE) -endif() diff --git a/setup/README.md b/setup/README.md index 994414c5..b7fe4e1a 100644 --- a/setup/README.md +++ b/setup/README.md @@ -1,42 +1,12 @@ -# Stratum Dependencies + +# We've Moved! + -Stratum is the component of `infrap4d` that implements the P4Runtime and gNMI -(OpenConfig) services. +The Stratum dependencies have moved from the `setup` directory to a new + repository. -This directory allows you to build and install the third-party libraries -that Stratum requires. +This allows the dependencies to be updated and built independently of the +Networking Recipe (P4 Control Plane). - -## We're Moving! - -The Stratum dependencies are being relocated to their own repository, -. - -This allows the dependencies to be updated independently of the Networking -Recipe (P4 Control Plane). - -### Development - -New development is currently taking place in the `stratum-deps` repository. - -See the -[change history](https://github.com/ipdk-io/stratum-deps/blob/main/docs/change-history.md) -for more information. - -### Transition - -We plan to phase out the `networking-recipe/setup` directory toward the end -of October 2023. - -If you would like to start using `stratum-deps` before then, -[version 1.2.0](https://github.com/ipdk-io/stratum-deps/tree/v1.2.0) -is a good place to start. - -### Documentation - -The `stratum-deps` repository includes updated versions of relevant sections -of the user manual, plus new documentation on the helper scripts. - -See the repository's -[README file](https://github.com/ipdk-io/stratum-deps/blob/main/README.md) -for links to the documentation. +See the [README](https://github.com/ipdk-io/stratum-deps/blob/main/README.md) +file for more information. diff --git a/setup/cleanup.sh b/setup/cleanup.sh deleted file mode 100755 index 464eb7d0..00000000 --- a/setup/cleanup.sh +++ /dev/null @@ -1,3 +0,0 @@ -rm -fr abseil-cpp c-ares cctz gflags glog gmock-gbl grpc gtest json protobuf zlib -rm -fr build -rm -f grpc.patch diff --git a/setup/cmake/cxx_standard.cmake b/setup/cmake/cxx_standard.cmake deleted file mode 100644 index f2350be0..00000000 --- a/setup/cmake/cxx_standard.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# Identify default CXX standard -# -# Copyright 2023 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -write_file( - ${CMAKE_CURRENT_BINARY_DIR}/cmake/tmp-cxx-standard.cpp - "#include \nint main(){std::cout << __cplusplus << std::endl;return 0;}" - ) - - try_run( - _cxx_standard_run_status _cxx_standard_build_status - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/cmake/tmp-cxx-standard.cpp - RUN_OUTPUT_VARIABLE _COMPILER_DEFAULT_CXX_STANDARD) - if(_cxx_standard_run_status EQUAL FAILED_TO_RUN - OR NOT _cxx_standard_build_status) - message( - WARNING - "Failed to build or run the script to get the _COMPILER_DEFAULT_CXX_STANDARD value from current compiler. Setting _COMPILER_DEFAULT_CXX_STANDARD to 201103" - ) - set(_COMPILER_DEFAULT_CXX_STANDARD "201103") - endif() - - string(STRIP "${_COMPILER_DEFAULT_CXX_STANDARD}" - _COMPILER_DEFAULT_CXX_STANDARD) - -if(DEFINED CMAKE_CXX_STANDARD) - set(_CXX_CURRENT_STANDARD ${CMAKE_CXX_STANDARD}) -elseif(DEFINED _COMPILER_DEFAULT_CXX_STANDARD) - # refer https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros - # for constants - if(_COMPILER_DEFAULT_CXX_STANDARD EQUAL 201103) - set(_CXX_CURRENT_STANDARD 11) - elseif(_COMPILER_DEFAULT_CXX_STANDARD EQUAL 201402) - set(_CXX_CURRENT_STANDARD 14) - elseif(_COMPILER_DEFAULT_CXX_STANDARD EQUAL 201703) - set(_CXX_CURRENT_STANDARD 17) - endif() -endif() diff --git a/setup/cmake/deps.cmake b/setup/cmake/deps.cmake deleted file mode 100644 index 8fcfb1d8..00000000 --- a/setup/cmake/deps.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# URL and TAG definitions for dependencies -# -# Copyright 2022-2023 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(ABSEIL_GIT_URL https://github.com/abseil/abseil-cpp.git) -set(ABSEIL_GIT_TAG 273292d1cfc0a94a65082ee350509af1d113344d) # 20220623.0 - -set(CARES_GIT_URL https://github.com/c-ares/c-ares.git) -set(CARES_GIT_TAG 6360e96b5cf8e5980c887ce58ef727e53d77243a) # v1.19.1 - -set(CCTZ_GIT_URL https://github.com/google/cctz.git) -set(CCTZ_GIT_TAG 02918d62329ef440935862719829d061a5f4beba) # master~25 - -set(GFLAGS_GIT_URL https://github.com/gflags/gflags.git) -set(GFLAGS_GIT_TAG 827c769e5fc98e0f2a34c47cef953cc6328abced) # master~5 - -set(GLOG_GIT_URL https://github.com/google/glog.git) -set(GLOG_GIT_TAG a8e0007e96ff96145022c488e367da10f835c75d) # v0.6.0-rc1 - -set(GRPC_GIT_URL https://github.com/google/grpc.git) -set(GRPC_GIT_TAG 8871dab19b4ab5389e28474d25cfeea61283265c) # v1.54.2 - -set(GTEST_GIT_URL https://github.com/google/googletest.git) -set(GTEST_GIT_TAG release-1.11.0) - -set(JSON_GIT_URL https://github.com/nlohmann/json.git) -set(JSON_GIT_TAG 760304635dc74a5bf77903ad92446a6febb85acf) # tags/v3.10.5^2~8 - -set(PROTOBUF_GIT_URL https://github.com/google/protobuf.git) -set(PROTOBUF_GIT_TAG fe271ab76f2ad2b2b28c10443865d2af21e27e0e) # v3.20.3 - -set(ZLIB_GIT_URL https://github.com/madler/zlib) -set(ZLIB_GIT_TAG 04f42ceca40f73e2978b50e93806c2a18c1281fc) # v1.2.13 diff --git a/setup/cmake/grpc.patch.in b/setup/cmake/grpc.patch.in deleted file mode 100644 index a976966a..00000000 --- a/setup/cmake/grpc.patch.in +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2022-2023 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -# Updated to gRPC v1.54.2 - -# 1) Patch the gRPC build script to set the RUNPATH of the installed -# Protobuf compiler plugins to the relative paths of the library -# directories. -# 2) Fix a bug in the v1.54.2 build script by suppressing installation of -# gRPCPluginTargets if gRPC_BUILD_CODEGEN is FALSE. We can't export -# the plugin targets if we haven't built them. -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b67b7aafae..18d837e301 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -12248,6 +12248,9 @@ if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CPP_PLUGIN) - add_executable(grpc_cpp_plugin - src/compiler/cpp_plugin.cc - ) -+set_target_properties(grpc_cpp_plugin -+ PROPERTIES INSTALL_RPATH @GRPC_INSTALL_RPATH@ -+) - target_compile_features(grpc_cpp_plugin PUBLIC cxx_std_14) - target_include_directories(grpc_cpp_plugin - PRIVATE -@@ -12507,6 +12510,9 @@ if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_PYTHON_PLUGIN) - add_executable(grpc_python_plugin - src/compiler/python_plugin.cc - ) -+set_target_properties(grpc_python_plugin -+ PROPERTIES INSTALL_RPATH @GRPC_INSTALL_RPATH@ -+) - target_compile_features(grpc_python_plugin PUBLIC cxx_std_14) - target_include_directories(grpc_python_plugin - PRIVATE -@@ -25968,10 +25974,12 @@ if(gRPC_INSTALL) - DESTINATION ${gRPC_INSTALL_CMAKEDIR} - NAMESPACE gRPC:: - ) -- install(EXPORT gRPCPluginTargets -- DESTINATION ${gRPC_INSTALL_CMAKEDIR} -- NAMESPACE gRPC:: -- ) -+ if(gRPC_BUILD_CODEGEN) -+ install(EXPORT gRPCPluginTargets -+ DESTINATION ${gRPC_INSTALL_CMAKEDIR} -+ NAMESPACE gRPC:: -+ ) -+ endif() - endif() - - include(CMakePackageConfigHelpers) diff --git a/setup/make-cross-deps.sh b/setup/make-cross-deps.sh deleted file mode 100755 index 51daca42..00000000 --- a/setup/make-cross-deps.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash -# -# Copyright 2022-2023 Intel Corporation -# SPDX-License-Identifier: Apache 2.0 -# -# Sample script to configure and build the dependency libraries -# on the development host when cross-compiling for the ES2K ACC. -# - -# Abort on error. -set -e - -if [ -z "${SDKTARGETSYSROOT}" ]; then - echo "" - echo "-----------------------------------------------------" - echo "Error: SDKTARGETSYSROOT is not defined!" - echo "Did you forget to source the environment variables?" - echo "-----------------------------------------------------" - echo "" - exit 1 -fi - -_SYSROOT=${SDKTARGETSYSROOT} - -################## -# Default values # -################## - -_BLD_DIR=build -_DO_BUILD=true -_DRY_RUN=false -_NJOBS=8 -_PREFIX=//opt/deps -_TOOLFILE=${CMAKE_TOOLCHAIN_FILE} - -############## -# print_help # -############## - -print_help() { - echo "" - echo "Build target dependency libraries" - echo "" - echo "Paths:" - echo " --build=DIR -B Build directory path [${_BLD_DIR}]" - echo " --host=DIR -H Host dependencies directory [${_HOST_DIR}]" - echo " --prefix=DIR* -P Install directory prefix [${_PREFIX}]" - echo " --toolchain=FILE -T CMake toolchain file" - echo "" - echo "Options:" - echo " --cxx=VERSION CXX_STANDARD to build dependencies (Default: empty)" - echo " --dry-run -n Display cmake parameters and exit" - echo " --force -f Specify -f when patching (Default: false)" - echo " --help -h Display this help text" - echo " --jobs=NJOBS -j Number of build threads (Default: ${_NJOBS})" - echo " --no-build Configure without building" - echo " --no-download Do not download repositories (Default: false)" - echo " --sudo Use sudo when installing (Default: false)" - echo "" - echo "* '//' at the beginning of the directory path will be replaced" - echo " with the sysroot directory path." - echo "" - echo "Environment variables:" - echo " CMAKE_TOOLCHAIN_FILE - Default toolchain file" - echo " SDKTARGETSYSROOT - sysroot directory" - echo "" -} - -###################### -# Parse command line # -###################### - -SHORTOPTS=B:H:P:T:fhj:n -LONGOPTS=build:,cxx:,hostdeps:,jobs:,prefix:,toolchain: -LONGOPTS=${LONGOPTS},dry-run,force,help,no-build,no-download,sudo - -eval set -- `getopt -o ${SHORTOPTS} --long ${LONGOPTS} -- "$@"` - -while true ; do - case "$1" in - # Paths - -B|--build) - _BLD_DIR=$2 - shift 2 ;; - -H|--hostdeps) - _HOST_DIR=$2 - shift 2 ;; - -P|--prefix) - _PREFIX=$2 - shift 2 ;; - -T|--toolchain) - _TOOLFILE=$2 - shift 2 ;; - # Options - --cxx) - _CXX_STANDARD_OPTION="-DCXX_STANDARD=$2" - shift 2 ;; - -f|--force) - _FORCE_PATCH="-DFORCE_PATCH=TRUE" - shift 1 ;; - -h|--help) - print_help - exit 99 ;; - -j|--jobs) - _NJOBS=$2 - shift 2 ;; - -n|--dry-run) - _DRY_RUN=true - shift 1 ;; - --no-build) - _DO_BUILD=false - shift ;; - --no-download) - _DOWNLOAD="-DDOWNLOAD=FALSE" - shift 1 ;; - --sudo) - _USE_SUDO="-DUSE_SUDO=TRUE" - shift ;; - --) - shift - break ;; - *) - echo "Invalid parameter: $1" - exit 1 ;; - esac -done - -###################### -# Process parameters # -###################### - -# Replace "//"" prefix with "${_SYSROOT}/"" -[ "${_PREFIX:0:2}" = "//" ] && _PREFIX="${_SYSROOT}/${_PREFIX:2}" - -if [ -n "${_HOST_DIR}" ]; then - _HOST_DEPEND_DIR="-DHOST_DEPEND_DIR=${_HOST_DIR}" -fi - -if [ "${_DRY_RUN}" = "true" ]; then - echo "" - echo "CMAKE_INSTALL_PREFIX=${_PREFIX}" - echo "CMAKE_TOOLCHAIN_FILE=${_TOOLFILE}" - echo "JOBS=${_NJOBS}" - [ -n "${_CXX_STANDARD_OPTION}" ] && echo "${_CXX_STANDARD_OPTION:2}" - [ -n "${_DOWNLOAD}" ] && echo "${_DOWNLOAD:2}" - [ -n "${_HOST_DEPEND_DIR}" ] && echo "${_HOST_DEPEND_DIR:2}" - [ -n "${_FORCE_PATCH}" ] && echo "${_FORCE_PATCH:2}" - [ -n "${_USE_SUDO}" ] && echo "${_USE_SUDO:2}" - - if [ "${_DO_BUILD}" = "false" ]; then - echo "" - echo "Configure without building" - fi - - echo "" - exit 0 -fi - -###################### -# Build dependencies # -###################### - -rm -fr ${_BLD_DIR} - -cmake -S . -B ${_BLD_DIR} \ - -DCMAKE_INSTALL_PREFIX=${_PREFIX} \ - -DCMAKE_TOOLCHAIN_FILE=${_TOOLFILE} \ - ${_HOST_DEPEND_DIR} \ - ${_CXX_STANDARD_OPTION} \ - ${_DOWNLOAD} ${_FORCE_PATCH} ${_USE_SUDO} - -if [ "${_DO_BUILD}" = "true" ]; then - cmake --build ${_BLD_DIR} -j${_NJOBS} -fi diff --git a/setup/make-host-deps.sh b/setup/make-host-deps.sh deleted file mode 100755 index 59103558..00000000 --- a/setup/make-host-deps.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash - -# Sample script to configure and build the subset of the dependency -# libraries needed to compile the Protobuf files on the development -# host when cross-compiling for the ES2K ACC platform. - -# The Protobuf compiler and grpc plugins run natively on the development -# host. They generate C++ source and header files that can be compiled -# to run natively on the host or cross-compiled to run on the target -# platform. - -# Abort on error. -set -e - -if [ -n "${SDKTARGETSYSROOT}" ]; then - echo "" - echo "-----------------------------------------------------" - echo "Error: SDKTARGETSYSROOT is defined!" - echo "The host dependencies must be built WITHOUT sourcing" - echo "the cross-compile environment variables." - echo "-----------------------------------------------------" - echo "" - exit 1 -fi - -# Default values -_BLD_DIR=build -_DO_BUILD=true -_DRY_RUN=false -_PREFIX=./host-deps -_NJOBS=8 -_SCOPE=minimal - -print_help() { - echo "" - echo "Build host dependency libraries" - echo "" - echo "Paths:" - echo " --build=DIR -B Build directory path (Default: ${_BLD_DIR})" - echo " --prefix=DIR -P Install directory path (Default: ${_PREFIX})" - echo "" - echo "Options:" - echo " --cxx=VERSION CXX_STANDARD to build dependencies (Default: empty)" - echo " --dry-run -n Display cmake parameters and exit (Default: false)" - echo " --force -f Specify -f when patching (Default: false)" - echo " --full Build all dependency libraries (Default: ${_SCOPE})" - echo " --jobs=NJOBS -j Number of build threads (Default: ${_NJOBS})" - echo " --minimal Build required host dependencies only (Default: ${_SCOPE})" - echo " --no-build Configure without building" - echo " --no-download Do not download repositories (Default: false)" - echo " --sudo Use sudo when installing (Default: false)" - echo "" -} - -# Parse options -SHORTOPTS=B:P:fhj:n -LONGOPTS=build:,cxx:,jobs:,prefix: -LONGOPTS=${LONGOPTS},dry-run,force,full,help,minimal,no-build,no-download,sudo - -eval set -- `getopt -o ${SHORTOPTS} --long ${LONGOPTS} -- "$@"` - -while true ; do - case "$1" in - # Paths - -B|--build) - _BLD_DIR=$2 - shift 2 ;; - -P|--prefix) - _PREFIX=$2 - shift 2 ;; - # Options - --cxx) - _CXX_STANDARD_OPTION="-DCXX_STANDARD=$2" - shift 2 ;; - -n|--dry-run) - _DRY_RUN=true - shift ;; - -f|--force) - _FORCE_PATCH="-DFORCE_PATCH=TRUE" - shift ;; - --full) - _SCOPE=full - shift ;; - -h|--help) - print_help - exit 99 ;; - -j|--jobs) - _JOBS=-j$2 - shift 2 ;; - --minimal) - _SCOPE=minimal - shift ;; - --no-build) - _DO_BUILD=false - shift ;; - --no-download) - _DOWNLOAD="-DDOWNLOAD=FALSE" - shift ;; - --sudo) - _USE_SUDO="-DUSE_SUDO=TRUE" - shift ;; - --) - shift - break ;; - *) - echo "Invalid parameter: $1" - exit 1 ;; - esac -done - -if [ "${_SCOPE}" = minimal ]; then - _ON_DEMAND="-DON_DEMAND=TRUE" - _TARGET="--target grpc" -fi - -if [ "${_DRY_RUN}" = "true" ]; then - echo "" - echo "Config options:" - echo " CMAKE_INSTALL_PREFIX=${_PREFIX}" - [ -n "${_CXX_STANDARD_OPTION}" ] && echo " ${_CXX_STANDARD_OPTION:2}" - [ -n "${_DOWNLOAD}" ] && echo " ${_DOWNLOAD:2}" - [ -n "${_FORCE_PATCH}" ] && echo " ${_FORCE_PATCH:2}" - [ -n "${_ON_DEMAND}" ] && echo " ${_ON_DEMAND:2}" - [ -n "${_USE_SUDO}" ] && echo " ${_USE_SUDO:2}" - echo "" - if [ "${_DO_BUILD}" = "false" ]; then - echo "Configure only (${_SCOPE} build)" - else - echo "Build options:" - echo " -j${_NJOBS}" - [ -n "${_TARGET}" ] && echo " ${_TARGET}" - echo "" - echo "Will perform a ${_SCOPE} build" - fi - echo "" - exit 0 -fi - -rm -fr ${_BLD_DIR} ${_PREFIX} - -cmake -S . -B ${_BLD_DIR} \ - -DCMAKE_INSTALL_PREFIX=${_PREFIX} \ - ${_CXX_STANDARD_OPTION} \ - ${_ON_DEMAND} ${_DOWNLOAD} ${_FORCE_PATCH} ${_USE_SUDO} - -if [ "${_DO_BUILD}" = "true" ]; then - cmake --build ${_BLD_DIR} -j${_NJOBS} ${_TARGET} -fi diff --git a/setup/prune.sh b/setup/prune.sh deleted file mode 100755 index 6edc5ae1..00000000 --- a/setup/prune.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2023 Intel Corporation -# SPDX-License-Identifier: Apache 2.0 -# -# Removes unnecessary third-party packages. -# - -# duplicate packages -rm -fr grpc/third_party/abseil-cpp -rm -fr grpc/third_party/bloaty/abseil-cpp -rm -fr grpc/third_party/bloaty/third_party/abseil-cpp -rm -fr grpc/third_party/bloaty/third_party/protobuf -rm -fr grpc/third_party/bloaty/third_party/zlib -rm -fr grpc/third_party/cares -rm -fr grpc/third_party/protobuf -rm -fr grpc/third_party/zlib - -# unused packages -rm -fr grpc/third_party/boringssl-with-bazel