diff --git a/docs/maintainers/portfile-functions.md b/docs/maintainers/portfile-functions.md index 515c8b511a..3ad30f46e2 100644 --- a/docs/maintainers/portfile-functions.md +++ b/docs/maintainers/portfile-functions.md @@ -90,3 +90,11 @@ ### [vcpkg-pkgconfig-get-modules](ports/vcpkg-pkgconfig-get-modules.md) - [x\_vcpkg\_pkgconfig\_get\_modules](ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.md) + +### [vcpkg-get-python-packages](ports/vcpkg-get-python-packages.md) + +- [x\_vcpkg\_get\_python\_packages](ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.md) + +### [vcpkg-qmake](ports/vcpkg-qmake.md) + +- [vcpkg\_qmake\_configure](ports/vcpkg-qmake/vcpkg_qmake_configure.md) diff --git a/ports/vcpkg-get-python-packages/README.md b/docs/maintainers/ports/vcpkg-get-python-packages.md similarity index 100% rename from ports/vcpkg-get-python-packages/README.md rename to docs/maintainers/ports/vcpkg-get-python-packages.md diff --git a/docs/maintainers/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.md b/docs/maintainers/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.md new file mode 100644 index 0000000000..26d57e4fa6 --- /dev/null +++ b/docs/maintainers/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.md @@ -0,0 +1,38 @@ +# x_vcpkg_get_python_packages + +The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.md). + +Experimental +Retrieve needed python packages + +## Usage +```cmake +x_vcpkg_get_python_packages( + [PYTHON_VERSION (2|3)] + PYTHON_EXECUTABLE + REQUIREMENTS_FILE + PACKAGES ... + [OUT_PYTHON_VAR somevar] +) +``` +## Parameters + +### PYTHON_VERSION +Python version to be used. Either 2 or 3 + +### PYTHON_EXECUTABLE +Full path to the python executable + +### REQUIREMENTS_FILE +Requirement file with the list of python packages + +### PACKAGES +List of python packages to acquire + +### OUT_PYTHON_VAR +Variable to store the path to the python binary inside the virtual environment + + + +## Source +[ports/vcpkg-get-python-packages/x\_vcpkg\_get\_python\_packages.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake) diff --git a/ports/vcpkg-qmake/README.md b/docs/maintainers/ports/vcpkg-qmake.md similarity index 100% rename from ports/vcpkg-qmake/README.md rename to docs/maintainers/ports/vcpkg-qmake.md diff --git a/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md new file mode 100644 index 0000000000..4130426579 --- /dev/null +++ b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md @@ -0,0 +1,36 @@ +# vcpkg_qmake_configure + +The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md). + +Configure a qmake-based project. + +###User setable triplet variables: +VCPKG_OSX_DEPLOYMENT_TARGET: Determines QMAKE_MACOSX_DEPLOYMENT_TARGET +VCPKG_QMAKE_COMMAND: Path to qmake. (default: "${CURRENT_HOST_INSTALLED_DIR}/tools/Qt6/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}") +VCPKG_QT_CONF_(RELEASE|DEBUG): Path to qt.config being used for RELEASE/DEBUG. (default: "${CURRENT_INSTALLED_DIR}/tools/Qt6/qt_(release|debug).conf") +VCPKG_QMAKE_OPTIONS(_RELEASE|_DEBUG)?: Extra options to pass to QMake + +```cmake +vcpkg_qmake_configure( + SOURCE_PATH + [QMAKE_OPTIONS arg1 [arg2 ...]] + [QMAKE_OPTIONS_RELEASE arg1 [arg2 ...]] + [QMAKE_OPTIONS_DEBUG arg1 [arg2 ...]] + [OPTIONS arg1 [arg2 ...]] + [OPTIONS_RELEASE arg1 [arg2 ...]] + [OPTIONS_DEBUG arg1 [arg2 ...]] +) +``` + +### SOURCE_PATH +The path to the *.pro qmake project file. + +### QMAKE_OPTIONS, QMAKE_OPTIONS\_RELEASE, QMAKE_OPTIONS\_DEBUG +options directly passed to qmake with the form QMAKE_X=something or CONFIG=something + +### OPTIONS, OPTIONS\_RELEASE, OPTIONS\_DEBUG +The options passed after -- to qmake. + + +## Source +[ports/vcpkg-qmake/vcpkg\_qmake\_configure.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake) diff --git a/docs/regenerate.ps1 b/docs/regenerate.ps1 deleted file mode 100755 index a319e19b14..0000000000 --- a/docs/regenerate.ps1 +++ /dev/null @@ -1,357 +0,0 @@ -#! /usr/bin/env pwsh - -[CmdletBinding()] -Param( - [String]$VcpkgRoot = '' -) - -if ([String]::IsNullOrEmpty($VcpkgRoot)) { - $VcpkgRoot = "${PSScriptRoot}/.." -} - -$VcpkgRoot = Resolve-Path $VcpkgRoot - -if (-not (Test-Path "$VcpkgRoot/.vcpkg-root")) { - throw "Invalid vcpkg instance, did you forget -VcpkgRoot?" -} - -class CMakeDocumentation { - [String]$Filename - [String[]]$ActualDocumentation - [Bool]$IsDeprecated - [String]$DeprecationMessage - [String]$DeprecatedByName - [String]$DeprecatedByPath - [Bool]$HasError -} - -[String[]]$cmakeScriptsPorts = @( - 'vcpkg-cmake' - 'vcpkg-gn' - 'vcpkg-cmake-config' - 'vcpkg-cmake-get-vars' - 'vcpkg-pkgconfig-get-modules' -) - -[CMakeDocumentation[]]$tableOfContents = @() -[CMakeDocumentation[]]$internalTableOfContents = @() -$portTableOfContents = [ordered]@{} - -function RelativeUnixPathTo -{ - Param( - [Parameter(Mandatory)] - [String]$Path, - [Parameter(Mandatory)] - [String]$Base - ) - - $Path = Resolve-Path -LiteralPath $Path - $Base = Resolve-Path -LiteralPath $Base - - if ($IsWindows) - { - if ((Split-Path -Qualifier $Path) -ne (Split-Path -Qualifier $Base)) - { - throw "It is not possible to get the relative unix path from $Base to $Path" - } - } - - $Path = $Path -replace '\\','/' - $Base = $Base -replace '\\','/' - - [String[]]$PathArray = $Path -split '/' - [String[]]$BaseArray = $Base -split '/' - - [String[]]$Result = @() - - $Idx = 0 - - while ($Idx -lt $PathArray.Length -and $Idx -lt $BaseArray.Length) - { - if ($PathArray[$Idx] -ne $BaseArray[$Idx]) - { - break - } - ++$Idx - } - - for ($BaseIdx = $Idx; $BaseIdx -lt $BaseArray.Length; ++$BaseIdx) - { - $Result += '..' - } - for ($PathIdx = $Idx; $PathIdx -lt $PathArray.Length; ++$PathIdx) - { - $Result += $PathArray[$PathIdx] - } - - $Result -join '/' -} -function WriteFile -{ - Param( - [String[]]$Value, - [String]$Path - ) - # note that we use this method of getting the utf-8 bytes in order to: - # - have no final `r`n, which happens when Set-Content does the thing automatically on Windows - # - have no BOM, which happens when one uses [System.Text.Encoding]::UTF8 - [byte[]]$ValueAsBytes = (New-Object -TypeName 'System.Text.UTF8Encoding').GetBytes($Value -join "`n") - Set-Content -Path $Path -Value $ValueAsBytes -AsByteStream -} -function FinalDocFile -{ - Param( - [CMakeDocumentation]$Docs, - [String]$PathToFile # something like docs/maintainers/blah.md - ) - [String[]]$documentation = @() - - if ($Docs.ActualDocumentation.Length -eq 0) - { - throw "Invalid documentation: empty docs" - } - - $documentation += $Docs.ActualDocumentation[0] # name line - if ($Docs.IsDeprecated) - { - if ($null -eq $Docs.DeprecationMessage -or $Docs.DeprecationMessage -match '^ *$') - { - if(![string]::IsNullOrEmpty($Docs.DeprecatedByName)) - { - $message = " in favor of [``$($Docs.DeprecatedByName)``]($($Docs.DeprecatedByPath)$($Docs.DeprecatedByName).md)" - $Docs.DeprecatedByPath -match '^ports/([a-z\-]+)/$' | Out-Null - $port = $matches[1] - if(![string]::IsNullOrEmpty($port)) - { - $message += " from the $port port." - } - } - $documentation += @("", "**This function has been deprecated$message**") - } - else - { - $documentation += @("", "**This function has been deprecated $($Docs.DeprecationMessage)**") - } - } - $documentation += @("", "The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/$PathToFile).") - - $documentation += $Docs.ActualDocumentation[1..$Docs.ActualDocumentation.Length] - - $relativePath = RelativeUnixPathTo $Docs.Filename $VcpkgRoot - $documentation += @( - "", - "## Source", - "[$($relativePath -replace '_','\_')](https://github.com/Microsoft/vcpkg/blob/master/$relativePath)", - "" - ) - - $documentation -} - -function ParseCmakeDocComment -{ - Param( - [Parameter(Mandatory)] - [System.IO.FileSystemInfo]$Filename - ) - - $Docs = New-Object 'CMakeDocumentation' - $Docs.HasError = $False - $Docs.IsDeprecated = $False - $Docs.Filename = $Filename.FullName - - [String[]]$contents = Get-Content $Filename - - if ($contents[0] -eq '# DEPRECATED') - { - $Docs.IsDeprecated = $True - } - elseif($contents[0] -match '^# DEPRECATED( BY (([^/]+/)+)(.+))?((: *)(.*))?$') - { - $Docs.IsDeprecated = $True - $Docs.DeprecatedByPath = $matches[2] - $Docs.DeprecatedByName = $matches[4] - $Docs.DeprecationMessage = $matches[7] - } - - [String]$startCommentRegex = '#\[(=*)\[' - [String]$endCommentRegex = '' - [Bool]$inComment = $False - - $contents = $contents | ForEach-Object { - if (-not $inComment) { - if ($_ -match "^\s*${startCommentRegex}(\.[a-z]*)?:?\s*$") { - if (-not [String]::IsNullOrEmpty($matches[2]) -and $matches[2] -ne '.md') { - Write-Warning "The documentation in $($Filename.FullName) doesn't seem to be markdown (extension: $($matches[2])). Only markdown is supported; please rewrite the documentation in markdown." - } - $inComment = $True - $endCommentRegex = "\]$($matches[1])\]" - } elseif ($_ -match $startCommentRegex) { - $Docs.HasError = $True - Write-Warning "Invalid start of comment -- the comment start must be at the beginning of the line. - (on line: `"$_`")" - } else { - # do nothing -- we're outside a comment, so cmake code - } - } else { - if ($_ -match "^\s*#?${endCommentRegex}\s*$") { - $inComment = $False - $endCommentRegex = '' - } elseif ($_ -match $endCommentRegex) { - $Docs.HasError = $True - Write-Warning "Invalid end of comment -- the comment end must be on it's own on a line. - (on line: `"$_`")" - } else { - # regular documentation line - $_ - } - } - } - - if ($inComment) { - Write-Warning "File $($Filename.FullName) has an unclosed comment." - $Docs.HasError = $True - } - - if (-not [String]::IsNullOrEmpty($contents)) - { - $Docs.ActualDocumentation = $contents - } - - $Docs -} - -Get-ChildItem "$VcpkgRoot/scripts/cmake" -Filter '*.cmake' | ForEach-Object { - $docs = ParseCmakeDocComment $_ - [Bool]$isInternalFunction = $_.Name.StartsWith("z_vcpkg") - - if ($docs.IsDeprecated -and $null -eq $docs.ActualDocumentation) - { - return - } - if ($docs.HasError) - { - return - } - - if ($null -ne $docs.ActualDocumentation) - { - if ($isInternalFunction) - { - $pathToFile = "maintainers/internal/$($_.BaseName).md" - WriteFile ` - -Path "$PSScriptRoot/$pathToFile" ` - -Value (FinalDocFile $docs) - - $internalTableOfContents += $docs - } - else - { - $pathToFile = "maintainers/$($_.BaseName).md" - WriteFile ` - -Path "$PSScriptRoot/$pathToFile" ` - -Value (FinalDocFile $docs $pathToFile) - - $tableOfContents += $docs - } - } - elseif (-not $isInternalFunction) - { - # don't worry about undocumented internal functions - Write-Warning "The cmake function in file $($_.FullName) doesn't seem to have any documentation. Make sure the documentation comments are correctly written." - } -} - -$cmakeScriptsPorts | ForEach-Object { - $portName = $_ - - if (Test-Path "$VcpkgRoot/ports/$portName/README.md") { - Copy-Item "$VcpkgRoot/ports/$portName/README.md" "$PSScriptRoot/maintainers/ports/$portName.md" - } - New-Item -Path "$PSScriptRoot/maintainers/ports/$portName" -Force -ItemType 'Directory' | Out-Null - - $portTableOfContents[$portName] = @() - - Get-ChildItem "$VcpkgRoot/ports/$portName" -Filter '*.cmake' | ForEach-Object { - if ($_.Name -eq 'vcpkg-port-config.cmake' -or $_.Name -eq 'portfile.cmake') - { - return - } - - $docs = ParseCmakeDocComment $_ - - if ($docs.IsDeprecated -and $null -eq $docs.ActualDocumentation) - { - return - } - if ($docs.HasError) - { - return - } - - if ($null -ne $docs.ActualDocumentation) - { - $pathToFile = "maintainers/ports/$portName/$($_.BaseName).md" - WriteFile ` - -Path "$PSScriptRoot/$pathToFile" ` - -Value (FinalDocFile $docs $pathToFile) - $portTableOfContents[$portName] += $docs - } - else - { - Write-Warning "The cmake function in file $($_.FullName) doesn't seem to have any documentation. Make sure the documentation comments are correctly written." - } - } -} - -$portfileFunctionsContent = @( - '', - '', - '# Portfile helper functions') - -function GetDeprecationMessage -{ - Param( - [CMakeDocumentation]$Doc - ) - $message = '' - if ($Doc.IsDeprecated) - { - $message = " (deprecated" - if(![string]::IsNullOrEmpty($Doc.DeprecatedByName)) - { - $message += ", use [$($($Doc.DeprecatedByName) -replace '_','\_')]($($Doc.DeprecatedByPath)$($Doc.DeprecatedByName).md)" - } - $message += ")" - } - $message -} - -$DocsName = @{ expression = { Split-Path -LeafBase $_.Filename } } -$tableOfContents | Sort-Object -Property $DocsName -Culture '' | ForEach-Object { - $name = Split-Path -LeafBase $_.Filename - $portfileFunctionsContent += "- [$($name -replace '_','\_')]($name.md)" + $(GetDeprecationMessage $_) -} -$portfileFunctionsContent += @("", "## Internal Functions", "") -$internalTableOfContents | Sort-Object -Property $DocsName -Culture '' | ForEach-Object { - $name = Split-Path -LeafBase $_.Filename - $portfileFunctionsContent += "- [$($name -replace '_','\_')](internal/$name.md)" + $(GetDeprecationMessage $_) -} - -$portfileFunctionsContent += @("", "## Scripts from Ports") -$portTableOfContents.GetEnumerator() | ForEach-Object { - $portName = $_.Name - $cmakeDocs = $_.Value - $portfileFunctionsContent += @("", "### [$portName](ports/$portName.md)", "") - $cmakeDocs | ForEach-Object { - $name = Split-Path -LeafBase $_.Filename - $portfileFunctionsContent += "- [$($name -replace '_','\_')](ports/$portName/$name.md)" + $(GetDeprecationMessage $_) - } -} - -$portfileFunctionsContent += "" # final newline - -WriteFile ` - -Path "$PSScriptRoot/maintainers/portfile-functions.md" ` - -Value $portfileFunctionsContent diff --git a/ports/vcpkg-cmake-config/README.md b/ports/vcpkg-cmake-config/README.md deleted file mode 100644 index 18e7bb9ac8..0000000000 --- a/ports/vcpkg-cmake-config/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# vcpkg-cmake-config - -`vcpkg-cmake-config` provides `vcpkg_cmake_config_fixup()`, -a function which both: - -- Fixes common mistakes in port build systems, like using absolute paths -- Merges the debug and release config files. - -This function should almost always be used when a port has `*config.cmake` files, -even when the buildsystem of the project is not CMake. diff --git a/ports/vcpkg-cmake-config/vcpkg.json b/ports/vcpkg-cmake-config/vcpkg.json index a99271b63c..db965341a7 100644 --- a/ports/vcpkg-cmake-config/vcpkg.json +++ b/ports/vcpkg-cmake-config/vcpkg.json @@ -1,4 +1,7 @@ { "name": "vcpkg-cmake-config", - "version-date": "2022-02-06" + "version-date": "2022-02-06", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", + "license": "MIT" } diff --git a/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake b/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake index 4045ae1eae..368e5809ac 100644 --- a/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake +++ b/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake @@ -1,58 +1,4 @@ -#[===[.md: -# vcpkg_cmake_config_fixup - -Merge release and debug CMake targets and configs to support multiconfig generators. - -Additionally corrects common issues with targets, such as absolute paths and incorrectly placed binaries. - -```cmake -vcpkg_cmake_config_fixup( - [PACKAGE_NAME ] - [CONFIG_PATH ] - [TOOLS_PATH ] - [DO_NOT_DELETE_PARENT_CONFIG_PATH] - [NO_PREFIX_CORRECTION] -) -``` - -For many ports, `vcpkg_cmake_config_fixup()` on its own should work, -as `PACKAGE_NAME` defaults to `${PORT}` and `CONFIG_PATH` defaults to `share/${PACKAGE_NAME}`. -For ports where the package name passed to `find_package` is distinct from the port name, -`PACKAGE_NAME` should be changed to be that name instead. -For ports where the directory of the `*config.cmake` files cannot be set, -use the `CONFIG_PATH` to change the directory where the files come from. - -By default the parent directory of CONFIG_PATH is removed if it is named "cmake". -Passing the `DO_NOT_DELETE_PARENT_CONFIG_PATH` option disable such behavior, -as it is convenient for ports that install -more than one CMake package configuration file. - -The `NO_PREFIX_CORRECTION` option disables the correction of `_IMPORT_PREFIX` -done by vcpkg due to moving the config files. -Currently the correction does not take into account how the files are moved, -and applies a rather simply correction which in some cases will yield the wrong results. - -## How it Works - -1. Moves `/debug//*targets-debug.cmake` to `/share/${PACKAGE_NAME}`. -2. Transforms all references matching `/bin/*.exe` to `/${TOOLS_PATH}/*.exe` on Windows. -3. Transforms all references matching `/bin/*` to `/${TOOLS_PATH}/*` on other platforms. -4. Fixes `${_IMPORT_PREFIX}` in auto generated targets. -5. Replaces `${CURRENT_INSTALLED_DIR}` with `${_IMPORT_PREFIX}` in configs. -6. Merges INTERFACE_LINK_LIBRARIES of release and debug configurations. -7. Replaces `${CURRENT_INSTALLED_DIR}` with `${VCPKG_IMPORT_PREFIX}` in targets. -8. Removes `/debug//*config.cmake`. - -## Examples - -* [concurrentqueue](https://github.com/Microsoft/vcpkg/blob/master/ports/concurrentqueue/portfile.cmake) -* [curl](https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake) -* [nlohmann-json](https://github.com/Microsoft/vcpkg/blob/master/ports/nlohmann-json/portfile.cmake) -#]===] -if(Z_VCPKG_CMAKE_CONFIG_FIXUP_GUARD) - return() -endif() -set(Z_VCPKG_CMAKE_CONFIG_FIXUP_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) function(vcpkg_cmake_config_fixup) cmake_parse_arguments(PARSE_ARGV 0 "arg" "DO_NOT_DELETE_PARENT_CONFIG_PATH;NO_PREFIX_CORRECTION" "PACKAGE_NAME;CONFIG_PATH;TOOLS_PATH" "") diff --git a/ports/vcpkg-cmake-get-vars/README.md b/ports/vcpkg-cmake-get-vars/README.md deleted file mode 100644 index 4881c82185..0000000000 --- a/ports/vcpkg-cmake-get-vars/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# vcpkg-cmake-get-vars - -This port contains a helper function to extract CMake variables into the scope of the portfile or other scripts diff --git a/ports/vcpkg-cmake-get-vars/vcpkg.json b/ports/vcpkg-cmake-get-vars/vcpkg.json index 4121b30c2e..33b5478822 100644 --- a/ports/vcpkg-cmake-get-vars/vcpkg.json +++ b/ports/vcpkg-cmake-get-vars/vcpkg.json @@ -1,6 +1,8 @@ { "name": "vcpkg-cmake-get-vars", "version-date": "2022-05-10", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "dependencies": [ { diff --git a/ports/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake b/ports/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake index e8a1feec48..8ce706bdf9 100644 --- a/ports/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake +++ b/ports/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake @@ -1,43 +1,6 @@ -#[===[.md: -# vcpkg_cmake_get_vars +include_guard(GLOBAL) -Runs a cmake configure with a dummy project to extract certain cmake variables - -## Usage -```cmake -vcpkg_cmake_get_vars() -``` - -`vcpkg_cmake_get_vars()` sets `` to -a path to a generated CMake file, with the detected `CMAKE_*` variables -re-exported as `VCPKG_DETECTED_CMAKE_*`. - -Additionally sets, for `RELEASE` and `DEBUG`: -- VCPKG_COMBINED_CXX_FLAGS_ -- VCPKG_COMBINED_C_FLAGS_ -- VCPKG_COMBINED_SHARED_LINKER_FLAGS_ -- VCPKG_COMBINED_STATIC_LINKER_FLAGS_ -- VCPKG_COMBINED_EXE_LINKER_FLAGS_ - -Most users should use these pre-combined flags instead of attempting -to read the `VCPKG_DETECTED_*` flags directly. - -## Notes -Avoid usage in portfiles. - -All calls to `vcpkg_cmake_get_vars` will result in the same output file; -the output file is not generated multiple times. - -### Basic Usage - -```cmake -vcpkg_cmake_get_vars(cmake_vars_file) -include("${cmake_vars_file}") -message(STATUS "detected CXX flags: ${VCPKG_DETECTED_CMAKE_CXX_FLAGS}") -``` -#]===] - -set(Z_VCPKG_CMAKE_GET_VARS_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}") +set(Z_VCPKG_CMAKE_GET_VARS_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") function(vcpkg_cmake_get_vars out_file) cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "") diff --git a/ports/vcpkg-cmake/README.md b/ports/vcpkg-cmake/README.md deleted file mode 100644 index b84c58869c..0000000000 --- a/ports/vcpkg-cmake/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# vcpkg-cmake - -This port contains cmake functions for dealing with a CMake buildsystem. - -In the common case, `vcpkg_cmake_configure()` (with appropriate arguments) -followed by `vcpkg_cmake_install()` will be enough to build and install a port. -`vcpkg_cmake_build()` is provided for more complex cases. diff --git a/ports/vcpkg-cmake/vcpkg.json b/ports/vcpkg-cmake/vcpkg.json index 9687cf2eb9..d78546dd88 100644 --- a/ports/vcpkg-cmake/vcpkg.json +++ b/ports/vcpkg-cmake/vcpkg.json @@ -1,5 +1,7 @@ { "name": "vcpkg-cmake", "version-date": "2022-05-10", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT" } diff --git a/ports/vcpkg-cmake/vcpkg_cmake_build.cmake b/ports/vcpkg-cmake/vcpkg_cmake_build.cmake index bb66a7800c..efdb194fa1 100644 --- a/ports/vcpkg-cmake/vcpkg_cmake_build.cmake +++ b/ports/vcpkg-cmake/vcpkg_cmake_build.cmake @@ -1,42 +1,4 @@ -#[===[.md: -# vcpkg_cmake_build - -Build a cmake project. - -```cmake -vcpkg_cmake_build( - [TARGET ] - [LOGFILE_BASE ] - [DISABLE_PARALLEL] - [ADD_BIN_TO_PATH] -) -``` - -`vcpkg_cmake_build` builds an already-configured cmake project. -You can use the alias [`vcpkg_cmake_install()`] function -if your CMake build system supports the `install` TARGET, -and this is something we recommend doing whenever possible. -Otherwise, you can use `TARGET` to set the target to build. -This function defaults to not passing a target to cmake. - -[`vcpkg_cmake_install()`]: vcpkg_cmake_install.md - -`LOGFILE_BASE` is used to set the base of the logfile names; -by default, this is `build`, and thus the logfiles end up being something like -`build-x86-windows-dbg.log`; if you use `vcpkg_cmake_install`, -this is set to `install`, so you'll get log names like `install-x86-windows-dbg.log`. - -For build systems that are buggy when run in parallel, -using `DISABLE_PARALLEL` will run the build with only one job. - -Finally, `ADD_BIN_TO_PATH` adds the appropriate (either release or debug) -`bin/` directories to the path during the build, -such that executables run during the build will be able to access those DLLs. -#]===] -if(Z_VCPKG_CMAKE_BUILD_GUARD) - return() -endif() -set(Z_VCPKG_CMAKE_BUILD_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) function(vcpkg_cmake_build) cmake_parse_arguments(PARSE_ARGV 0 "arg" "DISABLE_PARALLEL;ADD_BIN_TO_PATH" "TARGET;LOGFILE_BASE" "") diff --git a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake index fcb6f6f15a..748410a3ae 100644 --- a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake +++ b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake @@ -1,97 +1,4 @@ -#[===[.md: -# vcpkg_cmake_configure - -Configure a CMake buildsystem. - -```cmake -vcpkg_cmake_configure( - SOURCE_PATH - [LOGFILE_BASE ] - [DISABLE_PARALLEL_CONFIGURE] - [NO_CHARSET_FLAG] - [WINDOWS_USE_MSBUILD] - [GENERATOR ] - [OPTIONS - ...] - [OPTIONS_RELEASE - ...] - [OPTIONS_DEBUG - ...] - [MAYBE_UNUSED_VARIABLES - ...] -) -``` - -`vcpkg_cmake_configure` configures a CMake build system for use with -`vcpkg_cmake_buildsystem_build` and `vcpkg_cmake_buildsystem_install`. -`source-path` is where the source is located; by convention, -this is usually `${SOURCE_PATH}`, which is set by one of the `vcpkg_from_*` functions. -This function configures the build system for both Debug and Release builds by default, -assuming that `VCPKG_BUILD_TYPE` is not set; if it is, then it will only configure for -that build type. - -Use the `OPTIONS` argument to set the configure settings for both release and debug, -and use `OPTIONS_RELEASE` and `OPTIONS_DEBUG` to set the configure settings for -release only and debug only respectively. - -By default, when possible, `vcpkg_cmake_configure` uses [ninja-build] -as its build system. If the `WINDOWS_USE_MSBUILD` argument is passed, then -`vcpkg_cmake_configure` will use a Visual Studio generator on Windows; -on every other platform, `vcpkg_cmake_configure` just uses Ninja. - -[ninja-build]: https://ninja-build.org/ - -Additionally, one may pass the specific generator a port should use with `GENERATOR`. -This is useful if some project-specific buildsystem -has been wrapped in a CMake build system that doesn't perform an actual build. -If used for this purpose, it should be set to `"NMake Makefiles"`. -`vcpkg_cmake_buildsystem_build` and `install` do not support this being set to anything -except for NMake. - -For libraries which cannot be configured in parallel, -pass the `DISABLE_PARALLEL_CONFIGURE` flag. This is needed, for example, -if the library's build system writes back into the source directory during configure. -This also disables the `CMAKE_DISABLE_SOURCE_CHANGES` option. - -By default, this function adds flags to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS` -which set the default character set to utf-8 for MSVC. -If the library sets its own code page, pass the `NO_CHARSET_FLAG` option. - -This function makes certain that all options passed in are used by the -underlying CMake build system. If there are options that might be unused, -perhaps on certain platforms, pass those variable names to -`MAYBE_UNUSED_VARIABLES`. For example: -```cmake -vcpkg_cmake_configure( - ... - OPTIONS - -DBUILD_EXAMPLE=OFF - ... - MAYBE_UNUSED_VARIABLES - BUILD_EXAMPLE -) -``` - -`LOGFILE_BASE` is used to set the base of the logfile names; -by default, this is `config`, and thus the logfiles end up being something like -`config-x86-windows-dbg.log`. You can set it to anything you like; -if you set it to `config-the-first`, -you'll get something like `config-the-first-x86-windows.dbg.log`. - -## Notes -This command supplies many common arguments to CMake. To see the full list, examine the source. - -## Examples - -* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) -* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -* [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) -* [opencv4](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv4/portfile.cmake) -#]===] -if(Z_VCPKG_CMAKE_CONFIGURE_GUARD) - return() -endif() -set(Z_VCPKG_CMAKE_CONFIGURE_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) macro(z_vcpkg_cmake_configure_both_set_or_unset var1 var2) if(DEFINED ${var1} AND NOT DEFINED ${var2}) diff --git a/ports/vcpkg-cmake/vcpkg_cmake_install.cmake b/ports/vcpkg-cmake/vcpkg_cmake_install.cmake index 6eddcfb912..2bd8b4ea75 100644 --- a/ports/vcpkg-cmake/vcpkg_cmake_install.cmake +++ b/ports/vcpkg-cmake/vcpkg_cmake_install.cmake @@ -1,29 +1,4 @@ -#[===[.md: -# vcpkg_cmake_install - -Build and install a cmake project. - -```cmake -vcpkg_cmake_install( - [DISABLE_PARALLEL] - [ADD_BIN_TO_PATH] -) -``` - -`vcpkg_cmake_install` transparently forwards to [`vcpkg_cmake_build()`], -with additional parameters to set the `TARGET` to `install`, -and to set the `LOGFILE_ROOT` to `install` as well. - -[`vcpkg_cmake_build()`]: vcpkg_cmake_build.md - -## Examples: - -* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) -#]===] -if(Z_VCPKG_CMAKE_INSTALL_GUARD) - return() -endif() -set(Z_VCPKG_CMAKE_INSTALL_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) function(vcpkg_cmake_install) cmake_parse_arguments(PARSE_ARGV 0 "arg" "DISABLE_PARALLEL;ADD_BIN_TO_PATH" "" "") diff --git a/ports/vcpkg-get-python-packages/vcpkg.json b/ports/vcpkg-get-python-packages/vcpkg.json index 3ef203b06f..227e4557b1 100644 --- a/ports/vcpkg-get-python-packages/vcpkg.json +++ b/ports/vcpkg-get-python-packages/vcpkg.json @@ -1,6 +1,8 @@ { "name": "vcpkg-get-python-packages", "version-date": "2022-04-11", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "supports": "native" } diff --git a/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake b/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake index 4df1ebd800..189017cd2b 100644 --- a/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake +++ b/ports/vcpkg-get-python-packages/x_vcpkg_get_python_packages.cmake @@ -1,38 +1,3 @@ -#[===[.md: -# x_vcpkg_get_python_packages - -Experimental -Retrieve needed python packages - -## Usage -```cmake -x_vcpkg_get_python_packages( - [PYTHON_VERSION (2|3)] - PYTHON_EXECUTABLE - REQUIREMENTS_FILE - PACKAGES ... - [OUT_PYTHON_VAR somevar] -) -``` -## Parameters - -### PYTHON_VERSION -Python version to be used. Either 2 or 3 - -### PYTHON_EXECUTABLE -Full path to the python executable - -### REQUIREMENTS_FILE -Requirement file with the list of python packages - -### PACKAGES -List of python packages to acquire - -### OUT_PYTHON_VAR -Variable to store the path to the python binary inside the virtual environment - - -#]===] include_guard(GLOBAL) function(x_vcpkg_get_python_packages) diff --git a/ports/vcpkg-gn/vcpkg-port-config.cmake b/ports/vcpkg-gn/vcpkg-port-config.cmake index 3542ba9282..229050aea7 100644 --- a/ports/vcpkg-gn/vcpkg-port-config.cmake +++ b/ports/vcpkg-gn/vcpkg-port-config.cmake @@ -1,4 +1,3 @@ include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_gn_configure.cmake") include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_gn_install.cmake") - -file(REAL_PATH "${CMAKE_CURRENT_LIST_DIR}/../../tools/vcpkg-gn/gn${CMAKE_EXECUTABLE_SUFFIX}" VCPKG_GN) +include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_gn_real_path.cmake") diff --git a/ports/vcpkg-gn/vcpkg.json b/ports/vcpkg-gn/vcpkg.json index 26d89e6802..6dd7183765 100644 --- a/ports/vcpkg-gn/vcpkg.json +++ b/ports/vcpkg-gn/vcpkg.json @@ -1,8 +1,10 @@ { "name": "vcpkg-gn", "version-date": "2021-11-16", - "port-version": 1, + "port-version": 2, "description": "https://gn.googlesource.com/gn/+/4aa9bdfa05b688c58d3d7d3e496f3f18cbb3d89e", + "documentation": "https://vcpkg.io/en/docs/README.html", + "license": "MIT", "supports": "native & !x86", "dependencies": [ { diff --git a/ports/vcpkg-gn/vcpkg_gn_configure.cmake b/ports/vcpkg-gn/vcpkg_gn_configure.cmake index 87aaba85de..39de456e48 100644 --- a/ports/vcpkg-gn/vcpkg_gn_configure.cmake +++ b/ports/vcpkg-gn/vcpkg_gn_configure.cmake @@ -1,36 +1,5 @@ -#[===[.md: -# vcpkg_gn_configure - -Generate Ninja (GN) targets - -## Usage: -```cmake -vcpkg_gn_configure( - SOURCE_PATH - [OPTIONS ] - [OPTIONS_DEBUG ] - [OPTIONS_RELEASE ] -) -``` - -## Parameters: -### SOURCE_PATH (required) -The path to the GN project. - -### OPTIONS -Options to be passed to both the debug and release targets. -Note: Must be provided as a space-separated string. - -### OPTIONS_DEBUG (space-separated string) -Options to be passed to the debug target. - -### OPTIONS_RELEASE (space-separated string) -Options to be passed to the release target. -#]===] -if(Z_VCPKG_GN_CONFIGURE_GUARD) - return() -endif() -set(Z_VCPKG_GN_CONFIGURE_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) +include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_gn_real_path.cmake") function(z_vcpkg_gn_configure_generate) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "SOURCE_PATH;CONFIG;ARGS" "") diff --git a/ports/vcpkg-gn/vcpkg_gn_install.cmake b/ports/vcpkg-gn/vcpkg_gn_install.cmake index 517046b54e..8b9c3b2b7c 100644 --- a/ports/vcpkg-gn/vcpkg_gn_install.cmake +++ b/ports/vcpkg-gn/vcpkg_gn_install.cmake @@ -1,33 +1,5 @@ -#[===[.md: -# vcpkg_gn_install - -Installs a GN project. - -In order to build a GN project without installing, use [`vcpkg_build_ninja()`]. - -## Usage: -```cmake -vcpkg_gn_install( - SOURCE_PATH - [TARGETS ...] -) -``` - -## Parameters: -### SOURCE_PATH -The path to the source directory - -### TARGETS -Only install the specified targets. - -Note: includes must be handled separately - -[`vcpkg_build_ninja()`]: vcpkg_build_ninja.md -#]===] -if(Z_VCPKG_GN_INSTALL_GUARD) - return() -endif() -set(Z_VCPKG_GN_INSTALL_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) +include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_gn_real_path.cmake") function(z_vcpkg_gn_install_get_target_type out_var) cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "SOURCE_PATH;BUILD_DIR;TARGET" "") diff --git a/ports/vcpkg-gn/z_vcpkg_gn_real_path.cmake b/ports/vcpkg-gn/z_vcpkg_gn_real_path.cmake new file mode 100644 index 0000000000..855bf3e479 --- /dev/null +++ b/ports/vcpkg-gn/z_vcpkg_gn_real_path.cmake @@ -0,0 +1,4 @@ +include_guard(GLOBAL) + +file(REAL_PATH "${CMAKE_CURRENT_LIST_DIR}/../../tools/vcpkg-gn/gn${CMAKE_EXECUTABLE_SUFFIX}" VCPKG_GN) +set(VCPKG_GN "${VCPKG_GN}" CACHE INTERNAL "") diff --git a/ports/vcpkg-pkgconfig-get-modules/README.md b/ports/vcpkg-pkgconfig-get-modules/README.md deleted file mode 100644 index ac99412c24..0000000000 --- a/ports/vcpkg-pkgconfig-get-modules/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# vcpkg-pkgconfig-get-modules - -**Experimental: will change or be removed at any time** - -`vcpkg-pkgconfig-get-modules` provides `x_vcpkg_pkgconfig_get_modules()`, a function which simplifies calling -`pkg-config` in portfiles in order to gather dependencies for exotic buildsystems. diff --git a/ports/vcpkg-pkgconfig-get-modules/vcpkg.json b/ports/vcpkg-pkgconfig-get-modules/vcpkg.json index 06a3a549ee..f38c13d4d7 100644 --- a/ports/vcpkg-pkgconfig-get-modules/vcpkg.json +++ b/ports/vcpkg-pkgconfig-get-modules/vcpkg.json @@ -1,6 +1,9 @@ { "name": "vcpkg-pkgconfig-get-modules", "version-date": "2022-02-10", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", + "license": "MIT", "dependencies": [ { "name": "pkgconf", diff --git a/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake b/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake index 5a4dec12b9..0ed124cff4 100644 --- a/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake +++ b/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake @@ -1,49 +1,4 @@ -#[===[.md: -# x_vcpkg_pkgconfig_get_modules - -Experimental -Retrieve required module information from pkgconfig modules - -## Usage -```cmake -x_vcpkg_pkgconfig_get_modules( - PREFIX - MODULES ... - [CFLAGS] - [LIBS] - [LIBRARIES] - [LIBRARIES_DIRS] - [INCLUDE_DIRS] -) -``` -## Parameters - -### PREFIX -Used variable prefix to use - -### MODULES -List of pkgconfig modules to retrieve information for. - -### LIBS -Returns `"${PKGCONFIG}" --libs` in _LIBS_(DEBUG|RELEASE) - -### LIBRARIES -Returns `"${PKGCONFIG}" --libs-only-l` in _LIBRARIES_(DEBUG|RELEASE) - -### LIBRARIES_DIRS -Returns `"${PKGCONFIG}" --libs-only-L` in _LIBRARIES_DIRS_(DEBUG|RELEASE) - -### INCLUDE_DIRS -Returns `"${PKGCONFIG}" --cflags-only-I` in _INCLUDE_DIRS_(DEBUG|RELEASE) - -## Examples - -* [qt5-base](https://github.com/microsoft/vcpkg/blob/master/ports/qt5-base/portfile.cmake) -#]===] -if(Z_VCPKG_PKGCONFIG_GET_MODULES_GUARD) - return() -endif() -set(Z_VCPKG_PKGCONFIG_GET_MODULES_GUARD ON CACHE INTERNAL "guard variable") +include_guard(GLOBAL) function(x_vcpkg_pkgconfig_get_modules) cmake_parse_arguments(PARSE_ARGV 0 "arg" "CFLAGS;LIBS;LIBRARIES;LIBRARIES_DIR;INCLUDE_DIRS" "PREFIX" "MODULES") diff --git a/ports/vcpkg-qmake/vcpkg.json b/ports/vcpkg-qmake/vcpkg.json index ea5b8a11d3..727763343e 100644 --- a/ports/vcpkg-qmake/vcpkg.json +++ b/ports/vcpkg-qmake/vcpkg.json @@ -1,6 +1,8 @@ { "name": "vcpkg-qmake", "version-date": "2022-05-10", + "port-version": 1, + "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "supports": "native", "dependencies": [ diff --git a/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake b/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake index 86222e0993..89edab5d85 100644 --- a/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake +++ b/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake @@ -1,37 +1,5 @@ -#[===[.md: -# vcpkg_qmake_configure - -Configure a qmake-based project. - -###User setable triplet variables: -VCPKG_OSX_DEPLOYMENT_TARGET: Determines QMAKE_MACOSX_DEPLOYMENT_TARGET -VCPKG_QMAKE_COMMAND: Path to qmake. (default: "${CURRENT_HOST_INSTALLED_DIR}/tools/Qt6/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}") -VCPKG_QT_CONF_(RELEASE|DEBUG): Path to qt.config being used for RELEASE/DEBUG. (default: "${CURRENT_INSTALLED_DIR}/tools/Qt6/qt_(release|debug).conf") -VCPKG_QMAKE_OPTIONS(_RELEASE|_DEBUG)?: Extra options to pass to QMake - -```cmake -vcpkg_qmake_configure( - SOURCE_PATH - [QMAKE_OPTIONS arg1 [arg2 ...]] - [QMAKE_OPTIONS_RELEASE arg1 [arg2 ...]] - [QMAKE_OPTIONS_DEBUG arg1 [arg2 ...]] - [OPTIONS arg1 [arg2 ...]] - [OPTIONS_RELEASE arg1 [arg2 ...]] - [OPTIONS_DEBUG arg1 [arg2 ...]] -) -``` - -### SOURCE_PATH -The path to the *.pro qmake project file. - -### QMAKE_OPTIONS, QMAKE_OPTIONS\_RELEASE, QMAKE_OPTIONS\_DEBUG -options directly passed to qmake with the form QMAKE_X=something or CONFIG=something - -### OPTIONS, OPTIONS\_RELEASE, OPTIONS\_DEBUG -The options passed after -- to qmake. - -#]===] include_guard(GLOBAL) + function(vcpkg_qmake_configure) cmake_parse_arguments(PARSE_ARGV 0 arg "" "SOURCE_PATH" "QMAKE_OPTIONS;QMAKE_OPTIONS_RELEASE;QMAKE_OPTIONS_DEBUG;OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG") diff --git a/scripts/azure-pipelines/windows/azure-pipelines.yml b/scripts/azure-pipelines/windows/azure-pipelines.yml index 6f9220b0c9..a456464383 100644 --- a/scripts/azure-pipelines/windows/azure-pipelines.yml +++ b/scripts/azure-pipelines/windows/azure-pipelines.yml @@ -46,14 +46,6 @@ jobs: - script: .\scripts\azure-pipelines\windows\bootstrap-from-source.cmd ${{ parameters.vcpkgToolSha }} displayName: "Build vcpkg with CMake" condition: ne('use default', '${{ parameters.vcpkgToolSha }}') - # Note that we run docs checks before PR checks because they are likely to invalidate a whole run anyway - - task: Powershell@2 - displayName: 'Generate Documentation' - condition: eq('${{ parameters.triplet }}', '${{ variables.ExtraChecksTriplet }}') - inputs: - filePath: 'docs/regenerate.ps1' - arguments: '-VcpkgRoot . -WarningAction Stop' - pwsh: true - script: '.\vcpkg.exe format-manifest --all' displayName: 'Format Manifests' condition: eq('${{ parameters.triplet }}', '${{ variables.ExtraChecksTriplet }}') diff --git a/scripts/cmake/execute_process.cmake b/scripts/cmake/execute_process.cmake index be45604d6b..a338dda361 100644 --- a/scripts/cmake/execute_process.cmake +++ b/scripts/cmake/execute_process.cmake @@ -1,12 +1,3 @@ -#[===[.md: -# execute_process - -Intercepts all calls to execute_process() inside portfiles and fails when Download Mode -is enabled. - -In order to execute a process in Download Mode call `vcpkg_execute_in_download_mode()` instead. -#]===] - if (NOT DEFINED Z_VCPKG_OVERRIDEN_EXECUTE_PROCESS) set(Z_VCPKG_OVERRIDEN_EXECUTE_PROCESS ON) diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake index dcd93ed4f9..6fd681afa8 100644 --- a/scripts/cmake/vcpkg_acquire_msys.cmake +++ b/scripts/cmake/vcpkg_acquire_msys.cmake @@ -1,61 +1,3 @@ -#[===[.md: -# vcpkg_acquire_msys - -Download and prepare an MSYS2 instance. - -## Usage -```cmake -vcpkg_acquire_msys( - PACKAGES ... - [NO_DEFAULT_PACKAGES] - [DIRECT_PACKAGES ...] -) -``` - -## Parameters -### MSYS_ROOT_VAR -An out-variable that will be set to the path to MSYS2. - -### PACKAGES -A list of packages to acquire in msys. - -To ensure a package is available: `vcpkg_acquire_msys(MSYS_ROOT PACKAGES make automake1.16)` - -### NO_DEFAULT_PACKAGES -Exclude the normal base packages. - -The list of base packages includes: bash, coreutils, sed, grep, gawk, gzip, diffutils, make, and pkg-config - -### DIRECT_PACKAGES -A list of URL/SHA512 pairs to acquire in msys. - -This parameter can be used by a port to privately extend the list of msys packages to be acquired. -The URLs can be found on the msys2 website[1] and should be a direct archive link: - - https://repo.msys2.org/mingw/i686/mingw-w64-i686-gettext-0.19.8.1-9-any.pkg.tar.zst - -[1] https://packages.msys2.org/search - -## Notes -A call to `vcpkg_acquire_msys` will usually be followed by a call to `bash.exe`: -```cmake -vcpkg_acquire_msys(MSYS_ROOT) -set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) - -vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${CMAKE_CURRENT_LIST_DIR}\\build.sh" - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME build-${TARGET_TRIPLET}-rel -) -``` - -## Examples - -* [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake) -* [icu](https://github.com/Microsoft/vcpkg/blob/master/ports/icu/portfile.cmake) -* [libvpx](https://github.com/Microsoft/vcpkg/blob/master/ports/libvpx/portfile.cmake) -#]===] - # Mirror list from https://github.com/msys2/MSYS2-packages/blob/master/pacman-mirrors/mirrorlist.msys # Sourceforge is not used because it does not keep older package versions set(Z_VCPKG_ACQUIRE_MSYS_MIRRORS diff --git a/scripts/cmake/vcpkg_add_to_path.cmake b/scripts/cmake/vcpkg_add_to_path.cmake index b17aca3680..1ea11a6654 100644 --- a/scripts/cmake/vcpkg_add_to_path.cmake +++ b/scripts/cmake/vcpkg_add_to_path.cmake @@ -1,27 +1,3 @@ -#[===[ -# vcpkg_add_to_path - -Add a directory or directories to the PATH environment variable - -```cmake -vcpkg_add_to_path([PREPEND] [...]) -``` - -`vcpkg_add_to_path` adds all of the paths passed to it to the PATH environment variable. -If PREPEND is passed, then those paths are prepended to the PATH environment variable, -so that they are searched first; otherwise, those paths are appended, so they are -searched after the paths which are already in the environment variable. - -The paths are added in the order received, so that the first path is always searched -before a later path. - -If no paths are passed, then nothing will be done. - -## Examples: -* [curl](https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake#L75) -* [folly](https://github.com/Microsoft/vcpkg/blob/master/ports/folly/portfile.cmake#L15) -* [z3](https://github.com/Microsoft/vcpkg/blob/master/ports/z3/portfile.cmake#L13) -#]===] function(vcpkg_add_to_path) cmake_parse_arguments(PARSE_ARGV 0 "arg" "PREPEND" "" "") if(arg_PREPEND) diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index dae9e6018b..1a3756ec58 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -1,19 +1,3 @@ -# DEPRECATED: in favor of the `PATCHES` argument to [`vcpkg_from_github()`](vcpkg_from_github.md) et al. - -#[===[.md -# vcpkg_apply_patches - -Apply a set of patches to a source tree. - -```cmake -vcpkg_apply_patches( - SOURCE_PATH <${SOURCE_PATH}> - [QUIET] - PATCHES ... -) -``` -#]===] - function(vcpkg_apply_patches) z_vcpkg_deprecation_message("vcpkg_apply_patches has been deprecated in favor of the `PATCHES` argument to `vcpkg_from_*`.") diff --git a/scripts/cmake/vcpkg_backup_restore_env_vars.cmake b/scripts/cmake/vcpkg_backup_restore_env_vars.cmake index d7eb5f3839..63220f4349 100644 --- a/scripts/cmake/vcpkg_backup_restore_env_vars.cmake +++ b/scripts/cmake/vcpkg_backup_restore_env_vars.cmake @@ -1,27 +1,3 @@ -#[===[.md: -# vcpkg_backup_restore_env_vars - -Backup or restore the environment variables - -## Usage: -```cmake -vcpkg_backup_env_variables(VARS [...]) -vcpkg_restore_env_variables(VARS [...]) -``` - -### VARS -The variables to back up or restore. -These are placed in the parent scope, so you must backup and restore -from the same scope. - -## Notes -One must always call `vcpkg_backup_env_variables` before -`vcpkg_restore_env_variables`; however, `vcpkg_restore_env_variables` -does not change the back up variables, and so you may call `restore` -multiple times for one `backup`. - -#]===] - function(vcpkg_backup_env_variables) cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "VARS") if(NOT DEFINED arg_VARS) diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index cd8952f5df..592f6508ee 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -1,38 +1,3 @@ -# DEPRECATED BY ports/vcpkg-cmake/vcpkg_cmake_build -#[===[.md: -# vcpkg_build_cmake - -Build a cmake project. - -## Usage: -```cmake -vcpkg_build_cmake([DISABLE_PARALLEL] [TARGET ]) -``` - -## Parameters: -### DISABLE_PARALLEL -The underlying buildsystem will be instructed to not parallelize - -### TARGET -The target passed to the cmake build command (`cmake --build . --target `). 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 preceded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). -You can use the alias [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the -"install" target - -## Examples: - -* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) -* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -* [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) -* [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) -#]===] - function(vcpkg_build_cmake) cmake_parse_arguments(PARSE_ARGV 0 "arg" "DISABLE_PARALLEL;ADD_BIN_TO_PATH" diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake index dd5b061eea..11e4072cc0 100644 --- a/scripts/cmake/vcpkg_build_make.cmake +++ b/scripts/cmake/vcpkg_build_make.cmake @@ -1,58 +1,3 @@ -#[===[.md: -# vcpkg_build_make - -Build a linux makefile project. - -## Usage: -```cmake -vcpkg_build_make([BUILD_TARGET ] - [INSTALL_TARGET ] - [ADD_BIN_TO_PATH] - [ENABLE_INSTALL] - [MAKEFILE ] - [LOGFILE_ROOT ] - [DISABLE_PARALLEL] - [SUBPATH ]) -``` - -### BUILD_TARGET -The target passed to the make build command (`./make `). If not specified, the 'all' target will -be passed. - -### INSTALL_TARGET -The target passed to the make build command (`./make `) if `ENABLE_INSTALL` is used. Defaults to 'install'. - -### 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. - -### ENABLE_INSTALL -IF the port supports the install target use vcpkg_install_make() instead of vcpkg_build_make() - -### MAKEFILE -Specifies the Makefile as a relative path from the root of the sources passed to `vcpkg_configure_make()` - -### LOGFILE_ROOT -Specifies a log file prefix. - -### DISABLE_PARALLEL -The underlying buildsystem will be instructed to not parallelize - -### SUBPATH -Additional subdir to invoke make in. Useful if only parts of a port should be built. - -## Notes: -This command should be preceded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md). -You can use the alias [`vcpkg_install_make()`](vcpkg_install_make.md) function if your makefile 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) z_vcpkg_get_cmake_vars(cmake_vars_file) include("${cmake_vars_file}") diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake index 831887dc29..90fb313c90 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -1,67 +1,3 @@ -#[===[.md: -# vcpkg_build_msbuild - -Build a msbuild-based project. Deprecated in favor of `vcpkg_install_msbuild()`. - -## Usage -```cmake -vcpkg_build_msbuild( - PROJECT_PATH <${SOURCE_PATH}/port.sln> - [RELEASE_CONFIGURATION ] - [DEBUG_CONFIGURATION ] - [TARGET ] - [TARGET_PLATFORM_VERSION <10.0.15063.0>] - [PLATFORM <${TRIPLET_SYSTEM_ARCH}>] - [PLATFORM_TOOLSET <${VCPKG_PLATFORM_TOOLSET}>] - [OPTIONS ...] - [OPTIONS_RELEASE ...] - [OPTIONS_DEBUG ...] - [USE_VCPKG_INTEGRATION] -) -``` - -## Parameters -### USE_VCPKG_INTEGRATION -Apply the normal `integrate install` integration for building the project. - -By default, projects built with this command will not automatically link libraries or have header paths set. - -### PROJECT_PATH -The path to the solution (`.sln`) or project (`.vcxproj`) file. - -### RELEASE_CONFIGURATION -The configuration (``/p:Configuration`` msbuild parameter) used for Release builds. - -### DEBUG_CONFIGURATION -The configuration (``/p:Configuration`` msbuild parameter) -used for Debug builds. - -### TARGET_PLATFORM_VERSION -The WindowsTargetPlatformVersion (``/p:WindowsTargetPlatformVersion`` msbuild parameter) - -### TARGET -The MSBuild target to build. (``/t:``) - -### PLATFORM -The platform (``/p:Platform`` msbuild parameter) used for the build. - -### PLATFORM_TOOLSET -The platform toolset (``/p:PlatformToolset`` msbuild parameter) used for the build. - -### OPTIONS -Additional options passed to msbuild for all builds. - -### OPTIONS_RELEASE -Additional options passed to msbuild for Release builds. These are in addition to `OPTIONS`. - -### OPTIONS_DEBUG -Additional options passed to msbuild for Debug builds. These are in addition to `OPTIONS`. - -## Examples - -* [chakracore](https://github.com/Microsoft/vcpkg/blob/master/ports/chakracore/portfile.cmake) -#]===] - function(vcpkg_build_msbuild) cmake_parse_arguments( PARSE_ARGV 0 diff --git a/scripts/cmake/vcpkg_build_ninja.cmake b/scripts/cmake/vcpkg_build_ninja.cmake index 5a0a1755fa..a06f350246 100644 --- a/scripts/cmake/vcpkg_build_ninja.cmake +++ b/scripts/cmake/vcpkg_build_ninja.cmake @@ -1,20 +1,3 @@ -#[===[.md: -# vcpkg_build_ninja - -Build a ninja project - -## Usage: -```cmake -vcpkg_build_ninja( - [TARGETS ...] -) -``` - -## Parameters: -### TARGETS -Only build the specified targets. -#]===] - function(z_vcpkg_build_ninja_build config targets) message(STATUS "Building (${config})...") vcpkg_execute_build_process( diff --git a/scripts/cmake/vcpkg_build_nmake.cmake b/scripts/cmake/vcpkg_build_nmake.cmake index 282e04f5f6..54b132b315 100755 --- a/scripts/cmake/vcpkg_build_nmake.cmake +++ b/scripts/cmake/vcpkg_build_nmake.cmake @@ -1,73 +1,3 @@ -#[===[.md: -# vcpkg_build_nmake - -Build a msvc makefile project. - -## Usage: -```cmake -vcpkg_build_nmake( - SOURCE_PATH <${SOURCE_PATH}> - [NO_DEBUG] - [ENABLE_INSTALL] - [TARGET ] - [PROJECT_SUBPATH <${SUBPATH}>] - [PROJECT_NAME <${MAKEFILE_NAME}>] - [PRERUN_SHELL <${SHELL_PATH}>] - [PRERUN_SHELL_DEBUG <${SHELL_PATH}>] - [PRERUN_SHELL_RELEASE <${SHELL_PATH}>] - [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` - -### ENABLE_INSTALL -Install binaries after build. - -### PRERUN_SHELL -Script that needs to be called before build - -### PRERUN_SHELL_DEBUG -Script that needs to be called before debug build - -### PRERUN_SHELL_RELEASE -Script that needs to be called before release 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. - -## Notes: -You can use the alias [`vcpkg_install_nmake()`](vcpkg_install_nmake.md) function if your makefile 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(PARSE_ARGV 0 arg "ADD_BIN_TO_PATH;ENABLE_INSTALL;NO_DEBUG" diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake index eea3b822cf..c64a9f2742 100644 --- a/scripts/cmake/vcpkg_build_qmake.cmake +++ b/scripts/cmake/vcpkg_build_qmake.cmake @@ -1,13 +1,3 @@ -#[===[.md: -# vcpkg_build_qmake - -Build a qmake-based project, previously configured using vcpkg_configure_qmake. - -```cmake -vcpkg_build_qmake() -``` -#]===] - function(z_run_jom_build invoke_command targets log_prefix log_suffix) message(STATUS "Package ${log_prefix}-${TARGET_TRIPLET}-${log_suffix}") vcpkg_execute_build_process( diff --git a/scripts/cmake/vcpkg_buildpath_length_warning.cmake b/scripts/cmake/vcpkg_buildpath_length_warning.cmake index 7b4032e7cd..bb7d6844d3 100644 --- a/scripts/cmake/vcpkg_buildpath_length_warning.cmake +++ b/scripts/cmake/vcpkg_buildpath_length_warning.cmake @@ -1,17 +1,3 @@ -#[===[.md: -# vcpkg_buildpath_length_warning - -Warns the user if their vcpkg installation path might be too long for the package they're installing. - -```cmake -vcpkg_buildpath_length_warning() -``` - -`vcpkg_buildpath_length_warning` warns the user if the number of bytes in the -path to `buildtrees` is bigger than `N`. Note that this is simply a warning, -and isn't relied on for correctness. -#]===] - function(vcpkg_buildpath_length_warning warning_length) string(LENGTH "${CURRENT_BUILDTREES_DIR}" buildtrees_path_length) if(buildtrees_path_length GREATER warning_length AND CMAKE_HOST_WIN32) diff --git a/scripts/cmake/vcpkg_check_features.cmake b/scripts/cmake/vcpkg_check_features.cmake index 5f4c5339b6..d0573d77a3 100644 --- a/scripts/cmake/vcpkg_check_features.cmake +++ b/scripts/cmake/vcpkg_check_features.cmake @@ -1,137 +1,3 @@ -#[===[.md: -# vcpkg_check_features -Check if one or more features are a part of a package installation. - -```cmake -vcpkg_check_features( - OUT_FEATURE_OPTIONS - [PREFIX ] - [FEATURES - [ ]... - ] - [INVERTED_FEATURES - [ ]... - ] -) -``` - -The `` should be set to `FEATURE_OPTIONS` by convention. - -`vcpkg_check_features()` will: - -- for each `` passed in `FEATURES`: - - if the feature is set, add `-D=ON` to ``, - and set `_` to ON. - - if the feature is not set, add `-D=OFF` to ``, - and set `_` to OFF. -- for each `` passed in `INVERTED_FEATURES`: - - if the feature is set, add `-D=OFF` to ``, - and set `_` to OFF. - - if the feature is not set, add `-D=ON` to ``, - and set `_` to ON. - -If `` is not passed, then the feature vars set are simply ``, -not `_`. - -If `INVERTED_FEATURES` is not passed, then the `FEATURES` keyword is optional. -This behavior is deprecated. - -If the same `` is passed multiple times, -then `vcpkg_check_features` will cause a fatal error, -since that is a bug. - -## Examples - -### Example 1: Regular features - -```cmake -$ ./vcpkg install mimalloc[asm,secure] - -# ports/mimalloc/portfile.cmake -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - asm MI_SEE_ASM - override MI_OVERRIDE - secure MI_SECURE -) - -vcpkg_cmake_configure( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - # Expands to "-DMI_SEE_ASM=ON;-DMI_OVERRIDE=OFF;-DMI_SECURE=ON" - ${FEATURE_OPTIONS} -) -``` - -### Example 2: Inverted features - -```cmake -$ ./vcpkg install cpprestsdk[websockets] - -# ports/cpprestsdk/portfile.cmake -vcpkg_check_features( - INVERTED_FEATURES - brotli CPPREST_EXCLUDE_BROTLI - websockets CPPREST_EXCLUDE_WEBSOCKETS -) - -vcpkg_cmake_configure( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - # Expands to "-DCPPREST_EXCLUDE_BROTLI=ON;-DCPPREST_EXCLUDE_WEBSOCKETS=OFF" - ${FEATURE_OPTIONS} -) -``` - -### Example 3: Set multiple options for same feature - -```cmake -$ ./vcpkg install pcl[cuda] - -# ports/pcl/portfile.cmake -vcpkg_check_features( - FEATURES - cuda WITH_CUDA - cuda BUILD_CUDA - cuda BUILD_GPU -) - -vcpkg_cmake_configure( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - # Expands to "-DWITH_CUDA=ON;-DBUILD_CUDA=ON;-DBUILD_GPU=ON" - ${FEATURE_OPTIONS} -) -``` - -### Example 4: Use regular and inverted features - -```cmake -$ ./vcpkg install rocksdb[tbb] - -# ports/rocksdb/portfile.cmake -vcpkg_check_features( - FEATURES - tbb WITH_TBB - INVERTED_FEATURES - tbb ROCKSDB_IGNORE_PACKAGE_TBB -) - -vcpkg_cmake_configure( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - # Expands to "-DWITH_TBB=ON;-DROCKSDB_IGNORE_PACKAGE_TBB=OFF" - ${FEATURE_OPTIONS} -) -``` - -## Examples in portfiles - -* [cpprestsdk](https://github.com/microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -* [pcl](https://github.com/microsoft/vcpkg/blob/master/ports/pcl/portfile.cmake) -* [rocksdb](https://github.com/microsoft/vcpkg/blob/master/ports/rocksdb/portfile.cmake) -#]===] - function(z_vcpkg_check_features_last_feature out_var features_name features_list) list(LENGTH features_list features_length) math(EXPR features_length_mod_2 "${features_length} % 2") diff --git a/scripts/cmake/vcpkg_check_linkage.cmake b/scripts/cmake/vcpkg_check_linkage.cmake index f2e9fe10aa..63242932df 100644 --- a/scripts/cmake/vcpkg_check_linkage.cmake +++ b/scripts/cmake/vcpkg_check_linkage.cmake @@ -1,39 +1,3 @@ -#[===[.md: -# vcpkg_check_linkage - -Asserts the available library and CRT linkage options for the port. - -## Usage -```cmake -vcpkg_check_linkage( - [ONLY_STATIC_LIBRARY | ONLY_DYNAMIC_LIBRARY] - [ONLY_STATIC_CRT | ONLY_DYNAMIC_CRT] -) -``` - -## Parameters -### ONLY_STATIC_LIBRARY -Indicates that this port can only be built with static library linkage. - -Note: If the user requested a dynamic build ONLY_STATIC_LIBRARY will result in a note being printed, not a fatal error. - -### ONLY_DYNAMIC_LIBRARY -Indicates that this port can only be built with dynamic/shared library linkage. - -### ONLY_STATIC_CRT -Indicates that this port can only be built with static CRT linkage. - -### ONLY_DYNAMIC_CRT -Indicates that this port can only be built with dynamic/shared CRT linkage. - -## Notes -This command will either alter the settings for `VCPKG_LIBRARY_LINKAGE` or fail, depending on what was requested by the user versus what the library supports. - -## Examples - -* [abseil](https://github.com/Microsoft/vcpkg/blob/master/ports/abseil/portfile.cmake) -#]===] - function(vcpkg_check_linkage) cmake_parse_arguments(PARSE_ARGV 0 arg "ONLY_STATIC_LIBRARY;ONLY_DYNAMIC_LIBRARY;ONLY_DYNAMIC_CRT;ONLY_STATIC_CRT" diff --git a/scripts/cmake/vcpkg_clean_executables_in_bin.cmake b/scripts/cmake/vcpkg_clean_executables_in_bin.cmake index e1cea3a958..35cf8a6a31 100644 --- a/scripts/cmake/vcpkg_clean_executables_in_bin.cmake +++ b/scripts/cmake/vcpkg_clean_executables_in_bin.cmake @@ -1,26 +1,3 @@ -#[===[.md: -# vcpkg_clean_executables_in_bin - -Remove specified executables found in `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`. If, after all specified executables have been removed, and the `bin` and `debug/bin` directories are empty, then also delete `bin` and `debug/bin` directories. - -## Usage -```cmake -vcpkg_clean_executables_in_bin( - FILE_NAMES ... -) -``` - -## Parameters -### FILE_NAMES -A list of executable filenames without extension. - -## Notes -Generally, there is no need to call this function manually. Instead, pass an extra `AUTO_CLEAN` argument when calling `vcpkg_copy_tools`. - -## Examples -* [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) -#]===] - function(z_vcpkg_clean_executables_in_bin_remove_directory_if_empty directory) if(NOT EXISTS "${directory}") return() diff --git a/scripts/cmake/vcpkg_clean_msbuild.cmake b/scripts/cmake/vcpkg_clean_msbuild.cmake index 068208fb8b..904f40ae89 100644 --- a/scripts/cmake/vcpkg_clean_msbuild.cmake +++ b/scripts/cmake/vcpkg_clean_msbuild.cmake @@ -1,18 +1,3 @@ -#[===[.md: -# vcpkg_clean_msbuild - -Clean intermediate files generated by `vcpkg_install_msbuild()`. - -## Usage -```cmake -vcpkg_clean_msbuild() -``` - -## Examples - -* [python3](https://github.com/Microsoft/vcpkg/blob/master/ports/python3/portfile.cmake) -#]===] - function(vcpkg_clean_msbuild) if(NOT ARGC EQUAL 0) message(WARNING "vcpkg_clean_msbuild was passed extra arguments: ${ARGV}") diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index 40c8183f1b..0a1ef1a969 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -1,37 +1,3 @@ -#[===[.md: -# vcpkg_common_definitions - -This file defines the following variables which are commonly needed or used in portfiles: - -```cmake -VCPKG_TARGET_IS_ with being one of the following: WINDOWS, UWP, MINGW, LINUX, OSX, ANDROID, FREEBSD, OPENBSD. only defined if -VCPKG_HOST_IS_ with being one of the following: WINDOWS, LINUX, OSX, FREEBSD, OPENBSD. only defined if -VCPKG_HOST_PATH_SEPARATOR Host specific path separator (USAGE: "${VCPKG_HOST_PATH_SEPARATOR}"; only use and pass variables with VCPKG_HOST_PATH_SEPARATOR within "") -VCPKG_HOST_EXECUTABLE_SUFFIX executable suffix of the host -VCPKG_TARGET_EXECUTABLE_SUFFIX executable suffix of the target -VCPKG_HOST_BUNDLE_SUFFIX bundle suffix of the host -VCPKG_TARGET_BUNDLE_SUFFIX bundle suffix of the target -VCPKG_TARGET_STATIC_LIBRARY_PREFIX static library prefix for target (same as CMAKE_STATIC_LIBRARY_PREFIX) -VCPKG_TARGET_STATIC_LIBRARY_SUFFIX static library suffix for target (same as CMAKE_STATIC_LIBRARY_SUFFIX) -VCPKG_TARGET_SHARED_LIBRARY_PREFIX shared library prefix for target (same as CMAKE_SHARED_LIBRARY_PREFIX) -VCPKG_TARGET_SHARED_LIBRARY_SUFFIX shared library suffix for target (same as CMAKE_SHARED_LIBRARY_SUFFIX) -VCPKG_TARGET_IMPORT_LIBRARY_PREFIX import library prefix for target (same as CMAKE_IMPORT_LIBRARY_PREFIX) -VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX import library suffix for target (same as CMAKE_IMPORT_LIBRARY_SUFFIX) -VCPKG_FIND_LIBRARY_PREFIXES target dependent prefixes used for find_library calls in portfiles -VCPKG_FIND_LIBRARY_SUFFIXES target dependent suffixes used for find_library calls in portfiles -VCPKG_SYSTEM_LIBRARIES list of libraries are provide by the toolchain and are not managed by vcpkg -TARGET_TRIPLET the name of the current triplet to build for -CURRENT_INSTALLED_DIR the absolute path to the installed files for the current triplet -HOST_TRIPLET the name of the triplet corresponding to the host -CURRENT_HOST_INSTALLED_DIR the absolute path to the installed files for the host triplet -VCPKG_CROSSCOMPILING Whether vcpkg is cross-compiling: in other words, whether TARGET_TRIPLET and HOST_TRIPLET are different -``` - -CMAKE_STATIC_LIBRARY_(PREFIX|SUFFIX), CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX) and CMAKE_IMPORT_LIBRARY_(PREFIX|SUFFIX) are defined for the target -Furthermore the variables CMAKE_FIND_LIBRARY_(PREFIXES|SUFFIXES) are also defined for the target so that -portfiles are able to use find_library calls to discover dependent libraries within the current triplet for ports. -#]===] - string(COMPARE NOTEQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" VCPKG_CROSSCOMPILING) #Helper variable to identify the Target system. VCPKG_TARGET_IS_ if (NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "") diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 69e2abf9e5..d22734af96 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -1,87 +1,3 @@ -# DEPRECATED BY ports/vcpkg-cmake/vcpkg_cmake_configure -#[===[.md: -# vcpkg_configure_cmake - -Configure CMake for Debug and Release builds of a project. - -## Usage -```cmake -vcpkg_configure_cmake( - SOURCE_PATH <${SOURCE_PATH}> - [PREFER_NINJA] - [DISABLE_PARALLEL_CONFIGURE] - [NO_CHARSET_FLAG] - [GENERATOR <"NMake Makefiles">] - [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] - [OPTIONS_RELEASE <-DOPTIMIZE=1>...] - [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] - [MAYBE_UNUSED_VARIABLES ...] -) -``` - -## Parameters -### SOURCE_PATH -Specifies the directory containing the `CMakeLists.txt`. -By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. - -### PREFER_NINJA -Indicates that, when available, Vcpkg should use Ninja to perform the build. -This should be specified unless the port is known to not work under Ninja. - -### DISABLE_PARALLEL_CONFIGURE -Disables running the CMake configure step in parallel. -This is needed for libraries which write back into their source directory during configure. - -This also disables CMAKE_DISABLE_SOURCE_CHANGES. - -### NO_CHARSET_FLAG -Disables passing `utf-8` as the default character set to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`. - -This is needed for libraries that set their own source code's character set. - -### GENERATOR -Specifies the precise generator to use. - -This is useful if some project-specific buildsystem has been wrapped in a cmake script that won't perform an actual build. -If used for this purpose, it should be set to `"NMake Makefiles"`. - -### OPTIONS -Additional options passed to CMake during the configuration. - -### OPTIONS_RELEASE -Additional options passed to CMake during the Release configuration. These are in addition to `OPTIONS`. - -### OPTIONS_DEBUG -Additional options passed to CMake during the Debug configuration. These are in addition to `OPTIONS`. - -### MAYBE_UNUSED_VARIABLES -Any CMake variables which are explicitly passed in, but which may not be used on all platforms. -For example: -```cmake -vcpkg_cmake_configure( - ... - OPTIONS - -DBUILD_EXAMPLE=OFF - ... - MAYBE_UNUSED_VARIABLES - BUILD_EXAMPLE -) -``` - -### LOGNAME -Name of the log to write the output of the configure call to. - -## Notes -This command supplies many common arguments to CMake. To see the full list, examine the source. - -## Examples - -* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) -* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -* [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) -* [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) -#]===] - function(z_vcpkg_configure_cmake_both_or_neither_set var1 var2) if(DEFINED "${var1}" AND NOT DEFINED "${var2}") message(FATAL_ERROR "If ${var1} is set, ${var2} must be set.") diff --git a/scripts/cmake/vcpkg_configure_gn.cmake b/scripts/cmake/vcpkg_configure_gn.cmake index d3ec8ab59d..3363546467 100644 --- a/scripts/cmake/vcpkg_configure_gn.cmake +++ b/scripts/cmake/vcpkg_configure_gn.cmake @@ -1,34 +1,3 @@ -# DEPRECATED BY ports/vcpkg-gn/vcpkg_gn_configure -#[===[.md: -# vcpkg_configure_gn - -Generate Ninja (GN) targets - -## Usage: -```cmake -vcpkg_configure_gn( - SOURCE_PATH - [OPTIONS ] - [OPTIONS_DEBUG ] - [OPTIONS_RELEASE ] -) -``` - -## Parameters: -### SOURCE_PATH (required) -The path to the GN project. - -### OPTIONS -Options to be passed to both the debug and release targets. -Note: Must be provided as a space-separated string. - -### OPTIONS_DEBUG (space-separated string) -Options to be passed to the debug target. - -### OPTIONS_RELEASE (space-separated string) -Options to be passed to the release target. -#]===] - function(z_vcpkg_configure_gn_generate) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "SOURCE_PATH;CONFIG;ARGS" "") if(DEFINED arg_UNPARSED_ARGUMENTS) diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index f0413a0abe..3ead0e58ed 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -1,95 +1,3 @@ -#[===[.md: -# vcpkg_configure_make - -Configure configure for Debug and Release builds of a project. - -## Usage -```cmake -vcpkg_configure_make( - SOURCE_PATH <${SOURCE_PATH}> - [AUTOCONFIG] - [USE_WRAPPERS] - [DETERMINE_BUILD_TRIPLET] - [BUILD_TRIPLET "--host=x64 --build=i686-unknown-pc"] - [NO_ADDITIONAL_PATHS] - [CONFIG_DEPENDENT_ENVIRONMENT ...] - [CONFIGURE_ENVIRONMENT_VARIABLES ...] - [ADD_BIN_TO_PATH] - [DISABLE_VERBOSE_FLAGS] - [NO_DEBUG] - [SKIP_CONFIGURE] - [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`. - -### SKIP_CONFIGURE -Skip configure process - -### USE_WRAPPERS -Use autotools ar-lib and compile wrappers (only applies to windows cl and lib) - -### BUILD_TRIPLET -Used to pass custom --build/--target/--host to configure. Can be globally overwritten by VCPKG_MAKE_BUILD_TRIPLET - -### DETERMINE_BUILD_TRIPLET -For ports having a configure script following the autotools rules for selecting the triplet - -### NO_ADDITIONAL_PATHS -Don't pass any additional paths except for --prefix to the configure call - -### AUTOCONFIG -Need to use autoconfig to generate configure file. - -### PRERUN_SHELL -Script that needs to be called before configuration (do not use for batch files which simply call autoconf or configure) - -### ADD_BIN_TO_PATH -Adds the appropriate Release and Debug `bin\` directories to the path during configure such that executables can run against the in-tree DLLs. - -### DISABLE_VERBOSE_FLAGS -Do not pass '--disable-silent-rules --verbose' to configure. - -### 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`. - -### CONFIG_DEPENDENT_ENVIRONMENT -List of additional configuration dependent environment variables to set. -Pass SOMEVAR to set the environment and have SOMEVAR_(DEBUG|RELEASE) set in the portfile to the appropriate values -General environment variables can be set from within the portfile itself. - -### CONFIGURE_ENVIRONMENT_VARIABLES -List of additional environment variables to pass via the configure call. - -## 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) -#]===] - macro(z_vcpkg_determine_host_mingw out_var) if(DEFINED ENV{PROCESSOR_ARCHITEW6432}) set(host_arch $ENV{PROCESSOR_ARCHITEW6432}) diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake index 352b3e3e87..94c1a9f616 100644 --- a/scripts/cmake/vcpkg_configure_meson.cmake +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -1,45 +1,3 @@ -#[===[.md: -# vcpkg_configure_meson - -Configure Meson for Debug and Release builds of a project. - -## Usage -```cmake -vcpkg_configure_meson( - SOURCE_PATH <${SOURCE_PATH}> - [NO_PKG_CONFIG] - [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] - [OPTIONS_RELEASE <-DOPTIMIZE=1>...] - [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] -) -``` - -## Parameters -### SOURCE_PATH -Specifies the directory containing the `meson.build`. -By convention, this is usually set in the portfile as the variable `SOURCE_PATH`. - -### OPTIONS -Additional options passed to Meson during the configuration. - -### OPTIONS_RELEASE -Additional options passed to Meson during the Release configuration. These are in addition to `OPTIONS`. - -### OPTIONS_DEBUG -Additional options passed to Meson during the Debug configuration. These are in addition to `OPTIONS`. - -### NO_PKG_CONFIG -Disable pkg-config setup - -## Notes -This command supplies many common arguments to Meson. To see the full list, examine the source. - -## Examples - -* [fribidi](https://github.com/Microsoft/vcpkg/blob/master/ports/fribidi/portfile.cmake) -* [libepoxy](https://github.com/Microsoft/vcpkg/blob/master/ports/libepoxy/portfile.cmake) -#]===] - function(z_vcpkg_append_proglist var_to_append additional_binaries) string(APPEND "${var_to_append}" "[binaries]\n") if(VCPKG_TARGET_IS_WINDOWS) diff --git a/scripts/cmake/vcpkg_configure_qmake.cmake b/scripts/cmake/vcpkg_configure_qmake.cmake index bf22078735..9a5ed00ceb 100644 --- a/scripts/cmake/vcpkg_configure_qmake.cmake +++ b/scripts/cmake/vcpkg_configure_qmake.cmake @@ -1,30 +1,3 @@ -#[===[.md: -# vcpkg_configure_qmake - -Configure a qmake-based project. - -```cmake -vcpkg_configure_qmake( - SOURCE_PATH - [OPTIONS arg1 [arg2 ...]] - [OPTIONS_RELEASE arg1 [arg2 ...]] - [OPTIONS_DEBUG arg1 [arg2 ...]] - [BUILD_OPTIONS arg1 [arg2 ...]] - [BUILD_OPTIONS_RELEASE arg1 [arg2 ...]] - [BUILD_OPTIONS_DEBUG arg1 [arg2 ...]] -) -``` - -### SOURCE_PATH -The path to the *.pro qmake project file. - -### OPTIONS, OPTIONS\_RELEASE, OPTIONS\_DEBUG -The options passed to qmake to the configure step. - -### BUILD\_OPTIONS, BUILD\_OPTIONS\_RELEASE, BUILD\_OPTIONS\_DEBUG -The options passed to qmake to the build step. -#]===] - function(vcpkg_configure_qmake) # parse parameters such that semicolons in options arguments to COMMAND don't get erased cmake_parse_arguments(PARSE_ARGV 0 arg diff --git a/scripts/cmake/vcpkg_copy_pdbs.cmake b/scripts/cmake/vcpkg_copy_pdbs.cmake index 7e5c81e6d7..ce26c8d1ff 100644 --- a/scripts/cmake/vcpkg_copy_pdbs.cmake +++ b/scripts/cmake/vcpkg_copy_pdbs.cmake @@ -1,29 +1,3 @@ -#[===[.md: -# vcpkg_copy_pdbs - -Automatically locate pdbs in the build tree and copy them adjacent to all DLLs. - -```cmake -vcpkg_copy_pdbs( - [BUILD_PATHS ...]) -``` - -The ``s are patterns which will be passed to `file(GLOB_RECURSE)`, -for locating DLLs. It defaults to using: - -- `${CURRENT_PACKAGES_DIR}/bin/*.dll` -- `${CURRENT_PACKAGES_DIR}/debug/bin/*.dll` - -since that is generally where DLLs are located. - -## Notes -This command should always be called by portfiles after they have finished rearranging the binary output. - -## Examples - -* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) -* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -#]===] function(vcpkg_copy_pdbs) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "" "BUILD_PATHS") diff --git a/scripts/cmake/vcpkg_copy_tool_dependencies.cmake b/scripts/cmake/vcpkg_copy_tool_dependencies.cmake index b2c36a8e5b..cf3939bacb 100644 --- a/scripts/cmake/vcpkg_copy_tool_dependencies.cmake +++ b/scripts/cmake/vcpkg_copy_tool_dependencies.cmake @@ -1,24 +1,3 @@ -#[===[.md: -# vcpkg_copy_tool_dependencies - -Copy all DLL dependencies of built tools into the tool folder. - -## Usage -```cmake -vcpkg_copy_tool_dependencies(<${CURRENT_PACKAGES_DIR}/tools/${PORT}>) -``` -## Parameters -The path to the directory containing the tools. - -## Notes -This command should always be called by portfiles after they have finished rearranging the binary output, if they have any tools. - -## Examples - -* [glib](https://github.com/Microsoft/vcpkg/blob/master/ports/glib/portfile.cmake) -* [fltk](https://github.com/Microsoft/vcpkg/blob/master/ports/fltk/portfile.cmake) -#]===] - function(z_vcpkg_copy_tool_dependencies_search tool_dir path_to_search) if(DEFINED Z_VCPKG_COPY_TOOL_DEPENDENCIES_COUNT) set(count ${Z_VCPKG_COPY_TOOL_DEPENDENCIES_COUNT}) diff --git a/scripts/cmake/vcpkg_copy_tools.cmake b/scripts/cmake/vcpkg_copy_tools.cmake index a9c19870b0..d9b3b95232 100644 --- a/scripts/cmake/vcpkg_copy_tools.cmake +++ b/scripts/cmake/vcpkg_copy_tools.cmake @@ -1,37 +1,3 @@ -#[===[.md: -# vcpkg_copy_tools - -Copy tools and all their DLL dependencies into the `tools` folder. - -## Usage -```cmake -vcpkg_copy_tools( - TOOL_NAMES ... - [SEARCH_DIR <${CURRENT_PACKAGES_DIR}/bin>] - [DESTINATION <${CURRENT_PACKAGES_DIR}/tools/${PORT}>] - [AUTO_CLEAN] -) -``` -## Parameters -### TOOL_NAMES -A list of tool filenames without extension. - -### SEARCH_DIR -The path to the directory containing the tools. This will be set to `${CURRENT_PACKAGES_DIR}/bin` if omitted. - -### DESTINATION -Destination to copy the tools to. This will be set to `${CURRENT_PACKAGES_DIR}/tools/${PORT}` if omitted. - -### AUTO_CLEAN -Auto clean the copied executables from `${CURRENT_PACKAGES_DIR}/bin` and `${CURRENT_PACKAGES_DIR}/debug/bin`. - -## Examples - -* [cpuinfo](https://github.com/microsoft/vcpkg/blob/master/ports/cpuinfo/portfile.cmake) -* [nanomsg](https://github.com/microsoft/vcpkg/blob/master/ports/nanomsg/portfile.cmake) -* [uriparser](https://github.com/microsoft/vcpkg/blob/master/ports/uriparser/portfile.cmake) -#]===] - function(vcpkg_copy_tools) cmake_parse_arguments(PARSE_ARGV 0 arg "AUTO_CLEAN" "SEARCH_DIR;DESTINATION" "TOOL_NAMES") diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index d9339e059f..5277129f82 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -1,63 +1,3 @@ -#[===[.md: -# vcpkg_download_distfile - -Download and cache a file needed for this port. - -This helper should always be used instead of CMake's built-in `file(DOWNLOAD)` command. - -## Usage -```cmake -vcpkg_download_distfile( - - URLS ... - FILENAME - SHA512 <5981de...> - [ALWAYS_REDOWNLOAD] -) -``` -## Parameters -### OUT_VARIABLE -This variable will be set to the full path to the downloaded file. This can then immediately be passed in to [`vcpkg_extract_source_archive`](vcpkg_extract_source_archive.md) for sources. - -### URLS -A list of URLs to be consulted. They will be tried in order until one of the downloaded files successfully matches the SHA512 given. - -### FILENAME -The local name for the file. Files are shared between ports, so the file may need to be renamed to make it clearly attributed to this port and avoid conflicts. - -### SHA512 -The expected hash for the file. - -If this doesn't match the downloaded version, the build will be terminated with a message describing the mismatch. - -### QUIET -Suppress output on cache hit - -### SKIP_SHA512 -Skip SHA512 hash check for file. - -This switch is only valid when building with the `--head` command line flag. - -### ALWAYS_REDOWNLOAD -Avoid caching; this is a REST call or otherwise unstable. - -Requires `SKIP_SHA512`. - -### HEADERS -A list of headers to append to the download request. This can be used for authentication during a download. - -Headers should be specified as ": ". - -## Notes -The helper [`vcpkg_from_github`](vcpkg_from_github.md) should be used for downloading from GitHub projects. - -## Examples - -* [apr](https://github.com/Microsoft/vcpkg/blob/master/ports/apr/portfile.cmake) -* [fontconfig](https://github.com/Microsoft/vcpkg/blob/master/ports/fontconfig/portfile.cmake) -* [freetype](https://github.com/Microsoft/vcpkg/blob/master/ports/freetype/portfile.cmake) -#]===] - function(z_vcpkg_download_distfile_test_hash file_path kind error_advice sha512 skip_sha512) if(_VCPKG_INTERNAL_NO_HASH_CHECK) # When using the internal hash skip, do not output an explicit message. diff --git a/scripts/cmake/vcpkg_execute_build_process.cmake b/scripts/cmake/vcpkg_execute_build_process.cmake index 921196cc28..a2545c8b01 100644 --- a/scripts/cmake/vcpkg_execute_build_process.cmake +++ b/scripts/cmake/vcpkg_execute_build_process.cmake @@ -1,39 +1,3 @@ -#[===[.md: -# vcpkg_execute_build_process - -Execute a required build process - -## Usage -```cmake -vcpkg_execute_build_process( - COMMAND [...] - [NO_PARALLEL_COMMAND [...]] - WORKING_DIRECTORY - LOGNAME -) -``` -## Parameters -### COMMAND -The command to be executed, along with its arguments. - -### NO_PARALLEL_COMMAND -Optional parameter which specifies a non-parallel command to attempt if a -failure potentially due to parallelism is detected. - -### WORKING_DIRECTORY -The directory to execute the command in. - -### LOGNAME -The prefix to use for the log files. - -This should be a unique name for different triplets so that the logs don't -conflict when building multiple at once. - -## Examples - -* [icu](https://github.com/Microsoft/vcpkg/blob/master/ports/icu/portfile.cmake) -#]===] - set(Z_VCPKG_EXECUTE_BUILD_PROCESS_RETRY_ERROR_MESSAGES "LINK : fatal error LNK1102:" " fatal error C1060: " diff --git a/scripts/cmake/vcpkg_execute_in_download_mode.cmake b/scripts/cmake/vcpkg_execute_in_download_mode.cmake index bd88f8f5dc..2ad1481f8b 100644 --- a/scripts/cmake/vcpkg_execute_in_download_mode.cmake +++ b/scripts/cmake/vcpkg_execute_in_download_mode.cmake @@ -1,22 +1,3 @@ -#[===[.md: -# vcpkg_execute_in_download_mode - -Execute a process even in download mode. - -## Usage -```cmake -vcpkg_execute_in_download_mode( - ... -) -``` - -The signature of this function is identical to `execute_process()`. - -See [`execute_process()`] for more details. - -[`execute_process()`]: https://cmake.org/cmake/help/latest/command/execute_process.html -#]===] - function(vcpkg_execute_in_download_mode) # this allows us to grab the value of the output variables, but pass through the rest of the arguments cmake_parse_arguments(PARSE_ARGV 0 arg "" "RESULT_VARIABLE;RESULTS_VARIABLE;OUTPUT_VARIABLE;ERROR_VARIABLE" "") diff --git a/scripts/cmake/vcpkg_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake index cc18c41025..4c851d412f 100644 --- a/scripts/cmake/vcpkg_execute_required_process.cmake +++ b/scripts/cmake/vcpkg_execute_required_process.cmake @@ -1,52 +1,3 @@ -#[===[.md: -# vcpkg_execute_required_process - -Execute a process with logging and fail the build if the command fails. - -## Usage -```cmake -vcpkg_execute_required_process( - COMMAND <${PERL}> [...] - WORKING_DIRECTORY <${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg> - LOGNAME - [TIMEOUT ] - [OUTPUT_VARIABLE ] - [ERROR_VARIABLE ] -) -``` -## Parameters -### ALLOW_IN_DOWNLOAD_MODE -Allows the command to execute in Download Mode. -[See execute_process() override](../../scripts/cmake/execute_process.cmake). - -### COMMAND -The command to be executed, along with its arguments. - -### WORKING_DIRECTORY -The directory to execute the command in. - -### LOGNAME -The prefix to use for the log files. - -### TIMEOUT -Optional timeout after which to terminate the command. - -### OUTPUT_VARIABLE -Optional variable to receive stdout of the command. - -### ERROR_VARIABLE -Optional variable to receive stderr of the command. - -This should be a unique name for different triplets so that the logs don't conflict when building multiple at once. - -## Examples - -* [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake) -* [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) -* [boost](https://github.com/Microsoft/vcpkg/blob/master/ports/boost/portfile.cmake) -* [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) -#]===] - function(vcpkg_execute_required_process) cmake_parse_arguments(PARSE_ARGV 0 arg "ALLOW_IN_DOWNLOAD_MODE" diff --git a/scripts/cmake/vcpkg_execute_required_process_repeat.cmake b/scripts/cmake/vcpkg_execute_required_process_repeat.cmake index 3ad8d05ce9..66ca29191f 100644 --- a/scripts/cmake/vcpkg_execute_required_process_repeat.cmake +++ b/scripts/cmake/vcpkg_execute_required_process_repeat.cmake @@ -1,20 +1,3 @@ -#[===[.md: -# vcpkg_execute_required_process_repeat - -Execute a process until the command succeeds, or until the COUNT is reached. - -## Usage -```cmake -vcpkg_execute_required_process_repeat( - COMMAND [] - COUNT - WORKING_DIRECTORY - LOGNAME - [ALLOW_IN_DOWNLOAD_MODE] -) -``` -#]===] - function(vcpkg_execute_required_process_repeat) cmake_parse_arguments(PARSE_ARGV 0 arg "ALLOW_IN_DOWNLOAD_MODE" diff --git a/scripts/cmake/vcpkg_extract_source_archive.cmake b/scripts/cmake/vcpkg_extract_source_archive.cmake index 2b27194ba2..f1ecb44e29 100644 --- a/scripts/cmake/vcpkg_extract_source_archive.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive.cmake @@ -1,87 +1,3 @@ -#[===[.md: -# vcpkg_extract_source_archive - -Extract an archive into the source directory. - -## Usage -There are two "overloads" of this function. The first is deprecated: - -```cmake -vcpkg_extract_source_archive(<${ARCHIVE}> [<${TARGET_DIRECTORY}>]) -``` - -This overload should not be used. - -The latter is suggested to use for all future `vcpkg_extract_source_archive`s. - -```cmake -vcpkg_extract_source_archive( - ARCHIVE - [NO_REMOVE_ONE_LEVEL] - [SKIP_PATCH_CHECK] - [PATCHES ...] - [SOURCE_BASE ] - [BASE_DIRECTORY | WORKING_DIRECTORY ] -) -``` - -`vcpkg_extract_source_archive` takes an archive and extracts it. -It replaces existing uses of `vcpkg_extract_source_archive_ex`. -The simplest use of it is: - -```cmake -vcpkg_download_distfile(archive ...) -vcpkg_extract_source_archive(source_path ARCHIVE "${archive}") -``` - -The general expectation is that an archives are laid out with a base directory, -and all the actual files underneath that directory; in other words, if you -extract the archive, you'll get something that looks like: - -``` -zlib-1.2.11/ - doc/ - ... - examples/ - ... - ChangeLog - CMakeLists.txt - README - zlib.h - ... -``` - -`vcpkg_extract_source_archive` automatically removes this directory, -and gives you the items under it directly. However, this only works -when there is exactly one item in the top level of an archive. -Otherwise, you'll have to pass the `NO_REMOVE_ONE_LEVEL` argument to -prevent `vcpkg_extract_source_archive` from performing this transformation. - -If the source needs to be patched in some way, the `PATCHES` argument -allows one to do this, just like other `vcpkg_from_*` functions. -Additionally, the `SKIP_PATCH_CHECK` is provided for `--head` mode - -this allows patches to fail to apply silently. -This argument should _only_ be used when installing a `--head` library, -since otherwise we want a patch failing to appply to be a hard error. - -`vcpkg_extract_source_archive` extracts the files to -`${CURRENT_BUILDTREES_DIR}//-.clean`. -When in editable mode, no `.clean` is appended, -to allow for a user to modify the sources. -`base-directory` defaults to `src`, -and `source-base` defaults to the stem of ``. -You can change these via the `BASE_DIRECTORY` and `SOURCE_BASE` arguments -respectively. -If you need to extract to a location that is not based in `CURRENT_BUILDTREES_DIR`, -you can use the `WORKING_DIRECTORY` argument to do the same. - -## Examples - -* [libraw](https://github.com/Microsoft/vcpkg/blob/master/ports/libraw/portfile.cmake) -* [protobuf](https://github.com/Microsoft/vcpkg/blob/master/ports/protobuf/portfile.cmake) -* [msgpack](https://github.com/Microsoft/vcpkg/blob/master/ports/msgpack/portfile.cmake) -#]===] - function(z_vcpkg_extract_source_archive_deprecated_mode archive working_directory) cmake_path(GET archive FILENAME archive_filename) if(NOT EXISTS "${working_directory}/${archive_filename}.extracted") diff --git a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake index fb48c799d8..b279708bd4 100644 --- a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake @@ -1,27 +1,3 @@ -#[===[.md: -# vcpkg_extract_source_archive_ex - -Extract an archive into the source directory. -Originally replaced [`vcpkg_extract_source_archive()`], -but new ports should instead use the second overload of -[`vcpkg_extract_source_archive()`]. - -## Usage -```cmake -vcpkg_extract_source_archive_ex( - [OUT_SOURCE_PATH ] - ... -) -``` - -See the documentation for [`vcpkg_extract_source_archive()`] for other parameters. -Additionally, `vcpkg_extract_source_archive_ex()` adds the `REF` and `WORKING_DIRECTORY` -parameters, which are wrappers around `SOURCE_BASE` and `BASE_DIRECTORY` -respectively. - -[`vcpkg_extract_source_archive()`]: vcpkg_extract_source_archive.md -#]===] - function(vcpkg_extract_source_archive_ex) # OUT_SOURCE_PATH is an out-parameter so we need to parse it cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "OUT_SOURCE_PATH" "") diff --git a/scripts/cmake/vcpkg_fail_port_install.cmake b/scripts/cmake/vcpkg_fail_port_install.cmake index 4b760e9a0b..a5cb105f92 100644 --- a/scripts/cmake/vcpkg_fail_port_install.cmake +++ b/scripts/cmake/vcpkg_fail_port_install.cmake @@ -1,46 +1,3 @@ -# DEPRECATED: in favor of the `supports` field in [`manifest file`](manifest-files.md#supports) et al. - -#[===[.md: -# vcpkg_fail_port_install - -Checks common requirements and fails the current portfile with a (default) error message - -## Usage -```cmake -vcpkg_fail_port_install( - [ALWAYS] - [MESSAGE <"Reason for failure">] - [ON_TARGET [ ...]] - [ON_ARCH [ ...]] - [ON_CRT_LINKAGE [ ...]]) - [ON_LIBRARY_LINKAGE [ ...]] -) -``` - -## Parameters -### MESSAGE -Additional failure message. If none is given, a default message will be displayed depending on the failure condition. - -### ALWAYS -Will always fail early - -### ON_TARGET -Targets for which the build should fail early. Valid targets are `` from `VCPKG_IS_TARGET_` (see `vcpkg_common_definitions.cmake`). - -### ON_ARCH -Architecture for which the build should fail early. - -### ON_CRT_LINKAGE -CRT linkage for which the build should fail early. - -### ON_LIBRARY_LINKAGE -Library linkage for which the build should fail early. - -## Examples - -* [aws-lambda-cpp](https://github.com/Microsoft/vcpkg/blob/master/ports/aws-lambda-cpp/portfile.cmake) -#]===] - function(vcpkg_fail_port_install) message("${Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "vcpkg_fail_port_install has been removed and all values should be moved by adding `supports` field to manifest file or directly adding `${PORT}:${FAILED_TRIPLET}=fail` to _scripts/ci.baseline.txt_.\nPlease remove `vcpkg_fail_port_install(...)`.\n") diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index b5be6bbcba..cefcfb4be8 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -1,52 +1,3 @@ -#[===[.md: -# vcpkg_find_acquire_program - -Download or find a well-known tool. - -## Usage -```cmake -vcpkg_find_acquire_program() -``` -## Parameters -### program -This variable specifies both the program to be acquired as well as the out parameter that will be set to the path of the program executable. - -## Notes -The current list of programs includes: - -* 7Z -* ARIA2 (Downloader) -* BISON -* CLANG -* DARK -* DOXYGEN -* FLEX -* GASPREPROCESSOR -* GPERF -* PERL -* PYTHON2 -* PYTHON3 -* GIT -* GN -* GO -* JOM -* MESON -* NASM -* NINJA -* NUGET -* SCONS -* SWIG -* YASM - -Note that msys2 has a dedicated helper function: [`vcpkg_acquire_msys`](vcpkg_acquire_msys.md). - -## Examples - -* [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake) -* [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) -* [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) -#]===] - function(z_vcpkg_find_acquire_program_version_check out_var) cmake_parse_arguments(PARSE_ARGV 1 arg "EXACT_VERSION_MATCH" diff --git a/scripts/cmake/vcpkg_find_fortran.cmake b/scripts/cmake/vcpkg_find_fortran.cmake index 0e82c7d36f..2f1c497222 100644 --- a/scripts/cmake/vcpkg_find_fortran.cmake +++ b/scripts/cmake/vcpkg_find_fortran.cmake @@ -1,26 +1,3 @@ -#[===[.md: -# vcpkg_find_fortran - -Checks if a Fortran compiler can be found. -Windows(x86/x64) Only: If not it will switch/enable MinGW gfortran - and return required cmake args for building. - -## Usage -```cmake -vcpkg_find_fortran() -``` - -## Example -```cmake -vcpkg_find_fortran(fortran_args) -# ... -vcpkg_cmake_configure(... - OPTIONS - ${fortran_args} -) -``` -#]===] - function(vcpkg_find_fortran out_var) if("${ARGC}" GREATER "1") message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra args: ${ARGN}") diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index a49cfb2b55..3d8a8ba4f2 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -1,62 +1,3 @@ -# DEPRECATED BY ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup -#[===[.md: -# vcpkg_fixup_cmake_targets - -Merge release and debug CMake targets and configs to support multiconfig generators. - -Additionally corrects common issues with targets, such as absolute paths and incorrectly placed binaries. - -## Usage -```cmake -vcpkg_fixup_cmake_targets([CONFIG_PATH ] - [TARGET_PATH ] - [TOOLS_PATH ] - [DO_NOT_DELETE_PARENT_CONFIG_PATH]) -``` - -## Parameters - -### CONFIG_PATH -Subpath currently containing `*.cmake` files subdirectory (like `lib/cmake/${PORT}`). Should be relative to `${CURRENT_PACKAGES_DIR}`. - -Defaults to `share/${PORT}`. - -### TARGET_PATH -Subpath to which the above `*.cmake` files should be moved. Should be relative to `${CURRENT_PACKAGES_DIR}`. -This needs to be specified if the port name differs from the `find_package()` name. - -Defaults to `share/${PORT}`. - -### DO_NOT_DELETE_PARENT_CONFIG_PATH -By default the parent directory of CONFIG_PATH is removed if it is named "cmake". -Passing this option disable such behavior, as it is convenient for ports that install -more than one CMake package configuration file. - -### NO_PREFIX_CORRECTION -Disables the correction of_IMPORT_PREFIX done by vcpkg due to moving the targets. -Currently the correction does not take into account how the files are moved and applies -I rather simply correction which in some cases will yield the wrong results. - -### TOOLS_PATH -Define the base path to tools. Default: `tools/` - -## Notes -Transform all `/debug//*targets-debug.cmake` files and move them to `/`. -Removes all `/debug//*targets.cmake` and `/debug//*config.cmake`. - -Transform all references matching `/bin/*.exe` to `/${TOOLS_PATH}/*.exe` on Windows. -Transform all references matching `/bin/*` to `/${TOOLS_PATH}/*` on other platforms. - -Fix `${_IMPORT_PREFIX}` in auto generated targets to be one folder deeper. -Replace `${CURRENT_INSTALLED_DIR}` with `${_IMPORT_PREFIX}` in configs and targets. - -## Examples - -* [concurrentqueue](https://github.com/Microsoft/vcpkg/blob/master/ports/concurrentqueue/portfile.cmake) -* [curl](https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake) -* [nlohmann-json](https://github.com/Microsoft/vcpkg/blob/master/ports/nlohmann-json/portfile.cmake) -#]===] - function(vcpkg_fixup_cmake_targets) if(Z_VCPKG_CMAKE_CONFIG_FIXUP_GUARD) message(FATAL_ERROR "The ${PORT} port already depends on vcpkg-cmake-config; using both vcpkg-cmake-config and vcpkg_fixup_cmake_targets in the same port is unsupported.") diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake index 9cb35b7b24..6040c2699d 100644 --- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake +++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake @@ -1,50 +1,3 @@ -#[===[.md: -# vcpkg_fixup_pkgconfig - -Fix common paths in *.pc files and make everything relative to $(prefix). -Additionally, on static triplets, private entries are merged with their non-private counterparts, -allowing pkg-config to be called without the ``--static`` flag. -Note that vcpkg is designed to never have to call pkg-config with the ``--static`` flag, -since a consumer cannot know if a dependent library has been built statically or not. - -## Usage -```cmake -vcpkg_fixup_pkgconfig( - [RELEASE_FILES ...] - [DEBUG_FILES ...] - [SKIP_CHECK] -) -``` - -## Parameters -### RELEASE_FILES -Specifies a list of files to apply the fixes for release paths. -Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR} without ${CURRENT_PACKAGES_DIR}/debug/ - -### DEBUG_FILES -Specifies a list of files to apply the fixes for debug paths. -Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR}/debug/ - -### SKIP_CHECK -Skips the library checks in vcpkg_fixup_pkgconfig. Only use if the script itself has unhandled cases. - -### SYSTEM_PACKAGES (deprecated) -This argument has been deprecated and has no effect. - -### SYSTEM_LIBRARIES (deprecated) -This argument has been deprecated and has no effect. - -### IGNORE_FLAGS (deprecated) -This argument has been deprecated and has no effect. - -## Notes -Still work in progress. If there are more cases which can be handled here feel free to add them - -## Examples - -* [brotli](https://github.com/Microsoft/vcpkg/blob/master/ports/brotli/portfile.cmake) -#]===] - function(z_vcpkg_fixup_pkgconfig_check_files file config) set(path_suffix_DEBUG /debug) set(path_suffix_RELEASE "") diff --git a/scripts/cmake/vcpkg_from_bitbucket.cmake b/scripts/cmake/vcpkg_from_bitbucket.cmake index e27d62218e..2cd9c998a8 100644 --- a/scripts/cmake/vcpkg_from_bitbucket.cmake +++ b/scripts/cmake/vcpkg_from_bitbucket.cmake @@ -1,61 +1,3 @@ -#[===[.md: -# vcpkg_from_bitbucket - -Download and extract a project from Bitbucket. - -## Usage: -```cmake -vcpkg_from_bitbucket( - OUT_SOURCE_PATH - REPO - [REF ] - [SHA512 <45d0d7f8cc350...>] - [HEAD_REF ] - [PATCHES ...] -) -``` - -## Parameters: -### OUT_SOURCE_PATH -Specifies the out-variable that will contain the extracted location. - -This should be set to `SOURCE_PATH` by convention. - -### REPO -The organization or user and repository on GitHub. - -### REF -A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.** - -For repositories without official releases, this can be set to the full commit id of the current latest master. - -If `REF` is specified, `SHA512` must also be specified. - -### SHA512 -The SHA512 hash that should match the archive (https://bitbucket.com/${REPO}/get/${REF}.tar.gz). - -This is most easily determined by first setting it to `0`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile. - -### HEAD_REF -The unstable git commit-ish (ideally a branch) to pull for `--head` builds. - -For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms. - -### PATCHES -A list of patches to be applied to the extracted sources. - -Relative paths are based on the port directory. - -## Notes: -At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present. - -This exports the `VCPKG_HEAD_VERSION` variable during head builds. - -## Examples: - -* [blaze](https://github.com/Microsoft/vcpkg/blob/master/ports/blaze/portfile.cmake) -#]===] - function(vcpkg_from_bitbucket) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" diff --git a/scripts/cmake/vcpkg_from_git.cmake b/scripts/cmake/vcpkg_from_git.cmake index 7ff27b9bf2..0d9d40fe51 100644 --- a/scripts/cmake/vcpkg_from_git.cmake +++ b/scripts/cmake/vcpkg_from_git.cmake @@ -1,54 +1,3 @@ -#[===[.md: -# vcpkg_from_git - -Download and extract a project from git - -## Usage: -```cmake -vcpkg_from_git( - OUT_SOURCE_PATH - URL - REF <59f7335e4d...> - [HEAD_REF ] - [PATCHES ...] -) -``` - -## Parameters: -### OUT_SOURCE_PATH -Specifies the out-variable that will contain the extracted location. - -This should be set to `SOURCE_PATH` by convention. - -### URL -The url of the git repository. - -### REF -The git sha of the commit to download. - -### FETCH_REF -The git branch to fetch in non-HEAD mode. After this is fetched, -then `REF` is checked out. This is useful in cases where the git server -does not allow checking out non-advertised objects. - -### HEAD_REF -The git branch to use when the package is requested to be built from the latest sources. - -Example: `main`, `develop`, `HEAD` - -### PATCHES -A list of patches to be applied to the extracted sources. - -Relative paths are based on the port directory. - -## Notes: -`OUT_SOURCE_PATH`, `REF`, and `URL` must be specified. - -## Examples: - -* [fdlibm](https://github.com/Microsoft/vcpkg/blob/master/ports/fdlibm/portfile.cmake) -#]===] - function(vcpkg_from_git) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index 5313db3db1..3b1af1a621 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -1,79 +1,3 @@ -#[===[.md: -# vcpkg_from_github - -Download and extract a project from GitHub. Enables support for `install --head`. - -This also works with Gitea by specifying the Gitea server with the `GITHUB_HOST` option. - -## Usage: -```cmake -vcpkg_from_github( - OUT_SOURCE_PATH - REPO - [REF ] - [SHA512 <45d0d7f8cc350...>] - [HEAD_REF ] - [PATCHES ...] - [GITHUB_HOST ] - [AUTHORIZATION_TOKEN <${SECRET_FROM_FILE}>] - [FILE_DISAMBIGUATOR ] -) -``` - -## Parameters: -### OUT_SOURCE_PATH -Specifies the out-variable that will contain the extracted location. - -This should be set to `SOURCE_PATH` by convention. - -### REPO -The organization or user and repository on GitHub. - -### REF -A stable git commit-ish (ideally a tag or commit) that will not change contents. **This should not be a branch.** - -For repositories without official releases, this can be set to the full commit id of the current latest master. - -If `REF` is specified, `SHA512` must also be specified. - -### SHA512 -The SHA512 hash that should match the archive (https://github.com/${REPO}/archive/${REF}.tar.gz). - -This is most easily determined by first setting it to `0`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile. - -### HEAD_REF -The unstable git commit-ish (ideally a branch) to pull for `--head` builds. - -For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms. - -### PATCHES -A list of patches to be applied to the extracted sources. - -Relative paths are based on the port directory. - -### GITHUB_HOST -A replacement host for enterprise GitHub instances. - -This field should contain the scheme, host, and port of the desired URL without a trailing slash. - -### AUTHORIZATION_TOKEN -A token to be passed via the Authorization HTTP header as "token ${AUTHORIZATION_TOKEN}". - -### FILE_DISAMBIGUATOR -A token to uniquely identify the resulting filename if the SHA512 changes even though a git ref does not, to avoid stepping on the same file name. - -## Notes: -At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present. - -This exports the `VCPKG_HEAD_VERSION` variable during head builds. - -## Examples: - -* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -* [ms-gsl](https://github.com/Microsoft/vcpkg/blob/master/ports/ms-gsl/portfile.cmake) -* [boost-beast](https://github.com/Microsoft/vcpkg/blob/master/ports/boost-beast/portfile.cmake) -#]===] - function(vcpkg_from_github) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" diff --git a/scripts/cmake/vcpkg_from_gitlab.cmake b/scripts/cmake/vcpkg_from_gitlab.cmake index e091ca5c08..23f36fab7c 100644 --- a/scripts/cmake/vcpkg_from_gitlab.cmake +++ b/scripts/cmake/vcpkg_from_gitlab.cmake @@ -1,72 +1,3 @@ -#[===[.md: -# vcpkg_from_gitlab - -Download and extract a project from Gitlab instances. Enables support for `install --head`. - -## Usage: -```cmake -vcpkg_from_gitlab( - GITLAB_URL - OUT_SOURCE_PATH - REPO - [REF ] - [SHA512 <45d0d7f8cc350...>] - [HEAD_REF ] - [PATCHES ...] - [FILE_DISAMBIGUATOR ] -) -``` - -## Parameters: - -### GITLAB_URL -The URL of the Gitlab instance to use. - -### OUT_SOURCE_PATH -Specifies the out-variable that will contain the extracted location. - -This should be set to `SOURCE_PATH` by convention. - -### REPO -The organization or user plus the repository name on the Gitlab instance. - -### REF -A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.** - -For repositories without official releases, this can be set to the full commit id of the current latest master. - -If `REF` is specified, `SHA512` must also be specified. - -### SHA512 -The SHA512 hash that should match the archive (${GITLAB_URL}/${REPO}/-/archive/${REF}/${REPO_NAME}-${REF}.tar.gz). -The REPO_NAME variable is parsed from the value of REPO. - -This is most easily determined by first setting it to `0`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile. - -### HEAD_REF -The unstable git commit-ish (ideally a branch) to pull for `--head` builds. - -For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms. - -### PATCHES -A list of patches to be applied to the extracted sources. - -Relative paths are based on the port directory. - -### FILE_DISAMBIGUATOR -A token to uniquely identify the resulting filename if the SHA512 changes even though a git ref does not, to avoid stepping on the same file name. - -## Notes: -At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present. - -This exports the `VCPKG_HEAD_VERSION` variable during head builds. - -## Examples: -* [curl][https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake#L75] -* [folly](https://github.com/Microsoft/vcpkg/blob/master/ports/folly/portfile.cmake#L15) -* [z3](https://github.com/Microsoft/vcpkg/blob/master/ports/z3/portfile.cmake#L13) -#]===] - include(vcpkg_execute_in_download_mode) function(vcpkg_from_gitlab) diff --git a/scripts/cmake/vcpkg_from_sourceforge.cmake b/scripts/cmake/vcpkg_from_sourceforge.cmake index e1226c3b10..b2209ab358 100644 --- a/scripts/cmake/vcpkg_from_sourceforge.cmake +++ b/scripts/cmake/vcpkg_from_sourceforge.cmake @@ -1,74 +1,3 @@ -#[===[.md: -# vcpkg_from_sourceforge - -Download and extract a project from sourceforge. - -This function automatically checks a set of sourceforge mirrors. -Additional mirrors can be injected through the `VCPKG_SOURCEFORGE_EXTRA_MIRRORS` -list variable in the triplet. - -## Usage: -```cmake -vcpkg_from_sourceforge( - OUT_SOURCE_PATH SOURCE_PATH - REPO - [REF <2.1-3>] - SHA512 <547b417109332...> - FILENAME - [DISABLE_SSL] - [NO_REMOVE_ONE_LEVEL] - [PATCHES ...] -) -``` - -## Parameters: -### OUT_SOURCE_PATH -Specifies the out-variable that will contain the extracted location. - -This should be set to `SOURCE_PATH` by convention. - -### REPO -The organization or user and repository (optional) on sourceforge. - -### REF -A stable version number that will not change contents. - -### FILENAME -The local name for the file. Files are shared between ports, so the file may need to be renamed to make it clearly attributed to this port and avoid conflicts. - -For example, we can get the download link: -https://sourceforge.net/settings/mirror_choices?projectname=mad&filename=libmad/0.15.1b/libmad-0.15.1b.tar.gz&selected=nchc -So the REPO is `mad/libmad`, the REF is `0.15.1b`, and the FILENAME is `libmad-0.15.1b.tar.gz` - -For some special links: -https://sourceforge.net/settings/mirror_choices?projectname=soxr&filename=soxr-0.1.3-Source.tar.xz&selected=nchc -The REPO is `soxr`, REF is not exist, and the FILENAME is `soxr-0.1.3-Source.tar.xz` - -### SHA512 -The SHA512 hash that should match the archive. - -This is most easily determined by first setting it to `0`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile. - -### WORKING_DIRECTORY -If specified, the archive will be extracted into the working directory instead of `${CURRENT_BUILDTREES_DIR}/src/`. - -Note that the archive will still be extracted into a subfolder underneath that directory (`${WORKING_DIRECTORY}/${REF}-${HASH}/`). - -### PATCHES -A list of patches to be applied to the extracted sources. - -Relative paths are based on the port directory. - -### NO_REMOVE_ONE_LEVEL -Specifies that the default removal of the top level folder should not occur. - -## Examples: - -* [cunit](https://github.com/Microsoft/vcpkg/blob/master/ports/cunit/portfile.cmake) -* [polyclipping](https://github.com/Microsoft/vcpkg/blob/master/ports/polyclipping/portfile.cmake) -* [tinyfiledialogs](https://github.com/Microsoft/vcpkg/blob/master/ports/tinyfiledialogs/portfile.cmake) -#]===] - function(vcpkg_from_sourceforge) cmake_parse_arguments(PARSE_ARGV 0 "arg" "DISABLE_SSL;NO_REMOVE_ONE_LEVEL" diff --git a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake index b40b24c42d..b24b4d0712 100644 --- a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake +++ b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake @@ -1,16 +1,3 @@ -#[===[.md: -# vcpkg_get_program_files_platform_bitness - -Get the Program Files directory of the current platform's bitness: -either `$ENV{ProgramW6432}` on 64-bit windows, -or `$ENV{PROGRAMFILES}` on 32-bit windows. - -## Usage: -```cmake -vcpkg_get_program_files_platform_bitness() -``` -#]===] - function(vcpkg_get_program_files_platform_bitness out_var) if(DEFINED ENV{ProgramW6432}) set("${out_var}" "$ENV{ProgramW6432}" PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake index 0a80d4c76c..bb26b44b75 100644 --- a/scripts/cmake/vcpkg_get_windows_sdk.cmake +++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake @@ -1,14 +1,3 @@ -#[===[.md: -# vcpkg_get_windows_sdk - -Get the Windows SDK number. - -## Usage: -```cmake -vcpkg_get_windows_sdk() -``` -#]===] - function(vcpkg_get_windows_sdk out_var) if("$ENV{WindowsSDKVersion}" MATCHES [[^([0-9.]*)\\?$]]) set("${out_var}" "${CMAKE_MATCH_1}" PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_host_path_list.cmake b/scripts/cmake/vcpkg_host_path_list.cmake index 316793143b..81365f62c1 100644 --- a/scripts/cmake/vcpkg_host_path_list.cmake +++ b/scripts/cmake/vcpkg_host_path_list.cmake @@ -1,30 +1,3 @@ -#[===[ -# vcpkg_host_path_list - -Modify a host path list variable (PATH, INCLUDE, LIBPATH, etc.) - -```cmake -vcpkg_host_path_list(PREPEND [...]) -vcpkg_host_path_list(APPEND [...]) -vcpkg_host_path_list(SET [...]) -``` - -`` may be either a regular variable name, or `ENV{variable-name}`, -in which case `vcpkg_host_path_list` will modify the environment. - -`vcpkg_host_path_list` adds all of the paths passed to it to ``; -`PREPEND` puts them before the existing list, so that they are searched first; -`APPEND` places them after the existing list, -so they would be searched after the paths which are already in the variable, -and `SET` replaces the value of the existing list. - -For all of `APPEND`, `PREPEND`, and `SET`, -the paths are added (and thus searched) in the order received. - -If no paths are passed to `APPEND` or `PREPEND`, nothing will be done; -for `SET`, the variable will be set to the empty string. -#]===] - function(z_vcpkg_translate_to_host_path_list out_var lst) if(NOT DEFINED arg_UNPARSED_ARGUMENTS) set("${out_var}" "" PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake index 9582419ecd..df7d7bf616 100644 --- a/scripts/cmake/vcpkg_install_cmake.cmake +++ b/scripts/cmake/vcpkg_install_cmake.cmake @@ -1,29 +1,3 @@ -# DEPRECATED BY ports/vcpkg-cmake/vcpkg_cmake_install -#[===[.md: -# vcpkg_install_cmake - -Build and install a cmake project. - -## Usage: -```cmake -vcpkg_install_cmake(...) -``` - -## Parameters: -See [`vcpkg_build_cmake()`](vcpkg_build_cmake.md). - -## Notes: -This command transparently forwards to [`vcpkg_build_cmake()`](vcpkg_build_cmake.md), adding a `TARGET install` -parameter. - -## Examples: - -* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) -* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) -* [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) -* [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) -#]===] - function(vcpkg_install_cmake) if(Z_VCPKG_CMAKE_INSTALL_GUARD) message(FATAL_ERROR "The ${PORT} port already depends on vcpkg-cmake; using both vcpkg-cmake and vcpkg_install_cmake in the same port is unsupported.") diff --git a/scripts/cmake/vcpkg_install_gn.cmake b/scripts/cmake/vcpkg_install_gn.cmake index fc51f157ca..6f250ec045 100644 --- a/scripts/cmake/vcpkg_install_gn.cmake +++ b/scripts/cmake/vcpkg_install_gn.cmake @@ -1,31 +1,3 @@ -# DEPRECATED BY ports/vcpkg-gn/vcpkg_gn_install -#[===[.md: -# vcpkg_install_gn - -Installs a GN project. - -In order to build a GN project without installing, use [`vcpkg_build_ninja()`]. - -## Usage: -```cmake -vcpkg_install_gn( - SOURCE_PATH - [TARGETS ...] -) -``` - -## Parameters: -### SOURCE_PATH -The path to the source directory - -### TARGETS -Only install the specified targets. - -Note: includes must be handled separately - -[`vcpkg_build_ninja()`]: vcpkg_build_ninja.md -#]===] - function(z_vcpkg_install_gn_get_target_type out_var) cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "SOURCE_PATH;BUILD_DIR;TARGET" "") if(DEFINED arg_UNPARSED_ARGUMENTS) diff --git a/scripts/cmake/vcpkg_install_make.cmake b/scripts/cmake/vcpkg_install_make.cmake index f622edd406..281b6237a0 100644 --- a/scripts/cmake/vcpkg_install_make.cmake +++ b/scripts/cmake/vcpkg_install_make.cmake @@ -1,27 +1,3 @@ -#[===[.md: -# 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( ${ARGN} diff --git a/scripts/cmake/vcpkg_install_meson.cmake b/scripts/cmake/vcpkg_install_meson.cmake index e59162d0a4..5971aefd90 100644 --- a/scripts/cmake/vcpkg_install_meson.cmake +++ b/scripts/cmake/vcpkg_install_meson.cmake @@ -1,23 +1,3 @@ -#[===[.md: -# vcpkg_install_meson - -Builds a meson project previously configured with `vcpkg_configure_meson()`. - -## Usage -```cmake -vcpkg_install_meson([ADD_BIN_TO_PATH]) -``` - -## Parameters: -### 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. - -## Examples - -* [fribidi](https://github.com/Microsoft/vcpkg/blob/master/ports/fribidi/portfile.cmake) -* [libepoxy](https://github.com/Microsoft/vcpkg/blob/master/ports/libepoxy/portfile.cmake) -#]===] - function(vcpkg_install_meson) cmake_parse_arguments(PARSE_ARGV 0 arg "ADD_BIN_TO_PATH" "" "") diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake index 580e86ab22..eb93d2e250 100644 --- a/scripts/cmake/vcpkg_install_msbuild.cmake +++ b/scripts/cmake/vcpkg_install_msbuild.cmake @@ -1,96 +1,3 @@ -#[===[.md: -# vcpkg_install_msbuild - -Build and install a msbuild-based project. This replaces `vcpkg_build_msbuild()`. - -## Usage -```cmake -vcpkg_install_msbuild( - SOURCE_PATH <${SOURCE_PATH}> - PROJECT_SUBPATH - [INCLUDES_SUBPATH ] - [LICENSE_SUBPATH ] - [RELEASE_CONFIGURATION ] - [DEBUG_CONFIGURATION ] - [TARGET ] - [TARGET_PLATFORM_VERSION <10.0.15063.0>] - [PLATFORM <${TRIPLET_SYSTEM_ARCH}>] - [PLATFORM_TOOLSET <${VCPKG_PLATFORM_TOOLSET}>] - [OPTIONS ...] - [OPTIONS_RELEASE ...] - [OPTIONS_DEBUG ...] - [USE_VCPKG_INTEGRATION] - [ALLOW_ROOT_INCLUDES | REMOVE_ROOT_INCLUDES] -) -``` - -## Parameters -### SOURCE_PATH -The path to the root of the source tree. - -Because MSBuild uses in-source builds, the source tree will be copied into a temporary location for the build. This -parameter is the base for that copy and forms the base for all XYZ_SUBPATH options. - -### USE_VCPKG_INTEGRATION -Apply the normal `integrate install` integration for building the project. - -By default, projects built with this command will not automatically link libraries or have header paths set. - -### PROJECT_SUBPATH -The subpath to the solution (`.sln`) or project (`.vcxproj`) file relative to `SOURCE_PATH`. - -### LICENSE_SUBPATH -The subpath to the license file relative to `SOURCE_PATH`. - -### INCLUDES_SUBPATH -The subpath to the includes directory relative to `SOURCE_PATH`. - -This parameter should be a directory and should not end in a trailing slash. - -### ALLOW_ROOT_INCLUDES -Indicates that top-level include files (e.g. `include/zlib.h`) should be allowed. - -### REMOVE_ROOT_INCLUDES -Indicates that top-level include files (e.g. `include/Makefile.am`) should be removed. - -### SKIP_CLEAN -Indicates that the intermediate files should not be removed. - -Ports using this option should later call [`vcpkg_clean_msbuild()`](vcpkg_clean_msbuild.md) to manually clean up. - -### RELEASE_CONFIGURATION -The configuration (``/p:Configuration`` msbuild parameter) used for Release builds. - -### DEBUG_CONFIGURATION -The configuration (``/p:Configuration`` msbuild parameter) used for Debug builds. - -### TARGET_PLATFORM_VERSION -The WindowsTargetPlatformVersion (``/p:WindowsTargetPlatformVersion`` msbuild parameter) - -### TARGET -The MSBuild target to build. (``/t:``) - -### PLATFORM -The platform (``/p:Platform`` msbuild parameter) used for the build. - -### PLATFORM_TOOLSET -The platform toolset (``/p:PlatformToolset`` msbuild parameter) used for the build. - -### OPTIONS -Additional options passed to msbuild for all builds. - -### OPTIONS_RELEASE -Additional options passed to msbuild for Release builds. These are in addition to `OPTIONS`. - -### OPTIONS_DEBUG -Additional options passed to msbuild for Debug builds. These are in addition to `OPTIONS`. - -## Examples - -* [libirecovery](https://github.com/Microsoft/vcpkg/blob/master/ports/libirecovery/portfile.cmake) -* [libfabric](https://github.com/Microsoft/vcpkg/blob/master/ports/libfabric/portfile.cmake) -#]===] - function(vcpkg_install_msbuild) cmake_parse_arguments( PARSE_ARGV 0 diff --git a/scripts/cmake/vcpkg_install_nmake.cmake b/scripts/cmake/vcpkg_install_nmake.cmake index 2a3cb82706..fc8afa8d44 100644 --- a/scripts/cmake/vcpkg_install_nmake.cmake +++ b/scripts/cmake/vcpkg_install_nmake.cmake @@ -1,69 +1,3 @@ -#[===[.md: -# vcpkg_install_nmake - -Build and install a msvc makefile project. - -## Usage: -```cmake -vcpkg_install_nmake( - SOURCE_PATH <${SOURCE_PATH}> - [NO_DEBUG] - [TARGET ] - PROJECT_SUBPATH <${SUBPATH}> - PROJECT_NAME <${MAKEFILE_NAME}> - [PRERUN_SHELL <${SHELL_PATH}>] - [PRERUN_SHELL_DEBUG <${SHELL_PATH}>] - [PRERUN_SHELL_RELEASE <${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 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. - -### PRERUN_SHELL -Script that needs to be called before build - -### PRERUN_SHELL_DEBUG -Script that needs to be called before debug build - -### PRERUN_SHELL_RELEASE -Script that needs to be called before release 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`. - -## 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) vcpkg_list(SET multi_value_args TARGET diff --git a/scripts/cmake/vcpkg_install_qmake.cmake b/scripts/cmake/vcpkg_install_qmake.cmake index 38d9eacf9d..c665486273 100644 --- a/scripts/cmake/vcpkg_install_qmake.cmake +++ b/scripts/cmake/vcpkg_install_qmake.cmake @@ -1,27 +1,3 @@ -#[===[.md: -# vcpkg_install_qmake - -Build and install a qmake project. - -## Usage: -```cmake -vcpkg_install_qmake(...) -``` - -## Parameters: -See [`vcpkg_build_qmake()`](vcpkg_build_qmake.md). - -## Notes: -This command transparently forwards to [`vcpkg_build_qmake()`](vcpkg_build_qmake.md). - -Additionally, this command will copy produced .libs/.dlls/.as/.dylibs/.sos to the appropriate -staging directories. - -## Examples - -* [libqglviewer](https://github.com/Microsoft/vcpkg/blob/master/ports/libqglviewer/portfile.cmake) -#]===] - function(vcpkg_install_qmake) z_vcpkg_function_arguments(args) diff --git a/scripts/cmake/vcpkg_list.cmake b/scripts/cmake/vcpkg_list.cmake index 74523dc62e..d7fa0fe5bf 100644 --- a/scripts/cmake/vcpkg_list.cmake +++ b/scripts/cmake/vcpkg_list.cmake @@ -1,95 +1,3 @@ -#[===[.md: -# vcpkg_list - -A replacement for CMake's `list()` function, which correctly handles elements -with internal semicolons (in other words, escaped semicolons). -Use `vcpkg_list()` instead of `list()` whenever possible. - -```cmake -vcpkg_list(SET [...]) -vcpkg_list( [...]) -``` - -In addition to all of the commands from `list()`, `vcpkg_list` adds -a `vcpkg_list(SET)` command. -This command takes its arguments, escapes them, and then concatenates -them into a list; this should be used instead of `set()` for setting any -list variable. - -Otherwise, the `vcpkg_list()` function is the same as the built-in -`list()` function, with the following restrictions: - -- `GET`, `REMOVE_ITEM`, and `REMOVE_AT` support only one index/value -- `POP_BACK` and `POP_FRONT` do not support getting the value into - another out variable. Use C++ style `GET` then `POP_(BACK|FRONT)`. -- `FILTER` and `TRANSFORM` are unsupported. - -See the [CMake documentation for `list()`](https://cmake.org/cmake/help/latest/command/list.html) -for more information. - -## Notes: Some Weirdnesses - -The most major weirdness is due to `""` pulling double-duty as "list of zero elements", -and "list of one element, which is empty". `vcpkg_list` always uses the former understanding. -This can cause weird behavior, for example: - -```cmake -set(lst "") -vcpkg_list(APPEND lst "" "") -# lst = ";" -``` - -This is because you're appending two elements to the empty list. -One very weird behavior that comes out of this would be: - -```cmake -set(lst "") -vcpkg_list(APPEND lst "") -# lst = "" -``` - -since `""` is the empty list, we append the empty element and end up with a list -of one element, which is empty. This does not happen for non-empty lists; -for example: - -```cmake -set(lst "a") -vcpkg_list(APPEND lst "") -# lst = "a;" -``` - -only the empty list has this odd behavior. - -## Examples - -### Creating a list - -```cmake -vcpkg_list(SET foo_param) -if(DEFINED arg_FOO) - vcpkg_list(SET foo_param FOO "${arg_FOO}") -endif() -``` - -### Appending to a list - -```cmake -set(OPTIONS -DFOO=BAR) -if(VCPKG_TARGET_IS_WINDOWS) - vcpkg_list(APPEND OPTIONS "-DOS=WINDOWS;FOO") -endif() -``` - -### Popping the end off a list - -```cmake -if(NOT list STREQUAL "") - vcpkg_list(GET list end -1) - vcpkg_list(POP_BACK list) -endif() -``` -#]===] - macro(z_vcpkg_list_escape_once_more lst) string(REPLACE [[\;]] [[\\;]] "${lst}" "${${lst}}") endmacro() diff --git a/scripts/cmake/vcpkg_minimum_required.cmake b/scripts/cmake/vcpkg_minimum_required.cmake index a8f3a1265e..1ef14963b4 100644 --- a/scripts/cmake/vcpkg_minimum_required.cmake +++ b/scripts/cmake/vcpkg_minimum_required.cmake @@ -1,18 +1,3 @@ -#[===[.md: -# vcpkg_minimum_required - -Asserts that the version of the vcpkg program being used to build a port is later than the supplied date, inclusive. - -## Usage -```cmake -vcpkg_minimum_required(VERSION 2021-01-13) -``` - -## Parameters -### VERSION -The date-version to check against. -#]===] - function(vcpkg_minimum_required) cmake_parse_arguments(PARSE_ARGV 0 arg "" "VERSION" "") if(NOT DEFINED VCPKG_BASE_VERSION) diff --git a/scripts/cmake/vcpkg_replace_string.cmake b/scripts/cmake/vcpkg_replace_string.cmake index 1f8b37b656..7147acdf65 100644 --- a/scripts/cmake/vcpkg_replace_string.cmake +++ b/scripts/cmake/vcpkg_replace_string.cmake @@ -1,13 +1,3 @@ -#[===[.md: -# vcpkg_replace_string - -Replace a string in a file. - -```cmake -vcpkg_replace_string( ) -``` -#]===] - function(vcpkg_replace_string filename match replace) file(READ "${filename}" contents) string(REPLACE "${match}" "${replace}" contents "${contents}") diff --git a/scripts/cmake/z_vcpkg_apply_patches.cmake b/scripts/cmake/z_vcpkg_apply_patches.cmake index 9743981c88..77af63b3b7 100644 --- a/scripts/cmake/z_vcpkg_apply_patches.cmake +++ b/scripts/cmake/z_vcpkg_apply_patches.cmake @@ -1,33 +1,3 @@ -#[===[.md: -# z_vcpkg_apply_patches - -**Only for internal use in vcpkg helpers. Behavior and arguments will change without notice.** - -Apply a set of patches to a source tree. - -```cmake -z_vcpkg_apply_patches( - SOURCE_PATH - [QUIET] - PATCHES ... -) -``` - -The `` should be set to `${SOURCE_PATH}` by convention, -and is the path to apply the patches in. - -`z_vcpkg_apply_patches` will take the list of ``es, -which are by default relative to the port directory, -and apply them in order using `git apply`. -Generally, these ``es take the form of `some.patch` -to select patches in the port directory. -One may also download patches and use `${VCPKG_DOWNLOADS}/path/to/some.patch`. - -If `QUIET` is not passed, it is a fatal error for a patch to fail to apply; -otherwise, if `QUIET` is passed, no message is printed. -This should only be used for edge cases, such as patches that are known to fail even on a clean source tree. -#]===] - function(z_vcpkg_apply_patches) cmake_parse_arguments(PARSE_ARGV 0 "arg" "QUIET" "SOURCE_PATH" "PATCHES") diff --git a/scripts/cmake/z_vcpkg_forward_output_variable.cmake b/scripts/cmake/z_vcpkg_forward_output_variable.cmake index 4d775b8cc4..1177ef36cf 100644 --- a/scripts/cmake/z_vcpkg_forward_output_variable.cmake +++ b/scripts/cmake/z_vcpkg_forward_output_variable.cmake @@ -1,39 +1,3 @@ -#[===[.md: -# z_vcpkg_forward_output_variable - -This macro helps with forwarding values from inner function calls, -through a local function scope, into pointer out parameters. - -```cmake -z_vcpkg_forward_output_variable(ptr_to_parent_var var_to_forward) -``` - -is equivalent to - -```cmake -if(DEFINED ptr_to_parent_var) - if(DEFINED value_var) - set("${ptr_to_parent_var}" "${value_var}" PARENT_SCOPE) - else() - unset("${ptr_to_parent_var}" PARENT_SCOPE) - endif() -endif() -``` - -Take note that the first argument should be a local variable that has a value of the parent variable name. -Most commonly, this local is the result of a pointer-out parameter to a function. -If the variable in the first parameter is not defined, this function does nothing, -simplifying functions with optional out parameters. -Most commonly, this should be used in cases like: - -```cmake -function(my_function out_var) - file(SHA512 "somefile.txt" local_var) - z_vcpkg_forward_output_variable(out_var local_var) -endfunction() -``` -#]===] - macro(z_vcpkg_forward_output_variable ptr_to_parent_var var_to_forward) if("${ARGC}" GREATER "2") message(FATAL_ERROR "z_vcpkg_forward_output_variable was passed extra arguments: ${ARGN}") diff --git a/scripts/cmake/z_vcpkg_function_arguments.cmake b/scripts/cmake/z_vcpkg_function_arguments.cmake index 043c861910..45e60a2567 100644 --- a/scripts/cmake/z_vcpkg_function_arguments.cmake +++ b/scripts/cmake/z_vcpkg_function_arguments.cmake @@ -1,30 +1,3 @@ -#[===[.md: -# z_vcpkg_function_arguments - -**Only for internal use in vcpkg helpers. Behavior and arguments will change without notice.** -Get a list of the arguments which were passed in. -Unlike `ARGV`, which is simply the arguments joined with `;`, -so that `(A B)` is not distinguishable from `("A;B")`, -this macro gives `"A;B"` for the first argument list, -and `"A\;B"` for the second. - -```cmake -z_vcpkg_function_arguments( []) -``` - -`z_vcpkg_function_arguments` gets the arguments between `ARGV` and the last argument. -`` defaults to `0`, so that all arguments are taken. - -## Example: -```cmake -function(foo_replacement) - z_vcpkg_function_arguments(ARGS) - foo(${ARGS}) - ... -endfunction() -``` -#]===] - # NOTE: this function definition is copied directly to scripts/buildsystems/vcpkg.cmake # do not make changes here without making the same change there. macro(z_vcpkg_function_arguments OUT_VAR) diff --git a/scripts/cmake/z_vcpkg_get_cmake_vars.cmake b/scripts/cmake/z_vcpkg_get_cmake_vars.cmake index bbe88a6dbe..51e0f03a91 100644 --- a/scripts/cmake/z_vcpkg_get_cmake_vars.cmake +++ b/scripts/cmake/z_vcpkg_get_cmake_vars.cmake @@ -1,37 +1,3 @@ -#[===[.md: -# z_vcpkg_get_cmake_vars - -**Only for internal use in vcpkg helpers. Behavior and arguments will change without notice.** -Runs a cmake configure with a dummy project to extract certain cmake variables - -## Usage -```cmake -z_vcpkg_get_cmake_vars() -``` - -`z_vcpkg_get_cmake_vars(cmake_vars_file)` sets `` to -a path to a generated CMake file, with the detected `CMAKE_*` variables -re-exported as `VCPKG_DETECTED_*`. - -## Notes -Avoid usage in portfiles. - -All calls to `z_vcpkg_get_cmake_vars` will result in the same output file; -the output file is not generated multiple times. - -## Examples - -* [vcpkg_configure_make](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_configure_make.cmake) - -### Basic Usage - -```cmake -z_vcpkg_get_cmake_vars(cmake_vars_file) -include("${cmake_vars_file}") -message(STATUS "detected CXX flags: ${VCPKG_DETECTED_CXX_FLAGS}") -``` -#]===] - function(z_vcpkg_get_cmake_vars out_file) cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "") diff --git a/scripts/cmake/z_vcpkg_prettify_command_line.cmake b/scripts/cmake/z_vcpkg_prettify_command_line.cmake index ab12e78fe1..7752d7a0cf 100644 --- a/scripts/cmake/z_vcpkg_prettify_command_line.cmake +++ b/scripts/cmake/z_vcpkg_prettify_command_line.cmake @@ -1,22 +1,3 @@ -#[===[.md: -# z_vcpkg_prettify_command_line - -**Only for internal use in vcpkg helpers. Behavior and arguments will change without notice.** -Turn a command line into a formatted string. - -```cmake -z_vcpkg_prettify_command_line( ...) -``` - -This command is for internal use, when printing out to a message. - -## Examples - -* `scripts/cmake/vcpkg_execute_build_process.cmake` -* `scripts/cmake/vcpkg_execute_required_process.cmake` -* `scripts/cmake/vcpkg_execute_required_process_repeat.cmake` -#]===] - function(z_vcpkg_prettify_command_line out_var) set(output_list "") z_vcpkg_function_arguments(args 1) diff --git a/scripts/cmake/z_vcpkg_setup_pkgconfig_path.cmake b/scripts/cmake/z_vcpkg_setup_pkgconfig_path.cmake index 1a275bbac7..369fe77b2f 100644 --- a/scripts/cmake/z_vcpkg_setup_pkgconfig_path.cmake +++ b/scripts/cmake/z_vcpkg_setup_pkgconfig_path.cmake @@ -1,16 +1,3 @@ -#[===[ -# z_vcpkg_setup_pkgconfig_path - -`z_vcpkg_setup_pkgconfig_path` sets up environment variables to use `pkgconfig`, such as `PKG_CONFIG` and `PKG_CONFIG_PATH`. -The original values are restored with `z_vcpkg_restore_pkgconfig_path`. `BASE_DIRS` indicates the base directories to find `.pc` files; typically `${CURRENT_INSTALLED_DIR}`, or `${CURRENT_INSTALLED_DIR}/debug`. - -```cmake -z_vcpkg_setup_pkgconfig_path(BASE_DIRS <"${CURRENT_INSTALLED_DIR}" ...>) -# Build process that may transitively invoke pkgconfig -z_vcpkg_restore_pkgconfig_path() -``` - -#]===] function(z_vcpkg_setup_pkgconfig_path) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "" "BASE_DIRS") diff --git a/versions/baseline.json b/versions/baseline.json index 9757917e19..0065e976b2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7350,19 +7350,19 @@ }, "vcpkg-cmake": { "baseline": "2022-05-10", - "port-version": 0 + "port-version": 1 }, "vcpkg-cmake-config": { "baseline": "2022-02-06", - "port-version": 0 + "port-version": 1 }, "vcpkg-cmake-get-vars": { "baseline": "2022-05-10", - "port-version": 0 + "port-version": 1 }, "vcpkg-get-python-packages": { "baseline": "2022-04-11", - "port-version": 0 + "port-version": 1 }, "vcpkg-gfortran": { "baseline": "3", @@ -7370,15 +7370,15 @@ }, "vcpkg-gn": { "baseline": "2021-11-16", - "port-version": 1 + "port-version": 2 }, "vcpkg-pkgconfig-get-modules": { "baseline": "2022-02-10", - "port-version": 0 + "port-version": 1 }, "vcpkg-qmake": { "baseline": "2022-05-10", - "port-version": 0 + "port-version": 1 }, "vcpkg-tool-gn": { "baseline": "2022-04-16", diff --git a/versions/v-/vcpkg-cmake-config.json b/versions/v-/vcpkg-cmake-config.json index 208504f941..a354d87327 100644 --- a/versions/v-/vcpkg-cmake-config.json +++ b/versions/v-/vcpkg-cmake-config.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "8d54cc4f487d51b655abec5f9c9c3f86ca83311f", + "version-date": "2022-02-06", + "port-version": 1 + }, { "git-tree": "24dc7dfc704406e9f745f033643dc25f56e4ca18", "version-date": "2022-02-06", diff --git a/versions/v-/vcpkg-cmake-get-vars.json b/versions/v-/vcpkg-cmake-get-vars.json index 992a7e2445..362bbdce76 100644 --- a/versions/v-/vcpkg-cmake-get-vars.json +++ b/versions/v-/vcpkg-cmake-get-vars.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b50ca3d20736304215fbd82c102d4552457255bb", + "version-date": "2022-05-10", + "port-version": 1 + }, { "git-tree": "181f509cdab757511233106aa44c529e04c0c29f", "version-date": "2022-05-10", diff --git a/versions/v-/vcpkg-cmake.json b/versions/v-/vcpkg-cmake.json index e9e3468fa8..4477bc5e8a 100644 --- a/versions/v-/vcpkg-cmake.json +++ b/versions/v-/vcpkg-cmake.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "8b07d914c90cf8f611973318c85d3af13201e3f9", + "version-date": "2022-05-10", + "port-version": 1 + }, { "git-tree": "e8db2f70aa8b584aac932fcff65d91bf52d57731", "version-date": "2022-05-10", diff --git a/versions/v-/vcpkg-get-python-packages.json b/versions/v-/vcpkg-get-python-packages.json index a95148d645..31285bc57d 100644 --- a/versions/v-/vcpkg-get-python-packages.json +++ b/versions/v-/vcpkg-get-python-packages.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ffe13ab59e3e2f4f003498035bc1fbc06b64e164", + "version-date": "2022-04-11", + "port-version": 1 + }, { "git-tree": "f03d459d365b604decb720f7da79b3f7d7127670", "version-date": "2022-04-11", diff --git a/versions/v-/vcpkg-gn.json b/versions/v-/vcpkg-gn.json index b1802e0e8d..c4a418c49b 100644 --- a/versions/v-/vcpkg-gn.json +++ b/versions/v-/vcpkg-gn.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "119e620029e0579165590b4656882bd6c3ce297c", + "version-date": "2021-11-16", + "port-version": 2 + }, { "git-tree": "ba02b5d9d66b0e227762e6aeac0851fd8fb4314e", "version-date": "2021-11-16", diff --git a/versions/v-/vcpkg-pkgconfig-get-modules.json b/versions/v-/vcpkg-pkgconfig-get-modules.json index 1b3b6360a4..3bb85c48b8 100644 --- a/versions/v-/vcpkg-pkgconfig-get-modules.json +++ b/versions/v-/vcpkg-pkgconfig-get-modules.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "48bfa748f78837921860329547ed6e5799665698", + "version-date": "2022-02-10", + "port-version": 1 + }, { "git-tree": "d4f1fd82fd733b622ed83f5f502b8483e5b2ca3b", "version-date": "2022-02-10", diff --git a/versions/v-/vcpkg-qmake.json b/versions/v-/vcpkg-qmake.json index a3e4ee7e74..92995e2064 100644 --- a/versions/v-/vcpkg-qmake.json +++ b/versions/v-/vcpkg-qmake.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "546491787b275bfae887457a5eb17a7b502ae891", + "version-date": "2022-05-10", + "port-version": 1 + }, { "git-tree": "7f5f5955d901ed2c7caac9e3681d23338d8fe845", "version-date": "2022-05-10",