39 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
 | |
| 
 | |
| import re
 | |
| from SCons.Script import *
 | |
| 
 | |
| def _git_cook(env: Environment, repo: dict) -> dict:
 | |
|     imgui_source_files = [
 | |
|         os.path.join(repo['checkout_root'], 'imgui.cpp'),
 | |
|         os.path.join(repo['checkout_root'], 'imgui_draw.cpp'),
 | |
|         os.path.join(repo['checkout_root'], 'imgui_tables.cpp'),
 | |
|         os.path.join(repo['checkout_root'], 'imgui_widgets.cpp')
 | |
|     ]
 | |
| 
 | |
|     imgui_add_sources = []
 | |
|     for backend in env.get('IMGUI_BACKENDS', []):
 | |
|         imgui_add_sources.append(f'backends/imgui_impl_{backend}.cpp')
 | |
| 
 | |
|     env.StaticLibrary(
 | |
|         CPPPATH = [repo['checkout_root']],
 | |
|         CPPDEFINES = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1'],
 | |
|         target = env['LIB_DIR'] + '/imgui',
 | |
|         source = imgui_source_files,
 | |
|         add_source = imgui_add_sources
 | |
|     )
 | |
|     return {
 | |
|         'CPPPATH': [repo['checkout_root']],
 | |
|         'LIBS': [os.path.join(env['LIB_DIR'], env.LibFilename('imgui'))]
 | |
|     }
 | |
| 
 | |
| 
 | |
| env.GitRecipe(
 | |
|     globals = globals(),
 | |
|     repo_name = 'imgui',
 | |
|     repo_url = 'https://github.com/ocornut/imgui.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
 | |
| )
 |