mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 19:42:46 +08:00
[qt5] Add -j to make to parallelize on Linux and MacOS (#11111)
This commit is contained in:
parent
48decf759e
commit
7db401cb1e
@ -1,5 +1,5 @@
|
|||||||
Source: qt5-base
|
Source: qt5-base
|
||||||
Version: 5.12.8
|
Version: 5.12.8-2
|
||||||
Homepage: https://www.qt.io/
|
Homepage: https://www.qt.io/
|
||||||
Description: Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.
|
Description: Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.
|
||||||
Build-Depends: zlib, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion, openssl, angle (!windows), egl-registry, icu (!uwp), fontconfig (!windows)
|
Build-Depends: zlib, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion, openssl, angle (!windows), egl-registry, icu (!uwp), fontconfig (!windows)
|
||||||
|
@ -1,38 +1,12 @@
|
|||||||
include(qt_fix_makefile_install)
|
include(qt_fix_makefile_install)
|
||||||
|
|
||||||
function(install_qt)
|
function(install_qt)
|
||||||
cmake_parse_arguments(_bc "DISABLE_PARALLEL" "" "" ${ARGN})
|
|
||||||
|
|
||||||
if (_bc_DISABLE_PARALLEL)
|
|
||||||
set(NUMBER_OF_PROCESSORS "1")
|
|
||||||
else()
|
|
||||||
if(DEFINED ENV{NUMBER_OF_PROCESSORS})
|
|
||||||
set(NUMBER_OF_PROCESSORS $ENV{NUMBER_OF_PROCESSORS})
|
|
||||||
elseif(VCPKG_TARGET_IS_OSX)
|
|
||||||
execute_process(
|
|
||||||
COMMAND sysctl -n hw.ncpu
|
|
||||||
OUTPUT_VARIABLE NUMBER_OF_PROCESSORS
|
|
||||||
)
|
|
||||||
string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
|
|
||||||
string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
|
|
||||||
else()
|
|
||||||
execute_process(
|
|
||||||
COMMAND nproc
|
|
||||||
OUTPUT_VARIABLE NUMBER_OF_PROCESSORS
|
|
||||||
)
|
|
||||||
string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
|
|
||||||
string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "NUMBER_OF_PROCESSORS is ${NUMBER_OF_PROCESSORS}")
|
|
||||||
|
|
||||||
if(CMAKE_HOST_WIN32)
|
if(CMAKE_HOST_WIN32)
|
||||||
vcpkg_find_acquire_program(JOM)
|
vcpkg_find_acquire_program(JOM)
|
||||||
set(INVOKE "${JOM}" /J ${NUMBER_OF_PROCESSORS})
|
set(INVOKE "${JOM}" /J ${VCPKG_CONCURRENCY})
|
||||||
else()
|
else()
|
||||||
find_program(MAKE make)
|
find_program(MAKE make)
|
||||||
set(INVOKE "${MAKE}" -j${NUMBER_OF_PROCESSORS})
|
set(INVOKE "${MAKE}" -j${VCPKG_CONCURRENCY})
|
||||||
set(INVOKE_SINGLE "${MAKE}" -j1)
|
set(INVOKE_SINGLE "${MAKE}" -j1)
|
||||||
endif()
|
endif()
|
||||||
vcpkg_find_acquire_program(PYTHON3)
|
vcpkg_find_acquire_program(PYTHON3)
|
||||||
@ -71,10 +45,10 @@ function(install_qt)
|
|||||||
set(_build_type_${_buildname} "release")
|
set(_build_type_${_buildname} "release")
|
||||||
endif()
|
endif()
|
||||||
unset(_buildname)
|
unset(_buildname)
|
||||||
|
|
||||||
foreach(_buildname ${BUILDTYPES})
|
foreach(_buildname ${BUILDTYPES})
|
||||||
set(_build_triplet ${TARGET_TRIPLET}-${_short_name_${_buildname}})
|
set(_build_triplet ${TARGET_TRIPLET}-${_short_name_${_buildname}})
|
||||||
|
|
||||||
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/bin")
|
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/bin")
|
||||||
|
|
||||||
if(VCPKG_TARGET_IS_OSX)
|
if(VCPKG_TARGET_IS_OSX)
|
||||||
@ -86,14 +60,14 @@ function(install_qt)
|
|||||||
LOGNAME cleaning-1-${_build_triplet}
|
LOGNAME cleaning-1-${_build_triplet}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Building ${_build_triplet}")
|
message(STATUS "Building ${_build_triplet}")
|
||||||
vcpkg_execute_required_process(
|
vcpkg_execute_required_process(
|
||||||
COMMAND ${INVOKE}
|
COMMAND ${INVOKE}
|
||||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${_build_triplet}
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${_build_triplet}
|
||||||
LOGNAME build-${_build_triplet}
|
LOGNAME build-${_build_triplet}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(VCPKG_TARGET_IS_OSX)
|
if(VCPKG_TARGET_IS_OSX)
|
||||||
# For some reason there will be an error on MacOSX without this clean!
|
# For some reason there will be an error on MacOSX without this clean!
|
||||||
message(STATUS "Cleaning after build before install ${_build_triplet}")
|
message(STATUS "Cleaning after build before install ${_build_triplet}")
|
||||||
@ -103,7 +77,7 @@ function(install_qt)
|
|||||||
LOGNAME cleaning-2-${_build_triplet}
|
LOGNAME cleaning-2-${_build_triplet}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Fixing makefile installation path ${_build_triplet}")
|
message(STATUS "Fixing makefile installation path ${_build_triplet}")
|
||||||
qt_fix_makefile_install("${CURRENT_BUILDTREES_DIR}/${_build_triplet}")
|
qt_fix_makefile_install("${CURRENT_BUILDTREES_DIR}/${_build_triplet}")
|
||||||
message(STATUS "Installing ${_build_triplet}")
|
message(STATUS "Installing ${_build_triplet}")
|
||||||
@ -115,7 +89,4 @@ function(install_qt)
|
|||||||
message(STATUS "Package ${_build_triplet} done")
|
message(STATUS "Package ${_build_triplet} done")
|
||||||
set(ENV{PATH} "${_path}")
|
set(ENV{PATH} "${_path}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
# ::
|
# ::
|
||||||
# vcpkg_build_qmake()
|
# vcpkg_build_qmake()
|
||||||
#
|
#
|
||||||
|
|
||||||
function(vcpkg_build_qmake)
|
function(vcpkg_build_qmake)
|
||||||
cmake_parse_arguments(_csc "SKIP_MAKEFILES" "BUILD_LOGNAME" "TARGETS;RELEASE_TARGETS;DEBUG_TARGETS" ${ARGN})
|
cmake_parse_arguments(_csc "SKIP_MAKEFILES" "BUILD_LOGNAME" "TARGETS;RELEASE_TARGETS;DEBUG_TARGETS" ${ARGN})
|
||||||
|
|
||||||
@ -18,9 +17,9 @@ function(vcpkg_build_qmake)
|
|||||||
set(INVOKE "${MAKE}")
|
set(INVOKE "${MAKE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Make sure that the linker finds the libraries used
|
# Make sure that the linker finds the libraries used
|
||||||
set(ENV_PATH_BACKUP "$ENV{PATH}")
|
set(ENV_PATH_BACKUP "$ENV{PATH}")
|
||||||
|
|
||||||
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
|
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
|
||||||
|
|
||||||
if(NOT _csc_BUILD_LOGNAME)
|
if(NOT _csc_BUILD_LOGNAME)
|
||||||
@ -30,7 +29,7 @@ function(vcpkg_build_qmake)
|
|||||||
function(run_jom TARGETS LOG_PREFIX LOG_SUFFIX)
|
function(run_jom TARGETS LOG_PREFIX LOG_SUFFIX)
|
||||||
message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}")
|
message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}")
|
||||||
vcpkg_execute_required_process(
|
vcpkg_execute_required_process(
|
||||||
COMMAND ${INVOKE} ${TARGETS}
|
COMMAND ${INVOKE} -j ${VCPKG_CONCURRENCY} ${TARGETS}
|
||||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${LOG_SUFFIX}
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${LOG_SUFFIX}
|
||||||
LOGNAME package-${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}
|
LOGNAME package-${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}
|
||||||
)
|
)
|
||||||
@ -46,16 +45,16 @@ function(vcpkg_build_qmake)
|
|||||||
set(_buildname "DEBUG")
|
set(_buildname "DEBUG")
|
||||||
list(APPEND BUILDTYPES ${_buildname})
|
list(APPEND BUILDTYPES ${_buildname})
|
||||||
set(_short_name_${_buildname} "dbg")
|
set(_short_name_${_buildname} "dbg")
|
||||||
set(_path_suffix_${_buildname} "/debug")
|
set(_path_suffix_${_buildname} "/debug")
|
||||||
endif()
|
endif()
|
||||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||||
set(_buildname "RELEASE")
|
set(_buildname "RELEASE")
|
||||||
list(APPEND BUILDTYPES ${_buildname})
|
list(APPEND BUILDTYPES ${_buildname})
|
||||||
set(_short_name_${_buildname} "rel")
|
set(_short_name_${_buildname} "rel")
|
||||||
set(_path_suffix_${_buildname} "")
|
set(_path_suffix_${_buildname} "")
|
||||||
endif()
|
endif()
|
||||||
unset(_buildname)
|
unset(_buildname)
|
||||||
|
|
||||||
foreach(_buildname ${BUILDTYPES})
|
foreach(_buildname ${BUILDTYPES})
|
||||||
set(_BUILD_PREFIX "${_path_suffix_${_buildname}}")
|
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}/bin")
|
||||||
@ -67,7 +66,7 @@ function(vcpkg_build_qmake)
|
|||||||
run_jom("${_csc_${_buildname}_TARGETS}" ${_csc_BUILD_LOGNAME} ${_short_name_${_buildname}})
|
run_jom("${_csc_${_buildname}_TARGETS}" ${_csc_BUILD_LOGNAME} ${_short_name_${_buildname}})
|
||||||
unset(_BUILD_PREFIX)
|
unset(_BUILD_PREFIX)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Restore the original value of ENV{PATH}
|
# Restore the original value of ENV{PATH}
|
||||||
set(ENV{PATH} "${ENV_PATH_BACKUP}")
|
set(ENV{PATH} "${ENV_PATH_BACKUP}")
|
||||||
set(ENV{_CL_} "${ENV_CL_BACKUP}")
|
set(ENV{_CL_} "${ENV_CL_BACKUP}")
|
||||||
|
Loading…
Reference in New Issue
Block a user