2017-10-15 19:22:17 +08:00
|
|
|
function(install_qt)
|
|
|
|
cmake_parse_arguments(_bc "DISABLE_PARALLEL" "" "" ${ARGN})
|
|
|
|
|
|
|
|
if (_bc_DISABLE_PARALLEL)
|
2018-03-24 01:01:07 +08:00
|
|
|
set(NUMBER_OF_PROCESSORS "1")
|
2017-10-15 19:22:17 +08:00
|
|
|
else()
|
2018-03-24 01:01:07 +08:00
|
|
|
if(DEFINED ENV{NUMBER_OF_PROCESSORS})
|
|
|
|
set(NUMBER_OF_PROCESSORS $ENV{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()
|
2017-10-15 19:22:17 +08:00
|
|
|
endif()
|
|
|
|
|
2018-03-24 01:01:07 +08:00
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
vcpkg_find_acquire_program(JOM)
|
|
|
|
set(INVOKE "${JOM}" /J ${NUMBER_OF_PROCESSORS})
|
|
|
|
else()
|
|
|
|
find_program(MAKE make)
|
|
|
|
set(INVOKE "${MAKE}" -j${NUMBER_OF_PROCESSORS})
|
|
|
|
endif()
|
2017-10-15 19:22:17 +08:00
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY)
|
2019-04-15 20:00:14 +08:00
|
|
|
vcpkg_add_to_path(PREPEND "${PYTHON3_EXE_PATH}")
|
2019-05-23 06:54:53 +08:00
|
|
|
|
|
|
|
if (CMAKE_HOST_WIN32)
|
|
|
|
# flex and bison for ANGLE library
|
|
|
|
vcpkg_find_acquire_program(FLEX)
|
|
|
|
get_filename_component(FLEX_EXE_PATH ${FLEX} DIRECTORY)
|
|
|
|
get_filename_component(FLEX_DIR ${FLEX_EXE_PATH} NAME)
|
|
|
|
|
|
|
|
file(COPY ${FLEX_EXE_PATH} DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tools" )
|
|
|
|
set(FLEX_TEMP "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tools/${FLEX_DIR}")
|
|
|
|
file(RENAME "${FLEX_TEMP}/win_bison.exe" "${FLEX_TEMP}/bison.exe")
|
|
|
|
file(RENAME "${FLEX_TEMP}/win_flex.exe" "${FLEX_TEMP}/flex.exe")
|
|
|
|
vcpkg_add_to_path("${FLEX_TEMP}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(_path "$ENV{PATH}")
|
2017-10-15 19:22:17 +08:00
|
|
|
|
2019-04-26 05:30:39 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
|
|
|
|
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${INVOKE}
|
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${INVOKE} install
|
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
|
|
|
|
LOGNAME package-${TARGET_TRIPLET}-dbg
|
|
|
|
)
|
|
|
|
message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
|
|
|
|
endif()
|
2017-10-17 17:02:26 +08:00
|
|
|
|
2019-04-26 05:30:39 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
message(STATUS "Package ${TARGET_TRIPLET}-rel")
|
|
|
|
set(ENV{PATH} "${_path}")
|
|
|
|
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${INVOKE}
|
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
|
|
|
LOGNAME build-${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${INVOKE} install
|
|
|
|
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
|
|
|
|
LOGNAME package-${TARGET_TRIPLET}-rel
|
|
|
|
)
|
|
|
|
message(STATUS "Package ${TARGET_TRIPLET}-rel done")
|
|
|
|
endif()
|
2017-10-17 17:02:26 +08:00
|
|
|
|
2017-10-15 19:22:17 +08:00
|
|
|
set(ENV{PATH} "${_path}")
|
2017-10-17 17:02:26 +08:00
|
|
|
|
2019-04-15 20:00:14 +08:00
|
|
|
endfunction()
|