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 ...]]
|
2019-09-13 01:07:22 +08:00
|
|
|
# [OPTIONS_RELEASE arg1 [arg2 ...]]
|
|
|
|
# [OPTIONS_DEBUG arg1 [arg2 ...]]
|
2017-01-06 06:38:01 +08:00
|
|
|
# )
|
|
|
|
#
|
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.
|
2019-09-13 01:07:22 +08:00
|
|
|
# ``OPTIONS[_RELEASE|_DEBUG]``
|
2017-01-06 06:38:01 +08:00
|
|
|
# The options passed to qmake.
|
|
|
|
|
|
|
|
function(vcpkg_configure_qmake)
|
2019-09-21 05:06:43 +08:00
|
|
|
cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG;BUILD_OPTIONS;BUILD_OPTIONS_RELEASE;BUILD_OPTIONS_DEBUG" ${ARGN})
|
2019-09-13 01:07:22 +08:00
|
|
|
|
2018-01-18 23:36:07 +08:00
|
|
|
# Find qmake executable
|
2019-09-13 01:07:22 +08:00
|
|
|
set(_triplet_hostbindir ${CURRENT_INSTALLED_DIR}/tools/qt5/bin)
|
2020-01-07 04:36:51 +08:00
|
|
|
if(DEFINED VCPKG_QT_HOST_TOOLS_ROOT_DIR)
|
|
|
|
find_program(QMAKE_COMMAND NAMES qmake PATHS ${VCPKG_QT_HOST_TOOLS_ROOT_DIR}/bin ${_triplet_hostbindir} NO_DEFAULT_PATH)
|
|
|
|
else()
|
|
|
|
find_program(QMAKE_COMMAND NAMES qmake PATHS ${_triplet_hostbindir} NO_DEFAULT_PATH)
|
|
|
|
endif()
|
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()
|
|
|
|
|
2019-12-23 22:10:12 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2019-09-13 01:07:22 +08:00
|
|
|
list(APPEND _csc_OPTIONS "CONFIG-=shared")
|
|
|
|
list(APPEND _csc_OPTIONS "CONFIG*=static")
|
|
|
|
else()
|
|
|
|
list(APPEND _csc_OPTIONS "CONFIG-=static")
|
|
|
|
list(APPEND _csc_OPTIONS "CONFIG*=shared")
|
|
|
|
list(APPEND _csc_OPTIONS_DEBUG "CONFIG*=separate_debug_info")
|
2018-01-18 23:36:07 +08:00
|
|
|
endif()
|
2019-09-13 01:07:22 +08:00
|
|
|
|
2019-12-23 22:10:12 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static")
|
2019-09-13 01:07:22 +08:00
|
|
|
list(APPEND _csc_OPTIONS "CONFIG*=static-runtime")
|
|
|
|
endif()
|
2019-12-23 22:10:12 +08:00
|
|
|
|
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
|
|
|
|
2019-09-13 01:07:22 +08:00
|
|
|
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
|
|
|
|
set(ENV{QMAKE_MACOSX_DEPLOYMENT_TARGET} ${VCPKG_OSX_DEPLOYMENT_TARGET})
|
|
|
|
endif()
|
|
|
|
|
2019-04-26 05:30:39 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
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)
|
2019-09-21 05:06:43 +08:00
|
|
|
if(DEFINED _csc_BUILD_OPTIONS OR DEFINED _csc_BUILD_OPTIONS_RELEASE)
|
|
|
|
set(BUILD_OPT -- ${_csc_BUILD_OPTIONS} ${_csc_BUILD_OPTIONS_RELEASE})
|
|
|
|
endif()
|
2019-04-26 05:30:39 +08:00
|
|
|
vcpkg_execute_required_process(
|
2019-12-23 22:10:12 +08:00
|
|
|
COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release
|
|
|
|
${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} ${_csc_SOURCE_PATH}
|
|
|
|
-qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf"
|
2019-09-21 05:06:43 +08:00
|
|
|
${BUILD_OPT}
|
2019-04-26 05:30:39 +08:00
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
|
|
|
LOGNAME config-${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
|
|
|
|
endif()
|
|
|
|
|
2019-05-01 00:29:41 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
2019-04-26 05:30:39 +08:00
|
|
|
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)
|
2019-09-21 05:06:43 +08:00
|
|
|
if(DEFINED _csc_BUILD_OPTIONS OR DEFINED _csc_BUILD_OPTIONS_DEBUG)
|
|
|
|
set(BUILD_OPT -- ${_csc_BUILD_OPTIONS} ${_csc_BUILD_OPTIONS_DEBUG})
|
|
|
|
endif()
|
2019-04-26 05:30:39 +08:00
|
|
|
vcpkg_execute_required_process(
|
2019-12-23 22:10:12 +08:00
|
|
|
COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug
|
|
|
|
${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} ${_csc_SOURCE_PATH}
|
2019-09-21 05:06:43 +08:00
|
|
|
-qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf"
|
|
|
|
${BUILD_OPT}
|
2019-04-26 05:30:39 +08:00
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
|
|
|
LOGNAME config-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
|
|
|
|
endif()
|
2018-01-18 23:36:07 +08:00
|
|
|
|
2017-01-06 06:38:01 +08:00
|
|
|
endfunction()
|