示例#1
0
文件: wizard.py 项目: gnatali/qibuild
def run_config_wizard(toc):
    """ Run a nice interactive config wizard

    """
    if toc:
        qibuild_cfg = toc.config
    else:
        qibuild_cfg = qibuild.config.QiBuildConfig()
        qibuild_cfg_path = qibuild.config.get_global_cfg_path()
        if not os.path.exists(qibuild_cfg_path):
            to_create = os.path.dirname(qibuild_cfg_path)
            qisys.sh.mkdir(to_create, recursive=True)
            with open(qibuild_cfg_path, "w") as fp:
                fp.write('<qibuild version="1" />\n')
        qibuild_cfg.read()

    # Ask for a default cmake generator
    guess_cmake(qibuild_cfg)
    generator = ask_cmake_generator()
    qibuild_cfg.defaults.cmake.generator = generator

    ide = ask_ide(qibuild_cfg)
    if ide:
        configure_ide(qibuild_cfg, ide)

    if qibuild.get_platform() == "windows":
        ask_incredibuild(qibuild_cfg)

    qibuild_cfg.write()

    if toc:
        configure_local_settings(toc)
示例#2
0
文件: wizard.py 项目: gnatali/qibuild
def guess_cmake(qibuild_cfg):
    """ Try to find cmake

    """
    build_env = qibuild.config.get_build_env()
    cmake = qisys.command.find_program("cmake", env=build_env)
    platform = qibuild.get_platform()
    if platform == "windows":
        # FIXME: loook for it in registry
        pass
    if platform == "mac":
        # FIXME: hard-code some path in /Applications
        pass

    if cmake:
        print "Found CMake:" , cmake
        return cmake

    print "CMake not found"
    cmake = qisys.interact.ask_program("Please enter full CMake path")
    if not cmake:
        raise Exception("qiBuild cannot work without CMake\n"
            "Please install CMake if necessary and re-run this wizard\n")
    # Add path to CMake in build env
    cmake_path = os.path.dirname(cmake)
    qibuild_cfg.add_to_default_path(cmake_path)
    qibuild_cfg.write()
    return cmake
示例#3
0
文件: wizard.py 项目: gnatali/qibuild
def ask_ide(qibuild_cfg):
    """ Ask the user to choose an IDE

    """
    ides = ["QtCreator", "Eclipse CDT"]
    platform = qibuild.get_platform()
    if platform == "windows":
        ides.append("Visual Studio")
    if platform == "mac":
        ides.append("Xcode")
    ide = qisys.interact.ask_choice(ides,
        "Please choose an IDE")
    return ide