import os import platform from SCons.Script import * def cook(env: Environment, git_ref: str = "main") -> dict: repo = env.GitBranch(repo_name = 'SDL', remote_url = 'https://github.com/libsdl-org/SDL.git', git_ref = git_ref) checkout_root = repo['checkout_root'] build_result = env.CMakeProject(project_root=checkout_root, generate_args = ['-DSDL_STATIC=ON', '-DSDL_SHARED=OFF']) libs = [] if platform.system() == 'Windows': if env['BUILD_TYPE'] == 'debug': libs.append('SDL2-staticd') else: libs.append('SDL2-static') libs.extend(('kernel32', 'user32', 'gdi32', 'winmm', 'imm32', 'ole32', 'oleaut32', 'version', 'uuid', 'advapi32', 'setupapi', 'shell32', 'dinput8')) else: if env['BUILD_TYPE'] == 'debug': libs.append('SDL2d') else: libs.append('SDL2') return { 'LIBPATH': build_result['LIBPATH'], 'CPPPATH': [os.path.join(build_result['install_dir'], 'include/SDL2')], # SDL is really weird about include paths ... 'LIBS': libs }