Example #1
0
 def run(fips_dir, proj_dir, args):
     """run the 'nebula' verb"""
     try:
         cfg_file = expanduser("~") + "/.config/nebula/gscept.cfg"
         if len(args) > 0:
             noun = args[0]
             if noun == 'set':
                 if len(args) == 3:
                     key = argToKey(args[1])
                     setKey(cfg_file, key, args[2])
                 else:
                     log.error("Expected setting and value")
             elif noun == 'get':
                 if len(args) == 2:
                     key = argToKey(args[1])
                     value = getKey(cfg_file, key)
                     log.info(value)
         else:
             workval = getKey(cfg_file, "workdir")
             rootval = getKey(cfg_file, "path")
             log.colored(log.YELLOW, "Current settings")
             log.optional("Project directory", workval)
             log.optional("Nebula root director", rootval)
     except (RuntimeError, KeyError):
         log.error("failed manipulating settings")
Example #2
0
def check_tools(fips_dir) :
    """check whether required command line tools can be found"""
    log.colored(log.YELLOW, '=== tools:')
    tools = [ git, cmake, ccmake, cmake_gui, make, ninja, xcodebuild, java, ant, node, python2, ccache ]
    platform = util.get_host_platform()
    for tool in tools:
        if platform in tool.platforms :
            if tool.check_exists(fips_dir) :
                log.ok(tool.name, 'found')
            else :
                if tool.optional :
                    log.optional(tool.name, 'OPTIONAL, NOT FOUND ({})'.format(tool.not_found))
                else :
                    log.failed(tool.name, 'NOT FOUND ({})'.format(tool.not_found))
Example #3
0
def check_tools(fips_dir):
    """check whether required command line tools can be found"""
    log.colored(log.YELLOW, '=== tools:')
    tools = [
        git, cmake, ccmake, cmake_gui, make, ninja, xcrun, javac, java, node,
        ccache, vscode, clion, httpserver, wasmtime
    ]
    platform = util.get_host_platform()
    for tool in tools:
        if platform in tool.platforms:
            if tool.check_exists(fips_dir):
                log.ok(tool.name, 'found')
            else:
                if tool.optional:
                    log.optional(
                        tool.name,
                        'OPTIONAL, NOT FOUND ({})'.format(tool.not_found))
                else:
                    log.failed(tool.name,
                               'NOT FOUND ({})'.format(tool.not_found))
Example #4
0
 def run(fips_dir, proj_dir, args):
     """run the 'nebula' verb"""
     if len(args) > 0:
         noun = args[0]
         if noun == 'set':
             if len(args) > 2:
                 setKey(args[1], args[2])
             else:
                 log.error("Expected setting and value")
         elif noun == 'get':
             if len(args) > 1:
                 key = argToKey(args[1])
                 if key != "":
                     reg_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                                               base_reg, 0,
                                               _winreg.KEY_READ)
                     keyval, regtype = _winreg.QueryValueEx(reg_key, key)
                     _winreg.CloseKey(reg_key)
                     log.info(keyval)
                 else:
                     log.error("Invalid setting")
             else:
                 log.error("Expected setting name")
         elif noun == 'cleannidl':
             proj = util.get_project_name_from_dir(proj_dir)
             cfg = settings.get(proj_dir, 'config')
             path = util.get_build_dir(fips_dir, proj, cfg) + "/nidl"
             shutil.rmtree(path, True)
     else:
         try:
             reg_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, base_reg,
                                       0, _winreg.KEY_READ)
             workval, regtype = _winreg.QueryValueEx(reg_key, "workdir")
             rootval, regtype = _winreg.QueryValueEx(reg_key, "path")
             _winreg.CloseKey(reg_key)
             log.colored(log.YELLOW, "Current settings")
             log.optional("Project directory", workval)
             log.optional("Nebula root director", rootval)
         except WindowsError:
             log.colored(log.YELLOW, "No Nebula settings in registry\n")
Example #5
0
def run(fips_dir, proj_dir, args):
    """run the 'physx' verb"""
    if len(args) > 0:
        noun = args[0]
        if noun == 'build':
            if sys.platform == "win32":
                # FIXME all of this only works on windows at the moment and is super hacky

                if len(args) != 2:
                    log.error("expected compiler target (win-vs15, win-vs16)")

                preset = util.fix_path(
                    os.path.dirname(os.path.abspath(__file__))
                ) + "/physx-presets/" + "fips" + args[1] + ".xml"
                if not os.path.isfile(preset):
                    log.error("Unrecognized compiler target")
                shutil.copy2(preset,
                             proj_dir + "/../physx/physx/buildtools/presets/")
                subprocess.call(proj_dir +
                                "/../physx/physx/generate_projects.bat fips" +
                                args[1])

                # figure out a version number for vswhere
                version = args[1][6:]
                version_next = str(int(version) + 1)
                version = version + ".0," + version_next + ".0"
                #use vswhere to figure out where vs is
                devenvPath = subprocess.check_output(
                    proj_dir +
                    "/../physx/externals/vswhere/vswhere -version [" +
                    version +
                    "] -property productPath").decode("utf-8").rstrip()
                devenvPath = util.fix_path(devenvPath)
                if not os.path.isfile(devenvPath):
                    #try to find msbuild
                    log.info(
                        "Could not find Visual Studio, trying to find lastest version of MSBuild..."
                        + devenvPath)
                    devenvPath = subprocess.check_output(
                        proj_dir +
                        "/../physx/externals/vswhere/vswhere -version [" +
                        version +
                        "] -products * -requires Microsoft.Component.MSBuild -property installationPath"
                    ).decode("utf-8").rstrip()
                    devenvPath = util.fix_path(
                        devenvPath + "/MSBuild/Current/Bin/MSBuild.exe")
                    if not os.path.isfile(devenvPath):
                        log.error(
                            "Could not detect Visual Studio installation.")
                    log.optional("Using MSBuild from", devenvPath)

                    log.info("Compiling PhysX, this might take a while.")
                    log.info("Building debug version...")
                    #-noConsoleLogger
                    retcode = subprocess.call(
                        devenvPath + " " + proj_dir +
                        "/../physx/physx/compiler/fips" + args[1] +
                        "/INSTALL.vcxproj /verbosity:quiet /noLogo /noConsoleLogger /property:Configuration=Debug"
                    )
                    if retcode == 0:
                        log.colored(log.GREEN, "PhysX debug build completed.")
                    else:
                        log.colored(log.RED, "PhysX debug build failed!")

                    log.info("Building release version...")
                    retcode = subprocess.call(
                        devenvPath + " " + proj_dir +
                        "/../physx/physx/compiler/fips" + args[1] +
                        "/INSTALL.vcxproj /verbosity:quiet /noLogo /noConsoleLogger /property:Configuration=Release"
                    )
                    if retcode == 0:
                        log.colored(log.GREEN,
                                    "PhysX release build completed.")
                    else:
                        log.colored(log.RED, "PhysX release build failed!")
                else:
                    log.optional("Using Visual Studio from", devenvPath)

                    log.info("Compiling PhysX, this might take a while...")
                    log.info("Building debug version...")
                    retcode = subprocess.call(
                        devenvPath + " " + proj_dir +
                        "/../physx/physx/compiler/fips" + args[1] +
                        "/PhysXSDK.sln /Build debug /Project INSTALL")
                    if retcode == 0:
                        log.colored(log.GREEN, "PhysX debug build completed.")
                    else:
                        log.colored(log.RED, "PhysX debug build failed!")

                    log.info("Building release version...")
                    retcode = subprocess.call(
                        devenvPath + " " + proj_dir +
                        "/../physx/physx/compiler/fips" + args[1] +
                        "/PhysXSDK.sln /Build release /Project INSTALL")
                    if retcode == 0:
                        log.colored(log.GREEN,
                                    "PhysX release build completed.")
                    else:
                        log.colored(log.RED, "PhysX release build failed!")
            else:
                preset = util.fix_path(
                    os.path.dirname(os.path.abspath(
                        __file__))) + "/physx-presets/fipslinux.xml"
                shutil.copy2(preset,
                             proj_dir + "/../physx/physx/buildtools/presets/")
                subprocess.run([
                    proj_dir + "/../physx/physx/generate_projects.sh",
                    "fipslinux"
                ])
                subprocess.run(["make", "-j", "10"],
                               cwd=proj_dir +
                               "/../physx/physx/compiler/fipslinux-checked")
                subprocess.run(["make", "install"],
                               cwd=proj_dir +
                               "/../physx/physx/compiler/fipslinux-checked")
        if noun == 'deploy':
            if sys.platform == "win32":
                cur_cfg = None
                if len(args) > 1:
                    cur_cfg = args[1]
                if not cur_cfg:
                    cur_cfg = settings.get(proj_dir, 'config')

                ps_deploy = util.get_workspace_dir(
                    fips_dir) + "/fips-deploy/physx/bin/"
                cfg = config.load(fips_dir, proj_dir, cur_cfg)[0]
                px_target = cfg['defines']['PX_TARGET']
                target_dir = util.get_deploy_dir(
                    fips_dir, util.get_project_name_from_dir(proj_dir),
                    cur_cfg)

                dllFiles = glob.glob(ps_deploy + px_target + "/debug/*.dll")
                log.info("Looking for PhysX dlls in '{}/'".format(ps_deploy +
                                                                  px_target))
                if not dllFiles:
                    log.error(
                        "PhysX debug dlls not found! Have you built them? (fips physx build [compiler target])"
                    )
                else:
                    for dll in dllFiles:
                        shutil.copy2(dll, target_dir)
                    log.colored(
                        log.GREEN,
                        "Deployed PhysX debug binaries to '{}'".format(
                            target_dir))

                dllFiles = glob.glob(ps_deploy + px_target + "/release/*.dll")
                if not dllFiles:
                    log.error(
                        "PhysX release dlls not found! Have you built them? (fips physx build [compiler target])"
                    )
                else:
                    for dll in dllFiles:
                        shutil.copy2(dll, target_dir)
                    log.colored(
                        log.GREEN,
                        "Deployed PhysX release binaries to '{}'".format(
                            target_dir))
    else:

        def run(fips_dir, proj_dir, args):
            log.error("Not supported")