hack QT_CMAKE_PREFIX_PATH for Jenkins macos builds

This commit is contained in:
Andrew Meadows 2019-05-18 06:45:25 -07:00
parent f4d9aa71a4
commit 528a64c618
4 changed files with 30 additions and 7 deletions

View file

@ -17,14 +17,19 @@ if (APPLE)
set(ENV{MACOSX_DEPLOYMENT_TARGET} 10.9)
endif()
set(RELEASE_TYPE "$ENV{RELEASE_TYPE}")
if ((NOT "${RELEASE_TYPE}" STREQUAL "PRODUCTION") AND (NOT "${RELEASE_TYPE}" STREQUAL "PR"))
set(RELEASE_TYPE "DEV")
endif()
if (HIFI_ANDROID)
execute_process(
COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --android ${HIFI_ANDROID_APP} --build-root ${CMAKE_BINARY_DIR}
COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --release-type ${RELEASE_TYPE} --android ${HIFI_ANDROID_APP} --build-root ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
else()
execute_process(
COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --build-root ${CMAKE_BINARY_DIR}
COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --release-type ${RELEASE_TYPE} --build-root ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# squelch the Policy CMP0074 warning without requiring an update to cmake 3.12.

View file

@ -54,7 +54,13 @@ macro(setup_qt)
if (NOT DEFINED ENV{QT_CMAKE_PREFIX_PATH} OR NOT DEV_BUILD)
# HACK we ignore QT_CMAKE_PREFIX_PATH for PRODUCTION and PR builds
# so we can punt updating the automated build OS images while switching to vcpkg for Qt
set(QT_CMAKE_PREFIX_PATH ${VCPKG_QT_CMAKE_PREFIX_PATH})
if (APPLE AND NOT DEV_BUILD)
# DOUBLE HACK for Jenkins + macos build: always store qt5 in /var/tmp/
# because that is where the manually-edited hard-coded path thinks it is
set(QT_CMAKE_PREFIX_PATH "/var/tmp/qt5-install/lib/cmake")
else()
set(QT_CMAKE_PREFIX_PATH ${VCPKG_QT_CMAKE_PREFIX_PATH})
endif()
else()
set(QT_CMAKE_PREFIX_PATH $ENV{QT_CMAKE_PREFIX_PATH})
endif()

View file

@ -213,6 +213,17 @@ endif()
with open(self.tagFile, 'w') as f:
f.write(self.tagContents)
def getQt5InstallPath(self):
qt5InstallPath = os.path.join(self.path, 'installed', 'qt5-install')
if platform.system() == "Darwin" and self.args.release_type != "DEV":
# HACK for MacOS Jenkins PRODUCTION and PR builds during Qt-5.12.3 transition
# we always supply /var/tmp/qt5-install for QT_CMAKE_PREFIX_PATH
qt5InstallPath = "/var/tmp/qt5-install"
elif self.args.android:
precompiled = os.path.realpath(self.androidPackagePath)
qt5InstallPath = os.path.realpath(os.path.join(precompiled, 'qt'))
return qt5InstallPath
def writeConfig(self):
print("Writing cmake config to {}".format(self.configFilePath))
# Write out the configuration for use by CMake
@ -221,14 +232,13 @@ endif()
toolsPath = os.path.join(self.path, 'installed', self.hostTriplet, 'tools')
cmakeTemplate = VcpkgRepo.CMAKE_TEMPLATE
qtCmakePrefixPath = os.path.join(self.path, 'installed', 'qt5-install/lib/cmake')
if self.args.android:
precompiled = os.path.realpath(self.androidPackagePath)
cmakeTemplate += 'set(HIFI_ANDROID_PRECOMPILED "{}")\n'.format(precompiled)
qtCmakePrefixPath = os.path.realpath(os.path.join(precompiled, 'qt/lib/cmake'))
else:
cmakeTemplate += VcpkgRepo.CMAKE_TEMPLATE_NON_ANDROID
qtCmakePrefixPath = os.path.join(self.getQt5InstallPath(), "lib/cmake")
cmakeConfig = cmakeTemplate.format(cmakeScript, cmakeScript, installPath, toolsPath, qtCmakePrefixPath).replace('\\', '/')
with open(self.configFilePath, 'w') as f:
f.write(cmakeConfig)
@ -241,9 +251,10 @@ endif()
def installQt(self):
if not os.path.isdir(os.path.join(self.path, 'installed', 'qt5-install')):
qt5InstallPath = self.getQt5InstallPath()
if not os.path.isdir(qt5InstallPath):
print ('Downloading Qt from AWS')
dest = os.path.join(self.path, 'installed')
dest, tail = os.path.split(qt5InstallPath)
url = 'NOT DEFINED'
if platform.system() == 'Windows':

View file

@ -91,6 +91,7 @@ def parse_args():
parser.add_argument('--debug', action='store_true')
parser.add_argument('--force-bootstrap', action='store_true')
parser.add_argument('--force-build', action='store_true')
parser.add_argument('--release-type', type=str, default="DEV", help="DEV, PR, or PRODUCTION")
parser.add_argument('--vcpkg-root', type=str, help='The location of the vcpkg distribution')
parser.add_argument('--build-root', required=True, type=str, help='The location of the cmake build')
parser.add_argument('--ports-path', type=str, default=defaultPortsPath)