From 726b7a6618f24fb833b597f2f5e86e1d3d0e47ea Mon Sep 17 00:00:00 2001 From: Tetsuya Hayashi Date: Wed, 25 Sep 2019 07:58:10 +0900 Subject: [ports.cmake] Fixup capitalization inconsistencies of Windows drive letter. (#8304) CMAKE_CURRENT_LIST_DIR reflect current directory. Thus It can be lowercase drive letter. The lowercase drive letter cause #8237 issue. Fixup drive letter to uppercase by using get_filename_component(). --- scripts/ports.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 456434f12..cdc0bdd99 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -18,6 +18,9 @@ else() ]]) endif() +# fixup Windows drive letter to uppercase. +get_filename_component(VCPKG_ROOT_DIR_CANDIDATE ${VCPKG_ROOT_DIR_CANDIDATE} ABSOLUTE) + # Validate VCPKG_ROOT_DIR_CANDIDATE if (NOT EXISTS "${VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") message(FATAL_ERROR "Could not find .vcpkg-root") -- cgit v1.2.3 From 9433136b22b5e443d550ca7665a562637c8a86b9 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 27 Sep 2019 10:41:02 -0700 Subject: [boost] Update to 1.71.0 (#7959) * [boost] Update to 1.71.0 * [openmvs] Fixes for boost 1.71 * [telnetpp] DISABLE_PARALLEL_CONFIGURE * [execute_process] Fix output variables (like error_code) not getting populated * [telnetpp] Add missing boost-exception dependency * [boost] Refactor generate-ports.ps1 into scripts dir. Enable boost-thread on uwp. * [boost-iostreams] Revert removal of zstd dependency * [openmvs] Fix tools deployment --- scripts/boost/.gitignore | 3 + scripts/boost/generate-ports.ps1 | 421 ++++++++++++++++++++++++ scripts/boost/post-build-stubs/config.cmake | 7 + scripts/boost/post-build-stubs/context.cmake | 6 + scripts/boost/post-build-stubs/exception.cmake | 3 + scripts/boost/post-build-stubs/predef.cmake | 2 + scripts/boost/post-build-stubs/test.cmake | 14 + scripts/boost/post-source-stubs/context.cmake | 5 + scripts/boost/post-source-stubs/fiber.cmake | 5 + scripts/boost/post-source-stubs/iostreams.cmake | 18 + scripts/boost/post-source-stubs/log.cmake | 13 + scripts/boost/post-source-stubs/python.cmake | 5 + scripts/boost/post-source-stubs/test.cmake | 5 + 13 files changed, 507 insertions(+) create mode 100644 scripts/boost/.gitignore create mode 100644 scripts/boost/generate-ports.ps1 create mode 100644 scripts/boost/post-build-stubs/config.cmake create mode 100644 scripts/boost/post-build-stubs/context.cmake create mode 100644 scripts/boost/post-build-stubs/exception.cmake create mode 100644 scripts/boost/post-build-stubs/predef.cmake create mode 100644 scripts/boost/post-build-stubs/test.cmake create mode 100644 scripts/boost/post-source-stubs/context.cmake create mode 100644 scripts/boost/post-source-stubs/fiber.cmake create mode 100644 scripts/boost/post-source-stubs/iostreams.cmake create mode 100644 scripts/boost/post-source-stubs/log.cmake create mode 100644 scripts/boost/post-source-stubs/python.cmake create mode 100644 scripts/boost/post-source-stubs/test.cmake (limited to 'scripts') diff --git a/scripts/boost/.gitignore b/scripts/boost/.gitignore new file mode 100644 index 000000000..f8e31288e --- /dev/null +++ b/scripts/boost/.gitignore @@ -0,0 +1,3 @@ +/boost +/downloads +/libs \ No newline at end of file diff --git a/scripts/boost/generate-ports.ps1 b/scripts/boost/generate-ports.ps1 new file mode 100644 index 000000000..d51b37f7e --- /dev/null +++ b/scripts/boost/generate-ports.ps1 @@ -0,0 +1,421 @@ +[CmdletBinding()] +param ( + $libraries = @(), + $version = "1.71.0" +) + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +$portsDir = "$scriptsDir/../../ports" + +function TransformReference() +{ + param ( + [string]$library + ) + + if ($library -match "python|fiber") + { + # These two only work on windows desktop + "$library (windows)" + } + elseif ($library -match "type[_-]erasure|contract") + { + # These only work on x86-derived processors + "$library (!arm)" + } + elseif ($library -match "iostreams|filesystem|context|stacktrace|coroutine`$|locale|test|wave|log`$") + { + "$library (!uwp)" + } + else + { + "$library" + } +} + +function Generate() +{ + param ( + [string]$Name, + [string]$Hash, + [bool]$NeedsBuild, + $Depends = @() + ) + + $controlDeps = ($Depends | sort) -join ", " + + $sanitizedName = $name -replace "_","-" + + $versionsuffix = "" + if ($Name -eq "python" -or $Name -eq "asio" -or $Name -eq "mpi") + { + $versionsuffix = "-1" + } + + if ($Name -eq "test") + { + $versionsuffix = "-2" + } + + mkdir "$portsDir/boost-$sanitizedName" -erroraction SilentlyContinue | out-null + $controlLines = @( + "# Automatically generated by boost-vcpkg-helpers/generate-ports.ps1" + "Source: boost-$sanitizedName" + "Version: $version$versionsuffix" + "Build-Depends: $controlDeps" + "Homepage: https://github.com/boostorg/$name" + "Description: Boost $Name module" + ) + if ($Name -eq "locale") + { + $controlLines += @( + "" + "Feature: icu" + "Description: ICU backend for Boost.Locale" + "Build-Depends: icu" + ) + } + if ($Name -eq "regex") + { + $controlLines += @( + "" + "Feature: icu" + "Description: ICU backend for Boost.Regex" + "Build-Depends: icu" + ) + } + $controlLines | out-file -enc ascii "$portsDir/boost-$sanitizedName/CONTROL" + + $portfileLines = @( + "# Automatically generated by boost-vcpkg-helpers/generate-ports.ps1" + "" + "include(vcpkg_common_functions)" + "" + "vcpkg_from_github(" + " OUT_SOURCE_PATH SOURCE_PATH" + " REPO boostorg/$Name" + " REF boost-$version" + " SHA512 $Hash" + " HEAD_REF master" + ) + if ($Name -eq "asio") + { + $portfileLines += @(" PATCHES windows_alloca_header.patch") + } + if ($Name -eq "iostreams") + { + $portfileLines += @(" PATCHES Removeseekpos.patch") + } + $portfileLines += @( + ")" + "" + ) + + if (Test-Path "$scriptsDir/post-source-stubs/$Name.cmake") + { + $portfileLines += @(get-content "$scriptsDir/post-source-stubs/$Name.cmake") + } + + if ($NeedsBuild) + { + if ($Name -eq "locale") + { + $portfileLines += @( + "if(`"icu`" IN_LIST FEATURES)" + " set(BOOST_LOCALE_ICU on)" + "else()" + " set(BOOST_LOCALE_ICU off)" + "endif()" + "" + "include(`${CURRENT_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake)" + "boost_modular_build(" + " SOURCE_PATH `${SOURCE_PATH}" + " BOOST_CMAKE_FRAGMENT `"`${CMAKE_CURRENT_LIST_DIR}/cmake-fragment.cmake`"" + " OPTIONS" + " boost.locale.iconv=off" + " boost.locale.posix=off" + " /boost/locale//boost_locale" + " boost.locale.icu=`${BOOST_LOCALE_ICU}" + ")" + ) + } + elseif ($Name -eq "regex") + { + $portfileLines += @( + "if(`"icu`" IN_LIST FEATURES)" + " set(REQUIREMENTS `"/user-config//icuuc /user-config//icudt /user-config//icuin BOOST_HAS_ICU=1`")" + "else()" + " set(REQUIREMENTS)" + "endif()" + "" + "include(`${CURRENT_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake)" + "boost_modular_build(SOURCE_PATH `${SOURCE_PATH} REQUIREMENTS `"`${REQUIREMENTS}`")" + ) + } + elseif ($Name -eq "thread") + { + $portfileLines += @( + "include(`${CURRENT_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake)" + "boost_modular_build(" + " SOURCE_PATH `${SOURCE_PATH}" + " REQUIREMENTS `"/boost/date_time//boost_date_time`"" + " OPTIONS /boost/thread//boost_thread" + " BOOST_CMAKE_FRAGMENT `${CMAKE_CURRENT_LIST_DIR}/b2-options.cmake" + ")" + ) + } + elseif ($Name -eq "iostreams") + { + } + else + { + $portfileLines += @( + "include(`${CURRENT_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake)" + "boost_modular_build(SOURCE_PATH `${SOURCE_PATH})" + ) + } + } + if ($Name -ne "iostreams") + { + $portfileLines += @( + "include(`${CURRENT_INSTALLED_DIR}/share/boost-vcpkg-helpers/boost-modular-headers.cmake)" + "boost_modular_headers(SOURCE_PATH `${SOURCE_PATH})" + ) + } + + if (Test-Path "$scriptsDir/post-build-stubs/$Name.cmake") + { + $portfileLines += @(get-content "$scriptsDir/post-build-stubs/$Name.cmake") + } + + $portfileLines | out-file -enc ascii "$portsDir/boost-$sanitizedName/portfile.cmake" +} + +if (!(Test-Path "$scriptsDir/boost")) +{ + "Cloning boost..." + pushd $scriptsDir + try + { + git clone https://github.com/boostorg/boost --branch boost-$version + } + finally + { + popd + } +} +else +{ + pushd $scriptsDir/boost + try + { + git fetch + git checkout -f boost-$version + } + finally + { + popd + } +} + +$libraries_found = ls $scriptsDir/boost/libs -directory | % name | % { + if ($_ -match "numeric") + { + "numeric_conversion" + "interval" + "odeint" + "ublas" + "safe_numerics" + } + elseif ($_ -eq "headers") + { + } + else + { + $_ + } +} + +mkdir $scriptsDir/downloads -erroraction SilentlyContinue | out-null + +if ($libraries.Length -eq 0) +{ + $libraries = $libraries_found +} + +$libraries_in_boost_port = @() + +foreach ($library in $libraries) +{ + "Handling boost/$library..." + $archive = "$scriptsDir/downloads/$library-boost-$version.tar.gz" + if (!(Test-Path $archive)) + { + "Downloading boost/$library..." + & @(vcpkg fetch aria2)[-1] "https://github.com/boostorg/$library/archive/boost-$version.tar.gz" -d "$scriptsDir/downloads" -o "$library-boost-$version.tar.gz" + } + $hash = vcpkg hash $archive + $unpacked = "$scriptsDir/libs/$library-boost-$version" + if (!(Test-Path $unpacked)) + { + "Unpacking boost/$library..." + mkdir $scriptsDir/libs -erroraction SilentlyContinue | out-null + pushd $scriptsDir/libs + try + { + cmake -E tar xf $archive + } + finally + { + popd + } + } + pushd $unpacked + try + { + $groups = $( + findstr /si /C:"include ).*", "`$1" ` + -replace "/|\.hp?p?| ","" } | group | % name | % { + # mappings + Write-Verbose "${library}: $_" + if ($_ -match "aligned_storage") { "type_traits" } + elseif ($_ -match "noncopyable|ref|swap|get_pointer|checked_delete|visit_each") { "core" } + elseif ($_ -eq "type") { "core" } + elseif ($_ -match "unordered_") { "unordered" } + elseif ($_ -match "cstdint") { "integer" } + elseif ($_ -match "call_traits|operators|current_function|cstdlib|next_prior|compressed_pair") { "utility" } + elseif ($_ -match "^version|^workaround") { "config" } + elseif ($_ -match "enable_shared_from_this|shared_ptr|make_shared|make_unique|intrusive_ptr|scoped_ptr|pointer_to_other|weak_ptr|shared_array|scoped_array") { "smart_ptr" } + elseif ($_ -match "iterator_adaptors|generator_iterator|pointee") { "iterator" } + elseif ($_ -eq "regex_fwd") { "regex" } + elseif ($_ -eq "make_default") { "convert" } + elseif ($_ -eq "foreach_fwd") { "foreach" } + elseif ($_ -eq "cerrno") { "system" } + elseif ($_ -eq "archive") { "serialization" } + elseif ($_ -eq "none") { "optional" } + elseif ($_ -eq "integer_traits") { "integer" } + elseif ($_ -eq "limits") { "compatibility" } + elseif ($_ -eq "math_fwd") { "math" } + elseif ($_ -match "polymorphic_cast|implicit_cast") { "conversion" } + elseif ($_ -eq "nondet_random") { "random" } + elseif ($_ -eq "memory_order") { "atomic" } + elseif ($_ -eq "blank") { "detail" } + elseif ($_ -match "is_placeholder|mem_fn") { "bind" } + elseif ($_ -eq "exception_ptr") { "exception" } + elseif ($_ -eq "multi_index_container") { "multi_index" } + elseif ($_ -eq "lexical_cast") { "lexical_cast"; "math" } + elseif ($_ -match "token_iterator|token_functions") { "tokenizer" } + elseif ($_ -eq "numeric" -and $library -notmatch "numeric_conversion|interval|odeint|ublas") { "numeric_conversion"; "interval"; "odeint"; "ublas" } + else { $_ } + } | group | % name | ? { $_ -ne $library } + + #"`nFor ${library}:" + " [known] " + $($groups | ? { $libraries_found -contains $_ }) + " [unknown] " + $($groups | ? { $libraries_found -notcontains $_ }) + + $deps = @($groups | ? { $libraries_found -contains $_ }) + + $deps = @($deps | ? { + # Boost contains cycles, so remove a few dependencies to break the loop. + (($library -notmatch "core|assert|mpl|detail|throw_exception|type_traits|^exception") -or ($_ -notmatch "utility")) ` + -and ` + (($library -notmatch "range") -or ($_ -notmatch "algorithm"))` + -and ` + (($library -ne "config") -or ($_ -notmatch "integer"))` + -and ` + (($library -notmatch "multiprecision") -or ($_ -notmatch "random|math"))` + -and ` + (($library -notmatch "lexical_cast") -or ($_ -notmatch "math"))` + -and ` + (($library -notmatch "functional") -or ($_ -notmatch "function"))` + -and ` + (($library -notmatch "detail") -or ($_ -notmatch "static_assert|integer|mpl|type_traits"))` + -and ` + ($_ -notmatch "mpi")` + -and ` + (($library -notmatch "spirit") -or ($_ -notmatch "serialization"))` + -and ` + (($library -notmatch "throw_exception") -or ($_ -notmatch "^exception"))` + -and ` + (($library -notmatch "iostreams") -or ($_ -notmatch "random"))` + -and ` + (($library -notmatch "utility|concept_check") -or ($_ -notmatch "iterator")) + } | % { "boost-$_" -replace "_","-" } | % { + TransformReference $_ + }) + + $deps += @("boost-vcpkg-helpers") + + $needsBuild = $false + if ((Test-Path $unpacked/build/Jamfile.v2) -and $library -ne "metaparse" -and $library -ne "graph_parallel") + { + $deps += @("boost-build", "boost-modular-build-helper") + $needsBuild = $true + } + + if ($library -eq "python") + { + $deps += @("python3") + $needsBuild = $true + } + elseif ($library -eq "iostreams") + { + $deps += @("zlib", "bzip2", "liblzma", "zstd") + } + elseif ($library -eq "locale") + { + $deps += @("libiconv (!uwp&!windows)", "boost-system") + } + elseif ($library -eq "asio") + { + $deps += @("openssl") + } + elseif ($library -eq "mpi") + { + $deps += @("mpi") + } + + Generate ` + -Name $library ` + -Hash $hash ` + -Depends $deps ` + -NeedsBuild $needsBuild + + $libraries_in_boost_port += @(TransformReference $library) + } + finally + { + popd + } +} + +if ($libraries_in_boost_port.length -gt 1) { + # Generate master boost control file which depends on each individual library + # mpi is excluded due to it having a dependency on msmpi + $boostDependsList = @($libraries_in_boost_port | % { "boost-$_" -replace "_","-" } | ? { $_ -notmatch "boost-mpi" }) -join ", " + + @( + "# Automatically generated by boost-vcpkg-helpers/generate-ports.ps1" + "Source: boost" + "Version: $version" + "Homepage: https://boost.org" + "Description: Peer-reviewed portable C++ source libraries" + "Build-Depends: $boostDependsList" + "" + "Feature: mpi" + "Description: Build with MPI support" + "Build-Depends: boost-mpi" + ) | out-file -enc ascii $portsDir/boost/CONTROL + + "set(VCPKG_POLICY_EMPTY_PACKAGE enabled)`n" | out-file -enc ascii $portsDir/boost/portfile.cmake +} + +return diff --git a/scripts/boost/post-build-stubs/config.cmake b/scripts/boost/post-build-stubs/config.cmake new file mode 100644 index 000000000..b09ea209b --- /dev/null +++ b/scripts/boost/post-build-stubs/config.cmake @@ -0,0 +1,7 @@ +file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#ifndef BOOST_ALL_NO_LIB\n#define BOOST_ALL_NO_LIB\n#endif\n") +file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#undef BOOST_ALL_DYN_LINK\n") + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#define BOOST_ALL_DYN_LINK\n") +endif() +file(COPY ${SOURCE_PATH}/checks DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost-config) diff --git a/scripts/boost/post-build-stubs/context.cmake b/scripts/boost/post-build-stubs/context.cmake new file mode 100644 index 000000000..a88f8441d --- /dev/null +++ b/scripts/boost/post-build-stubs/context.cmake @@ -0,0 +1,6 @@ + +# boost-context removed all.hpp, which is used by FindBoost to determine that context is installed +if(NOT EXISTS ${CURRENT_PACKAGES_DIR}/include/boost/context/all.hpp) + file(WRITE ${CURRENT_PACKAGES_DIR}/include/boost/context/all.hpp + "#error \"#include is no longer supported by boost_context.\"") +endif() diff --git a/scripts/boost/post-build-stubs/exception.cmake b/scripts/boost/post-build-stubs/exception.cmake new file mode 100644 index 000000000..43594a044 --- /dev/null +++ b/scripts/boost/post-build-stubs/exception.cmake @@ -0,0 +1,3 @@ + +set(VCPKG_LIBRARY_LINKAGE static) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) diff --git a/scripts/boost/post-build-stubs/predef.cmake b/scripts/boost/post-build-stubs/predef.cmake new file mode 100644 index 000000000..b960fcd6e --- /dev/null +++ b/scripts/boost/post-build-stubs/predef.cmake @@ -0,0 +1,2 @@ + +file(COPY ${SOURCE_PATH}/tools/check DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost-predef) diff --git a/scripts/boost/post-build-stubs/test.cmake b/scripts/boost/post-build-stubs/test.cmake new file mode 100644 index 000000000..c6d07dbc4 --- /dev/null +++ b/scripts/boost/post-build-stubs/test.cmake @@ -0,0 +1,14 @@ +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) + file(GLOB MONITOR_LIBS ${CURRENT_PACKAGES_DIR}/lib/*_exec_monitor*) + file(COPY ${MONITOR_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link) + file(REMOVE ${MONITOR_LIBS}) +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link) + file(GLOB DEBUG_MONITOR_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/*_exec_monitor*) + file(COPY ${DEBUG_MONITOR_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link) + file(REMOVE ${DEBUG_MONITOR_LIBS}) +endif() + diff --git a/scripts/boost/post-source-stubs/context.cmake b/scripts/boost/post-source-stubs/context.cmake new file mode 100644 index 000000000..9ccf34233 --- /dev/null +++ b/scripts/boost/post-source-stubs/context.cmake @@ -0,0 +1,5 @@ +file(READ "${SOURCE_PATH}/build/Jamfile.v2" _contents) +string(REPLACE "import ../../config/checks/config" "import config/checks/config" _contents "${_contents}") +file(WRITE "${SOURCE_PATH}/build/Jamfile.v2" "${_contents}") +file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/build/config") + diff --git a/scripts/boost/post-source-stubs/fiber.cmake b/scripts/boost/post-source-stubs/fiber.cmake new file mode 100644 index 000000000..9ccf34233 --- /dev/null +++ b/scripts/boost/post-source-stubs/fiber.cmake @@ -0,0 +1,5 @@ +file(READ "${SOURCE_PATH}/build/Jamfile.v2" _contents) +string(REPLACE "import ../../config/checks/config" "import config/checks/config" _contents "${_contents}") +file(WRITE "${SOURCE_PATH}/build/Jamfile.v2" "${_contents}") +file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/build/config") + diff --git a/scripts/boost/post-source-stubs/iostreams.cmake b/scripts/boost/post-source-stubs/iostreams.cmake new file mode 100644 index 000000000..55841bb3f --- /dev/null +++ b/scripts/boost/post-source-stubs/iostreams.cmake @@ -0,0 +1,18 @@ +vcpkg_download_distfile(LICENSE + URLS "https://raw.githubusercontent.com/boostorg/boost/boost-1.70.0/LICENSE_1_0.txt" + FILENAME "boost_LICENSE_1_0.txt" + SHA512 d6078467835dba8932314c1c1e945569a64b065474d7aced27c9a7acc391d52e9f234138ed9f1aa9cd576f25f12f557e0b733c14891d42c16ecdc4a7bd4d60b8 +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost-iostreams RENAME copyright) diff --git a/scripts/boost/post-source-stubs/log.cmake b/scripts/boost/post-source-stubs/log.cmake new file mode 100644 index 000000000..78500ddc3 --- /dev/null +++ b/scripts/boost/post-source-stubs/log.cmake @@ -0,0 +1,13 @@ +file(READ "${SOURCE_PATH}/build/Jamfile.v2" _contents) +string(REPLACE "import ../../config/checks/config" "import config/checks/config" _contents "${_contents}") +string(REPLACE " @select-arch-specific-sources" "#@select-arch-specific-sources" _contents "${_contents}") +file(WRITE "${SOURCE_PATH}/build/Jamfile.v2" "${_contents}") +file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/build/config") + +file(READ ${SOURCE_PATH}/build/log-architecture.jam _contents) +string(REPLACE + "\nproject.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ] ;" + "\nproject.load [ path.join [ path.make $(here:D) ] config/checks/architecture ] ;" + _contents "${_contents}") +file(WRITE ${SOURCE_PATH}/build/log-architecture.jam "${_contents}") + diff --git a/scripts/boost/post-source-stubs/python.cmake b/scripts/boost/post-source-stubs/python.cmake new file mode 100644 index 000000000..40b8e0a0b --- /dev/null +++ b/scripts/boost/post-source-stubs/python.cmake @@ -0,0 +1,5 @@ +# Find Python. Can't use find_package here, but we already know where everything is +file(GLOB PYTHON_INCLUDE_PATH "${CURRENT_INSTALLED_DIR}/include/python[0-9.]*") +set(PYTHONLIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib") +set(PYTHONLIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib") +string(REGEX REPLACE ".*python([0-9\.]+)$" "\\1" PYTHON_VERSION "${PYTHON_INCLUDE_PATH}") diff --git a/scripts/boost/post-source-stubs/test.cmake b/scripts/boost/post-source-stubs/test.cmake new file mode 100644 index 000000000..b2872338d --- /dev/null +++ b/scripts/boost/post-source-stubs/test.cmake @@ -0,0 +1,5 @@ +file(READ "${SOURCE_PATH}/build/Jamfile.v2" _contents) +string(REPLACE "import ../../predef/check/predef" "import predef/check/predef" _contents "${_contents}") +file(WRITE "${SOURCE_PATH}/build/Jamfile.v2" "${_contents}") +file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-predef/check" DESTINATION "${SOURCE_PATH}/build/predef") + -- cgit v1.2.3 From 5ebf65665dfbf29abeb49410070c2102490fd476 Mon Sep 17 00:00:00 2001 From: Vinny Date: Tue, 1 Oct 2019 11:21:04 -0400 Subject: [Documentation] Added documentation page for vcpkg_fixup_cmake_targets.cmake (#8365) * Added documentation page for vcpkg_fixup_cmake_targets.cmake, added example usage comment to .cmake file * Update cmake_fixup_cmake_targets.md * Update cmake_fixup_cmake_targets.md --- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 1e0f2493d..3b5370bcd 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -1,21 +1,23 @@ #.rst: # .. command:: vcpkg_fixup_cmake_targets # -# Transform all /debug/share//*targets-debug.cmake files and move them to /share/. +# Transforms all /debug/share//*targets-debug.cmake files and move them to /share/. # Removes all /debug/share//*targets.cmake and /debug/share//*config.cmake # -# Transform all references matching /bin/*.exe to /tools//*.exe on Windows -# Transform all references matching /bin/* to /tools//* on other platforms +# Transforms all references matching /bin/*.exe to /tools//*.exe on Windows +# Transforms all references matching /bin/* to /tools//* on other platforms # -# Fix ${_IMPORT_PREFIX} in auto generated targets to be one folder deeper. -# Replace ${CURRENT_INSTALLED_DIR} with ${_IMPORT_PREFIX} in configs/targets. +# Fixes ${_IMPORT_PREFIX} in auto generated targets to be one folder deeper. +# Replaces ${CURRENT_INSTALLED_DIR} with ${_IMPORT_PREFIX} in configs/targets. # # :: # vcpkg_fixup_cmake_targets([CONFIG_PATH ]) # # ``CONFIG_PATH`` # *.cmake files subdirectory (like "lib/cmake/${PORT}"). -# +# +# Example usage: +# vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/myPort") function(vcpkg_fixup_cmake_targets) cmake_parse_arguments(_vfct "" "CONFIG_PATH;TARGET_PATH" "" ${ARGN}) -- cgit v1.2.3 From da233c38ec1ab90cbe9e440b82b055db02f83a62 Mon Sep 17 00:00:00 2001 From: Alexej Harm Date: Fri, 4 Oct 2019 20:14:35 +0200 Subject: Add go to vcpkg_find_acquire_program (#8440) --- scripts/cmake/vcpkg_find_acquire_program.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index aa8a70026..b5af58cc2 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -20,6 +20,7 @@ ## - PERL ## - PYTHON2 ## - PYTHON3 +## - GO ## - JOM ## - MESON ## - NASM @@ -79,6 +80,14 @@ function(vcpkg_find_acquire_program VAR) set(_vfa_RENAME "yasm.exe") set(NOEXTRACT ON) set(HASH c1945669d983b632a10c5ff31e86d6ecbff143c3d8b2c433c0d3d18f84356d2b351f71ac05fd44e5403651b00c31db0d14615d7f9a6ecce5750438d37105c55b) + elseif(VAR MATCHES "GO") + set(PROGNAME go) + set(PATHS ${DOWNLOADS}/tools/go/go/bin) + set(BREW_PACKAGE_NAME "go") + set(APT_PACKAGE_NAME "golang-go") + set(URL "https://dl.google.com/go/go1.13.1.windows-386.zip") + set(ARCHIVE "go1.13.1.windows-386.zip") + set(HASH 2ab0f07e876ad98d592351a8808c2de42351ab387217e088bc4c5fa51d6a835694c501e2350802323b55a27dc0157f8b70045597f789f9e50f5ceae50dea3027) elseif(VAR MATCHES "PYTHON3") if(CMAKE_HOST_WIN32) set(PROGNAME python) -- cgit v1.2.3 From ad493fd8600c13f75dabcad60e6bd8d644f83c6b Mon Sep 17 00:00:00 2001 From: JackBoosY <47264268+JackBoosY@users.noreply.github.com> Date: Sat, 5 Oct 2019 22:51:07 +0800 Subject: Add function vcpkg_configure_make/vcpkg_build_make/vcpkg_install_make/vcpkg_build_nmake/vcpkg_install_nmake (#8267) * Add function vcpkg_configure_make/vcpkg_build_make. * Fix autoreconf command and add log. * Add vcpkg_install_make. * Fix call function name. * support non-debug mode. * Add nmake support. * [tcl]Add new port for testing. * [vcpkg_configure_make]Fix prefix in linux. * restart CI systen. * Separate vcpkg_build_nmake/vcpkg_install_nmake. Add arg PROJECT_NAME. * fix copy source file. add samples. * Remove uncommon options. Add force install para to autoreconf. * fix build error. * fix options judgment. * enable nmake in windows. * fix some envs and macros. Disable NMAKE in vcpkg_configure_make currently. * update docs. * fix environments. * Modify libosip2 to use vcpkg_configure_make/vcpkg_install_make. * [tcl]Tcl separates PR. * trigger PR-EAGER. * [freexl]Fix options name and remove option NMAKE. * use tool-chain instead of set environments manually. * fix autoreconf para. * use vcpkg_execute_build_process instead. --- scripts/cmake/vcpkg_build_make.cmake | 171 ++++++++++++++ scripts/cmake/vcpkg_build_nmake.cmake | 185 +++++++++++++++ scripts/cmake/vcpkg_common_functions.cmake | 5 + scripts/cmake/vcpkg_configure_make.cmake | 347 +++++++++++++++++++++++++++++ scripts/cmake/vcpkg_install_make.cmake | 25 +++ scripts/cmake/vcpkg_install_nmake.cmake | 69 ++++++ 6 files changed, 802 insertions(+) create mode 100644 scripts/cmake/vcpkg_build_make.cmake create mode 100644 scripts/cmake/vcpkg_build_nmake.cmake create mode 100644 scripts/cmake/vcpkg_configure_make.cmake create mode 100644 scripts/cmake/vcpkg_install_make.cmake create mode 100644 scripts/cmake/vcpkg_install_nmake.cmake (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake new file mode 100644 index 000000000..f73fb98d5 --- /dev/null +++ b/scripts/cmake/vcpkg_build_make.cmake @@ -0,0 +1,171 @@ +## # vcpkg_build_make +## +## Build a linux makefile project. +## +## ## Usage: +## ```cmake +## vcpkg_build_make([TARGET ]) +## ``` +## +## ### TARGET +## The target passed to the configure/make build command (`./configure/make/make install`). If not specified, no target will +## be passed. +## +## ### ADD_BIN_TO_PATH +## Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs. +## +## ## Notes: +## This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md). +## You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the +## "install" target +## +## ## Examples +## +## * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake) +## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) +## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) +## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) +function(vcpkg_build_make) + cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT" "" ${ARGN}) + + if(NOT _bc_LOGFILE_ROOT) + set(_bc_LOGFILE_ROOT "build") + endif() + + if (_VCPKG_PROJECT_SUBPATH) + set(_VCPKG_PROJECT_SUBPATH /${_VCPKG_PROJECT_SUBPATH}/) + endif() + + set(MAKE ) + set(MAKE_OPTS ) + set(INSTALL_OPTS ) + if (_VCPKG_MAKE_GENERATOR STREQUAL "make") + if (CMAKE_HOST_WIN32) + # Compiler requriements + vcpkg_find_acquire_program(YASM) + vcpkg_find_acquire_program(PERL) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES make) + get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) + get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) + + set(PATH_GLOBAL "$ENV{PATH}") + set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}") + set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) + # Set make command and install command + set(MAKE ${BASH} --noprofile --norc -c) + # Must use absolute path to call make in windows + set(MAKE_OPTS "${_VCPKG_PROJECT_SUBPATH}make") + set(INSTALL_OPTS "${_VCPKG_PROJECT_SUBPATH}make install") + else() + # Compiler requriements + find_program(MAKE make REQUIRED) + set(MAKE make) + # Set make command and install command + set(MAKE_OPTS) + set(INSTALL_OPTS install) + endif() + elseif (_VCPKG_MAKE_GENERATOR STREQUAL "nmake") + find_program(NMAKE nmake REQUIRED) + get_filename_component(NMAKE_EXE_PATH ${NMAKE} DIRECTORY) + set(PATH_GLOBAL "$ENV{PATH}") + set(ENV{PATH} "$ENV{PATH};${NMAKE_EXE_PATH}") + set(ENV{CL} "$ENV{CL} /MP") + # Set make command and install command + set(MAKE ${NMAKE} /NOLOGO /G /U) + set(MAKE_OPTS -f makefile all) + set(INSTALL_OPTS install) + else() + message(FATAL_ERROR "${_VCPKG_MAKE_GENERATOR} not supported.") + endif() + + set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}") + + foreach(BUILDTYPE "debug" "release") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) + if(BUILDTYPE STREQUAL "debug") + # Skip debug generate + if (_VCPKG_NO_DEBUG) + continue() + endif() + set(SHORT_BUILDTYPE "-dbg") + else() + # In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory. + if (_VCPKG_NO_DEBUG) + set(SHORT_BUILDTYPE "") + else() + set(SHORT_BUILDTYPE "-rel") + endif() + endif() + + if (CMAKE_HOST_WIN32) + # In windows we can remotely call make + set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}) + else() + set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}${_VCPKG_PROJECT_SUBPATH}) + endif() + + message(STATUS "Building ${TARGET_TRIPLET}${SHORT_BUILDTYPE}") + + if(_bc_ADD_BIN_TO_PATH) + set(_BACKUP_ENV_PATH "$ENV{PATH}") + if(CMAKE_HOST_WIN32) + set(_PATHSEP ";") + else() + set(_PATHSEP ":") + endif() + if(BUILDTYPE STREQUAL "debug") + set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin${_PATHSEP}$ENV{PATH}") + else() + set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin${_PATHSEP}$ENV{PATH}") + endif() + endif() + + vcpkg_execute_build_process( + COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} ${MAKE_OPTS} + WORKING_DIRECTORY ${WORKING_DIRECTORY} + LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" + ) + + if(_bc_ADD_BIN_TO_PATH) + set(ENV{PATH} "${_BACKUP_ENV_PATH}") + endif() + endif() + endforeach() + + if (_bc_ENABLE_INSTALL) + foreach(BUILDTYPE "debug" "release") + if(BUILDTYPE STREQUAL "debug") + # Skip debug generate + if (_VCPKG_NO_DEBUG) + continue() + endif() + set(SHORT_BUILDTYPE "-dbg") + else() + # In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory. + if (_VCPKG_NO_DEBUG) + set(SHORT_BUILDTYPE "") + else() + set(SHORT_BUILDTYPE "-rel") + endif() + endif() + + if (CMAKE_HOST_WIN32) + # In windows we can remotely call make + set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}) + else() + set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}${_VCPKG_PROJECT_SUBPATH}) + endif() + + message(STATUS "Installing ${TARGET_TRIPLET}${SHORT_BUILDTYPE}") + vcpkg_execute_required_process( + COMMAND ${MAKE} ${INSTALL_OPTS} + WORKING_DIRECTORY ${WORKING_DIRECTORY} + LOGNAME "install-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" + ) + endforeach() + endif() + + if (CMAKE_HOST_WIN32) + set(ENV{PATH} "${PATH_GLOBAL}") + endif() +endfunction() diff --git a/scripts/cmake/vcpkg_build_nmake.cmake b/scripts/cmake/vcpkg_build_nmake.cmake new file mode 100644 index 000000000..c98df946a --- /dev/null +++ b/scripts/cmake/vcpkg_build_nmake.cmake @@ -0,0 +1,185 @@ +## # vcpkg_build_nmake +## +## Build a msvc makefile project. +## +## ## Usage: +## ```cmake +## vcpkg_build_nmake( +## SOURCE_PATH <${SOURCE_PATH}> +## [NO_DEBUG] +## PROJECT_SUBPATH <${SUBPATH}> +## PROJECT_NAME <${MAKEFILE_NAME}> +## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## [TARGET ]) +## ``` +## +## ## Parameters +## ### SOURCE_PATH +## Specifies the directory containing the source files. +## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. +## +## ### PROJECT_SUBPATH +## Specifies the sub directory containing the `makefile.vc`/`makefile.mak`/`makefile.msvc` or other msvc makefile. +## +## ### PROJECT_NAME +## Specifies the name of msvc makefile name. +## Default is `makefile.vc` +## +## ### NO_DEBUG +## This port doesn't support debug mode. +## +## ### ENABLE_INSTALL +## Install binaries after build. +## +## ### OPTIONS +## Additional options passed to generate during the generation. +## +## ### OPTIONS_RELEASE +## Additional options passed to generate during the Release generation. These are in addition to `OPTIONS`. +## +## ### OPTIONS_DEBUG +## Additional options passed to generate during the Debug generation. These are in addition to `OPTIONS`. +## +## ### TARGET +## The target passed to the nmake build command (`nmake/nmake install`). If not specified, no target will +## be passed. +## +## ### ADD_BIN_TO_PATH +## Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs. +## +## ## Notes: +## This command should be preceeded by a call to [`vcpkg_configure_nmake()`](vcpkg_configure_nmake.md). +## You can use the alias [`vcpkg_install_nmake()`](vcpkg_configure_nmake.md) function if your CMake script supports the +## "install" target +## +## ## Examples +## +## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) +## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) +function(vcpkg_build_nmake) + cmake_parse_arguments(_bn + "ADD_BIN_TO_PATH;ENABLE_INSTALL;NO_DEBUG" + "SOURCE_PATH;PROJECT_SUBPATH;PROJECT_NAME;LOGFILE_ROOT" + "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" + ${ARGN} + ) + + if (NOT CMAKE_HOST_WIN32) + message(FATAL_ERROR "vcpkg_build_nmake only support windows.") + endif() + + if (_bn_OPTIONS_DEBUG STREQUAL _bn_OPTIONS_RELEASE) + message(FATAL_ERROR "Detected debug configuration is equal to release configuration, please use NO_DEBUG for vcpkg_build_nmake/vcpkg_install_nmake") + endif() + + if(NOT _bn_LOGFILE_ROOT) + set(_bn_LOGFILE_ROOT "build") + endif() + + if (NOT _bn_PROJECT_NAME) + set(MAKEFILE_NAME makefile.vc) + else() + set(MAKEFILE_NAME ${_bn_PROJECT_NAME}) + endif() + + set(MAKE ) + set(MAKE_OPTS_BASE ) + set(INSTALL_OPTS_BASE ) + + find_program(NMAKE nmake REQUIRED) + get_filename_component(NMAKE_EXE_PATH ${NMAKE} DIRECTORY) + # Load toolchains + if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake") + endif() + include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") + # Set needed env + set(ENV{PATH} "$ENV{PATH};${NMAKE_EXE_PATH}") + set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}") + # Set make command and install command + set(MAKE ${NMAKE} /NOLOGO /G /U) + set(MAKE_OPTS_BASE -f ${MAKEFILE_NAME} all) + set(INSTALL_OPTS_BASE install) + # Add subpath to work directory + if (_bn_PROJECT_SUBPATH) + set(_bn_PROJECT_SUBPATH /${_bn_PROJECT_SUBPATH}) + else() + set(_bn_PROJECT_SUBPATH ) + endif() + + foreach(BUILDTYPE "debug" "release") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) + if(BUILDTYPE STREQUAL "debug") + # Skip debug generate + if (_bn_NO_DEBUG) + continue() + endif() + # Generate obj dir suffix + set(SHORT_BUILDTYPE "-dbg") + set(CONFIG "Debug") + # Add install command and arguments + set(MAKE_OPTS ${MAKE_OPTS_BASE}) + if (_bn_ENABLE_INSTALL) + set(INSTALL_OPTS ${INSTALL_OPTS_BASE} INSTALLDIR=${CURRENT_PACKAGES_DIR}/debug) + set(MAKE_OPTS ${MAKE_OPTS} ${INSTALL_OPTS}) + endif() + set(MAKE_OPTS ${MAKE_OPTS} ${_bn_OPTIONS} ${_bn_OPTIONS_DEBUG}) + + unset(ENV{CL}) + set(TMP_CL_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/" "-" TMP_CL_FLAGS "${TMP_CL_FLAGS}") + set(ENV{CL} "$ENV{CL} ${TMP_CL_FLAGS}") + else() + # In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory. + if (_bn_NO_DEBUG) + set(SHORT_BUILDTYPE "") + else() + set(SHORT_BUILDTYPE "-rel") + endif() + set(CONFIG "Release") + # Add install command and arguments + set(MAKE_OPTS ${MAKE_OPTS_BASE}) + if (_bn_ENABLE_INSTALL) + set(INSTALL_OPTS ${INSTALL_OPTS_BASE} INSTALLDIR=${CURRENT_PACKAGES_DIR}) + set(MAKE_OPTS ${MAKE_OPTS} ${INSTALL_OPTS}) + endif() + set(MAKE_OPTS ${MAKE_OPTS} ${_bn_OPTIONS} ${_bn_OPTIONS_RELEASE}) + + unset(ENV{CL}) + set(TMP_CL_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/" "-" TMP_CL_FLAGS "${TMP_CL_FLAGS}") + set(ENV{CL} "$ENV{CL} ${TMP_CL_FLAGS}") + endif() + + set(CURRENT_TRIPLET_NAME ${TARGET_TRIPLET}${SHORT_BUILDTYPE}) + set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${CURRENT_TRIPLET_NAME}) + + file(REMOVE_RECURSE ${OBJ_DIR}) + file(MAKE_DIRECTORY ${OBJ_DIR}) + file(GLOB_RECURSE SOURCE_FILES ${_bn_SOURCE_PATH}/*) + foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES}) + get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH) + string(REPLACE "${_bn_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}") + file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR}) + endforeach() + + if (NOT _bn_ENABLE_INSTALL) + message(STATUS "Building ${CURRENT_TRIPLET_NAME}") + else() + message(STATUS "Building and installing ${CURRENT_TRIPLET_NAME}") + endif() + + vcpkg_execute_required_process( + COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} ${MAKE_OPTS} + WORKING_DIRECTORY ${OBJ_DIR}${_bn_PROJECT_SUBPATH} + LOGNAME "${_bn_LOGFILE_ROOT}-${CURRENT_TRIPLET_NAME}" + ) + + if(_bn_ADD_BIN_TO_PATH) + set(ENV{PATH} "${_BACKUP_ENV_PATH}") + endif() + endif() + endforeach() +endfunction() diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index d2ea35608..4aa115f47 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -19,12 +19,17 @@ include(vcpkg_from_bitbucket) include(vcpkg_build_cmake) include(vcpkg_build_msbuild) include(vcpkg_build_qmake) +include(vcpkg_build_make) +include(vcpkg_build_nmake) include(vcpkg_install_cmake) include(vcpkg_install_meson) include(vcpkg_install_msbuild) +include(vcpkg_install_make) +include(vcpkg_install_nmake) include(vcpkg_configure_cmake) include(vcpkg_configure_meson) include(vcpkg_configure_qmake) +include(vcpkg_configure_make) include(vcpkg_apply_patches) include(vcpkg_copy_pdbs) include(vcpkg_copy_tool_dependencies) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake new file mode 100644 index 000000000..a30b962e9 --- /dev/null +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -0,0 +1,347 @@ +## # vcpkg_configure_make +## +## Configure configure for Debug and Release builds of a project. +## +## ## Usage +## ```cmake +## vcpkg_configure_make( +## SOURCE_PATH <${SOURCE_PATH}> +## [AUTOCONFIG] +## [DISABLE_AUTO_HOST] +## [DISABLE_AUTO_DST] +## [GENERATOR] +## [NO_DEBUG] +## [PROJECT_SUBPATH <${PROJ_SUBPATH}>] +## [PRERUN_SHELL <${SHELL_PATH}>] +## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## ) +## ``` +## +## ## Parameters +## ### SOURCE_PATH +## Specifies the directory containing the `configure`/`configure.ac`. +## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. +## +## ### PROJECT_SUBPATH +## Specifies the directory containing the ``configure`/`configure.ac`. +## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. +## Should use `GENERATOR NMake` first. +## +## ### NO_DEBUG +## This port doesn't support debug mode. +## +## ### AUTOCONFIG +## Need to use autoconfig to generate configure file. +## +## ### DISABLE_AUTO_HOST +## Don't set host automatically, the default value is `i686`. +## If use this option, you will need to set host manually. +## +## ### DISABLE_AUTO_DST +## Don't set installation path automatically, the default value is `${CURRENT_PACKAGES_DIR}` and `${CURRENT_PACKAGES_DIR}/debug` +## If use this option, you will need to set dst path manually. +## +## ### GENERATOR +## Specifies the precise generator to use. +## NMake: nmake(windows) make(unix) +## MAKE: make(windows) make(unix) +## +## ### PRERUN_SHELL +## Script that needs to be called before configuration +## +## ### OPTIONS +## Additional options passed to configure during the configuration. +## +## ### OPTIONS_RELEASE +## Additional options passed to configure during the Release configuration. These are in addition to `OPTIONS`. +## +## ### OPTIONS_DEBUG +## Additional options passed to configure during the Debug configuration. These are in addition to `OPTIONS`. +## +## ## Notes +## This command supplies many common arguments to configure. To see the full list, examine the source. +## +## ## Examples +## +## * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake) +## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) +## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) +## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) +function(vcpkg_configure_make) + cmake_parse_arguments(_csc + "AUTOCONFIG;DISABLE_AUTO_HOST;DISABLE_AUTO_DST;NO_DEBUG" + "SOURCE_PATH;PROJECT_SUBPATH;GENERATOR;PRERUN_SHELL" + "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" + ${ARGN} + ) + + if(NOT VCPKG_PLATFORM_TOOLSET) + message(FATAL_ERROR "Vcpkg has been updated with VS2017 support; " + "however, vcpkg.exe must be rebuilt by re-running bootstrap-vcpkg.bat\n") + endif() + + if (_csc_OPTIONS_DEBUG STREQUAL _csc_OPTIONS_RELEASE OR NMAKE_OPTION_RELEASE STREQUAL NMAKE_OPTION_DEBUG) + message(FATAL_ERROR "Detected debug configuration is equal to release configuration, please use NO_DEBUG for vcpkg_configure_make") + endif() + # Select compiler + if(_csc_GENERATOR MATCHES "NMake") + message(FATAL_ERROR "Sorry, NMake does not supported currently.") + if (CMAKE_HOST_WIN32) + set(GENERATOR "nmake") + else() + set(GENERATOR "make") + endif() + elseif(NOT _csc_GENERATOR OR _csc_GENERATOR MATCHES "MAKE") + if (CMAKE_HOST_WIN32) + set(GENERATOR "make") + else() + set(GENERATOR "make") + endif() + else() + message(FATAL_ERROR "${_csc_GENERATOR} not supported.") + endif() + + if (_csc_AUTOCONFIG AND NOT CMAKE_HOST_WIN32) + find_program(autoreconf autoreconf REQUIRED) + endif() + + set(WIN_TARGET_ARCH ) + set(WIN_TARGET_COMPILER ) + # Detect compiler + if (GENERATOR STREQUAL "nmake") + message(STATUS "Using generator NMAKE") + find_program(NMAKE nmake REQUIRED) + elseif (GENERATOR STREQUAL "make") + message(STATUS "Using generator make") + find_program(MAKE make REQUIRED) + else() + message(FATAL_ERROR "${GENERATOR} not supported.") + endif() + # Pre-processing windows configure requirements + if (CMAKE_HOST_WIN32) + vcpkg_find_acquire_program(YASM) + vcpkg_find_acquire_program(PERL) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils) + get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) + get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) + + if (NOT _csc_DISABLE_AUTO_HOST) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86) + set(WIN_TARGET_ARCH --host=i686-pc-mingw32) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) + set(WIN_TARGET_ARCH --host=i686-pc-mingw64) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm) + set(WIN_TARGET_ARCH --host=arm-pc-mingw32) + endif() + endif() + set(WIN_TARGET_COMPILER CC=cl) + set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}") + set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) + endif() + + if (NOT _csc_NO_DEBUG) + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + else() + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") + endif() + + if (NOT _csc_DISABLE_AUTO_DST) + set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE} + --prefix=${CURRENT_PACKAGES_DIR} + --bindir=${CURRENT_PACKAGES_DIR}/bin + --sbindir=${CURRENT_PACKAGES_DIR}/bin + --libdir=${CURRENT_PACKAGES_DIR}/lib + --includedir=${CURRENT_PACKAGES_DIR}/include) + + set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG} + --prefix=${CURRENT_PACKAGES_DIR}/debug + --bindir=${CURRENT_PACKAGES_DIR}/debug/bin + --sbindir=${CURRENT_PACKAGES_DIR}/debug/bin + --libdir=${CURRENT_PACKAGES_DIR}/debug/lib + --includedir=${CURRENT_PACKAGES_DIR}/debug/include) + endif() + + set(base_cmd ) + if(CMAKE_HOST_WIN32) + set(base_cmd ${BASH} --noprofile --norc -c) + + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(_csc_OPTIONS ${_csc_OPTIONS} --enable-shared) + if (VCPKG_TARGET_IS_UWP) + set(_csc_OPTIONS ${_csc_OPTIONS} --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib) + endif() + else() + set(_csc_OPTIONS ${_csc_OPTIONS} --enable-static) + endif() + # Load toolchains + if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake") + endif() + include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") + + set(C_FLAGS_GLOBAL "$ENV{CFLAGS} ${VCPKG_C_FLAGS}") + set(CXX_FLAGS_GLOBAL "$ENV{CXXFLAGS} ${VCPKG_CXX_FLAGS}") + set(LD_FLAGS_GLOBAL "$ENV{LDFLAGS}") + + if(VCPKG_TARGET_IS_UWP) + set(ENV{LIBPATH} "$ENV{LIBPATH};$ENV{_WKITS10}references\\windows.foundation.foundationcontract\\2.0.0.0\\;$ENV{_WKITS10}references\\windows.foundation.universalapicontract\\3.0.0.0\\") + set(_csc_OPTIONS ${_csc_OPTIONS} --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00) + endif() + + list(JOIN _csc_OPTIONS " " _csc_OPTIONS) + list(JOIN _csc_OPTIONS_RELEASE " " _csc_OPTIONS_RELEASE) + list(JOIN _csc_OPTIONS_DEBUG " " _csc_OPTIONS_DEBUG) + + set(rel_command + ${base_cmd} "${WIN_TARGET_COMPILER} ${_csc_SOURCE_PATH}/configure ${WIN_TARGET_ARCH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE}" + ) + set(dbg_command + ${base_cmd} "${WIN_TARGET_COMPILER} ${_csc_SOURCE_PATH}/configure ${WIN_TARGET_ARCH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG}" + ) + else() + set(base_cmd ./) + set(rel_command + ${base_cmd}configure "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}" + ) + set(dbg_command + ${base_cmd}configure "${_csc_OPTIONS}" "${_csc_OPTIONS_DEBUG}" + ) + endif() + + # Configure debug + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT _csc_NO_DEBUG) + if (CMAKE_HOST_WIN32) + unset(ENV{CFLAGS}) + unset(ENV{CXXFLAGS}) + unset(ENV{LDFLAGS}) + set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}") + string(REPLACE "/" "-" TMP_CFLAGS "${TMP_CFLAGS}") + set(ENV{CFLAGS} ${TMP_CFLAGS}) + set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/" "-" TMP_CXXFLAGS "${TMP_CXXFLAGS}") + set(ENV{CXXFLAGS} ${TMP_CXXFLAGS}) + set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL}") + string(REPLACE "/" "-" TMP_LDFLAGS "${TMP_LDFLAGS}") + set(ENV{LDFLAGS} ${TMP_LDFLAGS}) + endif() + + set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + set(PRJ_DIR ${OBJ_DIR}/${_csc_PROJECT_SUBPATH}) + + file(MAKE_DIRECTORY ${OBJ_DIR}) + + if (NOT CMAKE_HOST_WIN32) + file(GLOB_RECURSE SOURCE_FILES ${_csc_SOURCE_PATH}/*) + foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES}) + file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${OBJ_DIR}) + get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH) + string(REPLACE "${_csc_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}") + file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR}) + endforeach() + endif() + + if (_csc_PRERUN_SHELL) + message(STATUS "Prerun shell with ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${base_cmd}${_csc_PRERUN_SHELL} + WORKING_DIRECTORY ${PRJ_DIR} + LOGNAME prerun-${TARGET_TRIPLET}-dbg + ) + endif() + + if (_csc_AUTOCONFIG) + message(STATUS "Generating configure with ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND autoreconf -vfi + WORKING_DIRECTORY ${PRJ_DIR} + LOGNAME prerun-${TARGET_TRIPLET}-dbg + ) + endif() + + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${dbg_command} + WORKING_DIRECTORY ${PRJ_DIR} + LOGNAME config-${TARGET_TRIPLET}-dbg + ) + endif() + + # Configure release + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + if (CMAKE_HOST_WIN32) + unset(ENV{CFLAGS}) + unset(ENV{CXXFLAGS}) + unset(ENV{LDFLAGS}) + set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}") + string(REPLACE "/" "-" TMP_CFLAGS "${TMP_CFLAGS}") + set(ENV{CFLAGS} ${TMP_CFLAGS}) + + set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/" "-" TMP_CXXFLAGS "${TMP_CXXFLAGS}") + set(ENV{CXXFLAGS} ${TMP_CXXFLAGS}) + + set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") + string(REPLACE "/" "-" TMP_LDFLAGS "${TMP_LDFLAGS}") + set(ENV{LDFLAGS} ${TMP_LDFLAGS}) + endif() + + if (_csc_NO_DEBUG) + set(TAR_TRIPLET_DIR ${TARGET_TRIPLET}) + set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TAR_TRIPLET_DIR}) + else() + set(TAR_TRIPLET_DIR ${TARGET_TRIPLET}-rel) + set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TAR_TRIPLET_DIR}) + endif() + set(PRJ_DIR ${OBJ_DIR}/${_csc_PROJECT_SUBPATH}) + + file(MAKE_DIRECTORY ${OBJ_DIR}) + + if (NOT CMAKE_HOST_WIN32) + file(GLOB_RECURSE SOURCE_FILES ${_csc_SOURCE_PATH}/*) + foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES}) + get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH) + string(REPLACE "${_csc_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}") + file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR}) + endforeach() + endif() + + if (_csc_PRERUN_SHELL) + message(STATUS "Prerun shell with ${TAR_TRIPLET_DIR}") + vcpkg_execute_required_process( + COMMAND ${base_cmd}${_csc_PRERUN_SHELL} + WORKING_DIRECTORY ${PRJ_DIR} + LOGNAME prerun-${TAR_TRIPLET_DIR} + ) + endif() + + if (_csc_AUTOCONFIG) + message(STATUS "Generating configure with ${TAR_TRIPLET_DIR}") + vcpkg_execute_required_process( + COMMAND autoreconf -vfi + WORKING_DIRECTORY ${PRJ_DIR} + LOGNAME prerun-${TAR_TRIPLET_DIR} + ) + endif() + + message(STATUS "Configuring ${TAR_TRIPLET_DIR}") + vcpkg_execute_required_process( + COMMAND ${rel_command} + WORKING_DIRECTORY ${PRJ_DIR} + LOGNAME config-${TAR_TRIPLET_DIR} + ) + endif() + + # Restore envs + if (CMAKE_HOST_WIN32) + set(ENV{CFLAGS} "${C_FLAGS_GLOBAL}") + set(ENV{CXXFLAGS} "${CXX_FLAGS_GLOBAL}") + set(ENV{LDFLAGS} "${LD_FLAGS_GLOBAL}") + endif() + + set(_VCPKG_MAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE) + set(_VCPKG_NO_DEBUG ${_csc_NO_DEBUG} PARENT_SCOPE) + SET(_VCPKG_PROJECT_SOURCE_PATH ${_csc_SOURCE_PATH} PARENT_SCOPE) + set(_VCPKG_PROJECT_SUBPATH ${_csc_PROJECT_SUBPATH} PARENT_SCOPE) +endfunction() diff --git a/scripts/cmake/vcpkg_install_make.cmake b/scripts/cmake/vcpkg_install_make.cmake new file mode 100644 index 000000000..1672d7c5a --- /dev/null +++ b/scripts/cmake/vcpkg_install_make.cmake @@ -0,0 +1,25 @@ +## # vcpkg_install_make +## +## Build and install a make project. +## +## ## Usage: +## ```cmake +## vcpkg_install_make(...) +## ``` +## +## ## Parameters: +## See [`vcpkg_build_make()`](vcpkg_build_make.md). +## +## ## Notes: +## This command transparently forwards to [`vcpkg_build_make()`](vcpkg_build_make.md), adding `ENABLE_INSTALL` +## +## ## Examples +## +## * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake) +## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) +## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) +## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) + +function(vcpkg_install_make) + vcpkg_build_make(LOGFILE_ROOT ENABLE_INSTALL) +endfunction() diff --git a/scripts/cmake/vcpkg_install_nmake.cmake b/scripts/cmake/vcpkg_install_nmake.cmake new file mode 100644 index 000000000..ca7fe6ce5 --- /dev/null +++ b/scripts/cmake/vcpkg_install_nmake.cmake @@ -0,0 +1,69 @@ +## # vcpkg_install_nmake +## +## Build and install a msvc makefile project. +## +## ## Usage: +## ```cmake +## vcpkg_install_nmake( +## SOURCE_PATH <${SOURCE_PATH}> +## [NO_DEBUG] +## PROJECT_SUBPATH <${SUBPATH}> +## PROJECT_NAME <${MAKEFILE_NAME}> +## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## ``` +## +## ## Parameters +## ### SOURCE_PATH +## Specifies the directory containing the source files. +## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. +## +## ### PROJECT_SUBPATH +## Specifies the sub directory containing the `makefile.vc`/`makefile.mak`/`makefile.msvc` or other msvc makefile. +## +## ### PROJECT_NAME +## Specifies the name of msvc makefile name. +## Default is makefile.vc +## +## ### NO_DEBUG +## This port doesn't support debug mode. +## +## ### OPTIONS +## Additional options passed to generate during the generation. +## +## ### OPTIONS_RELEASE +## Additional options passed to generate during the Release generation. These are in addition to `OPTIONS`. +## +## ### OPTIONS_DEBUG +## Additional options passed to generate during the Debug generation. These are in addition to `OPTIONS`. +## +## ## Parameters: +## See [`vcpkg_build_nmake()`](vcpkg_build_nmake.md). +## +## ## Notes: +## This command transparently forwards to [`vcpkg_build_nmake()`](vcpkg_build_nmake.md), adding `ENABLE_INSTALL` +## +## ## Examples +## +## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) +## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) + +function(vcpkg_install_nmake) + cmake_parse_arguments(_in + "NO_DEBUG" + "SOURCE_PATH;PROJECT_SUBPATH;PROJECT_NAME" + "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" + ${ARGN} + ) + + if (NOT CMAKE_HOST_WIN32) + message(FATAL_ERROR "vcpkg_install_nmake only support windows.") + endif() + + vcpkg_build_nmake(LOGFILE_ROOT ENABLE_INSTALL + ${_in_NO_DEBUG} + SOURCE_PATH ${_in_SOURCE_PATH} PROJECT_SUBPATH ${_in_PROJECT_SUBPATH} PROJECT_NAME ${_in_PROJECT_NAME} + OPTIONS ${_in_OPTIONS} OPTIONS_RELEASE ${_in_OPTIONS_RELEASE} OPTIONS_DEBUG ${_in_OPTIONS_DEBUG} + ) +endfunction() -- cgit v1.2.3 From e86ff2cc54bda9e9ee322ab69141e7113d5c40a9 Mon Sep 17 00:00:00 2001 From: Vinny Date: Mon, 7 Oct 2019 13:31:39 -0400 Subject: Update vcpkg create template (#8427) * Began updating * Added 'Homepage:' to CONTROL, added vcpkg_check_features to vcpkg_create template * Update portfile.in.cmake Added documentation link for vcpkg_check_features --- scripts/templates/CONTROL.in | 1 + scripts/templates/portfile.in.cmake | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/templates/CONTROL.in b/scripts/templates/CONTROL.in index c5b706861..e22cefdce 100644 --- a/scripts/templates/CONTROL.in +++ b/scripts/templates/CONTROL.in @@ -1,3 +1,4 @@ Source: @PORT@ Version: +Homepage: Description: \ No newline at end of file diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index 33f8a4853..f6003a0cf 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -9,8 +9,10 @@ # VCPKG_ROOT_DIR = # VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) # +# See additional helpful variables in /docs/maintainers/vcpkg_common_definitions.md -include(vcpkg_common_functions) +# # Specifies if the port install should fail immediately given a condition +# vcpkg_fail_port_install(MESSAGE "@PORT@ currently only supports Linux and Mac platforms" ON_TARGET "Windows") vcpkg_download_distfile(ARCHIVE URLS "@URL@" @@ -30,6 +32,15 @@ vcpkg_extract_source_archive_ex( # 002_more_port_fixes.patch ) +# # Check if one or more features are a part of a package installation. +# # See /docs/maintainers/vcpkg_check_features.md for more details +# vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS +# FEATURES # <- Keyword FEATURES is required because INVERTED_FEATURES are being used +# tbb WITH_TBB +# INVERTED_FEATURES +# tbb ROCKSDB_IGNORE_PACKAGE_TBB +# ) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA # Disable this option if project cannot be built with Ninja @@ -40,8 +51,12 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -# Handle copyright +# # Moves all .cmake files from /debug/share/@PORT@/ to /share/@PORT@/ +# # See /docs/maintainers/vcpkg_fixup_cmake_targets.md for more details +# vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/@PORT@) + +# # Handle copyright # file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/@PORT@ RENAME copyright) -# Post-build test for cmake libraries +# # Post-build test for cmake libraries # vcpkg_test_cmake(PACKAGE_NAME @PORT@) -- cgit v1.2.3 From 726c11148105a97aef39bec024fdb7c140b1b154 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 7 Oct 2019 19:35:13 +0200 Subject: [vcpkg] fatal_error when patch fails to apply (#8087) vcpkg will now fail on failure to apply patches except when using `--head`. --- scripts/boost/generate-ports.ps1 | 10 +++++----- scripts/bootstrap.sh | 14 +++++++++++--- scripts/cmake/vcpkg_apply_patches.cmake | 2 +- scripts/cmake/vcpkg_common_definitions.cmake | 3 +++ scripts/cmake/vcpkg_extract_source_archive_ex.cmake | 19 ++++++++++++++++++- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 2 ++ scripts/cmake/vcpkg_from_github.cmake | 1 + 7 files changed, 41 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/boost/generate-ports.ps1 b/scripts/boost/generate-ports.ps1 index d51b37f7e..5f5897718 100644 --- a/scripts/boost/generate-ports.ps1 +++ b/scripts/boost/generate-ports.ps1 @@ -13,9 +13,9 @@ function TransformReference() [string]$library ) - if ($library -match "python|fiber") + if ($library -match "fiber") { - # These two only work on windows desktop + # these only work on windows desktop "$library (windows)" } elseif ($library -match "type[_-]erasure|contract") @@ -47,12 +47,12 @@ function Generate() $sanitizedName = $name -replace "_","-" $versionsuffix = "" - if ($Name -eq "python" -or $Name -eq "asio" -or $Name -eq "mpi") + if ($Name -eq "asio" -or $Name -eq "mpi") { $versionsuffix = "-1" } - if ($Name -eq "test") + if ($Name -eq "python" -or $Name -eq "test") { $versionsuffix = "-2" } @@ -363,7 +363,7 @@ foreach ($library in $libraries) if ($library -eq "python") { - $deps += @("python3") + $deps += @("python3 (!osx&!linux)") $needsBuild = $true } elseif ($library -eq "iostreams") diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index afdd9c1b3..d89d5a15b 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -17,7 +17,7 @@ fi # Argument parsing vcpkgDisableMetrics="OFF" vcpkgUseSystem=false -vcpkgAllowAppleClang=OFF +vcpkgAllowAppleClang=false for var in "$@" do if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then @@ -25,7 +25,7 @@ do elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then vcpkgUseSystem=true elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then - vcpkgAllowAppleClang=ON + vcpkgAllowAppleClang=true elif [ "$var" = "-help" -o "$var" = "--help" ]; then echo "Usage: ./bootstrap-vcpkg.sh [options]" echo @@ -242,7 +242,15 @@ else fetchTool "cmake" "$UNAME" cmakeExe || exit 1 fetchTool "ninja" "$UNAME" ninjaExe || exit 1 fi -selectCXX CXX || exit 1 +if [ "$os" = "osx" ]; then + if [ "$vcpkgAllowAppleClang" = "true" ] ; then + CXX=clang + else + selectCXX CXX || exit 1 + fi +else + selectCXX CXX || exit 1 +fi # Do the build buildDir="$vcpkgRootDir/toolsrc/build.rel" diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index 9698917de..8957fca27 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -49,7 +49,7 @@ function(vcpkg_apply_patches) ) if(error_code AND NOT _ap_QUIET) - message(STATUS "Applying patch failed. This is expected if this patch was previously applied.") + message(FATAL_ERROR "Applying patch failed. Patch needs to be updated to work with source being used by vcpkg!") endif() math(EXPR PATCHNUM "${PATCHNUM}+1") diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index 28177fbbf..60afeaf36 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -55,6 +55,7 @@ endif() #Helper variables for libraries if(VCPKG_TARGET_IS_WINDOWS) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll") set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "") @@ -69,6 +70,7 @@ if(VCPKG_TARGET_IS_WINDOWS) #set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "") elseif(VCPKG_TARGET_IS_OSX) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib") set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib") @@ -76,6 +78,7 @@ elseif(VCPKG_TARGET_IS_OSX) set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "") else() set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib") set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib") diff --git a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake index a775c2094..67916d09d 100644 --- a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake @@ -5,6 +5,7 @@ ## ## Usage ## ```cmake ## vcpkg_extract_source_archive_ex( +## SKIP_PATCH_CHECK ## OUT_SOURCE_PATH ## ARCHIVE <${ARCHIVE}> ## [REF <1.0.0>] @@ -14,6 +15,9 @@ ## ) ## ``` ## ## Parameters +## ### SKIP_PATCH_CHECK +## If this option is set the failure to apply a patch is ignored. +## ## ### OUT_SOURCE_PATH ## Specifies the out-variable that will contain the extracted location. ## @@ -51,7 +55,13 @@ include(vcpkg_apply_patches) include(vcpkg_extract_source_archive) function(vcpkg_extract_source_archive_ex) - cmake_parse_arguments(_vesae "NO_REMOVE_ONE_LEVEL" "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" "PATCHES" ${ARGN}) + cmake_parse_arguments( + _vesae + "NO_REMOVE_ONE_LEVEL;SKIP_PATCH_CHECK" + "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" + "PATCHES" + ${ARGN} + ) if(NOT _vesae_ARCHIVE) message(FATAL_ERROR "Must specify ARCHIVE parameter to vcpkg_extract_source_archive_ex()") @@ -115,7 +125,14 @@ function(vcpkg_extract_source_archive_ex) endif() endif() + if (_vesae_SKIP_PATCH_CHECK) + set (QUIET QUIET) + else() + set (QUIET) + endif() + vcpkg_apply_patches( + ${QUIET} SOURCE_PATH ${TEMP_SOURCE_PATH} PATCHES ${_vesae_PATCHES} ) diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 3b5370bcd..c383fcb56 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -178,3 +178,5 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${CMAKE_FILE} "${_contents}") endforeach() endfunction() + + diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index c0d657bbc..a822ee40e 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -172,6 +172,7 @@ function(vcpkg_from_github) endif() vcpkg_extract_source_archive_ex( + SKIP_PATCH_CHECK OUT_SOURCE_PATH SOURCE_PATH ARCHIVE "${downloaded_file_path}" REF "${SANITIZED_HEAD_REF}" -- cgit v1.2.3 From c784f08ee032dc28c4b5d15ab782d0198d3d0f0c Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Mon, 7 Oct 2019 20:07:26 -0700 Subject: update templates. --- scripts/templates/CONTROL.in | 8 +++++++- scripts/templates/portfile.in.cmake | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/templates/CONTROL.in b/scripts/templates/CONTROL.in index e22cefdce..77f287e0a 100644 --- a/scripts/templates/CONTROL.in +++ b/scripts/templates/CONTROL.in @@ -1,4 +1,10 @@ Source: @PORT@ Version: Homepage: -Description: \ No newline at end of file +Description: +Build-Depends: +Default-Features: + +Feature: +Description: +Build-Depends: \ No newline at end of file diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index f6003a0cf..6081c6b19 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -2,12 +2,24 @@ # CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} # CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} # CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# CURRENT_INSTALLED_DIR = ${VCPKG_ROOT_DIR}\installed\${TRIPLET} +# DOWNLOADS = ${VCPKG_ROOT_DIR}\downloads # PORT = current port name (zlib, etc) # TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) # VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) # VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) # VCPKG_ROOT_DIR = # VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# VCPKG_CMAKE_SYSTEM_NAME = "WindowsStore" "WindowsPhone" "Linux" "Darwin" "Windows" "FreeBSD" empty(windows) +# VCPKG_TOOLCHAIN = ON OFF +# TRIPLET_SYSTEM_ARCH = arm x86 x64 +# BUILD_ARCH = "Win32" "x64" "ARM" +# MSBUILD_PLATFORM = "Win32"/"x64"/${TRIPLET_SYSTEM_ARCH} +# DEBUG_CONFIG = "Debug Static" "Debug Dll" +# RELEASE_CONFIG = "Release Static"" "Release DLL" +# VCPKG_TARGET_EXECUTABLE_SUFFIX +# VCPKG_TARGET_STATIC_LIBRARY_SUFFIX +# VCPKG_TARGET_SHARED_LIBRARY_SUFFIX # # See additional helpful variables in /docs/maintainers/vcpkg_common_definitions.md -- cgit v1.2.3 From bc80d3c00ef99709fff6bab059b3b87090c92e58 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Mon, 7 Oct 2019 20:10:46 -0700 Subject: use macros VCPKG_TARGET_IS_ instead of VCPKG_CMAKE_SYSTEM_NAME --- scripts/templates/portfile.in.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index 6081c6b19..62c53a6db 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -10,13 +10,18 @@ # VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) # VCPKG_ROOT_DIR = # VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) -# VCPKG_CMAKE_SYSTEM_NAME = "WindowsStore" "WindowsPhone" "Linux" "Darwin" "Windows" "FreeBSD" empty(windows) # VCPKG_TOOLCHAIN = ON OFF # TRIPLET_SYSTEM_ARCH = arm x86 x64 # BUILD_ARCH = "Win32" "x64" "ARM" # MSBUILD_PLATFORM = "Win32"/"x64"/${TRIPLET_SYSTEM_ARCH} # DEBUG_CONFIG = "Debug Static" "Debug Dll" # RELEASE_CONFIG = "Release Static"" "Release DLL" +# VCPKG_TARGET_IS_WINDOWS +# VCPKG_TARGET_IS_UWP +# VCPKG_TARGET_IS_LINUX +# VCPKG_TARGET_IS_OSX +# VCPKG_TARGET_IS_FREEBSD +# VCPKG_TARGET_IS_ANDROID # VCPKG_TARGET_EXECUTABLE_SUFFIX # VCPKG_TARGET_STATIC_LIBRARY_SUFFIX # VCPKG_TARGET_SHARED_LIBRARY_SUFFIX -- cgit v1.2.3 From 37be706f568f07b1507e7e1717a9bc4910747a61 Mon Sep 17 00:00:00 2001 From: JackBoosY <47264268+JackBoosY@users.noreply.github.com> Date: Wed, 9 Oct 2019 20:54:19 +0800 Subject: Fix option -j (#8489) * Remove unusable parameters -j * trigger CI system. * Add option -j to make. * Re-trigger CI system. * Fix -j in make, fix NO_DEBUG in nmake. * Re-trigger CI system. --- scripts/cmake/vcpkg_build_make.cmake | 12 ++++++------ scripts/cmake/vcpkg_build_nmake.cmake | 4 ++-- scripts/cmake/vcpkg_install_nmake.cmake | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake index f73fb98d5..793341655 100644 --- a/scripts/cmake/vcpkg_build_make.cmake +++ b/scripts/cmake/vcpkg_build_make.cmake @@ -52,17 +52,17 @@ function(vcpkg_build_make) set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}") set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) # Set make command and install command - set(MAKE ${BASH} --noprofile --norc -c) + set(MAKE ${BASH} --noprofile --norc -c "${_VCPKG_PROJECT_SUBPATH}make") # Must use absolute path to call make in windows - set(MAKE_OPTS "${_VCPKG_PROJECT_SUBPATH}make") - set(INSTALL_OPTS "${_VCPKG_PROJECT_SUBPATH}make install") + set(MAKE_OPTS "-j ${VCPKG_CONCURRENCY}") + set(INSTALL_OPTS "install -j ${VCPKG_CONCURRENCY}") else() # Compiler requriements find_program(MAKE make REQUIRED) set(MAKE make) # Set make command and install command - set(MAKE_OPTS) - set(INSTALL_OPTS install) + set(MAKE_OPTS -j ${VCPKG_CONCURRENCY}) + set(INSTALL_OPTS install -j ${VCPKG_CONCURRENCY}) endif() elseif (_VCPKG_MAKE_GENERATOR STREQUAL "nmake") find_program(NMAKE nmake REQUIRED) @@ -121,7 +121,7 @@ function(vcpkg_build_make) endif() vcpkg_execute_build_process( - COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} ${MAKE_OPTS} + COMMAND ${MAKE} ${MAKE_OPTS} WORKING_DIRECTORY ${WORKING_DIRECTORY} LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}" ) diff --git a/scripts/cmake/vcpkg_build_nmake.cmake b/scripts/cmake/vcpkg_build_nmake.cmake index c98df946a..1eb621b0e 100644 --- a/scripts/cmake/vcpkg_build_nmake.cmake +++ b/scripts/cmake/vcpkg_build_nmake.cmake @@ -171,8 +171,8 @@ function(vcpkg_build_nmake) message(STATUS "Building and installing ${CURRENT_TRIPLET_NAME}") endif() - vcpkg_execute_required_process( - COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} ${MAKE_OPTS} + vcpkg_execute_build_process( + COMMAND ${MAKE} ${MAKE_OPTS} WORKING_DIRECTORY ${OBJ_DIR}${_bn_PROJECT_SUBPATH} LOGNAME "${_bn_LOGFILE_ROOT}-${CURRENT_TRIPLET_NAME}" ) diff --git a/scripts/cmake/vcpkg_install_nmake.cmake b/scripts/cmake/vcpkg_install_nmake.cmake index ca7fe6ce5..0674f9ec3 100644 --- a/scripts/cmake/vcpkg_install_nmake.cmake +++ b/scripts/cmake/vcpkg_install_nmake.cmake @@ -61,8 +61,12 @@ function(vcpkg_install_nmake) message(FATAL_ERROR "vcpkg_install_nmake only support windows.") endif() + if (_in_NO_DEBUG) + set(NO_DEBUG NO_DEBUG) + endif() + vcpkg_build_nmake(LOGFILE_ROOT ENABLE_INSTALL - ${_in_NO_DEBUG} + ${NO_DEBUG} SOURCE_PATH ${_in_SOURCE_PATH} PROJECT_SUBPATH ${_in_PROJECT_SUBPATH} PROJECT_NAME ${_in_PROJECT_NAME} OPTIONS ${_in_OPTIONS} OPTIONS_RELEASE ${_in_OPTIONS_RELEASE} OPTIONS_DEBUG ${_in_OPTIONS_DEBUG} ) -- cgit v1.2.3