From aef838536ea3a08e3c1030ead553ca6456cc7fe3 Mon Sep 17 00:00:00 2001 From: ras0219 Date: Mon, 22 Jun 2020 14:14:36 -0700 Subject: [vcpkg] Track compiler information in ABI (#11654) * [vcpkg] Refactor out abi_tags_from_pre_build_info() * [vcpkg] Track Windows toolchain file in triplet hash * [vcpkg] Improve error messages when constructing PreBuildInfo * [vcpkg] Extract InstallPlanAction::BuildAbiInfo * [vcpkg] Extract Build::EnvCache and private-impl VcpkgPaths * [vcpkg] Enable compiler hash detection when binarycaching is enabled * [vcpkg] Downgrade warning about missing ABI keys When binarycaching is not enabled, this warning is spurious and provides no user value. * [vcpkg] Cleanup * [vcpkg] Refactor compiler tracking into triplet abi computation Move several static global caches into VcpkgPaths/EnvCache. Add feature flag 'compilertracking' to enable the new feature. * [vcpkg] Refactor out PreBuildInfo::using_vcvars() Move VcpkgTripletVar into build.cpp because it is not used outside that file. * [vcpkg] Address some code analysis warnings Co-authored-by: Robert Schumacher --- scripts/detect_compiler/CMakeLists.txt | 8 ++++++++ scripts/detect_compiler/portfile.cmake | 28 ++++++++++++++++++++++++++++ scripts/ports.cmake | 7 +++---- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 scripts/detect_compiler/CMakeLists.txt create mode 100644 scripts/detect_compiler/portfile.cmake (limited to 'scripts') diff --git a/scripts/detect_compiler/CMakeLists.txt b/scripts/detect_compiler/CMakeLists.txt new file mode 100644 index 000000000..5dc0889a6 --- /dev/null +++ b/scripts/detect_compiler/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(detect_compiler) + +file(SHA1 "${CMAKE_CXX_COMPILER}" CXX_HASH) +file(SHA1 "${CMAKE_C_COMPILER}" C_HASH) +string(SHA1 COMPILER_HASH "${C_HASH}${CXX_HASH}") + +message("#COMPILER_HASH#${COMPILER_HASH}") diff --git a/scripts/detect_compiler/portfile.cmake b/scripts/detect_compiler/portfile.cmake new file mode 100644 index 000000000..16c760706 --- /dev/null +++ b/scripts/detect_compiler/portfile.cmake @@ -0,0 +1,28 @@ +set(LOGS + ${CURRENT_BUILDTREES_DIR}/config-${TARGET_TRIPLET}-out.log + ${CURRENT_BUILDTREES_DIR}/config-${TARGET_TRIPLET}-rel-out.log + ${CURRENT_BUILDTREES_DIR}/config-${TARGET_TRIPLET}-dbg-out.log +) + +foreach(LOG IN LISTS LOGS) + file(REMOVE ${LOG}) + if(EXISTS ${LOG}) + message(FATAL_ERROR "Could not remove ${LOG}") + endif() +endforeach() + +set(VCPKG_BUILD_TYPE release) + +vcpkg_configure_cmake( + SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}" + PREFER_NINJA +) + +foreach(LOG IN LISTS LOGS) + if(EXISTS ${LOG}) + file(READ "${LOG}" _contents) + message("${_contents}") + return() + endif() +endforeach() +message(FATAL_ERROR "Could read logs: ${LOGS}") diff --git a/scripts/ports.cmake b/scripts/ports.cmake index cd687026f..8c7c71d34 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -43,9 +43,6 @@ if(CMD MATCHES "^BUILD$") if(NOT EXISTS ${CURRENT_PORT_DIR}/portfile.cmake) message(FATAL_ERROR "Port is missing portfile: ${CURRENT_PORT_DIR}/portfile.cmake") endif() - if(NOT EXISTS ${CURRENT_PORT_DIR}/CONTROL) - message(FATAL_ERROR "Port is missing control file: ${CURRENT_PORT_DIR}/CONTROL") - endif() unset(PACKAGES_DIR) unset(BUILDTREES_DIR) @@ -74,7 +71,9 @@ if(CMD MATCHES "^BUILD$") include(${SCRIPTS}/cmake/vcpkg_common_definitions.cmake) include(${SCRIPTS}/cmake/vcpkg_common_functions.cmake) include(${CURRENT_PORT_DIR}/portfile.cmake) - include(${SCRIPTS}/build_info.cmake) + if(DEFINED PORT) + include(${SCRIPTS}/build_info.cmake) + endif() elseif(CMD MATCHES "^CREATE$") file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR) file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS) -- cgit v1.2.3