Exemple #1
0
def gen_project(fips_dir, proj_dir, cfg, force):
    """private: generate build files for one config"""

    proj_name = util.get_project_name_from_dir(proj_dir)
    build_dir = util.get_build_dir(fips_dir, proj_name, cfg)
    defines = {}
    defines['FIPS_USE_CCACHE'] = 'ON' if settings.get(proj_dir,
                                                      'ccache') else 'OFF'
    defines['FIPS_AUTO_IMPORT'] = 'OFF' if dep.get_policy(
        proj_dir, 'no_auto_import') else 'ON'
    do_it = force
    if not os.path.isdir(build_dir):
        os.makedirs(build_dir)
        do_it = True
    if do_it:
        # if Ninja build tool and on Windows, need to copy
        # the precompiled ninja.exe to the build dir
        log.colored(log.YELLOW, "=== generating: {}".format(cfg['name']))
        toolchain_path = config.get_toolchain(fips_dir, proj_dir, cfg)
        if toolchain_path:
            log.info("Using Toolchain File: {}".format(toolchain_path))
        if cfg['build_tool'] == 'ninja':
            ninja.prepare_ninja_tool(fips_dir, build_dir)
        cmake_result = cmake.run_gen(cfg, fips_dir, proj_dir, build_dir,
                                     toolchain_path, defines)
        if cfg['build_tool'] == 'vscode_cmake':
            vscode.write_workspace_settings(fips_dir, proj_dir, cfg)
        return cmake_result
    else:
        return True
Exemple #2
0
def gen_project(fips_dir, proj_dir, cfg, force):
    """private: generate build files for one config"""

    proj_name = util.get_project_name_from_dir(proj_dir)
    deploy_dir = util.get_deploy_dir(fips_dir, proj_name, cfg['name'])
    build_dir = util.get_build_dir(fips_dir, proj_name, cfg['name'])
    defines = {}
    defines['FIPS_USE_CCACHE'] = 'ON' if settings.get(proj_dir,
                                                      'ccache') else 'OFF'
    defines['FIPS_AUTO_IMPORT'] = 'OFF' if dep.get_policy(
        proj_dir, 'no_auto_import') else 'ON'
    if cfg['generator'] in ['Ninja', 'Unix Makefiles']:
        defines['CMAKE_EXPORT_COMPILE_COMMANDS'] = 'ON'
    if cfg['platform'] == 'ios':
        defines['CMAKE_OSX_SYSROOT'] = xcrun.get_ios_sdk_sysroot()
        ios_team_id = settings.get(proj_dir, 'iosteam')
        if ios_team_id:
            defines['FIPS_IOS_TEAMID'] = ios_team_id
    if cfg['platform'] == 'osx':
        defines['CMAKE_OSX_SYSROOT'] = xcrun.get_macos_sdk_sysroot()
    if cfg['platform'] == 'emscripten':
        defines['EMSCRIPTEN_ROOT'] = emsdk.get_emscripten_root(fips_dir)
    if cfg['platform'] == 'wasisdk':
        defines['WASISDK_ROOT'] = wasisdk.get_wasisdk_root(fips_dir)
    do_it = force
    if not os.path.isdir(build_dir):
        os.makedirs(build_dir)
    if not os.path.isfile(build_dir + '/CMakeCache.txt'):
        do_it = True
    if do_it:
        # if Ninja build tool and on Windows, need to copy
        # the precompiled ninja.exe to the build dir
        log.colored(log.YELLOW, "=== generating: {}".format(cfg['name']))
        log.info("config file: {}".format(cfg['path']))
        toolchain_path = config.get_toolchain(fips_dir, proj_dir, cfg)
        if toolchain_path:
            log.info("Using Toolchain File: {}".format(toolchain_path))
        is_local_build = settings.get(proj_dir, 'local')
        cmake_result = cmake.run_gen(cfg, fips_dir, proj_dir, build_dir,
                                     is_local_build, toolchain_path, defines)
        if vscode.match(cfg['build_tool']):
            vscode.write_workspace_settings(
                fips_dir, proj_dir, cfg, settings.get_all_settings(proj_dir))
        if clion.match(cfg['build_tool']):
            clion.write_workspace_settings(fips_dir, proj_dir, cfg)
        return cmake_result
    else:
        return True
Exemple #3
0
def gen_project(fips_dir, proj_dir, cfg, force) :
    """private: generate build files for one config"""

    proj_name = util.get_project_name_from_dir(proj_dir)
    build_dir = util.get_build_dir(fips_dir, proj_name, cfg)
    defines = {}
    defines['FIPS_USE_CCACHE'] = 'ON' if settings.get(proj_dir, 'ccache') else 'OFF'
    defines['FIPS_AUTO_IMPORT'] = 'OFF' if dep.get_policy(proj_dir, 'no_auto_import') else 'ON'
    do_it = force
    if not os.path.isdir(build_dir) :
        os.makedirs(build_dir)
        do_it = True
    if do_it :
        # if Ninja build tool and on Windows, need to copy 
        # the precompiled ninja.exe to the build dir
        if cfg['build_tool'] == 'ninja' :
            ninja.prepare_ninja_tool(fips_dir, build_dir)
        log.colored(log.YELLOW, "=== generating: {}".format(cfg['name']))
        toolchain_path = config.get_toolchain(fips_dir, proj_dir, cfg)
        if toolchain_path :
            log.info("Using Toolchain File: {}".format(toolchain_path))
        return cmake.run_gen(cfg, fips_dir, proj_dir, build_dir, toolchain_path, defines)
    else :
        return True