mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 00:19:06 +08:00
Add function vcpkg_configure_make/vcpkg_build_make/vcpkg_install_make/vcpkg_build_nmake/vcpkg_install_nmake (#8267)
* Add function vcpkg_configure_make/vcpkg_build_make. * Fix autoreconf command and add log. * Add vcpkg_install_make. * Fix call function name. * support non-debug mode. * Add nmake support. * [tcl]Add new port for testing. * [vcpkg_configure_make]Fix prefix in linux. * restart CI systen. * Separate vcpkg_build_nmake/vcpkg_install_nmake. Add arg PROJECT_NAME. * fix copy source file. add samples. * Remove uncommon options. Add force install para to autoreconf. * fix build error. * fix options judgment. * enable nmake in windows. * fix some envs and macros. Disable NMAKE in vcpkg_configure_make currently. * update docs. * fix environments. * Modify libosip2 to use vcpkg_configure_make/vcpkg_install_make. * [tcl]Tcl separates PR. * trigger PR-EAGER. * [freexl]Fix options name and remove option NMAKE. * use tool-chain instead of set environments manually. * fix autoreconf para. * use vcpkg_execute_build_process instead.
This commit is contained in:
parent
47c6b3f557
commit
ad493fd860
@ -6,12 +6,15 @@
|
||||
- [vcpkg\_add\_to\_path](vcpkg_add_to_path.md)
|
||||
- [vcpkg\_apply\_patches](vcpkg_apply_patches.md)
|
||||
- [vcpkg\_build\_cmake](vcpkg_build_cmake.md)
|
||||
- [vcpkg\_build\_msbuild](vcpkg_build_msbuild.md)
|
||||
- [vcpkg\_build\_msbuild](vcpkg_build_msbuild.md)
|
||||
- [vcpkg\_build\_make](vcpkg_build_make.md)
|
||||
- [vcpkg\_build\_nmake](vcpkg_build_nmake.md)
|
||||
- [vcpkg\_check\_features](vcpkg_check_features.md)
|
||||
- [vcpkg\_check\_linkage](vcpkg_check_linkage.md)
|
||||
- [vcpkg\_clean\_msbuild](vcpkg_clean_msbuild.md)
|
||||
- [vcpkg\_common\_definitions](vcpkg_common_definitions.md)
|
||||
- [vcpkg\_configure\_cmake](vcpkg_configure_cmake.md)
|
||||
- [vcpkg\_configure\_cmake](vcpkg_configure_cmake.md)
|
||||
- [vcpkg\_configure\_make](vcpkg_configure_make.md)
|
||||
- [vcpkg\_copy\_pdbs](vcpkg_copy_pdbs.md)
|
||||
- [vcpkg\_copy\_tool\_dependencies](vcpkg_copy_tool_dependencies.md)
|
||||
- [vcpkg\_download\_distfile](vcpkg_download_distfile.md)
|
||||
@ -26,6 +29,8 @@
|
||||
- [vcpkg\_from\_github](vcpkg_from_github.md)
|
||||
- [vcpkg\_from\_gitlab](vcpkg_from_gitlab.md)
|
||||
- [vcpkg\_install\_cmake](vcpkg_install_cmake.md)
|
||||
- [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md)
|
||||
- [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md)
|
||||
- [vcpkg\_install\_make](vcpkg_install_make.md)
|
||||
- [vcpkg\_install\_nmake](vcpkg_install_nmake.md)
|
||||
- [vcpkg\_prettify\_command](vcpkg_prettify_command.md)
|
||||
- [vcpkg\_test\_cmake](vcpkg_test_cmake.md)
|
||||
|
30
docs/maintainers/vcpkg_build_make.md
Normal file
30
docs/maintainers/vcpkg_build_make.md
Normal file
@ -0,0 +1,30 @@
|
||||
# vcpkg_build_make
|
||||
|
||||
Build a linux makefile project.
|
||||
|
||||
## Usage:
|
||||
```cmake
|
||||
vcpkg_build_make([TARGET <target>])
|
||||
```
|
||||
|
||||
### TARGET
|
||||
The target passed to the configure/make build command (`./configure/make/make install`). If not specified, no target will
|
||||
be passed.
|
||||
|
||||
### ADD_BIN_TO_PATH
|
||||
Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
|
||||
|
||||
## Notes:
|
||||
This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md).
|
||||
You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the
|
||||
"install" target
|
||||
|
||||
## Examples
|
||||
|
||||
* [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake)
|
||||
* [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
* [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
* [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
|
||||
|
||||
## Source
|
||||
[scripts/cmake/vcpkg_build_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_build_make.cmake)
|
63
docs/maintainers/vcpkg_build_nmake.md
Normal file
63
docs/maintainers/vcpkg_build_nmake.md
Normal file
@ -0,0 +1,63 @@
|
||||
# vcpkg_build_nmake
|
||||
|
||||
Build a msvc makefile project.
|
||||
|
||||
## Usage:
|
||||
```cmake
|
||||
vcpkg_build_nmake(
|
||||
SOURCE_PATH <${SOURCE_PATH}>
|
||||
[NO_DEBUG]
|
||||
PROJECT_SUBPATH <${SUBPATH}>
|
||||
PROJECT_NAME <${MAKEFILE_NAME}>
|
||||
[OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
|
||||
[OPTIONS_RELEASE <-DOPTIMIZE=1>...]
|
||||
[OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
|
||||
[TARGET <target>])
|
||||
```
|
||||
|
||||
## Parameters
|
||||
### SOURCE_PATH
|
||||
Specifies the directory containing the source files.
|
||||
By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
|
||||
### PROJECT_SUBPATH
|
||||
Specifies the sub directory containing the `makefile.vc`/`makefile.mak`/`makefile.msvc` or other msvc makefile.
|
||||
|
||||
### PROJECT_NAME
|
||||
Specifies the name of msvc makefile name.
|
||||
Default is `makefile.vc`
|
||||
|
||||
### NO_DEBUG
|
||||
This port doesn't support debug mode.
|
||||
|
||||
### ENABLE_INSTALL
|
||||
Install binaries after build.
|
||||
|
||||
### OPTIONS
|
||||
Additional options passed to generate during the generation.
|
||||
|
||||
### OPTIONS_RELEASE
|
||||
Additional options passed to generate during the Release generation. These are in addition to `OPTIONS`.
|
||||
|
||||
### OPTIONS_DEBUG
|
||||
Additional options passed to generate during the Debug generation. These are in addition to `OPTIONS`.
|
||||
|
||||
### TARGET
|
||||
The target passed to the nmake build command (`nmake/nmake install`). If not specified, no target will
|
||||
be passed.
|
||||
|
||||
### ADD_BIN_TO_PATH
|
||||
Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
|
||||
|
||||
## Notes:
|
||||
This command should be preceeded by a call to [`vcpkg_configure_nmake()`](vcpkg_configure_nmake.md).
|
||||
You can use the alias [`vcpkg_install_nmake()`](vcpkg_configure_nmake.md) function if your CMake script supports the
|
||||
"install" target
|
||||
|
||||
## Examples
|
||||
|
||||
* [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
* [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
|
||||
## Source
|
||||
[scripts/cmake/vcpkg_build_nmake.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_build_nmake.cmake)
|
74
docs/maintainers/vcpkg_configure_make.md
Normal file
74
docs/maintainers/vcpkg_configure_make.md
Normal file
@ -0,0 +1,74 @@
|
||||
# vcpkg_configure_make
|
||||
|
||||
Configure `configure` for Debug and Release builds of a project.
|
||||
|
||||
## Usage
|
||||
```cmake
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH <${SOURCE_PATH}>
|
||||
[AUTOCONFIG]
|
||||
[DISABLE_AUTO_HOST]
|
||||
[DISABLE_AUTO_DST]
|
||||
[GENERATOR]
|
||||
[NO_DEBUG]
|
||||
[PROJECT_SUBPATH <${PROJ_SUBPATH}>]
|
||||
[PRERUN_SHELL <${SHELL_PATH}>]
|
||||
[OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
|
||||
[OPTIONS_RELEASE <-DOPTIMIZE=1>...]
|
||||
[OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
### SOURCE_PATH
|
||||
Specifies the directory containing the `configure`/`configure.ac`.
|
||||
By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
|
||||
### PROJECT_SUBPATH
|
||||
Specifies the directory containing the ``configure`/`configure.ac`.
|
||||
By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
Should use `GENERATOR NMake` first.
|
||||
|
||||
### NO_DEBUG
|
||||
This port doesn't support debug mode.
|
||||
|
||||
### AUTOCONFIG
|
||||
Need to use autoconfig to generate configure file.
|
||||
|
||||
### DISABLE_AUTO_HOST
|
||||
Don't set host automatically, the default value is `i686`.
|
||||
If use this option, you will need to set host manually.
|
||||
|
||||
### DISABLE_AUTO_DST
|
||||
Don't set installation path automatically, the default value is `${CURRENT_PACKAGES_DIR}` and `${CURRENT_PACKAGES_DIR}/debug`
|
||||
If use this option, you will need to set dst path manually.
|
||||
|
||||
### GENERATOR
|
||||
Specifies the precise generator to use.
|
||||
NMake: nmake(windows) make(unix)
|
||||
MAKE: make(windows) make(unix)
|
||||
|
||||
### PRERUN_SHELL
|
||||
Script that needs to be called before configuration
|
||||
|
||||
### OPTIONS
|
||||
Additional options passed to configure during the configuration.
|
||||
|
||||
### OPTIONS_RELEASE
|
||||
Additional options passed to configure during the Release configuration. These are in addition to `OPTIONS`.
|
||||
|
||||
### OPTIONS_DEBUG
|
||||
Additional options passed to configure during the Debug configuration. These are in addition to `OPTIONS`.
|
||||
|
||||
## Notes
|
||||
This command supplies many common arguments to configure. To see the full list, examine the source.
|
||||
|
||||
## Examples
|
||||
|
||||
* [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake)
|
||||
* [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
* [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
* [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
|
||||
|
||||
## Source
|
||||
[scripts/cmake/vcpkg_configure_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_configure_make.cmake)
|
24
docs/maintainers/vcpkg_install_make.md
Normal file
24
docs/maintainers/vcpkg_install_make.md
Normal file
@ -0,0 +1,24 @@
|
||||
# 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)
|
||||
|
||||
## Source
|
||||
[scripts/cmake/vcpkg_install_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_install_make.cmake)
|
48
docs/maintainers/vcpkg_install_nmake.md
Normal file
48
docs/maintainers/vcpkg_install_nmake.md
Normal file
@ -0,0 +1,48 @@
|
||||
# vcpkg_install_nmake
|
||||
|
||||
Build and install a msvc makefile project.
|
||||
|
||||
## Usage:
|
||||
```cmake
|
||||
vcpkg_install_nmake(
|
||||
SOURCE_PATH <${SOURCE_PATH}>
|
||||
[NO_DEBUG]
|
||||
PROJECT_SUBPATH <${SUBPATH}>
|
||||
PROJECT_NAME <${MAKEFILE_NAME}>
|
||||
[OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
|
||||
[OPTIONS_RELEASE <-DOPTIMIZE=1>...]
|
||||
[OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
|
||||
```
|
||||
|
||||
## Parameters
|
||||
### SOURCE_PATH
|
||||
Specifies the directory containing the source files.
|
||||
By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
|
||||
### PROJECT_SUBPATH
|
||||
Specifies the sub directory containing the `makefile.vc`/`makefile.mak`/`makefile.msvc` or other msvc makefile.
|
||||
|
||||
### PROJECT_NAME
|
||||
Specifies the name of msvc makefile name.
|
||||
Default is makefile.vc
|
||||
|
||||
### NO_DEBUG
|
||||
This port doesn't support debug mode.
|
||||
|
||||
### OPTIONS
|
||||
Additional options passed to generate during the generation.
|
||||
|
||||
### OPTIONS_RELEASE
|
||||
Additional options passed to generate during the Release generation. These are in addition to `OPTIONS`.
|
||||
|
||||
### OPTIONS_DEBUG
|
||||
Additional options passed to generate during the Debug generation. These are in addition to `OPTIONS`.
|
||||
|
||||
## Parameters:
|
||||
See [`vcpkg_build_nmake()`](vcpkg_build_nmake.md).
|
||||
|
||||
## Notes:
|
||||
This command transparently forwards to [`vcpkg_build_nmake()`](vcpkg_build_nmake.md), adding `ENABLE_INSTALL`
|
||||
|
||||
## Source
|
||||
[scripts/cmake/vcpkg_install_nmake.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_install_nmake.cmake)
|
@ -1,5 +1,5 @@
|
||||
Source: freexl
|
||||
Version: 1.0.4-2
|
||||
Version: 1.0.4-5
|
||||
Homepage: https://www.gaia-gis.it/gaia-sins/freexl-sources
|
||||
Description: FreeXL is an open source library to extract valid data from within an Excel (.xls) spreadsheet
|
||||
Build-Depends: libiconv
|
||||
|
@ -1,177 +1,87 @@
|
||||
include(vcpkg_common_functions)
|
||||
set(FREEXL_VERSION_STR "1.0.4")
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freexl-${FREEXL_VERSION_STR})
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-${FREEXL_VERSION_STR}.tar.gz"
|
||||
FILENAME "freexl-${FREEXL_VERSION_STR}.tar.gz"
|
||||
SHA512 d72561f7b82e0281cb211fbf249e5e45411a7cdd009cfb58da3696f0a0341ea7df210883bfde794be28738486aeb4ffc67ec2c98fd2acde5280e246e204ce788
|
||||
)
|
||||
if (CMAKE_HOST_WIN32)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-makefiles.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-sources.patch
|
||||
)
|
||||
find_program(NMAKE nmake)
|
||||
|
||||
set(LIBS_ALL_DBG
|
||||
"\"${CURRENT_INSTALLED_DIR}/debug/lib/libiconv.lib\" \
|
||||
\"${CURRENT_INSTALLED_DIR}/debug/lib/libcharset.lib\""
|
||||
if (VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_extract_source_archive_ex(
|
||||
ARCHIVE ${ARCHIVE}
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
PATCHES
|
||||
fix-makefiles.patch
|
||||
fix-sources.patch
|
||||
)
|
||||
set(LIBS_ALL_REL
|
||||
"\"${CURRENT_INSTALLED_DIR}/lib/libiconv.lib\" \
|
||||
\"${CURRENT_INSTALLED_DIR}/lib/libcharset.lib\""
|
||||
|
||||
set(LIBS_ALL_DBG
|
||||
"\"${CURRENT_INSTALLED_DIR}/debug/lib/libiconv.lib\" \
|
||||
\"${CURRENT_INSTALLED_DIR}/debug/lib/libcharset.lib\""
|
||||
)
|
||||
set(LIBS_ALL_REL
|
||||
"\"${CURRENT_INSTALLED_DIR}/lib/libiconv.lib\" \
|
||||
\"${CURRENT_INSTALLED_DIR}/lib/libcharset.lib\""
|
||||
)
|
||||
|
||||
vcpkg_install_nmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS_DEBUG
|
||||
INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}/debug"
|
||||
INST_DIR="${CURRENT_PACKAGES_DIR}/debug"
|
||||
"LINK_FLAGS=/debug"
|
||||
"LIBS_ALL=${LIBS_ALL_DBG}"
|
||||
OPTIONS_RELEASE
|
||||
INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}"
|
||||
INST_DIR="${CURRENT_PACKAGES_DIR}"
|
||||
"LINK_FLAGS="
|
||||
"LIBS_ALL=${LIBS_ALL_REL}"
|
||||
|
||||
)
|
||||
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
|
||||
set(CL_FLAGS_DBG "/MDd /Zi")
|
||||
set(CL_FLAGS_REL "/MD /Ox")
|
||||
else()
|
||||
set(CL_FLAGS_DBG "/MTd /Zi")
|
||||
set(CL_FLAGS_REL "/MT /Ox")
|
||||
endif()
|
||||
|
||||
|
||||
################
|
||||
# Debug build
|
||||
################
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
|
||||
|
||||
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" INST_DIR_DBG)
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NMAKE} -f makefile.vc clean install
|
||||
INST_DIR="${INST_DIR_DBG}" INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}" "LINK_FLAGS=/debug" "CL_FLAGS=${CL_FLAGS_DBG}" "LIBS_ALL=${LIBS_ALL_DBG}"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}
|
||||
LOGNAME nmake-build-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
|
||||
vcpkg_copy_pdbs()
|
||||
endif()
|
||||
|
||||
################
|
||||
# Release build
|
||||
################
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-rel")
|
||||
|
||||
file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL)
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${NMAKE} -f makefile.vc clean install
|
||||
INST_DIR="${INST_DIR_REL}" INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}" "LINK_FLAGS=" "CL_FLAGS=${CL_FLAGS_REL}" "LIBS_ALL=${LIBS_ALL_REL}"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}
|
||||
LOGNAME nmake-build-${TARGET_TRIPLET}-release
|
||||
)
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-rel done")
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freexl RENAME copyright)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/freexl_i.lib)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/freexl_i.lib)
|
||||
else()
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/freexl.lib)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/freexl.lib)
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/freexl_i.lib ${CURRENT_PACKAGES_DIR}/lib/freexl.lib)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freexl RENAME copyright)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/freexl_i.lib)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/freexl_i.lib)
|
||||
else()
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/freexl.lib)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/freexl.lib)
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/freexl_i.lib ${CURRENT_PACKAGES_DIR}/lib/freexl.lib)
|
||||
endif()
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/freexl_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/freexl.lib)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/freexl_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/freexl.lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
elseif (CMAKE_HOST_UNIX OR CMAKE_HOST_APPLE) # Build in UNIX
|
||||
|
||||
# Check build system first
|
||||
find_program(MAKE make)
|
||||
if (NOT MAKE)
|
||||
message(FATAL_ERROR "MAKE not found")
|
||||
endif()
|
||||
|
||||
# CI error logs appear to indicate that it doesn't like ./configure in the same source dir
|
||||
# so extract the source into separate debug/release source directories
|
||||
set(SOURCE_ROOT_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug)
|
||||
set(SOURCE_ROOT_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release)
|
||||
set(SOURCE_PATH_DEBUG ${SOURCE_ROOT_DEBUG}/freexl-${FREEXL_VERSION_STR})
|
||||
set(SOURCE_PATH_RELEASE ${SOURCE_ROOT_RELEASE}/freexl-${FREEXL_VERSION_STR})
|
||||
|
||||
file(REMOVE_RECURSE ${SOURCE_ROOT_DEBUG})
|
||||
file(REMOVE_RECURSE ${SOURCE_ROOT_RELEASE})
|
||||
|
||||
vcpkg_extract_source_archive(${ARCHIVE} ${SOURCE_ROOT_DEBUG})
|
||||
vcpkg_extract_source_archive(${ARCHIVE} ${SOURCE_ROOT_RELEASE})
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
################
|
||||
# Release build
|
||||
################
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
||||
set(OUT_PATH_RELEASE ${SOURCE_PATH_RELEASE}/../../make-build-${TARGET_TRIPLET}-release)
|
||||
file(MAKE_DIRECTORY ${OUT_PATH_RELEASE})
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${SOURCE_PATH_RELEASE}/configure" --prefix=${OUT_PATH_RELEASE} "${FREEXL_CONFIGURE_ARGS_REL}"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
LOGNAME config-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-rel")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND make
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
LOGNAME make-build-${TARGET_TRIPLET}-release
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND make install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
|
||||
LOGNAME make-install-${TARGET_TRIPLET}-release
|
||||
)
|
||||
|
||||
file(COPY ${OUT_PATH_RELEASE}/lib DESTINATION ${CURRENT_PACKAGES_DIR})
|
||||
file(COPY ${OUT_PATH_RELEASE}/include DESTINATION ${CURRENT_PACKAGES_DIR})
|
||||
file(COPY ${SOURCE_PATH_RELEASE}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freexl)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/freexl/COPYING ${CURRENT_PACKAGES_DIR}/share/freexl/copyright)
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-rel done")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
################
|
||||
# Debug build
|
||||
################
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
||||
set(OUT_PATH_DEBUG ${SOURCE_PATH_DEBUG}/../../make-build-${TARGET_TRIPLET}-debug)
|
||||
file(MAKE_DIRECTORY ${OUT_PATH_DEBUG})
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${SOURCE_PATH_DEBUG}/configure" --prefix=${OUT_PATH_DEBUG} "${FREEXL_CONFIGURE_ARGS_DBG}"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
LOGNAME config-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
|
||||
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND make
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
LOGNAME make-build-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND make install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
|
||||
LOGNAME make-install-${TARGET_TRIPLET}-debug
|
||||
)
|
||||
|
||||
file(COPY ${OUT_PATH_DEBUG}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug)
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}-dbg done")
|
||||
endif()
|
||||
vcpkg_extract_source_archive_ex(
|
||||
ARCHIVE ${ARCHIVE}
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
)
|
||||
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS_DEBUG
|
||||
INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}"
|
||||
"LINK_FLAGS=/debug"
|
||||
"CL_FLAGS=${CL_FLAGS_DBG}"
|
||||
"LIBS_ALL=${LIBS_ALL_DBG}"
|
||||
OPTIONS_RELEASE
|
||||
INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}"
|
||||
"LINK_FLAGS="
|
||||
"CL_FLAGS=${CL_FLAGS_REL}"
|
||||
"LIBS_ALL=${LIBS_ALL_REL}"
|
||||
)
|
||||
|
||||
vcpkg_install_make()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freexl RENAME copyright)
|
||||
|
||||
else()# Other build system
|
||||
message(FATAL_ERROR "Unsupported build system.")
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: libosip2
|
||||
Version: 5.1.0
|
||||
Version: 5.1.0-1
|
||||
Homepage: https://www.gnu.org/software/osip/
|
||||
Description: oSIP is an LGPL implementation of SIP. It's stable, portable, flexible and compliant! -may be more-! It is used mostly with eXosip2 stack (GPL) which provides simpler API for User-Agent implementation.
|
@ -17,50 +17,17 @@ vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
)
|
||||
|
||||
find_program(autoreconf autoreconf)
|
||||
if (NOT autoreconf)
|
||||
message(FATAL_ERROR "autoreconf must be installed before libx11 can build. Install them with \"apt-get dh-autoreconf\".")
|
||||
endif()
|
||||
|
||||
find_program(MAKE make)
|
||||
if (NOT MAKE)
|
||||
message(FATAL_ERROR "MAKE not found")
|
||||
endif()
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "./autogen.sh"
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}
|
||||
LOGNAME autoreconf-${TARGET_TRIPLET}
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
NO_DEBUG
|
||||
AUTO_HOST
|
||||
AUTO_DST
|
||||
PRERUN_SHELL autogen.sh
|
||||
)
|
||||
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}")
|
||||
set(OUT_PATH ${CURRENT_BUILDTREES_DIR}/make-build-${TARGET_TRIPLET})
|
||||
|
||||
file(REMOVE_RECURSE ${OUT_PATH})
|
||||
file(MAKE_DIRECTORY ${OUT_PATH})
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "./configure" --prefix=${OUT_PATH}
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}
|
||||
LOGNAME config-${TARGET_TRIPLET}
|
||||
)
|
||||
|
||||
message(STATUS "Building ${TARGET_TRIPLET}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND make
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}
|
||||
LOGNAME build-${TARGET_TRIPLET}-release
|
||||
)
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND make install
|
||||
WORKING_DIRECTORY ${SOURCE_PATH}
|
||||
LOGNAME install-${TARGET_TRIPLET}-release
|
||||
)
|
||||
file(COPY ${OUT_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR})
|
||||
file(COPY ${OUT_PATH}/lib DESTINATION ${CURRENT_PACKAGES_DIR})
|
||||
vcpkg_install_make()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(GLOB_RECURSE LIBOSIP2_BINARIES ${CURRENT_PACKAGES_DIR}/lib *.so)
|
||||
foreach(LIBOSIP2_BINARY LIBOSIP2_BINARIES)
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: x264
|
||||
Version: 157-303c484ec828ed0-2
|
||||
Version: 157-303c484ec828ed0-3
|
||||
Homepage: https://github.com/mirror/x264
|
||||
Description: x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format
|
||||
|
@ -2,6 +2,10 @@ include(vcpkg_common_functions)
|
||||
|
||||
set(X264_VERSION 157)
|
||||
|
||||
if (NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
message(FATAL_ERROR "x264 only support windows.")
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO mirror/x264
|
||||
@ -12,99 +16,21 @@ vcpkg_from_github(
|
||||
"uwp-cflags.patch"
|
||||
)
|
||||
|
||||
# Acquire tools
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make automake1.15)
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
--enable-strip
|
||||
--disable-lavf
|
||||
--disable-swscale
|
||||
--disable-avs
|
||||
--disable-ffms
|
||||
--disable-gpac
|
||||
--disable-lsmash
|
||||
--disable-asm
|
||||
--enable-debug
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86 OR VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
||||
vcpkg_find_acquire_program(NASM)
|
||||
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
|
||||
set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}")
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
|
||||
set(AUTOMAKE_DIR ${MSYS_ROOT}/usr/share/automake-1.15)
|
||||
#file(COPY ${AUTOMAKE_DIR}/config.guess ${AUTOMAKE_DIR}/config.sub DESTINATION ${SOURCE_PATH}/source)
|
||||
|
||||
set(CONFIGURE_OPTIONS "--host=i686-pc-mingw32 --enable-strip --disable-lavf --disable-swscale --disable-avs --disable-ffms --disable-gpac --disable-lsmash")
|
||||
|
||||
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x86 AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
||||
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --disable-asm")
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --enable-shared")
|
||||
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib")
|
||||
endif()
|
||||
else()
|
||||
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --enable-static")
|
||||
endif()
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(ENV{LIBPATH} "$ENV{LIBPATH};$ENV{_WKITS10}references\\windows.foundation.foundationcontract\\2.0.0.0\\;$ENV{_WKITS10}references\\windows.foundation.universalapicontract\\3.0.0.0\\")
|
||||
set(CONFIGURE_OPTIONS "${CONFIGURE_OPTIONS} --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00")
|
||||
endif()
|
||||
|
||||
set(CONFIGURE_OPTIONS_RELEASE "--prefix=${CURRENT_PACKAGES_DIR}")
|
||||
set(CONFIGURE_OPTIONS_DEBUG "--enable-debug --prefix=${CURRENT_PACKAGES_DIR}/debug")
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
set(X264_RUNTIME "-MT")
|
||||
else()
|
||||
set(X264_RUNTIME "-MD")
|
||||
endif()
|
||||
|
||||
# Configure release
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
set(ENV{CFLAGS} "${X264_RUNTIME} -O2 -Oi -Zi")
|
||||
set(ENV{CXXFLAGS} "${X264_RUNTIME} -O2 -Oi -Zi")
|
||||
set(ENV{LDFLAGS} "-DEBUG -INCREMENTAL:NO -OPT:REF -OPT:ICF")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${BASH} --noprofile --norc -c
|
||||
"CC=cl ${SOURCE_PATH}/configure ${CONFIGURE_OPTIONS} ${CONFIGURE_OPTIONS_RELEASE}"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
LOGNAME "configure-${TARGET_TRIPLET}-rel")
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
|
||||
|
||||
# Configure debug
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
||||
set(ENV{CFLAGS} "${X264_RUNTIME}d -Od -Zi -RTC1")
|
||||
set(ENV{CXXFLAGS} "${X264_RUNTIME}d -Od -Zi -RTC1")
|
||||
set(ENV{LDFLAGS} "-DEBUG")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${BASH} --noprofile --norc -c
|
||||
"CC=cl ${SOURCE_PATH}/configure ${CONFIGURE_OPTIONS} ${CONFIGURE_OPTIONS_DEBUG}"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
LOGNAME "configure-${TARGET_TRIPLET}-dbg")
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
|
||||
|
||||
unset(ENV{CFLAGS})
|
||||
unset(ENV{CXXFLAGS})
|
||||
unset(ENV{LDFLAGS})
|
||||
|
||||
# Build release
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-rel")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${BASH} --noprofile --norc -c "make && make install"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
LOGNAME "build-${TARGET_TRIPLET}-rel")
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-rel done")
|
||||
|
||||
# Build debug
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${BASH} --noprofile --norc -c "make && make install"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
LOGNAME "build-${TARGET_TRIPLET}-dbg")
|
||||
message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
|
||||
vcpkg_install_make()
|
||||
|
||||
if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/x264)
|
||||
|
171
scripts/cmake/vcpkg_build_make.cmake
Normal file
171
scripts/cmake/vcpkg_build_make.cmake
Normal file
@ -0,0 +1,171 @@
|
||||
## # vcpkg_build_make
|
||||
##
|
||||
## Build a linux makefile project.
|
||||
##
|
||||
## ## Usage:
|
||||
## ```cmake
|
||||
## vcpkg_build_make([TARGET <target>])
|
||||
## ```
|
||||
##
|
||||
## ### TARGET
|
||||
## The target passed to the configure/make build command (`./configure/make/make install`). If not specified, no target will
|
||||
## be passed.
|
||||
##
|
||||
## ### ADD_BIN_TO_PATH
|
||||
## Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
|
||||
##
|
||||
## ## Notes:
|
||||
## This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md).
|
||||
## You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the
|
||||
## "install" target
|
||||
##
|
||||
## ## Examples
|
||||
##
|
||||
## * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake)
|
||||
## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
|
||||
function(vcpkg_build_make)
|
||||
cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT" "" ${ARGN})
|
||||
|
||||
if(NOT _bc_LOGFILE_ROOT)
|
||||
set(_bc_LOGFILE_ROOT "build")
|
||||
endif()
|
||||
|
||||
if (_VCPKG_PROJECT_SUBPATH)
|
||||
set(_VCPKG_PROJECT_SUBPATH /${_VCPKG_PROJECT_SUBPATH}/)
|
||||
endif()
|
||||
|
||||
set(MAKE )
|
||||
set(MAKE_OPTS )
|
||||
set(INSTALL_OPTS )
|
||||
if (_VCPKG_MAKE_GENERATOR STREQUAL "make")
|
||||
if (CMAKE_HOST_WIN32)
|
||||
# Compiler requriements
|
||||
vcpkg_find_acquire_program(YASM)
|
||||
vcpkg_find_acquire_program(PERL)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make)
|
||||
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
|
||||
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
|
||||
|
||||
set(PATH_GLOBAL "$ENV{PATH}")
|
||||
set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}")
|
||||
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
|
||||
# Set make command and install command
|
||||
set(MAKE ${BASH} --noprofile --norc -c)
|
||||
# Must use absolute path to call make in windows
|
||||
set(MAKE_OPTS "${_VCPKG_PROJECT_SUBPATH}make")
|
||||
set(INSTALL_OPTS "${_VCPKG_PROJECT_SUBPATH}make install")
|
||||
else()
|
||||
# Compiler requriements
|
||||
find_program(MAKE make REQUIRED)
|
||||
set(MAKE make)
|
||||
# Set make command and install command
|
||||
set(MAKE_OPTS)
|
||||
set(INSTALL_OPTS install)
|
||||
endif()
|
||||
elseif (_VCPKG_MAKE_GENERATOR STREQUAL "nmake")
|
||||
find_program(NMAKE nmake REQUIRED)
|
||||
get_filename_component(NMAKE_EXE_PATH ${NMAKE} DIRECTORY)
|
||||
set(PATH_GLOBAL "$ENV{PATH}")
|
||||
set(ENV{PATH} "$ENV{PATH};${NMAKE_EXE_PATH}")
|
||||
set(ENV{CL} "$ENV{CL} /MP")
|
||||
# Set make command and install command
|
||||
set(MAKE ${NMAKE} /NOLOGO /G /U)
|
||||
set(MAKE_OPTS -f makefile all)
|
||||
set(INSTALL_OPTS install)
|
||||
else()
|
||||
message(FATAL_ERROR "${_VCPKG_MAKE_GENERATOR} not supported.")
|
||||
endif()
|
||||
|
||||
set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}")
|
||||
|
||||
foreach(BUILDTYPE "debug" "release")
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE)
|
||||
if(BUILDTYPE STREQUAL "debug")
|
||||
# Skip debug generate
|
||||
if (_VCPKG_NO_DEBUG)
|
||||
continue()
|
||||
endif()
|
||||
set(SHORT_BUILDTYPE "-dbg")
|
||||
else()
|
||||
# In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory.
|
||||
if (_VCPKG_NO_DEBUG)
|
||||
set(SHORT_BUILDTYPE "")
|
||||
else()
|
||||
set(SHORT_BUILDTYPE "-rel")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_HOST_WIN32)
|
||||
# In windows we can remotely call make
|
||||
set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE})
|
||||
else()
|
||||
set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}${_VCPKG_PROJECT_SUBPATH})
|
||||
endif()
|
||||
|
||||
message(STATUS "Building ${TARGET_TRIPLET}${SHORT_BUILDTYPE}")
|
||||
|
||||
if(_bc_ADD_BIN_TO_PATH)
|
||||
set(_BACKUP_ENV_PATH "$ENV{PATH}")
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(_PATHSEP ";")
|
||||
else()
|
||||
set(_PATHSEP ":")
|
||||
endif()
|
||||
if(BUILDTYPE STREQUAL "debug")
|
||||
set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin${_PATHSEP}$ENV{PATH}")
|
||||
else()
|
||||
set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin${_PATHSEP}$ENV{PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} ${MAKE_OPTS}
|
||||
WORKING_DIRECTORY ${WORKING_DIRECTORY}
|
||||
LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}"
|
||||
)
|
||||
|
||||
if(_bc_ADD_BIN_TO_PATH)
|
||||
set(ENV{PATH} "${_BACKUP_ENV_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (_bc_ENABLE_INSTALL)
|
||||
foreach(BUILDTYPE "debug" "release")
|
||||
if(BUILDTYPE STREQUAL "debug")
|
||||
# Skip debug generate
|
||||
if (_VCPKG_NO_DEBUG)
|
||||
continue()
|
||||
endif()
|
||||
set(SHORT_BUILDTYPE "-dbg")
|
||||
else()
|
||||
# In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory.
|
||||
if (_VCPKG_NO_DEBUG)
|
||||
set(SHORT_BUILDTYPE "")
|
||||
else()
|
||||
set(SHORT_BUILDTYPE "-rel")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_HOST_WIN32)
|
||||
# In windows we can remotely call make
|
||||
set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE})
|
||||
else()
|
||||
set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}${_VCPKG_PROJECT_SUBPATH})
|
||||
endif()
|
||||
|
||||
message(STATUS "Installing ${TARGET_TRIPLET}${SHORT_BUILDTYPE}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${MAKE} ${INSTALL_OPTS}
|
||||
WORKING_DIRECTORY ${WORKING_DIRECTORY}
|
||||
LOGNAME "install-${TARGET_TRIPLET}${SHORT_BUILDTYPE}"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(ENV{PATH} "${PATH_GLOBAL}")
|
||||
endif()
|
||||
endfunction()
|
185
scripts/cmake/vcpkg_build_nmake.cmake
Normal file
185
scripts/cmake/vcpkg_build_nmake.cmake
Normal file
@ -0,0 +1,185 @@
|
||||
## # vcpkg_build_nmake
|
||||
##
|
||||
## Build a msvc makefile project.
|
||||
##
|
||||
## ## Usage:
|
||||
## ```cmake
|
||||
## vcpkg_build_nmake(
|
||||
## SOURCE_PATH <${SOURCE_PATH}>
|
||||
## [NO_DEBUG]
|
||||
## PROJECT_SUBPATH <${SUBPATH}>
|
||||
## PROJECT_NAME <${MAKEFILE_NAME}>
|
||||
## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
|
||||
## [OPTIONS_RELEASE <-DOPTIMIZE=1>...]
|
||||
## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
|
||||
## [TARGET <target>])
|
||||
## ```
|
||||
##
|
||||
## ## Parameters
|
||||
## ### SOURCE_PATH
|
||||
## Specifies the directory containing the source files.
|
||||
## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
##
|
||||
## ### PROJECT_SUBPATH
|
||||
## Specifies the sub directory containing the `makefile.vc`/`makefile.mak`/`makefile.msvc` or other msvc makefile.
|
||||
##
|
||||
## ### PROJECT_NAME
|
||||
## Specifies the name of msvc makefile name.
|
||||
## Default is `makefile.vc`
|
||||
##
|
||||
## ### NO_DEBUG
|
||||
## This port doesn't support debug mode.
|
||||
##
|
||||
## ### ENABLE_INSTALL
|
||||
## Install binaries after build.
|
||||
##
|
||||
## ### OPTIONS
|
||||
## Additional options passed to generate during the generation.
|
||||
##
|
||||
## ### OPTIONS_RELEASE
|
||||
## Additional options passed to generate during the Release generation. These are in addition to `OPTIONS`.
|
||||
##
|
||||
## ### OPTIONS_DEBUG
|
||||
## Additional options passed to generate during the Debug generation. These are in addition to `OPTIONS`.
|
||||
##
|
||||
## ### TARGET
|
||||
## The target passed to the nmake build command (`nmake/nmake install`). If not specified, no target will
|
||||
## be passed.
|
||||
##
|
||||
## ### ADD_BIN_TO_PATH
|
||||
## Adds the appropriate Release and Debug `bin\` directories to the path during the build such that executables can run against the in-tree DLLs.
|
||||
##
|
||||
## ## Notes:
|
||||
## This command should be preceeded by a call to [`vcpkg_configure_nmake()`](vcpkg_configure_nmake.md).
|
||||
## You can use the alias [`vcpkg_install_nmake()`](vcpkg_configure_nmake.md) function if your CMake script supports the
|
||||
## "install" target
|
||||
##
|
||||
## ## Examples
|
||||
##
|
||||
## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
function(vcpkg_build_nmake)
|
||||
cmake_parse_arguments(_bn
|
||||
"ADD_BIN_TO_PATH;ENABLE_INSTALL;NO_DEBUG"
|
||||
"SOURCE_PATH;PROJECT_SUBPATH;PROJECT_NAME;LOGFILE_ROOT"
|
||||
"OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
message(FATAL_ERROR "vcpkg_build_nmake only support windows.")
|
||||
endif()
|
||||
|
||||
if (_bn_OPTIONS_DEBUG STREQUAL _bn_OPTIONS_RELEASE)
|
||||
message(FATAL_ERROR "Detected debug configuration is equal to release configuration, please use NO_DEBUG for vcpkg_build_nmake/vcpkg_install_nmake")
|
||||
endif()
|
||||
|
||||
if(NOT _bn_LOGFILE_ROOT)
|
||||
set(_bn_LOGFILE_ROOT "build")
|
||||
endif()
|
||||
|
||||
if (NOT _bn_PROJECT_NAME)
|
||||
set(MAKEFILE_NAME makefile.vc)
|
||||
else()
|
||||
set(MAKEFILE_NAME ${_bn_PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
set(MAKE )
|
||||
set(MAKE_OPTS_BASE )
|
||||
set(INSTALL_OPTS_BASE )
|
||||
|
||||
find_program(NMAKE nmake REQUIRED)
|
||||
get_filename_component(NMAKE_EXE_PATH ${NMAKE} DIRECTORY)
|
||||
# Load toolchains
|
||||
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
|
||||
endif()
|
||||
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
|
||||
# Set needed env
|
||||
set(ENV{PATH} "$ENV{PATH};${NMAKE_EXE_PATH}")
|
||||
set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}")
|
||||
# Set make command and install command
|
||||
set(MAKE ${NMAKE} /NOLOGO /G /U)
|
||||
set(MAKE_OPTS_BASE -f ${MAKEFILE_NAME} all)
|
||||
set(INSTALL_OPTS_BASE install)
|
||||
# Add subpath to work directory
|
||||
if (_bn_PROJECT_SUBPATH)
|
||||
set(_bn_PROJECT_SUBPATH /${_bn_PROJECT_SUBPATH})
|
||||
else()
|
||||
set(_bn_PROJECT_SUBPATH )
|
||||
endif()
|
||||
|
||||
foreach(BUILDTYPE "debug" "release")
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE)
|
||||
if(BUILDTYPE STREQUAL "debug")
|
||||
# Skip debug generate
|
||||
if (_bn_NO_DEBUG)
|
||||
continue()
|
||||
endif()
|
||||
# Generate obj dir suffix
|
||||
set(SHORT_BUILDTYPE "-dbg")
|
||||
set(CONFIG "Debug")
|
||||
# Add install command and arguments
|
||||
set(MAKE_OPTS ${MAKE_OPTS_BASE})
|
||||
if (_bn_ENABLE_INSTALL)
|
||||
set(INSTALL_OPTS ${INSTALL_OPTS_BASE} INSTALLDIR=${CURRENT_PACKAGES_DIR}/debug)
|
||||
set(MAKE_OPTS ${MAKE_OPTS} ${INSTALL_OPTS})
|
||||
endif()
|
||||
set(MAKE_OPTS ${MAKE_OPTS} ${_bn_OPTIONS} ${_bn_OPTIONS_DEBUG})
|
||||
|
||||
unset(ENV{CL})
|
||||
set(TMP_CL_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE "/" "-" TMP_CL_FLAGS "${TMP_CL_FLAGS}")
|
||||
set(ENV{CL} "$ENV{CL} ${TMP_CL_FLAGS}")
|
||||
else()
|
||||
# In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory.
|
||||
if (_bn_NO_DEBUG)
|
||||
set(SHORT_BUILDTYPE "")
|
||||
else()
|
||||
set(SHORT_BUILDTYPE "-rel")
|
||||
endif()
|
||||
set(CONFIG "Release")
|
||||
# Add install command and arguments
|
||||
set(MAKE_OPTS ${MAKE_OPTS_BASE})
|
||||
if (_bn_ENABLE_INSTALL)
|
||||
set(INSTALL_OPTS ${INSTALL_OPTS_BASE} INSTALLDIR=${CURRENT_PACKAGES_DIR})
|
||||
set(MAKE_OPTS ${MAKE_OPTS} ${INSTALL_OPTS})
|
||||
endif()
|
||||
set(MAKE_OPTS ${MAKE_OPTS} ${_bn_OPTIONS} ${_bn_OPTIONS_RELEASE})
|
||||
|
||||
unset(ENV{CL})
|
||||
set(TMP_CL_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "/" "-" TMP_CL_FLAGS "${TMP_CL_FLAGS}")
|
||||
set(ENV{CL} "$ENV{CL} ${TMP_CL_FLAGS}")
|
||||
endif()
|
||||
|
||||
set(CURRENT_TRIPLET_NAME ${TARGET_TRIPLET}${SHORT_BUILDTYPE})
|
||||
set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${CURRENT_TRIPLET_NAME})
|
||||
|
||||
file(REMOVE_RECURSE ${OBJ_DIR})
|
||||
file(MAKE_DIRECTORY ${OBJ_DIR})
|
||||
file(GLOB_RECURSE SOURCE_FILES ${_bn_SOURCE_PATH}/*)
|
||||
foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES})
|
||||
get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH)
|
||||
string(REPLACE "${_bn_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}")
|
||||
file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR})
|
||||
endforeach()
|
||||
|
||||
if (NOT _bn_ENABLE_INSTALL)
|
||||
message(STATUS "Building ${CURRENT_TRIPLET_NAME}")
|
||||
else()
|
||||
message(STATUS "Building and installing ${CURRENT_TRIPLET_NAME}")
|
||||
endif()
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} ${MAKE_OPTS}
|
||||
WORKING_DIRECTORY ${OBJ_DIR}${_bn_PROJECT_SUBPATH}
|
||||
LOGNAME "${_bn_LOGFILE_ROOT}-${CURRENT_TRIPLET_NAME}"
|
||||
)
|
||||
|
||||
if(_bn_ADD_BIN_TO_PATH)
|
||||
set(ENV{PATH} "${_BACKUP_ENV_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
@ -19,12 +19,17 @@ include(vcpkg_from_bitbucket)
|
||||
include(vcpkg_build_cmake)
|
||||
include(vcpkg_build_msbuild)
|
||||
include(vcpkg_build_qmake)
|
||||
include(vcpkg_build_make)
|
||||
include(vcpkg_build_nmake)
|
||||
include(vcpkg_install_cmake)
|
||||
include(vcpkg_install_meson)
|
||||
include(vcpkg_install_msbuild)
|
||||
include(vcpkg_install_make)
|
||||
include(vcpkg_install_nmake)
|
||||
include(vcpkg_configure_cmake)
|
||||
include(vcpkg_configure_meson)
|
||||
include(vcpkg_configure_qmake)
|
||||
include(vcpkg_configure_make)
|
||||
include(vcpkg_apply_patches)
|
||||
include(vcpkg_copy_pdbs)
|
||||
include(vcpkg_copy_tool_dependencies)
|
||||
|
347
scripts/cmake/vcpkg_configure_make.cmake
Normal file
347
scripts/cmake/vcpkg_configure_make.cmake
Normal file
@ -0,0 +1,347 @@
|
||||
## # vcpkg_configure_make
|
||||
##
|
||||
## Configure configure for Debug and Release builds of a project.
|
||||
##
|
||||
## ## Usage
|
||||
## ```cmake
|
||||
## vcpkg_configure_make(
|
||||
## SOURCE_PATH <${SOURCE_PATH}>
|
||||
## [AUTOCONFIG]
|
||||
## [DISABLE_AUTO_HOST]
|
||||
## [DISABLE_AUTO_DST]
|
||||
## [GENERATOR]
|
||||
## [NO_DEBUG]
|
||||
## [PROJECT_SUBPATH <${PROJ_SUBPATH}>]
|
||||
## [PRERUN_SHELL <${SHELL_PATH}>]
|
||||
## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
|
||||
## [OPTIONS_RELEASE <-DOPTIMIZE=1>...]
|
||||
## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
|
||||
## )
|
||||
## ```
|
||||
##
|
||||
## ## Parameters
|
||||
## ### SOURCE_PATH
|
||||
## Specifies the directory containing the `configure`/`configure.ac`.
|
||||
## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
##
|
||||
## ### PROJECT_SUBPATH
|
||||
## Specifies the directory containing the ``configure`/`configure.ac`.
|
||||
## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
## Should use `GENERATOR NMake` first.
|
||||
##
|
||||
## ### NO_DEBUG
|
||||
## This port doesn't support debug mode.
|
||||
##
|
||||
## ### AUTOCONFIG
|
||||
## Need to use autoconfig to generate configure file.
|
||||
##
|
||||
## ### DISABLE_AUTO_HOST
|
||||
## Don't set host automatically, the default value is `i686`.
|
||||
## If use this option, you will need to set host manually.
|
||||
##
|
||||
## ### DISABLE_AUTO_DST
|
||||
## Don't set installation path automatically, the default value is `${CURRENT_PACKAGES_DIR}` and `${CURRENT_PACKAGES_DIR}/debug`
|
||||
## If use this option, you will need to set dst path manually.
|
||||
##
|
||||
## ### GENERATOR
|
||||
## Specifies the precise generator to use.
|
||||
## NMake: nmake(windows) make(unix)
|
||||
## MAKE: make(windows) make(unix)
|
||||
##
|
||||
## ### PRERUN_SHELL
|
||||
## Script that needs to be called before configuration
|
||||
##
|
||||
## ### OPTIONS
|
||||
## Additional options passed to configure during the configuration.
|
||||
##
|
||||
## ### OPTIONS_RELEASE
|
||||
## Additional options passed to configure during the Release configuration. These are in addition to `OPTIONS`.
|
||||
##
|
||||
## ### OPTIONS_DEBUG
|
||||
## Additional options passed to configure during the Debug configuration. These are in addition to `OPTIONS`.
|
||||
##
|
||||
## ## Notes
|
||||
## This command supplies many common arguments to configure. To see the full list, examine the source.
|
||||
##
|
||||
## ## Examples
|
||||
##
|
||||
## * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake)
|
||||
## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
|
||||
function(vcpkg_configure_make)
|
||||
cmake_parse_arguments(_csc
|
||||
"AUTOCONFIG;DISABLE_AUTO_HOST;DISABLE_AUTO_DST;NO_DEBUG"
|
||||
"SOURCE_PATH;PROJECT_SUBPATH;GENERATOR;PRERUN_SHELL"
|
||||
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(NOT VCPKG_PLATFORM_TOOLSET)
|
||||
message(FATAL_ERROR "Vcpkg has been updated with VS2017 support; "
|
||||
"however, vcpkg.exe must be rebuilt by re-running bootstrap-vcpkg.bat\n")
|
||||
endif()
|
||||
|
||||
if (_csc_OPTIONS_DEBUG STREQUAL _csc_OPTIONS_RELEASE OR NMAKE_OPTION_RELEASE STREQUAL NMAKE_OPTION_DEBUG)
|
||||
message(FATAL_ERROR "Detected debug configuration is equal to release configuration, please use NO_DEBUG for vcpkg_configure_make")
|
||||
endif()
|
||||
# Select compiler
|
||||
if(_csc_GENERATOR MATCHES "NMake")
|
||||
message(FATAL_ERROR "Sorry, NMake does not supported currently.")
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(GENERATOR "nmake")
|
||||
else()
|
||||
set(GENERATOR "make")
|
||||
endif()
|
||||
elseif(NOT _csc_GENERATOR OR _csc_GENERATOR MATCHES "MAKE")
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(GENERATOR "make")
|
||||
else()
|
||||
set(GENERATOR "make")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "${_csc_GENERATOR} not supported.")
|
||||
endif()
|
||||
|
||||
if (_csc_AUTOCONFIG AND NOT CMAKE_HOST_WIN32)
|
||||
find_program(autoreconf autoreconf REQUIRED)
|
||||
endif()
|
||||
|
||||
set(WIN_TARGET_ARCH )
|
||||
set(WIN_TARGET_COMPILER )
|
||||
# Detect compiler
|
||||
if (GENERATOR STREQUAL "nmake")
|
||||
message(STATUS "Using generator NMAKE")
|
||||
find_program(NMAKE nmake REQUIRED)
|
||||
elseif (GENERATOR STREQUAL "make")
|
||||
message(STATUS "Using generator make")
|
||||
find_program(MAKE make REQUIRED)
|
||||
else()
|
||||
message(FATAL_ERROR "${GENERATOR} not supported.")
|
||||
endif()
|
||||
# Pre-processing windows configure requirements
|
||||
if (CMAKE_HOST_WIN32)
|
||||
vcpkg_find_acquire_program(YASM)
|
||||
vcpkg_find_acquire_program(PERL)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils)
|
||||
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
|
||||
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
|
||||
|
||||
if (NOT _csc_DISABLE_AUTO_HOST)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
set(WIN_TARGET_ARCH --host=i686-pc-mingw32)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
||||
set(WIN_TARGET_ARCH --host=i686-pc-mingw64)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(WIN_TARGET_ARCH --host=arm-pc-mingw32)
|
||||
endif()
|
||||
endif()
|
||||
set(WIN_TARGET_COMPILER CC=cl)
|
||||
set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;${PERL_EXE_PATH}")
|
||||
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
|
||||
endif()
|
||||
|
||||
if (NOT _csc_NO_DEBUG)
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
else()
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
|
||||
endif()
|
||||
|
||||
if (NOT _csc_DISABLE_AUTO_DST)
|
||||
set(_csc_OPTIONS_RELEASE ${_csc_OPTIONS_RELEASE}
|
||||
--prefix=${CURRENT_PACKAGES_DIR}
|
||||
--bindir=${CURRENT_PACKAGES_DIR}/bin
|
||||
--sbindir=${CURRENT_PACKAGES_DIR}/bin
|
||||
--libdir=${CURRENT_PACKAGES_DIR}/lib
|
||||
--includedir=${CURRENT_PACKAGES_DIR}/include)
|
||||
|
||||
set(_csc_OPTIONS_DEBUG ${_csc_OPTIONS_DEBUG}
|
||||
--prefix=${CURRENT_PACKAGES_DIR}/debug
|
||||
--bindir=${CURRENT_PACKAGES_DIR}/debug/bin
|
||||
--sbindir=${CURRENT_PACKAGES_DIR}/debug/bin
|
||||
--libdir=${CURRENT_PACKAGES_DIR}/debug/lib
|
||||
--includedir=${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
endif()
|
||||
|
||||
set(base_cmd )
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(base_cmd ${BASH} --noprofile --norc -c)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(_csc_OPTIONS ${_csc_OPTIONS} --enable-shared)
|
||||
if (VCPKG_TARGET_IS_UWP)
|
||||
set(_csc_OPTIONS ${_csc_OPTIONS} --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib)
|
||||
endif()
|
||||
else()
|
||||
set(_csc_OPTIONS ${_csc_OPTIONS} --enable-static)
|
||||
endif()
|
||||
# Load toolchains
|
||||
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
|
||||
endif()
|
||||
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
|
||||
|
||||
set(C_FLAGS_GLOBAL "$ENV{CFLAGS} ${VCPKG_C_FLAGS}")
|
||||
set(CXX_FLAGS_GLOBAL "$ENV{CXXFLAGS} ${VCPKG_CXX_FLAGS}")
|
||||
set(LD_FLAGS_GLOBAL "$ENV{LDFLAGS}")
|
||||
|
||||
if(VCPKG_TARGET_IS_UWP)
|
||||
set(ENV{LIBPATH} "$ENV{LIBPATH};$ENV{_WKITS10}references\\windows.foundation.foundationcontract\\2.0.0.0\\;$ENV{_WKITS10}references\\windows.foundation.universalapicontract\\3.0.0.0\\")
|
||||
set(_csc_OPTIONS ${_csc_OPTIONS} --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00)
|
||||
endif()
|
||||
|
||||
list(JOIN _csc_OPTIONS " " _csc_OPTIONS)
|
||||
list(JOIN _csc_OPTIONS_RELEASE " " _csc_OPTIONS_RELEASE)
|
||||
list(JOIN _csc_OPTIONS_DEBUG " " _csc_OPTIONS_DEBUG)
|
||||
|
||||
set(rel_command
|
||||
${base_cmd} "${WIN_TARGET_COMPILER} ${_csc_SOURCE_PATH}/configure ${WIN_TARGET_ARCH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE}"
|
||||
)
|
||||
set(dbg_command
|
||||
${base_cmd} "${WIN_TARGET_COMPILER} ${_csc_SOURCE_PATH}/configure ${WIN_TARGET_ARCH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG}"
|
||||
)
|
||||
else()
|
||||
set(base_cmd ./)
|
||||
set(rel_command
|
||||
${base_cmd}configure "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}"
|
||||
)
|
||||
set(dbg_command
|
||||
${base_cmd}configure "${_csc_OPTIONS}" "${_csc_OPTIONS_DEBUG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Configure debug
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT _csc_NO_DEBUG)
|
||||
if (CMAKE_HOST_WIN32)
|
||||
unset(ENV{CFLAGS})
|
||||
unset(ENV{CXXFLAGS})
|
||||
unset(ENV{LDFLAGS})
|
||||
set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REPLACE "/" "-" TMP_CFLAGS "${TMP_CFLAGS}")
|
||||
set(ENV{CFLAGS} ${TMP_CFLAGS})
|
||||
set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE "/" "-" TMP_CXXFLAGS "${TMP_CXXFLAGS}")
|
||||
set(ENV{CXXFLAGS} ${TMP_CXXFLAGS})
|
||||
set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL}")
|
||||
string(REPLACE "/" "-" TMP_LDFLAGS "${TMP_LDFLAGS}")
|
||||
set(ENV{LDFLAGS} ${TMP_LDFLAGS})
|
||||
endif()
|
||||
|
||||
set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
||||
set(PRJ_DIR ${OBJ_DIR}/${_csc_PROJECT_SUBPATH})
|
||||
|
||||
file(MAKE_DIRECTORY ${OBJ_DIR})
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
file(GLOB_RECURSE SOURCE_FILES ${_csc_SOURCE_PATH}/*)
|
||||
foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES})
|
||||
file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${OBJ_DIR})
|
||||
get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH)
|
||||
string(REPLACE "${_csc_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}")
|
||||
file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (_csc_PRERUN_SHELL)
|
||||
message(STATUS "Prerun shell with ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${base_cmd}${_csc_PRERUN_SHELL}
|
||||
WORKING_DIRECTORY ${PRJ_DIR}
|
||||
LOGNAME prerun-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
endif()
|
||||
|
||||
if (_csc_AUTOCONFIG)
|
||||
message(STATUS "Generating configure with ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND autoreconf -vfi
|
||||
WORKING_DIRECTORY ${PRJ_DIR}
|
||||
LOGNAME prerun-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${dbg_command}
|
||||
WORKING_DIRECTORY ${PRJ_DIR}
|
||||
LOGNAME config-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
endif()
|
||||
|
||||
# Configure release
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
if (CMAKE_HOST_WIN32)
|
||||
unset(ENV{CFLAGS})
|
||||
unset(ENV{CXXFLAGS})
|
||||
unset(ENV{LDFLAGS})
|
||||
set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
|
||||
string(REPLACE "/" "-" TMP_CFLAGS "${TMP_CFLAGS}")
|
||||
set(ENV{CFLAGS} ${TMP_CFLAGS})
|
||||
|
||||
set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "/" "-" TMP_CXXFLAGS "${TMP_CXXFLAGS}")
|
||||
set(ENV{CXXFLAGS} ${TMP_CXXFLAGS})
|
||||
|
||||
set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
string(REPLACE "/" "-" TMP_LDFLAGS "${TMP_LDFLAGS}")
|
||||
set(ENV{LDFLAGS} ${TMP_LDFLAGS})
|
||||
endif()
|
||||
|
||||
if (_csc_NO_DEBUG)
|
||||
set(TAR_TRIPLET_DIR ${TARGET_TRIPLET})
|
||||
set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TAR_TRIPLET_DIR})
|
||||
else()
|
||||
set(TAR_TRIPLET_DIR ${TARGET_TRIPLET}-rel)
|
||||
set(OBJ_DIR ${CURRENT_BUILDTREES_DIR}/${TAR_TRIPLET_DIR})
|
||||
endif()
|
||||
set(PRJ_DIR ${OBJ_DIR}/${_csc_PROJECT_SUBPATH})
|
||||
|
||||
file(MAKE_DIRECTORY ${OBJ_DIR})
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
file(GLOB_RECURSE SOURCE_FILES ${_csc_SOURCE_PATH}/*)
|
||||
foreach(ONE_SOUCRCE_FILE ${SOURCE_FILES})
|
||||
get_filename_component(DST_DIR ${ONE_SOUCRCE_FILE} PATH)
|
||||
string(REPLACE "${_csc_SOURCE_PATH}" "${OBJ_DIR}" DST_DIR "${DST_DIR}")
|
||||
file(COPY ${ONE_SOUCRCE_FILE} DESTINATION ${DST_DIR})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (_csc_PRERUN_SHELL)
|
||||
message(STATUS "Prerun shell with ${TAR_TRIPLET_DIR}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${base_cmd}${_csc_PRERUN_SHELL}
|
||||
WORKING_DIRECTORY ${PRJ_DIR}
|
||||
LOGNAME prerun-${TAR_TRIPLET_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (_csc_AUTOCONFIG)
|
||||
message(STATUS "Generating configure with ${TAR_TRIPLET_DIR}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND autoreconf -vfi
|
||||
WORKING_DIRECTORY ${PRJ_DIR}
|
||||
LOGNAME prerun-${TAR_TRIPLET_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Configuring ${TAR_TRIPLET_DIR}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${rel_command}
|
||||
WORKING_DIRECTORY ${PRJ_DIR}
|
||||
LOGNAME config-${TAR_TRIPLET_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Restore envs
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(ENV{CFLAGS} "${C_FLAGS_GLOBAL}")
|
||||
set(ENV{CXXFLAGS} "${CXX_FLAGS_GLOBAL}")
|
||||
set(ENV{LDFLAGS} "${LD_FLAGS_GLOBAL}")
|
||||
endif()
|
||||
|
||||
set(_VCPKG_MAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE)
|
||||
set(_VCPKG_NO_DEBUG ${_csc_NO_DEBUG} PARENT_SCOPE)
|
||||
SET(_VCPKG_PROJECT_SOURCE_PATH ${_csc_SOURCE_PATH} PARENT_SCOPE)
|
||||
set(_VCPKG_PROJECT_SUBPATH ${_csc_PROJECT_SUBPATH} PARENT_SCOPE)
|
||||
endfunction()
|
25
scripts/cmake/vcpkg_install_make.cmake
Normal file
25
scripts/cmake/vcpkg_install_make.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
## # vcpkg_install_make
|
||||
##
|
||||
## Build and install a make project.
|
||||
##
|
||||
## ## Usage:
|
||||
## ```cmake
|
||||
## vcpkg_install_make(...)
|
||||
## ```
|
||||
##
|
||||
## ## Parameters:
|
||||
## See [`vcpkg_build_make()`](vcpkg_build_make.md).
|
||||
##
|
||||
## ## Notes:
|
||||
## This command transparently forwards to [`vcpkg_build_make()`](vcpkg_build_make.md), adding `ENABLE_INSTALL`
|
||||
##
|
||||
## ## Examples
|
||||
##
|
||||
## * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake)
|
||||
## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
|
||||
|
||||
function(vcpkg_install_make)
|
||||
vcpkg_build_make(LOGFILE_ROOT ENABLE_INSTALL)
|
||||
endfunction()
|
69
scripts/cmake/vcpkg_install_nmake.cmake
Normal file
69
scripts/cmake/vcpkg_install_nmake.cmake
Normal file
@ -0,0 +1,69 @@
|
||||
## # vcpkg_install_nmake
|
||||
##
|
||||
## Build and install a msvc makefile project.
|
||||
##
|
||||
## ## Usage:
|
||||
## ```cmake
|
||||
## vcpkg_install_nmake(
|
||||
## SOURCE_PATH <${SOURCE_PATH}>
|
||||
## [NO_DEBUG]
|
||||
## PROJECT_SUBPATH <${SUBPATH}>
|
||||
## PROJECT_NAME <${MAKEFILE_NAME}>
|
||||
## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...]
|
||||
## [OPTIONS_RELEASE <-DOPTIMIZE=1>...]
|
||||
## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...]
|
||||
## ```
|
||||
##
|
||||
## ## Parameters
|
||||
## ### SOURCE_PATH
|
||||
## Specifies the directory containing the source files.
|
||||
## By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
||||
##
|
||||
## ### PROJECT_SUBPATH
|
||||
## Specifies the sub directory containing the `makefile.vc`/`makefile.mak`/`makefile.msvc` or other msvc makefile.
|
||||
##
|
||||
## ### PROJECT_NAME
|
||||
## Specifies the name of msvc makefile name.
|
||||
## Default is makefile.vc
|
||||
##
|
||||
## ### NO_DEBUG
|
||||
## This port doesn't support debug mode.
|
||||
##
|
||||
## ### OPTIONS
|
||||
## Additional options passed to generate during the generation.
|
||||
##
|
||||
## ### OPTIONS_RELEASE
|
||||
## Additional options passed to generate during the Release generation. These are in addition to `OPTIONS`.
|
||||
##
|
||||
## ### OPTIONS_DEBUG
|
||||
## Additional options passed to generate during the Debug generation. These are in addition to `OPTIONS`.
|
||||
##
|
||||
## ## Parameters:
|
||||
## See [`vcpkg_build_nmake()`](vcpkg_build_nmake.md).
|
||||
##
|
||||
## ## Notes:
|
||||
## This command transparently forwards to [`vcpkg_build_nmake()`](vcpkg_build_nmake.md), adding `ENABLE_INSTALL`
|
||||
##
|
||||
## ## Examples
|
||||
##
|
||||
## * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake)
|
||||
## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
|
||||
|
||||
function(vcpkg_install_nmake)
|
||||
cmake_parse_arguments(_in
|
||||
"NO_DEBUG"
|
||||
"SOURCE_PATH;PROJECT_SUBPATH;PROJECT_NAME"
|
||||
"OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
message(FATAL_ERROR "vcpkg_install_nmake only support windows.")
|
||||
endif()
|
||||
|
||||
vcpkg_build_nmake(LOGFILE_ROOT ENABLE_INSTALL
|
||||
${_in_NO_DEBUG}
|
||||
SOURCE_PATH ${_in_SOURCE_PATH} PROJECT_SUBPATH ${_in_PROJECT_SUBPATH} PROJECT_NAME ${_in_PROJECT_NAME}
|
||||
OPTIONS ${_in_OPTIONS} OPTIONS_RELEASE ${_in_OPTIONS_RELEASE} OPTIONS_DEBUG ${_in_OPTIONS_DEBUG}
|
||||
)
|
||||
endfunction()
|
Loading…
Reference in New Issue
Block a user