[release/2.x] Cherry pick: Unsafe different project (#3894) (#3933)

This commit is contained in:
Amaury Chamayou 2022-06-14 20:45:43 +02:00 коммит произвёл GitHub
Родитель 8dde5433d0
Коммит dfcb3b4021
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 38 добавлений и 21 удалений

Просмотреть файл

@ -22,7 +22,12 @@ steps:
- script: |
set -ex
./tests/test_install_build.sh
unsafe_build=$(grep unsafe /tmp/install_prefix) || true
if [[ -n "$unsafe_build" ]]; then
./tests/test_install_build.sh -DUSE_UNSAFE_VERSION=ON
else
./tests/test_install_build.sh
fi
displayName: Test building a sample against installed CCF
- task: PublishPipelineArtifact@1

Просмотреть файл

@ -7,7 +7,7 @@ include(${CCF_DIR}/cmake/preproject.cmake)
include(${CCF_DIR}/cmake/version.cmake)
project(
ccf
${CCF_PROJECT}
VERSION ${CCF_RELEASE_VERSION}
LANGUAGES C CXX
)
@ -25,7 +25,7 @@ include(${CCF_DIR}/cmake/cpack_settings.cmake)
#
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"/opt/ccf"
"/opt/${CCF_PROJECT}"
CACHE PATH "Default install prefix" FORCE
)
endif()
@ -960,16 +960,16 @@ endif()
# Generate and install CMake export file for consumers using CMake
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/ccf-config.cmake.in
${CMAKE_BINARY_DIR}/cmake/ccf-config.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CCF_PROJECT}-config.cmake.in
${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR
)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/cmake/ccf-config-version.cmake
${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config-version.cmake
COMPATIBILITY SameMajorVersion
)
install(FILES ${CMAKE_BINARY_DIR}/cmake/ccf-config.cmake
${CMAKE_BINARY_DIR}/cmake/ccf-config-version.cmake
install(FILES ${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config.cmake
${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
)

Просмотреть файл

@ -0,0 +1,8 @@
@PACKAGE_INIT@
set(CCF_DIR "@CMAKE_INSTALL_PREFIX@")
include("${CCF_DIR}/cmake/ccf-targets.cmake")
include("${CCF_DIR}/cmake/preproject.cmake")
include("${CCF_DIR}/cmake/ccf_app.cmake")
include("${CCF_DIR}/cmake/tools.cmake")

Просмотреть файл

@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
set(CPACK_PACKAGE_NAME "ccf")
set(CPACK_PACKAGE_NAME ${CCF_PROJECT})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Confidential Consortium Framework")
set(CPACK_PACKAGE_CONTACT "https://github.com/Microsoft/CCF")
set(CPACK_RESOURCE_FILE_LICENSE "${CCF_DIR}/LICENSE")
@ -19,7 +19,7 @@ endif()
# CPack variables for Debian packages
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"open-enclave (>=0.17.6), libuv1 (>= 1.34.2), libc++1-10, libc++abi1-10, openssl (>=1.1.1)"
"open-enclave (>=0.17.7), libuv1 (>= 1.34.2), libc++1-10, libc++abi1-10, openssl (>=1.1.1)"
)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

Просмотреть файл

@ -7,6 +7,11 @@ unset(CCF_VERSION_SUFFIX)
option(UNSAFE_VERSION "Produce build with unsafe logging levels" OFF)
set(CCF_PROJECT "ccf")
if(UNSAFE_VERSION)
set(CCF_PROJECT "${CCF_PROJECT}_unsafe")
endif()
# If possible, deduce project version from git environment
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
find_package(Git)
@ -22,10 +27,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
message(FATAL_ERROR "Error calling git describe")
endif()
if(UNSAFE_VERSION)
set(CCF_VERSION "${CCF_VERSION}+unsafe")
endif()
# Convert git description into cmake list, separated at '-'
string(REPLACE "-" ";" CCF_VERSION_COMPONENTS ${CCF_VERSION})
@ -46,10 +47,6 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(UNSAFE_VERSION)
set(CCF_VERSION "${CCF_VERSION}+unsafe")
endif()
# Convert directory name into cmake list, separated at '-'
string(REPLACE "-" ";" CCF_VERSION_COMPONENTS ${CCF_VERSION})

Просмотреть файл

@ -5,8 +5,15 @@ cmake_minimum_required(VERSION 3.16)
project(logging LANGUAGES C CXX)
if(NOT TARGET ccf)
find_package(ccf REQUIRED)
option(USE_UNSAFE_VERSION "Use build with unsafe logging levels" OFF)
set(CCF_PROJECT "ccf")
if(USE_UNSAFE_VERSION)
set(CCF_PROJECT "${CCF_PROJECT}_unsafe")
endif()
if(NOT TARGET ${CCF_PROJECT})
find_package(${CCF_PROJECT} REQUIRED)
endif()
add_ccf_app(logging SRCS logging.cpp)

Просмотреть файл

@ -5,5 +5,5 @@ set -ex
mkdir -p build_against_install
cd build_against_install
CC=$(command -v clang-10) CXX=$(command -v clang++-10) cmake -GNinja ../samples/apps/logging/
CC=$(command -v clang-10) CXX=$(command -v clang++-10) cmake -GNinja "$1" ../samples/apps/logging/
ninja