Add doxygen and add packages option to vcpkg_require_msys (#2869)

* Add doxygen to acquired programs

* Add packages option to msys function

* Add documentation for PACKAGES in vcpkg_require_msys

* [ffmpeg][x264] Update to use `PACKAGES` parameter. Tweak docs.
This commit is contained in:
Jacob Zhong 2018-02-24 16:00:51 +08:00 committed by Robert Schumacher
parent c55ccbf146
commit 63901137f6
8 changed files with 45 additions and 61 deletions

View File

@ -4,13 +4,18 @@ Download and prepare an MSYS2 instance.
## Usage
```cmake
vcpkg_acquire_msys(<MSYS_ROOT_VAR>)
vcpkg_acquire_msys(<MSYS_ROOT_VAR> [PACKAGES <package>...])
```
## 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.15)`
## Notes
A call to `vcpkg_acquire_msys` will usually be followed by a call to `bash.exe`:
```cmake
@ -23,19 +28,6 @@ vcpkg_execute_required_process(
LOGNAME build-${TARGET_TRIPLET}-rel
)
```
To ensure a package is available:
```cmake
vcpkg_acquire_msys(MSYS_ROOT)
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
message(STATUS "Installing MSYS Packages")
vcpkg_execute_required_process(
COMMAND
${BASH} --noprofile --norc -c
'PATH=/usr/bin:\$PATH pacman -Sy --noconfirm --needed make'
WORKING_DIRECTORY ${MSYS_ROOT}
LOGNAME pacman-${TARGET_TRIPLET})
```
## Examples

View File

@ -8,7 +8,6 @@ fi
if [ "$HTTPS_PROXY" ]; then
export https_proxy=$HTTPS_PROXY
fi
pacman -Sy --noconfirm --needed diffutils make
PATH_TO_BUILD_DIR="`cygpath "$1"`"
PATH_TO_SRC_DIR="`cygpath "$2"`"

View File

@ -17,7 +17,11 @@ vcpkg_find_acquire_program(YASM)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}")
vcpkg_acquire_msys(MSYS_ROOT)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
vcpkg_acquire_msys(MSYS_ROOT PACKAGES perl gcc diffutils make)
else()
vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils make)
endif()
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}")
set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;$ENV{LIB}")
@ -45,14 +49,6 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
get_filename_component(GAS_ITEM_PATH ${GAS_PATH} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${GAS_ITEM_PATH}")
endforeach(GAS_PATH)
## Get Perl and GCC for MSYS2
vcpkg_execute_required_process(
COMMAND ${BASH} --noprofile --norc -c 'PATH=/usr/bin:\$PATH;pacman -Sy --noconfirm --needed perl gcc'
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME msys-${TARGET_TRIPLET}
)
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
else()

View File

@ -15,7 +15,7 @@ vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/disable-escapestr-tool.patch)
# Acquire tools
vcpkg_acquire_msys(MSYS_ROOT)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make automake1.15)
# Insert msys into the path between the compiler toolset and windows system32. This prevents masking of "link.exe" but DOES mask "find.exe".
string(REPLACE ";$ENV{SystemRoot}\\system32;" ";${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\system32;" NEWPATH "$ENV{PATH}")
@ -23,11 +23,6 @@ string(REPLACE ";$ENV{SystemRoot}\\System32;" ";${MSYS_ROOT}/usr/bin;$ENV{System
set(ENV{PATH} "${NEWPATH}")
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
vcpkg_execute_required_process(
COMMAND ${BASH} --noprofile --norc -c "pacman -Sy --noconfirm --needed make automake1.15"
WORKING_DIRECTORY "${MSYS_ROOT}"
LOGNAME "pacman-${TARGET_TRIPLET}")
set(AUTOMAKE_DIR ${MSYS_ROOT}/usr/share/automake-1.15)
file(COPY ${AUTOMAKE_DIR}/config.guess ${AUTOMAKE_DIR}/config.sub DESTINATION ${SOURCE_PATH}/source)

View File

@ -22,20 +22,12 @@ vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_find_acquire_program(YASM)
vcpkg_find_acquire_program(PERL)
vcpkg_acquire_msys(MSYS_ROOT)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
set(ENV{PATH} "${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;$ENV{PATH};${PERL_EXE_PATH}")
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
message(STATUS "Installing MSYS Packages")
vcpkg_execute_required_process(
COMMAND
${BASH} --noprofile --norc -c
"pacman -Sy --noconfirm --needed make"
WORKING_DIRECTORY ${MSYS_ROOT}
LOGNAME pacman-${TARGET_TRIPLET})
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
if(VCPKG_CRT_LINKAGE STREQUAL static)

View File

@ -11,18 +11,13 @@ vcpkg_from_github(
)
# Acquire tools
vcpkg_acquire_msys(MSYS_ROOT)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make automake1.15)
# Insert msys into the path between the compiler toolset and windows system32. This prevents masking of "link.exe" but DOES mask "find.exe".
string(REPLACE ";$ENV{SystemRoot}\\system32;" ";${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\system32;" NEWPATH "$ENV{PATH}")
set(ENV{PATH} "${NEWPATH}")
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
vcpkg_execute_required_process(
COMMAND ${BASH} --noprofile --norc -c "pacman -Sy --noconfirm --needed make automake1.15"
WORKING_DIRECTORY "${MSYS_ROOT}"
LOGNAME "pacman-${TARGET_TRIPLET}")
set(AUTOMAKE_DIR ${MSYS_ROOT}/usr/share/automake-1.15)
#file(COPY ${AUTOMAKE_DIR}/config.guess ${AUTOMAKE_DIR}/config.sub DESTINATION ${SOURCE_PATH}/source)

View File

@ -4,13 +4,18 @@
##
## ## Usage
## ```cmake
## vcpkg_acquire_msys(<MSYS_ROOT_VAR>)
## vcpkg_acquire_msys(<MSYS_ROOT_VAR> [PACKAGES <package>...])
## ```
##
## ## 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.15)`
##
## ## Notes
## A call to `vcpkg_acquire_msys` will usually be followed by a call to `bash.exe`:
## ```cmake
@ -23,19 +28,6 @@
## LOGNAME build-${TARGET_TRIPLET}-rel
## )
## ```
## To ensure a package is available:
## ```cmake
## vcpkg_acquire_msys(MSYS_ROOT)
## set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
##
## message(STATUS "Installing MSYS Packages")
## vcpkg_execute_required_process(
## COMMAND
## ${BASH} --noprofile --norc -c
## 'PATH=/usr/bin:\$PATH pacman -Sy --noconfirm --needed make'
## WORKING_DIRECTORY ${MSYS_ROOT}
## LOGNAME pacman-${TARGET_TRIPLET})
## ```
##
## ## Examples
##
@ -45,6 +37,7 @@
function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
set(TOOLPATH ${DOWNLOADS}/tools/msys2)
cmake_parse_arguments(_am "" "" "PACKAGES" ${ARGN})
# detect host architecture
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
@ -85,16 +78,32 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
WORKING_DIRECTORY ${TOOLPATH}
)
execute_process(
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin:\$PATH;pacman-key --init;pacman-key --populate"
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman-key --init;pacman-key --populate"
WORKING_DIRECTORY ${TOOLPATH}
)
execute_process(
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin:\$PATH;pacman -Syu --noconfirm"
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Syu --noconfirm"
WORKING_DIRECTORY ${TOOLPATH}
)
file(WRITE "${TOOLPATH}/${STAMP}" "0")
message(STATUS "Acquiring MSYS2... OK")
endif()
if(_am_PACKAGES)
message(STATUS "Acquiring MSYS Packages...")
string(REPLACE ";" " " _am_PACKAGES "${_am_PACKAGES}")
set(_ENV_ORIGINAL $ENV{PATH})
set(ENV{PATH} ${PATH_TO_ROOT}/usr/bin)
vcpkg_execute_required_process(
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "pacman -Sy --noconfirm --needed ${_am_PACKAGES}"
WORKING_DIRECTORY ${TOOLPATH}
LOGNAME msys-pacman-${TARGET_TRIPLET}
)
set(ENV{PATH} "${_ENV_ORIGINAL}")
message(STATUS "Acquiring MSYS Packages... OK")
endif()
set(${PATH_TO_ROOT_OUT} ${PATH_TO_ROOT} PARENT_SCOPE)
endfunction()

View File

@ -159,6 +159,12 @@ function(vcpkg_find_acquire_program VAR)
set(URL "https://sourceforge.net/projects/scons/files/scons-local-3.0.1.zip/download")
set(ARCHIVE "scons-local-3.0.1.zip")
set(HASH fe121b67b979a4e9580c7f62cfdbe0c243eba62a05b560d6d513ac7f35816d439b26d92fc2d7b7d7241c9ce2a49ea7949455a17587ef53c04a5f5125ac635727)
elseif(VAR MATCHES "DOXYGEN")
set(PROGNAME doxygen)
set(PATHS ${DOWNLOADS}/tools/doxygen)
set(URL "http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.14.windows.bin.zip")
set(ARCHIVE "doxygen-1.8.14.windows.bin.zip")
set(HASH d0d706501e7112045b1f401f22d12a2c8d9b7728edee9ad1975a17dff914c16494ae48a70beab6f6304643779935843f268c7afed3b9da7d403b5cb11cac0c50)
else()
message(FATAL "unknown tool ${VAR} -- unable to acquire.")
endif()