diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake index 50432f8fa..cfd429da2 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -108,7 +108,7 @@ function(vcpkg_build_msbuild) if(_csc_USE_VCPKG_INTEGRATION) list( APPEND _csc_OPTIONS - /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets + /p:ForceImportBeforeCppTargets=${SCRIPTS}/buildsystems/msbuild/vcpkg.targets "/p:VcpkgTriplet=${TARGET_TRIPLET}" ) endif() diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 6c392d385..1c3a26a74 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -198,15 +198,15 @@ function(vcpkg_configure_cmake) if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE) if(NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR _TARGETTING_UWP) - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/windows.cmake") + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/linux.cmake") + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/linux.cmake") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android") - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/android.cmake") + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/osx.cmake") + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${VCPKG_ROOT_DIR}/scripts/toolchains/freebsd.cmake") + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake") endif() endif() @@ -222,7 +222,7 @@ function(vcpkg_configure_cmake) "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" - "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/buildsystems/vcpkg.cmake" + "-DCMAKE_TOOLCHAIN_FILE=${SCRIPTS}/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=${VCPKG_CXX_FLAGS}" "-DVCPKG_CXX_FLAGS_RELEASE=${VCPKG_CXX_FLAGS_RELEASE}" diff --git a/scripts/cmake/vcpkg_copy_tool_dependencies.cmake b/scripts/cmake/vcpkg_copy_tool_dependencies.cmake index 165f19ed1..396d20b41 100644 --- a/scripts/cmake/vcpkg_copy_tool_dependencies.cmake +++ b/scripts/cmake/vcpkg_copy_tool_dependencies.cmake @@ -21,7 +21,7 @@ function(vcpkg_copy_tool_dependencies TOOL_DIR) file(GLOB TOOLS ${TOOL_DIR}/*.exe ${TOOL_DIR}/*.dll) foreach(TOOL ${TOOLS}) execute_process(COMMAND powershell -noprofile -executionpolicy Bypass -nologo - -file ${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/applocal.ps1 + -file ${SCRIPTS}/buildsystems/msbuild/applocal.ps1 -targetBinary ${TOOL} -installedDir ${PATH_TO_SEARCH} OUTPUT_VARIABLE OUT) diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake index 92c84bf0b..7c2fdd836 100644 --- a/scripts/cmake/vcpkg_install_msbuild.cmake +++ b/scripts/cmake/vcpkg_install_msbuild.cmake @@ -144,7 +144,7 @@ function(vcpkg_install_msbuild) endif() if(_csc_USE_VCPKG_INTEGRATION) - list(APPEND _csc_OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets /p:VcpkgApplocalDeps=false) + list(APPEND _csc_OPTIONS /p:ForceImportBeforeCppTargets=${SCRIPTS}/buildsystems/msbuild/vcpkg.targets /p:VcpkgApplocalDeps=false) endif() get_filename_component(SOURCE_PATH_SUFFIX "${_csc_SOURCE_PATH}" NAME) diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 056485568..456434f12 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -7,22 +7,28 @@ macro(debug_message) endmacro() #Detect .vcpkg-root to figure VCPKG_ROOT_DIR, starting from triplet folder. -get_filename_component(TARGET_TRIPLET_DIR ${TARGET_TRIPLET_FILE} DIRECTORY) -SET(VCPKG_ROOT_DIR_CANDIDATE ${TARGET_TRIPLET_DIR}) -while(IS_DIRECTORY ${VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") - get_filename_component(VCPKG_ROOT_DIR_TEMP ${VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) - if (VCPKG_ROOT_DIR_TEMP STREQUAL VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive - message(FATAL_ERROR "Could not find .vcpkg-root") - else() - SET(VCPKG_ROOT_DIR_CANDIDATE ${VCPKG_ROOT_DIR_TEMP}) - endif() -endwhile() +set(VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) + +if(DEFINED VCPKG_ROOT_PATH) + set(VCPKG_ROOT_DIR_CANDIDATE ${VCPKG_ROOT_PATH}) +else() + message(FATAL_ERROR [[ + Your vcpkg executable is outdated and is not compatible with the current CMake scripts. + Please re-build vcpkg by running bootstrap-vcpkg. + ]]) +endif() + +# Validate VCPKG_ROOT_DIR_CANDIDATE +if (NOT EXISTS "${VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") + message(FATAL_ERROR "Could not find .vcpkg-root") +endif() set(VCPKG_ROOT_DIR ${VCPKG_ROOT_DIR_CANDIDATE}) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) set(CURRENT_INSTALLED_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET} CACHE PATH "Location to install final packages") set(DOWNLOADS ${VCPKG_ROOT_DIR}/downloads CACHE PATH "Location to download sources and tools") +set(SCRIPTS ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Location to stored scripts") set(PACKAGES_DIR ${VCPKG_ROOT_DIR}/packages CACHE PATH "Location to store package images") set(BUILDTREES_DIR ${VCPKG_ROOT_DIR}/buildtrees CACHE PATH "Location to perform actual extract+config+build") @@ -80,8 +86,8 @@ if(CMD MATCHES "^BUILD$") endif() set(TRIPLET_SYSTEM_ARCH ${VCPKG_TARGET_ARCHITECTURE}) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg_common_definitions.cmake) - include(${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg_common_functions.cmake) + include(${SCRIPTS}/cmake/vcpkg_common_definitions.cmake) + include(${SCRIPTS}/cmake/vcpkg_common_functions.cmake) include(${CURRENT_PORT_DIR}/portfile.cmake) set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) @@ -131,8 +137,8 @@ elseif(CMD MATCHES "^CREATE$") file(SHA512 ${DOWNLOADS}/${FILENAME} SHA512) file(MAKE_DIRECTORY ports/${PORT}) - configure_file(scripts/templates/portfile.in.cmake ports/${PORT}/portfile.cmake @ONLY) - configure_file(scripts/templates/CONTROL.in ports/${PORT}/CONTROL @ONLY) + configure_file(${SCRIPTS}/templates/portfile.in.cmake ports/${PORT}/portfile.cmake @ONLY) + configure_file(${SCRIPTS}/templates/CONTROL.in ports/${PORT}/CONTROL @ONLY) message(STATUS "Generated portfile: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake") message(STATUS "Generated CONTROL: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\CONTROL") diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 2dc424b6c..4d402b96c 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"2019.08.27" +"2019.09.12" diff --git a/toolsrc/src/vcpkg-test/arguments.cpp b/toolsrc/src/vcpkg-test/arguments.cpp index 326b07579..c63a31396 100644 --- a/toolsrc/src/vcpkg-test/arguments.cpp +++ b/toolsrc/src/vcpkg-test/arguments.cpp @@ -13,7 +13,7 @@ TEST_CASE ("VcpkgCmdArguments from lowercase argument sequence", "[arguments]") { std::vector t = {"--vcpkg-root", "C:\\vcpkg", - "--scripts-root=C:\\scripts", + "--x-scripts-root=C:\\scripts", "--debug", "--sendmetrics", "--printmetrics", @@ -45,7 +45,7 @@ TEST_CASE ("VcpkgCmdArguments from uppercase argument sequence", "[arguments]") { std::vector t = {"--VCPKG-ROOT", "C:\\vcpkg", - "--SCRIPTS-ROOT=C:\\scripts", + "--X-SCRIPTS-ROOT=C:\\scripts", "--DEBUG", "--SENDMETRICS", "--PRINTMETRICS", diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index e5c00b929..618e4126b 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -396,6 +396,7 @@ namespace vcpkg::Build {"CMD", "BUILD"}, {"PORT", config.scf.core_paragraph->name}, {"CURRENT_PORT_DIR", config.port_dir}, + {"VCPKG_ROOT_PATH", paths.root}, {"TARGET_TRIPLET", triplet.canonical_name()}, {"TARGET_TRIPLET_FILE", paths.get_triplet_file_path(triplet).u8string()}, {"VCPKG_PLATFORM_TOOLSET", toolset.version.c_str()}, diff --git a/toolsrc/src/vcpkg/help.cpp b/toolsrc/src/vcpkg/help.cpp index 48c836e63..0c53536fb 100644 --- a/toolsrc/src/vcpkg/help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -125,7 +125,7 @@ namespace vcpkg::Help " (default: " ENVVAR(VCPKG_ROOT) // ")\n" "\n" - " --scripts-root= Specify the scripts root directory\n" + " --x-scripts-root= (Experimental) Specify the scripts root directory\n" "\n" " @response_file Specify a " "response file to provide additional parameters\n" diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index e48340df7..5f99b85e5 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -146,10 +146,10 @@ namespace vcpkg parse_value(arg_begin, arg_end, "--vcpkg-root", args.vcpkg_root_dir); continue; } - if (Strings::starts_with(arg, "--scripts-root=")) + if (Strings::starts_with(arg, "--x-scripts-root=")) { parse_cojoined_value( - arg.substr(sizeof("--scripts-root=") - 1), "--scripts-root", args.scripts_root_dir); + arg.substr(sizeof("--x-scripts-root=") - 1), "--x-scripts-root", args.scripts_root_dir); continue; } if (arg == "--triplet") @@ -430,7 +430,7 @@ namespace vcpkg "--vcpkg-root ", "Specify the vcpkg directory to use instead of current directory or tool directory"); System::printf(" %-40s %s\n", - "--scripts-root=", - "Specify the scripts directory to use instead of default vcpkg scripts directory"); + "--x-scripts-root=", + "(Experimental) Specify the scripts directory to use instead of default vcpkg scripts directory"); } } diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index 4f01ed03b..078121fcc 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -76,7 +76,7 @@ namespace vcpkg Checks::exit_with_message( VCPKG_LINE_INFO, "Invalid scripts override directory: %s; " - "create that directory or unset --scripts-root to use the default scripts location.", + "create that directory or unset --x-scripts-root to use the default scripts location.", scripts_dir->u8string()); }