[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: | - script: |
set -ex 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 displayName: Test building a sample against installed CCF
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1

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

@ -7,7 +7,7 @@ include(${CCF_DIR}/cmake/preproject.cmake)
include(${CCF_DIR}/cmake/version.cmake) include(${CCF_DIR}/cmake/version.cmake)
project( project(
ccf ${CCF_PROJECT}
VERSION ${CCF_RELEASE_VERSION} VERSION ${CCF_RELEASE_VERSION}
LANGUAGES C CXX LANGUAGES C CXX
) )
@ -25,7 +25,7 @@ include(${CCF_DIR}/cmake/cpack_settings.cmake)
# #
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX set(CMAKE_INSTALL_PREFIX
"/opt/ccf" "/opt/${CCF_PROJECT}"
CACHE PATH "Default install prefix" FORCE CACHE PATH "Default install prefix" FORCE
) )
endif() endif()
@ -960,16 +960,16 @@ endif()
# Generate and install CMake export file for consumers using CMake # Generate and install CMake export file for consumers using CMake
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
configure_package_config_file( configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/ccf-config.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CCF_PROJECT}-config.cmake.in
${CMAKE_BINARY_DIR}/cmake/ccf-config.cmake ${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR
) )
write_basic_package_version_file( write_basic_package_version_file(
${CMAKE_BINARY_DIR}/cmake/ccf-config-version.cmake ${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config-version.cmake
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion
) )
install(FILES ${CMAKE_BINARY_DIR}/cmake/ccf-config.cmake install(FILES ${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config.cmake
${CMAKE_BINARY_DIR}/cmake/ccf-config-version.cmake ${CMAKE_BINARY_DIR}/cmake/${CCF_PROJECT}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/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. # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License. # 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_DESCRIPTION_SUMMARY "Confidential Consortium Framework")
set(CPACK_PACKAGE_CONTACT "https://github.com/Microsoft/CCF") set(CPACK_PACKAGE_CONTACT "https://github.com/Microsoft/CCF")
set(CPACK_RESOURCE_FILE_LICENSE "${CCF_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CCF_DIR}/LICENSE")
@ -19,7 +19,7 @@ endif()
# CPack variables for Debian packages # CPack variables for Debian packages
set(CPACK_DEBIAN_PACKAGE_DEPENDS 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) 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) 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 possible, deduce project version from git environment
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
find_package(Git) find_package(Git)
@ -22,10 +27,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
message(FATAL_ERROR "Error calling git describe") message(FATAL_ERROR "Error calling git describe")
endif() endif()
if(UNSAFE_VERSION)
set(CCF_VERSION "${CCF_VERSION}+unsafe")
endif()
# Convert git description into cmake list, separated at '-' # Convert git description into cmake list, separated at '-'
string(REPLACE "-" ";" CCF_VERSION_COMPONENTS ${CCF_VERSION}) string(REPLACE "-" ";" CCF_VERSION_COMPONENTS ${CCF_VERSION})
@ -46,10 +47,6 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
if(UNSAFE_VERSION)
set(CCF_VERSION "${CCF_VERSION}+unsafe")
endif()
# Convert directory name into cmake list, separated at '-' # Convert directory name into cmake list, separated at '-'
string(REPLACE "-" ";" CCF_VERSION_COMPONENTS ${CCF_VERSION}) string(REPLACE "-" ";" CCF_VERSION_COMPONENTS ${CCF_VERSION})

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

@ -5,8 +5,15 @@ cmake_minimum_required(VERSION 3.16)
project(logging LANGUAGES C CXX) project(logging LANGUAGES C CXX)
if(NOT TARGET ccf) option(USE_UNSAFE_VERSION "Use build with unsafe logging levels" OFF)
find_package(ccf REQUIRED)
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() endif()
add_ccf_app(logging SRCS logging.cpp) add_ccf_app(logging SRCS logging.cpp)

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

@ -5,5 +5,5 @@ set -ex
mkdir -p build_against_install mkdir -p build_against_install
cd 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 ninja