mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[vcpkg] Allow compilation inside WSL
This commit is contained in:
parent
5335d17f53
commit
14cbe496bc
@ -27,8 +27,10 @@ vcpkg_install_cmake()
|
||||
|
||||
# Both dynamic and static are built, so keep only the one needed
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/lib/zlib.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibd.lib)
|
||||
if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/lib/zlib.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibd.lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright)
|
||||
|
@ -42,6 +42,8 @@ else()
|
||||
set(_VCPKG_TARGET_TRIPLET_ARCH arm)
|
||||
elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$")
|
||||
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to determine target architecture.")
|
||||
endif()
|
||||
@ -50,6 +52,8 @@ endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
|
||||
set(_VCPKG_TARGET_TRIPLET_PLAT uwp)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(_VCPKG_TARGET_TRIPLET_PLAT linux)
|
||||
else()
|
||||
set(_VCPKG_TARGET_TRIPLET_PLAT windows)
|
||||
endif()
|
||||
@ -93,7 +97,7 @@ list(APPEND CMAKE_LIBRARY_PATH
|
||||
|
||||
set(Boost_COMPILER "-vc140")
|
||||
|
||||
if (NOT DEFINED CMAKE_SYSTEM_VERSION)
|
||||
if (NOT DEFINED CMAKE_SYSTEM_VERSION AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp")
|
||||
include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake)
|
||||
# This is used as an implicit parameter for vcpkg_get_windows_sdk
|
||||
set(VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR})
|
||||
@ -134,7 +138,7 @@ function(add_executable name)
|
||||
list(FIND ARGV "IMPORTED" IMPORTED_IDX)
|
||||
list(FIND ARGV "ALIAS" ALIAS_IDX)
|
||||
if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1)
|
||||
if(VCPKG_APPLOCAL_DEPS)
|
||||
if(VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp")
|
||||
add_custom_command(TARGET ${name} POST_BUILD
|
||||
COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
|
||||
-targetBinary $<TARGET_FILE:${name}>
|
||||
|
14
toolsrc/CMakeLists.txt
Normal file
14
toolsrc/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
project(vcpkg CXX)
|
||||
|
||||
add_compile_options(-std=c++1z)
|
||||
|
||||
file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)
|
||||
|
||||
add_library(vcpkglib STATIC ${VCPKGLIB_SOURCES})
|
||||
target_compile_definitions(vcpkglib PRIVATE -DDISABLE_METRICS=0)
|
||||
target_include_directories(vcpkglib PUBLIC include)
|
||||
target_link_libraries(vcpkglib PRIVATE stdc++fs)
|
||||
|
||||
add_executable(vcpkg src/vcpkg.cpp)
|
||||
target_link_libraries(vcpkg PRIVATE vcpkglib)
|
@ -113,7 +113,11 @@ namespace vcpkg
|
||||
|
||||
static fs::path get_cmake_path(const fs::path& downloads_folder, const fs::path& scripts_folder)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
static constexpr std::array<int, 3> EXPECTED_VERSION = {3, 9, 5};
|
||||
#else
|
||||
static constexpr std::array<int, 3> EXPECTED_VERSION = {3, 5, 1};
|
||||
#endif
|
||||
static const std::string VERSION_CHECK_ARGUMENTS = "--version";
|
||||
|
||||
const std::vector<fs::path> from_path = Files::find_from_PATH("cmake");
|
||||
@ -161,7 +165,11 @@ namespace vcpkg
|
||||
|
||||
fs::path get_git_path(const fs::path& downloads_folder, const fs::path& scripts_folder)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
static constexpr std::array<int, 3> EXPECTED_VERSION = {2, 15, 0};
|
||||
#else
|
||||
static constexpr std::array<int, 3> EXPECTED_VERSION = {2, 7, 4};
|
||||
#endif
|
||||
static const std::string VERSION_CHECK_ARGUMENTS = "--version";
|
||||
|
||||
const std::vector<fs::path> from_path = Files::find_from_PATH("git");
|
||||
|
Loading…
x
Reference in New Issue
Block a user