vcpkg/scripts/cmake/vcpkg_common_definitions.cmake

209 lines
10 KiB
CMake
Raw Normal View History

#[===[.md:
# vcpkg_common_definitions
[aws-cpp-sdk] [zlib] [openssl] [curl] Fix zlib, OpenSSL, curl and AWS SDK for Android (#15725) * Fix Android build * Add versioning support * Disable building tests for cURL * Fix patch file * Fix patch file * Fix patch file * Fix versioning * Fix patch file * [aws-sdk-cpp] Update patch * update baseline * Fix dependencies * Simplify Android configuration * Simplify Android configuration * Simplify Android configuration Add alternative Git CMake script * Bump port version * Bump version files * Remove redundant file * Bump port version * Fix version files * Do not build curl, zlib and OpenSSL * Typo de pkgconfig script * Fix cURL build for Android * Add required flags * Revert macro change * Fix curl build for other platforms * Fix curl build for other platforms * [vcpkg baseline][gsoap] Update to 2.8.111 * Update versions * [ktx/otl] Update download hash * update version record * Fix curl build for other platforms * Update ports/aws-sdk-cpp/portfile.cmake Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * Update ports/aws-sdk-cpp/portfile.cmake Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * Remove FingGit * Fix configuration step * Bump cURL port version * Bump cURL port version * Bump AWS SDK C++ version * Bump AWS SDK C++ version * Bump AWS SDK C++ version * Bump AWS SDK C++ version * Update ports/curl/CONTROL * Update ports/curl/portfile.cmake * update baseline record * Fix Git * update version record * Typo * Fix cross-platform builds of OpenSSL on MinGW/Windows * Update version * Fix version * update doc * Update ports/aws-sdk-cpp/portfile.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * Update ports/aws-sdk-cpp/portfile.cmake Co-authored-by: Robert Schumacher <roschuma@microsoft.com> * Add debug libraries to curl for Android Simplify OpenSSL patch for curl Update OpenSSL's port version * Update aws-sdk-cpp, curl, and OpenSSL versions * Fix libssh after latest update * Update libssh version * Update libssh version * Update ports/libssh/portfile.cmake Co-authored-by: nicole mazzuca <mazzucan@outlook.com> * Update ports/curl/portfile.cmake Co-authored-by: nicole mazzuca <mazzucan@outlook.com> * Update ports/libssh/portfile.cmake * Apply suggestions from code review * Use correct variables for OpenSSL libraries when building curl for Android Fix zlib building for Android Remove redundant patch comments * Bump zlib's port version * Update zlib, libssh, and curl versions * [vcpkg baseline][popsift] Fix vcpkg_find_cuda.cmake path * update version record * Update versions/o-/openssl.json Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: Ahmed Yarub Hani Al Nuaimi <ahmed.alnuaimi@zwift.com> Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com> Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com> Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com> Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2021-04-20 08:08:51 +08:00
This file defines the following variables which are commonly needed or used in portfiles:
```cmake
VCPKG_TARGET_IS_<target> with <target> being one of the following: WINDOWS, UWP, MINGW, LINUX, OSX, ANDROID, FREEBSD, OPENBSD. only defined if <target>
VCPKG_HOST_IS_<host> with <host> being one of the following: WINDOWS, LINUX, OSX, FREEBSD, OPENBSD. only defined if <host>
VCPKG_HOST_PATH_SEPARATOR Host specific path separator (USAGE: "<something>${VCPKG_HOST_PATH_SEPARATOR}<something>"; 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_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.
#]===]
2021-04-08 03:51:40 +08:00
string(COMPARE NOTEQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" VCPKG_CROSSCOMPILING)
#Helper variable to identify the Target system. VCPKG_TARGET_IS_<targetname>
if (NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "")
set(VCPKG_TARGET_IS_WINDOWS ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(VCPKG_TARGET_IS_WINDOWS ON)
set(VCPKG_TARGET_IS_UWP ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(VCPKG_TARGET_IS_OSX ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(VCPKG_TARGET_IS_IOS ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(VCPKG_TARGET_IS_LINUX ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
set(VCPKG_TARGET_IS_ANDROID ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(VCPKG_TARGET_IS_FREEBSD ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
set(VCPKG_TARGET_IS_OPENBSD ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
set(VCPKG_TARGET_IS_WINDOWS ON)
set(VCPKG_TARGET_IS_MINGW ON)
endif()
#Helper variables to identify the host system name
if (CMAKE_HOST_WIN32)
set(VCPKG_HOST_IS_WINDOWS ON)
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(VCPKG_HOST_IS_OSX ON)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(VCPKG_HOST_IS_LINUX ON)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
set(VCPKG_HOST_IS_FREEBSD ON)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
set(VCPKG_HOST_IS_OPENBSD ON)
endif()
#Helper variable to identify the host path separator.
if(CMAKE_HOST_WIN32)
set(VCPKG_HOST_PATH_SEPARATOR ";")
elseif(CMAKE_HOST_UNIX)
set(VCPKG_HOST_PATH_SEPARATOR ":")
endif()
#Helper variables to identify executables on host/target
if(CMAKE_HOST_WIN32)
set(VCPKG_HOST_EXECUTABLE_SUFFIX ".exe")
else()
set(VCPKG_HOST_EXECUTABLE_SUFFIX "")
endif()
#set(CMAKE_EXECUTABLE_SUFFIX ${VCPKG_HOST_EXECUTABLE_SUFFIX}) not required by find_program
if(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_TARGET_EXECUTABLE_SUFFIX ".exe")
else()
set(VCPKG_TARGET_EXECUTABLE_SUFFIX "")
endif()
#Helper variables for libraries
if(VCPKG_TARGET_IS_MINGW)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".dll.a")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "lib")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "")
set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".lib" ".dll") #This is a slight modification to CMakes value which does not include ".dll".
set(VCPKG_FIND_LIBRARY_PREFIXES "" "lib") #This is a slight modification to CMakes value which does not include "lib".
elseif(VCPKG_TARGET_IS_OSX)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
else()
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".so" ".a")
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
endif()
#Setting these variables allows find_library to work in script mode and thus in portfiles!
#This allows us scale down on hardcoded target dependent paths in portfiles
set(CMAKE_STATIC_LIBRARY_SUFFIX "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
set(CMAKE_SHARED_LIBRARY_SUFFIX "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
set(CMAKE_IMPORT_LIBRARY_SUFFIX "${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}")
set(CMAKE_STATIC_LIBRARY_PREFIX "${VCPKG_TARGET_STATIC_LIBRARY_PREFIX}")
set(CMAKE_SHARED_LIBRARY_PREFIX "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}")
set(CMAKE_IMPORT_LIBRARY_PREFIX "${VCPKG_TARGET_IMPORT_LIBRARY_PREFIX}")
set(CMAKE_FIND_LIBRARY_SUFFIXES "${VCPKG_FIND_LIBRARY_SUFFIXES}" CACHE INTERNAL "") # Required by find_library
set(CMAKE_FIND_LIBRARY_PREFIXES "${VCPKG_FIND_LIBRARY_PREFIXES}" CACHE INTERNAL "") # Required by find_library
# Append platform libraries to VCPKG_SYSTEM_LIBRARIES
# The variable are just appended to permit to custom triplets define the variable
# Platforms with libdl
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX)
list(APPEND VCPKG_SYSTEM_LIBRARIES dl)
endif()
# Platforms with libm
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES m)
endif()
# Platforms with pthread
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES pthread)
endif()
# Platforms with libstdc++
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES [[stdc\+\+]])
endif()
# Platforms with libc++
if(VCPKG_TARGET_IS_OSX)
list(APPEND VCPKG_SYSTEM_LIBRARIES [[c\+\+]])
endif()
# Platforms with librt
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES rt)
endif()
# Platforms with GCC libs
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc)
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc_s)
endif()
# Platforms with system iconv
if(VCPKG_TARGET_IS_OSX)
list(APPEND VCPKG_SYSTEM_LIBRARIES iconv)
endif()
# Windows system libs
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND VCPKG_SYSTEM_LIBRARIES advapi32)
list(APPEND VCPKG_SYSTEM_LIBRARIES bcrypt)
list(APPEND VCPKG_SYSTEM_LIBRARIES dinput8)
list(APPEND VCPKG_SYSTEM_LIBRARIES gdi32)
list(APPEND VCPKG_SYSTEM_LIBRARIES imm32)
list(APPEND VCPKG_SYSTEM_LIBRARIES oleaut32)
list(APPEND VCPKG_SYSTEM_LIBRARIES ole32)
list(APPEND VCPKG_SYSTEM_LIBRARIES psapi)
list(APPEND VCPKG_SYSTEM_LIBRARIES secur32)
list(APPEND VCPKG_SYSTEM_LIBRARIES setupapi)
list(APPEND VCPKG_SYSTEM_LIBRARIES shell32)
list(APPEND VCPKG_SYSTEM_LIBRARIES shlwapi)
list(APPEND VCPKG_SYSTEM_LIBRARIES strmiids)
list(APPEND VCPKG_SYSTEM_LIBRARIES user32)
list(APPEND VCPKG_SYSTEM_LIBRARIES uuid)
list(APPEND VCPKG_SYSTEM_LIBRARIES version)
list(APPEND VCPKG_SYSTEM_LIBRARIES vfw32)
list(APPEND VCPKG_SYSTEM_LIBRARIES winmm)
list(APPEND VCPKG_SYSTEM_LIBRARIES wsock32)
[vcpkg/scripts/pkgconfig] rewrite pkg-config check for libraries (#11550) * [vcpkg/scripts/pkgconfig] rewrite pkgconfig check for libraries. * [vcpkg/scripts/pkgconfig] fix more details. * [vcpkg/scripts/pkgconfig] smaller improvements * ws change to check functionallity of script for testing. * [vcpkg/scripts/pkgconfig] update to latest test version * Revert "ws change to check functionallity of script for testing." This reverts commit 26269e9e776009230777d9390465715f2ebac465. * [nettle] bump control for vcpkg_fixup_pkgconfig test * [gmp] rerun CI to create new *.pc files * [gmp/nettle] enable port debug * [vcpkg/script/pkgconfig] fix path conversion regex for CI * [CI|OSX] install pkg-config on osx * [gmp/nettle] disable port debug * [vcpkg/scripts/pkgconfig] update to latest version of x windows pr * [zlib] add pkgconfig file * [zstd] add fixup pkgconfig * [libpng] add pc file installation * [bzip2] install pc file and leave a TODO for somebody else ;) * [bzip2] bump control * [vcpkg/scripts/pkgconfig] skip checks if pkgconfig cannot be found. - small bugfix in ignore flags regex * retry zstd and zlib * [libpng] retry by adding dl and m to system libraries for osx * [libpng] add missing vcpkg_fixup_pkgconfig() * [vcpkg/scripts/pkgconfig] unset var if found. fixes checks for other configurations which will be always succesful otherwise * [libpng] bump control * [libpng] enable port debug to debug osx regression * ws change to retrigger osx ci and hopeing that it works * fix typo * [libpng] remove -lm flag on apple platforms * ws change to rerun some ports in ci for good measure after the merge with master * Re-trigger CI test * [zstd] add pkgconfig * [zstd] correct debug link * [vcpkg/script/pkgconfig] - add more search suffixes for static libs - add additional debug messages for debuging - fix unsetting of cache variables hiding issues with debug libraries - fixed pkgconfig fix in the debug case * [pcre] add pthread dependency to pcre * [protobuf] fix pkgconfig * include quotes around the prefix in the case the prefix path was quoted (fixes some regressions) add option NOT_STATIC_PKGCONFIG to run pkg-config without the --static argument * [ignition-msgs5] get rid of a dev warning * [apr] fix apr regression * [protobuf] fix protobuf regression * [sdl1] fix regression due to variable expansion of pkg-config. Use similar regex to the library removal for ignored flags. * [ignition] fix regression * remove changes of zlib portfile. * reset changes in osx ci pipeline * add DISABLE_PARALLEL_CONFIGURE Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com> Co-authored-by: Billy Robert O'Neal <bion@microsoft.com>
2020-07-25 02:39:21 +08:00
list(APPEND VCPKG_SYSTEM_LIBRARIES Ws2_32)
list(APPEND VCPKG_SYSTEM_LIBRARIES wldap32)
list(APPEND VCPKG_SYSTEM_LIBRARIES crypt32)
endif()