2017-01-06 06:38:01 +08:00
|
|
|
#.rst:
|
|
|
|
# .. command:: vcpkg_build_qmake
|
|
|
|
#
|
2018-01-18 23:36:07 +08:00
|
|
|
# Build a qmake-based project, previously configured using vcpkg_configure_qmake.
|
2017-01-06 06:38:01 +08:00
|
|
|
#
|
|
|
|
# ::
|
|
|
|
# vcpkg_build_qmake()
|
|
|
|
#
|
|
|
|
function(vcpkg_build_qmake)
|
2018-01-18 23:36:07 +08:00
|
|
|
cmake_parse_arguments(_csc "SKIP_MAKEFILES" "BUILD_LOGNAME" "TARGETS;RELEASE_TARGETS;DEBUG_TARGETS" ${ARGN})
|
2019-03-14 21:33:48 +08:00
|
|
|
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
vcpkg_find_acquire_program(JOM)
|
|
|
|
set(INVOKE "${JOM}")
|
|
|
|
else()
|
|
|
|
find_program(MAKE make)
|
|
|
|
set(INVOKE "${MAKE}")
|
|
|
|
endif()
|
2017-01-06 06:38:01 +08:00
|
|
|
|
2020-05-05 06:37:57 +08:00
|
|
|
# Make sure that the linker finds the libraries used
|
2017-10-16 20:04:16 +08:00
|
|
|
set(ENV_PATH_BACKUP "$ENV{PATH}")
|
2020-05-05 06:37:57 +08:00
|
|
|
|
2018-01-18 23:36:07 +08:00
|
|
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
|
|
|
|
|
|
|
|
if(NOT _csc_BUILD_LOGNAME)
|
|
|
|
set(_csc_BUILD_LOGNAME build)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
function(run_jom TARGETS LOG_PREFIX LOG_SUFFIX)
|
|
|
|
message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}")
|
|
|
|
vcpkg_execute_required_process(
|
2020-05-05 06:37:57 +08:00
|
|
|
COMMAND ${INVOKE} -j ${VCPKG_CONCURRENCY} ${TARGETS}
|
2018-01-18 23:36:07 +08:00
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${LOG_SUFFIX}
|
|
|
|
LOGNAME package-${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings
|
|
|
|
set(ENV_CL_BACKUP "$ENV{_CL_}")
|
|
|
|
set(ENV{_CL_} "/utf-8")
|
|
|
|
|
2019-09-13 01:07:22 +08:00
|
|
|
#Replace with VCPKG variables if PR #7733 is merged
|
|
|
|
unset(BUILDTYPES)
|
2019-05-01 00:29:41 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
2019-09-13 01:07:22 +08:00
|
|
|
set(_buildname "DEBUG")
|
|
|
|
list(APPEND BUILDTYPES ${_buildname})
|
|
|
|
set(_short_name_${_buildname} "dbg")
|
2020-05-05 06:37:57 +08:00
|
|
|
set(_path_suffix_${_buildname} "/debug")
|
2018-01-18 23:36:07 +08:00
|
|
|
endif()
|
2019-05-01 00:29:41 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
2019-09-13 01:07:22 +08:00
|
|
|
set(_buildname "RELEASE")
|
|
|
|
list(APPEND BUILDTYPES ${_buildname})
|
|
|
|
set(_short_name_${_buildname} "rel")
|
2020-05-05 06:37:57 +08:00
|
|
|
set(_path_suffix_${_buildname} "")
|
2018-01-18 23:36:07 +08:00
|
|
|
endif()
|
2019-09-13 01:07:22 +08:00
|
|
|
unset(_buildname)
|
2020-05-05 06:37:57 +08:00
|
|
|
|
2019-09-13 01:07:22 +08:00
|
|
|
foreach(_buildname ${BUILDTYPES})
|
|
|
|
set(_BUILD_PREFIX "${_path_suffix_${_buildname}}")
|
|
|
|
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}${_BUILD_PREFIX}/bin")
|
|
|
|
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}${_BUILD_PREFIX}/lib")
|
|
|
|
list(APPEND _csc_${_buildname}_TARGETS ${_csc_TARGETS})
|
|
|
|
if(NOT _csc_SKIP_MAKEFILES)
|
|
|
|
run_jom(qmake_all makefiles ${_short_name_${_buildname}})
|
|
|
|
endif()
|
|
|
|
run_jom("${_csc_${_buildname}_TARGETS}" ${_csc_BUILD_LOGNAME} ${_short_name_${_buildname}})
|
2019-09-20 18:57:29 +08:00
|
|
|
unset(_BUILD_PREFIX)
|
2019-09-13 01:07:22 +08:00
|
|
|
endforeach()
|
2020-05-05 06:37:57 +08:00
|
|
|
|
2017-10-15 21:40:25 +08:00
|
|
|
# Restore the original value of ENV{PATH}
|
2017-10-16 20:04:16 +08:00
|
|
|
set(ENV{PATH} "${ENV_PATH_BACKUP}")
|
2018-01-18 23:36:07 +08:00
|
|
|
set(ENV{_CL_} "${ENV_CL_BACKUP}")
|
2017-01-06 06:38:01 +08:00
|
|
|
endfunction()
|