import re from SCons.Script import * def _git_cook(env: Environment, repo: dict) -> dict: ine_source_files = [ os.path.join(repo['checkout_root'], 'crude_json.cpp'), os.path.join(repo['checkout_root'], 'imgui_canvas.cpp'), os.path.join(repo['checkout_root'], 'imgui_node_editor.cpp'), os.path.join(repo['checkout_root'], 'imgui_node_editor_api.cpp') ] ccflags = list(env['CCFLAGS']) if env['COMPILER_FAMILY'] == 'cl': ccflags.append('/wd4100') elif env['COMPILER_FAMILY'] == 'gcc': ccflags.extend(('-Wno-comment', '-Wno-unused-but-set-variable', '-Wno-unused-parameter')) lib_ine = env.StaticLibrary( CPPPATH = [repo['checkout_root']], CCFLAGS = ccflags, target = env['LIB_DIR'] + '/imgui_node_editor', source = ine_source_files, dependencies = { 'imgui': { 'min': (1, 72, 0) } } ) return { 'CPPPATH': [repo['checkout_root']], 'LIBS': [lib_ine] } env.GitRecipe( globals = globals(), repo_name = 'imgui-node-editor', repo_url = 'https://github.com/thedmd/imgui-node-editor.git', tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'), tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}', cook_fn = _git_cook, dependencies = { 'imgui': {} } )