mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 10:51:48 +08:00
cmake: add qmake-related helpers function
This commit is contained in:
parent
f4c34bb42d
commit
1decb1b52c
36
scripts/cmake/vcpkg_build_qmake.cmake
Normal file
36
scripts/cmake/vcpkg_build_qmake.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
#.rst:
|
||||
# .. command:: vcpkg_build_qmake
|
||||
#
|
||||
# Build a qmake-based project, previously configured using vcpkg_configure_qmake .
|
||||
# As the CONFIG qmake option is assumed to be "debug_and_release" (the default value on Windows, see [1]),
|
||||
# both the debug and release libraries are build in the same build tree.
|
||||
#
|
||||
# ::
|
||||
# vcpkg_build_qmake()
|
||||
#
|
||||
#
|
||||
# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
|
||||
|
||||
function(vcpkg_build_qmake)
|
||||
vcpkg_find_acquire_program("JOM")
|
||||
|
||||
if(NOT JOM)
|
||||
BUILD_ERROR("vcpkg_install_qmake: impossible to find jom.")
|
||||
endif()
|
||||
|
||||
# Make sure that the linker finds the libraries used
|
||||
set(ENV_LIB_BACKUP ENV{LIB})
|
||||
set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/debug/lib;$ENV{LIB}")
|
||||
|
||||
message(STATUS "Package ${TARGET_TRIPLET}")
|
||||
vcpkg_execute_required_process_repeat(
|
||||
COUNT 2
|
||||
COMMAND ${JOM}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
|
||||
LOGNAME package-${TARGET_TRIPLET}
|
||||
)
|
||||
message(STATUS "Package ${TARGET_TRIPLET} done")
|
||||
|
||||
# Restore the original value of ENV{LIB}
|
||||
set(ENV{LIB} ENV_LIB_BACKUP)
|
||||
endfunction()
|
@ -5,7 +5,9 @@ include(vcpkg_execute_required_process_repeat)
|
||||
include(vcpkg_find_acquire_program)
|
||||
include(vcpkg_build_cmake)
|
||||
include(vcpkg_build_msbuild)
|
||||
include(vcpkg_build_qmake)
|
||||
include(vcpkg_install_cmake)
|
||||
include(vcpkg_configure_cmake)
|
||||
include(vcpkg_configure_qmake)
|
||||
include(vcpkg_apply_patches)
|
||||
include(vcpkg_copy_pdbs)
|
||||
|
44
scripts/cmake/vcpkg_configure_qmake.cmake
Normal file
44
scripts/cmake/vcpkg_configure_qmake.cmake
Normal file
@ -0,0 +1,44 @@
|
||||
#.rst:
|
||||
# .. command:: vcpkg_configure_qmake
|
||||
#
|
||||
# Configure a qmake-based project.
|
||||
# It is assume that the qmake project CONFIG variable is
|
||||
# "debug_and_release" (the default value on Windows, see [1]).
|
||||
# Using this option, only one Makefile for building both Release and Debug
|
||||
# libraries is generated, that then can be run using the vcpkg_install_qmake
|
||||
# command.
|
||||
#
|
||||
# ::
|
||||
# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
|
||||
# [OPTIONS arg1 [arg2 ...]]
|
||||
# )
|
||||
#
|
||||
# ``PROJECT_PATH``
|
||||
# The path to the *.pro qmake project file.
|
||||
# ``OPTIONS``
|
||||
# The options passed to qmake.
|
||||
#
|
||||
# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
|
||||
|
||||
function(vcpkg_configure_qmake)
|
||||
cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
|
||||
|
||||
# Find qmake exectuable
|
||||
find_program(QMAKE_COMMAND NAMES qmake)
|
||||
|
||||
if(NOT QMAKE_COMMAND)
|
||||
BUILD_ERROR("vcpkg_configure_qmake: impossible to find qmake.")
|
||||
endif()
|
||||
|
||||
# Cleanup build directories
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
|
||||
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET}")
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${QMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
|
||||
LOGNAME config-${TARGET_TRIPLET}
|
||||
)
|
||||
message(STATUS "Configuring ${TARGET_TRIPLET} done")
|
||||
endfunction()
|
Loading…
Reference in New Issue
Block a user