aboutsummaryrefslogtreecommitdiff
path: root/scripts/buildsystems
diff options
context:
space:
mode:
authorBarath Kannan <barathsotd@gmail.com>2017-12-27 16:57:43 +1100
committerBarath Kannan <barathsotd@gmail.com>2017-12-27 16:57:43 +1100
commitd8f0ea999983892b8e5e49340ece3474ee257156 (patch)
treece9b615075350d90d0b7312874bae6dd202fe93b /scripts/buildsystems
parent22e9a2b25db21e1d1a1f75786442f2c90ae0db0c (diff)
parent6e05f9cdf5cf4d53153214f4d4b29133b368bc4d (diff)
downloadvcpkg-d8f0ea999983892b8e5e49340ece3474ee257156.tar.gz
vcpkg-d8f0ea999983892b8e5e49340ece3474ee257156.zip
resolve merge conflicts
Diffstat (limited to 'scripts/buildsystems')
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets4
-rw-r--r--scripts/buildsystems/vcpkg.cmake97
2 files changed, 72 insertions, 29 deletions
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index ad1dde89b..092e013b5 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -67,11 +67,11 @@
File="$(TLogLocation)$(ProjectName).write.1u.tlog"
Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
<Exec Condition="$(VcpkgConfiguration.StartsWith('Debug'))"
- Command="powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
+ Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
<Exec Condition="$(VcpkgConfiguration.StartsWith('Release'))"
- Command="powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
+ Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
<ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log">
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index ff89439cc..b8d3fbdbb 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -1,6 +1,12 @@
# Mark variables as used so cmake doesn't complain about them
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
+# This is a backport of CMAKE_TRY_COMPILE_PLATFORM_VARIABLES to cmake 3.0
+get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
+if( _CMAKE_IN_TRY_COMPILE )
+ include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL )
+endif()
+
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
endif()
@@ -9,11 +15,6 @@ if(VCPKG_TOOLCHAIN)
return()
endif()
-get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
-if( _CMAKE_IN_TRY_COMPILE )
- include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL )
-endif()
-
if(VCPKG_TARGET_TRIPLET)
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$")
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
@@ -30,9 +31,9 @@ else()
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$")
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
- elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM")
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$")
set(_VCPKG_TARGET_TRIPLET_ARCH arm)
- elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017")
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$")
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
else()
find_program(_VCPKG_CL cl)
@@ -42,6 +43,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,24 +53,28 @@ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
set(_VCPKG_TARGET_TRIPLET_PLAT uwp)
-else()
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ set(_VCPKG_TARGET_TRIPLET_PLAT linux)
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(_VCPKG_TARGET_TRIPLET_PLAT windows)
endif()
set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)")
set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR})
-# Detect .vcpkg-root to figure VCPKG_ROOT_DIR
-set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_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 ${_VCPKG_ROOT_DIR_CANDIDATE})
+if(NOT DEFINED _VCPKG_ROOT_DIR)
+ # Detect .vcpkg-root to figure VCPKG_ROOT_DIR
+ set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_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 ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE INTERNAL "Vcpkg root directory")
+endif()
set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed)
if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE)
@@ -77,17 +84,21 @@ if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE)
list(APPEND CMAKE_LIBRARY_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link
)
+ list(APPEND CMAKE_FIND_ROOT_PATH
+ ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug
+ )
endif()
list(APPEND CMAKE_PREFIX_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
)
+list(APPEND CMAKE_FIND_ROOT_PATH
+ ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
+)
list(APPEND CMAKE_LIBRARY_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link
)
-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})
@@ -114,11 +125,11 @@ set(CMAKE_SYSTEM_IGNORE_PATH
"C:/OpenSSL-Win64/lib/VC/static"
)
-set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools)
+list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools)
file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*)
foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS})
if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR})
- set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_TOOLS_DIR})
+ list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_TOOLS_DIR})
endif()
endforeach()
@@ -128,7 +139,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}>
@@ -154,10 +165,22 @@ endfunction()
macro(find_package name)
if("${name}" STREQUAL "Boost")
+ set(_Boost_USE_STATIC_LIBS ${Boost_USE_STATIC_LIBS})
+ set(_Boost_USE_MULTITHREADED ${Boost_USE_MULTITHREADED})
+ set(_Boost_USE_STATIC_RUNTIME ${Boost_USE_STATIC_RUNTIME})
+ set(_Boost_COMPILER ${Boost_COMPILER})
unset(Boost_USE_STATIC_LIBS)
unset(Boost_USE_MULTITHREADED)
unset(Boost_USE_STATIC_RUNTIME)
+ set(Boost_COMPILER "-vc140")
_find_package(${ARGV})
+ if(NOT Boost_FOUND)
+ set(Boost_USE_STATIC_LIBS ${_Boost_USE_STATIC_LIBS})
+ set(Boost_USE_MULTITHREADED ${_Boost_USE_MULTITHREADED})
+ set(Boost_USE_STATIC_RUNTIME ${_Boost_USE_STATIC_RUNTIME})
+ set(Boost_COMPILER ${_Boost_COMPILER})
+ _find_package(${ARGV})
+ endif()
elseif("${name}" STREQUAL "ICU")
function(_vcpkg_find_in_list)
list(FIND ARGV "COMPONENTS" COMPONENTS_IDX)
@@ -178,6 +201,23 @@ macro(find_package name)
if(TIFF_LIBRARIES)
list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()
+ elseif("${name}" STREQUAL "tinyxml2")
+ _find_package(${ARGV})
+ if(TARGET tinyxml2_static AND NOT TARGET tinyxml2)
+ add_library(tinyxml2 INTERFACE IMPORTED)
+ set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static")
+ endif()
+ elseif("${name}" STREQUAL "MPI")
+ if(MPI_C_LIB_NAMES)
+ set(MPI_C_WORKS TRUE)
+ set(MPI_C_WRAPPER_FOUND TRUE)
+ endif()
+ if(MPI_CXX_LIB_NAMES)
+ set(MPI_CXX_WORKS TRUE)
+ set(MPI_CXX_WRAPPER_FOUND TRUE)
+ set(MPI_CXX_VALIDATE_SKIP_MPICXX TRUE)
+ endif()
+ _find_package(${ARGV})
else()
_find_package(${ARGV})
endif()
@@ -192,8 +232,11 @@ set(_UNUSED ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP})
if(NOT _CMAKE_IN_TRY_COMPILE)
file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file)
+ file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake"
"set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n"
"set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n"
- "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n")
-endif() \ No newline at end of file
+ "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n"
+ "set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n"
+ )
+endif()