diff --git a/CMakeLists.txt b/CMakeLists.txt index ae2183e427..1f6cffb7c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/cmake/macros/SetupQt.cmake b/cmake/macros/SetupQt.cmake index 316172a204..45ddd87035 100644 --- a/cmake/macros/SetupQt.cmake +++ b/cmake/macros/SetupQt.cmake @@ -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() diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 77e0c70ecf..3df714e6f9 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -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': diff --git a/prebuild.py b/prebuild.py index b401c94e7f..1fb96290b3 100644 --- a/prebuild.py +++ b/prebuild.py @@ -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)