Пример #1
0
    def __init__(self, args):
        self.args = args
        self.configFilePath = os.path.join(args.build_root, 'qt.cmake')
        self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.12.3')

        self.assets_url = hifi_utils.readEnviromentVariableFromFile(
            args.build_root, 'EXTERNAL_BUILD_ASSETS')

        defaultBasePath = os.path.expanduser('~/hifi/qt')
        self.basePath = os.getenv('HIFI_QT_BASE', defaultBasePath)
        if (not os.path.isdir(self.basePath)):
            os.makedirs(self.basePath)
        self.path = os.path.join(self.basePath, self.version)
        self.fullPath = os.path.join(self.path, 'qt5-install')
        self.cmakePath = os.path.join(self.fullPath, 'lib/cmake')

        print("Using qt path {}".format(self.path))
        lockDir, lockName = os.path.split(self.path)
        lockName += '.lock'
        if not os.path.isdir(lockDir):
            os.makedirs(lockDir)

        self.lockFile = os.path.join(lockDir, lockName)

        if (os.getenv('VIRCADIA_USE_PREBUILT_QT')):
            print("Using pre-built Qt5")
            return

        # OS dependent information
        system = platform.system()

        if 'Windows' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-windows3.tar.gz%3FversionId=5ADqP0M0j5ZfimUHrx4zJld6vYceHEsI'
        elif 'Darwin' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz%3FversionId=bLAgnoJ8IMKpqv8NFDcAu8hsyQy3Rwwz'
        elif 'Linux' == system:
            import distro
            dist = distro.linux_distribution()

            if distro.id() == 'ubuntu':
                u_major = int(distro.major_version())
                u_minor = int(distro.minor_version())

                if u_major == 16:
                    self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04-with-symbols.tar.gz'
                elif u_major == 18:
                    self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz'
                elif u_major == 19 and u_minor == 10:
                    self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.6-ubuntu-19.10.tar.xz'
                elif u_major > 18 and (u_major != 19 and u_minor != 4):
                    print("We don't support " + distro.name(pretty=True) +
                          " yet. Perhaps consider helping us out?")
                    raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                else:
                    print(
                        "Sorry, " + distro.name(pretty=True) +
                        " is old and won't be officially supported. Please consider upgrading."
                    )
                    raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')
            else:
                print("Sorry, " + distro.name(pretty=True) +
                      " is not supported. Please consider helping us out.")
                print(
                    "It's also possible to build Qt for your distribution, please see the documentation at:"
                )
                print(
                    "https://github.com/kasenvr/project-athena/tree/kasen/core/tools/qt-builder"
                )
                raise Exception('UNKNOWN LINUX VERSION!!!')
        else:
            print("System      : " + platform.system())
            print("Architecture: " + platform.architecture())
            print("Machine     : " + platform.machine())
            raise Exception('UNKNOWN OPERATING SYSTEM!!!')
Пример #2
0
    def __init__(self, args):
        self.args = args
        self.configFilePath = os.path.join(args.build_root, 'qt.cmake')
        self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.15.2')

        self.assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS')

        defaultBasePath = os.path.expanduser('~/hifi/qt')
        self.basePath = os.getenv('HIFI_QT_BASE', defaultBasePath)
        if (not os.path.isdir(self.basePath)):
            os.makedirs(self.basePath)
        self.path = os.path.join(self.basePath, self.version)
        self.fullPath = os.path.join(self.path, 'qt5-install')
        self.cmakePath = os.path.join(self.fullPath, 'lib/cmake')

        print("Using qt path {}".format(self.path))
        lockDir, lockName = os.path.split(self.path)
        lockName += '.lock'
        if not os.path.isdir(lockDir):
            os.makedirs(lockDir)

        self.lockFile = os.path.join(lockDir, lockName)

        if (os.getenv('VIRCADIA_USE_PREBUILT_QT')):
            print("Using pre-built Qt5")
            return

        # OS dependent information
        system = platform.system()
        cpu_architecture = platform.machine()

        if 'Windows' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-windows.tar.gz'
        elif 'Darwin' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-macos.tar.gz'
        elif 'Linux' == system:
            import distro
            dist = distro.linux_distribution()

            if 'x86_64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-ubuntu-18.04-amd64.tar.xz'
                    elif u_major > 19:
                        print("We don't support " + distro.name(pretty=True) + " yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    else:
                        print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                        raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')
                else:
                    print("Sorry, " + distro.name(pretty=True) + " is not supported on x86_64. Please consider helping us out.")
                    print("It's also possible to build Qt for your distribution, please see the documentation at:")
                    print("https://github.com/vircadia/vircadia/tree/master/tools/qt-builder")
                    raise Exception('UNKNOWN LINUX VERSION!!!')
            elif 'aarch64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = 'http://motofckr9k.ddns.net/vircadia_packages/qt5-install-5.15.2-ubuntu-18.04-aarch64_test.tar.xz'
                    elif u_major > 19:
                        print("We don't support " + distro.name(pretty=True) + " on aarch64 yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    else:
                        print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                        raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')

                elif distro.id() == 'debian':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 10:
                        #self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04-with-symbols.tar.gz'
                        print("We don't support " + distro.name(pretty=True) + " on aarch64 yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    elif u_major > 10:
                        print("We don't support " + distro.name(pretty=True) + " on aarch64 yet. Perhaps consider helping us out?")
                        raise Exception('LINUX DISTRO IS NOT SUPPORTED YET!!!')
                    else:
                        print("Sorry, " + distro.name(pretty=True) + " is old and won't be officially supported. Please consider upgrading.");
                        raise Exception('UNKNOWN LINUX DISTRO VERSION!!!')

                else:
                    print("Sorry, " + distro.name(pretty=True) + " is not supported on aarch64. Please consider helping us out.")
                    print("It's also possible to build Qt for your distribution, please see the documentation at:")
                    print("https://github.com/vircadia/vircadia/tree/master/tools/qt-builder")
                    raise Exception('UNKNOWN LINUX VERSION!!!')
            else:
                raise Exception('UNKNOWN CPU ARCHITECTURE!!!')

        else:
            print("System      : " + platform.system())
            print("Architecture: " + platform.architecture())
            print("Machine     : " + platform.machine())
            raise Exception('UNKNOWN OPERATING SYSTEM!!!')
Пример #3
0
def main():
    # Fixup env variables.  Leaving `USE_CCACHE` on will cause scribe to fail to build
    # VCPKG_ROOT seems to cause confusion on Windows systems that previously used it for
    # building OpenSSL
    removeEnvVars = ['VCPKG_ROOT', 'USE_CCACHE']
    for var in removeEnvVars:
        if var in os.environ:
            del os.environ[var]

    args = parse_args()
    nsis_urls = hifi_utils.readEnviromentVariableFromFile(
        args.build_root, 'EXTERNAL_NSIS_HIFI_PLUGINS_URLS').split(';')

    if args.ci_build:
        logging.basicConfig(datefmt='%H:%M:%S',
                            format='%(asctime)s %(guid)s %(message)s',
                            level=logging.INFO)

    logger.info('start')

    # OS dependent information
    system = platform.system()
    if 'Windows' == system and 'CI_BUILD' in os.environ and os.environ[
            "CI_BUILD"] == "Github":
        logger.info("Downloading NSIS")
        with timer('NSIS'):
            hifi_utils.downloadAndExtract(nsis_urls, "C:/Program Files (x86)")

    qtInstallPath = None
    # If not android, install our Qt build
    if not args.android:
        qt = hifi_qt.QtDownloader(args)
        qtInstallPath = qt.cmakePath

        if qtInstallPath is not None:
            # qtInstallPath is None when we're doing a system Qt build
            print("cmake path: " + qtInstallPath)

            with hifi_singleton.Singleton(qt.lockFile) as lock:
                with timer('Qt'):
                    qt.installQt()
                    qt.writeConfig()
        else:
            if (os.environ["VIRCADIA_USE_SYSTEM_QT"]):
                print("System Qt selected")
            else:
                raise Exception(
                    "Internal error: System Qt not selected, but hifi_qt.py failed to return a cmake path"
                )

    pm = hifi_vcpkg.VcpkgRepo(args)
    if qtInstallPath is not None:
        pm.writeVar('QT_CMAKE_PREFIX_PATH', qtInstallPath)

    # Only allow one instance of the program to run at a time

    if qtInstallPath is not None:
        pm.writeVar('QT_CMAKE_PREFIX_PATH', qtInstallPath)

    # Only allow one instance of the program to run at a time
    with hifi_singleton.Singleton(pm.lockFile) as lock:

        with timer('Bootstraping'):
            if not pm.upToDate():
                pm.bootstrap()

        # Always write the tag, even if we changed nothing.  This
        # allows vcpkg to reclaim disk space by identifying directories with
        # tags that haven't been touched in a long time
        pm.writeTag()

        # Grab our required dependencies:
        #  * build host tools, like spirv-cross and scribe
        #  * build client dependencies like openssl and nvtt
        with timer('Setting up dependencies'):
            pm.setupDependencies(qt=qtInstallPath)

        # wipe out the build directories (after writing the tag, since failure
        # here shouldn't invalidate the vcpkg install)
        with timer('Cleaning builds'):
            pm.cleanBuilds()

        # If we're running in android mode, we also need to grab a bunch of additional binaries
        # (this logic is all migrated from the old setupDependencies tasks in gradle)
        if args.android:
            # Find the target location
            appPath = hifi_utils.scriptRelative('android/apps/' + args.android)
            # Copy the non-Qt libraries specified in the config in hifi_android.py
            hifi_android.copyAndroidLibs(pm.androidPackagePath, appPath)
            # Determine the Qt package path
            qtPath = os.path.join(pm.androidPackagePath, 'qt')
            hifi_android.QtPackager(appPath, qtPath).bundle()

        # Fixup the vcpkg cmake to not reset VCPKG_TARGET_TRIPLET
        pm.fixupCmakeScript()

        if not args.vcpkg_skip_clean:
            # Cleanup downloads and packages folders in vcpkg to make it smaller for CI
            pm.cleanupDevelopmentFiles()

        # Write the vcpkg config to the build directory last
        with timer('Writing configuration'):
            pm.writeConfig()

    logger.info('end')
Пример #4
0
    def __init__(self, args):
        self.args = args
        self.configFilePath = os.path.join(args.build_root, 'qt.cmake')
        self.version = os.getenv('VIRCADIA_USE_QT_VERSION', '5.15.2')
        self.assets_url = hifi_utils.readEnviromentVariableFromFile(args.build_root, 'EXTERNAL_BUILD_ASSETS')

        # OS dependent information
        system = platform.system()

        qt_found = False
        system_qt = False

        # Here we handle the 3 possible cases of dealing with Qt:
        if os.getenv('VIRCADIA_USE_SYSTEM_QT', "") != "":
            # 1. Using the system provided Qt. This is only recommended for Qt 5.15.0 and above,
            # as it includes a required fix on Linux.
            #
            # This path only works on Linux as neither Windows nor OSX ship Qt.

            if system != "Linux":
                raise Exception("Using the system Qt is only supported on Linux")

            self.path = None
            self.cmakePath = None

            qt_found = True
            system_qt = True
            print("Using system Qt")

        elif os.getenv('VIRCADIA_QT_PATH', "") != "":
            # 2. Using an user-provided directory.
            # VIRCADIA_QT_PATH must point to a directory with a Qt install in it.

            self.path = os.getenv('VIRCADIA_QT_PATH')
            self.fullPath = self.path
            self.cmakePath = os.path.join(self.fullPath, 'lib', 'cmake')

            qt_found = True
            print("Using Qt from " + self.fullPath)

        else:
            # 3. Using a pre-built Qt.
            #
            # This works somewhat differently from above, notice how path and fullPath are
            # used differently in this case.
            #
            # In the case of an user-provided directory, we just use the user-supplied directory.
            #
            # For a pre-built qt, however, we have to unpack it. The archive is required to contain
            # a qt5-install directory in it.

            self.path = os.path.expanduser("~/vircadia-files/qt")
            self.fullPath = os.path.join(self.path, 'qt5-install')
            self.cmakePath = os.path.join(self.fullPath, 'lib', 'cmake')

            if (not os.path.isdir(self.path)):
                os.makedirs(self.path)

            qt_found = os.path.isdir(self.fullPath)
            print("Using a packaged Qt")


        if not system_qt:
            if qt_found:
                # Sanity check, ensure we have a good cmake directory
                qt5_dir = os.path.join(self.cmakePath, "Qt5")
                if not os.path.isdir(qt5_dir):
                    raise Exception("Failed to find Qt5 directory under " + self.cmakePath + ". There should be a " + qt5_dir)
                else:
                    print("Qt5 check passed, found " + qt5_dir)

            # I'm not sure why this is needed. It's used by hifi_singleton.
            # Perhaps it stops multiple build processes from interferring?
            lockDir, lockName = os.path.split(self.path)
            lockName += '.lock'
            if not os.path.isdir(lockDir):
                os.makedirs(lockDir)

            self.lockFile = os.path.join(lockDir, lockName)

        if qt_found:
            print("Found pre-built Qt5")
            return

        if 'Windows' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-windows.tar.gz'
        elif 'Darwin' == system:
            self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-macos.tar.gz'
        elif 'Linux' == system:
            import distro
            cpu_architecture = platform.machine()

            if 'x86_64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-ubuntu-18.04-amd64.tar.xz'
                    elif u_major > 19:
                        self.__no_qt_package_error()
                    else:
                        self.__unsupported_error()
                else:
                    self.__no_qt_package_error()

            elif 'aarch64' == cpu_architecture:
                if distro.id() == 'ubuntu':
                    u_major = int( distro.major_version() )
                    u_minor = int( distro.minor_version() )

                    if u_major == 18:
                        self.qtUrl = 'http://motofckr9k.ddns.net/vircadia_packages/qt5-install-5.15.2-ubuntu-18.04-aarch64_test.tar.xz'
                    elif u_major > 19:
                        self.__no_qt_package_error()
                    else:
                        self.__unsupported_error()

                elif distro.id() == 'debian':
                    u_major = int( distro.major_version() )

                    if u_major == 10:
                        self.qtUrl = 'https://data.moto9000.moe/vircadia_packages/qt5-install-5.15.2-debian-10-aarch64.tar.xz'
                    elif u_major > 10:
                        self.__no_qt_package_error()
                    else:
                        self.__unsupported_error()

                else:
                    self.__no_qt_package_error()
            else:
                raise Exception('UNKNOWN CPU ARCHITECTURE!!!')

        else:
            print("System      : " + platform.system())
            print("Architecture: " + platform.architecture())
            print("Machine     : " + platform.machine())
            raise Exception('UNKNOWN OPERATING SYSTEM!!!')