2017-01-06 06:38:01 +08:00
|
|
|
#.rst:
|
|
|
|
# .. command:: vcpkg_configure_qmake
|
|
|
|
#
|
2018-02-22 06:50:36 +08:00
|
|
|
# Configure a qmake-based project.
|
2017-01-06 06:38:01 +08:00
|
|
|
#
|
|
|
|
# ::
|
|
|
|
# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
|
|
|
|
# [OPTIONS arg1 [arg2 ...]]
|
|
|
|
# )
|
|
|
|
#
|
2017-03-21 07:10:45 +08:00
|
|
|
# ``SOURCE_PATH``
|
2017-01-06 06:38:01 +08:00
|
|
|
# The path to the *.pro qmake project file.
|
|
|
|
# ``OPTIONS``
|
|
|
|
# The options passed to qmake.
|
|
|
|
|
|
|
|
function(vcpkg_configure_qmake)
|
|
|
|
cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
|
2018-02-22 06:50:36 +08:00
|
|
|
|
2018-01-18 23:36:07 +08:00
|
|
|
# Find qmake executable
|
2017-03-21 07:10:45 +08:00
|
|
|
find_program(QMAKE_COMMAND NAMES qmake.exe PATHS ${CURRENT_INSTALLED_DIR}/tools/qt5)
|
2018-02-22 06:50:36 +08:00
|
|
|
|
2017-01-06 06:38:01 +08:00
|
|
|
if(NOT QMAKE_COMMAND)
|
2017-03-21 07:10:45 +08:00
|
|
|
message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.")
|
2017-01-06 06:38:01 +08:00
|
|
|
endif()
|
|
|
|
|
2018-01-18 23:36:07 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
list(APPEND _csc_OPTIONS CONFIG+=staticlib)
|
|
|
|
endif()
|
|
|
|
|
2018-02-22 06:50:36 +08:00
|
|
|
# Cleanup build directories
|
2018-01-18 23:36:07 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
2017-01-06 06:38:01 +08:00
|
|
|
|
2018-01-18 23:36:07 +08:00
|
|
|
configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_release.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf)
|
|
|
|
|
|
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
2017-01-06 06:38:01 +08:00
|
|
|
vcpkg_execute_required_process(
|
2018-02-22 06:50:36 +08:00
|
|
|
COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release ${_csc_OPTIONS} ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf"
|
2018-01-18 23:36:07 +08:00
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
|
|
|
LOGNAME config-${TARGET_TRIPLET}-rel
|
2017-01-06 06:38:01 +08:00
|
|
|
)
|
2018-01-18 23:36:07 +08:00
|
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
|
|
|
|
|
|
|
|
configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_debug.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf)
|
|
|
|
|
|
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
|
|
|
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
vcpkg_execute_required_process(
|
2018-02-22 06:50:36 +08:00
|
|
|
COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug ${_csc_OPTIONS} ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf"
|
2018-01-18 23:36:07 +08:00
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
|
|
|
LOGNAME config-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
|
|
|
|
|
2017-01-06 06:38:01 +08:00
|
|
|
endfunction()
|