(ports, settings, shared)
| 49 | |
| 50 | |
| 51 | def get(ports, settings, shared): |
| 52 | ports.fetch_project('sdl2_image', f'https://github.com/libsdl-org/SDL_image/archive/refs/tags/{TAG}.zip', sha512hash=HASH) |
| 53 | libname = get_lib_name(settings) |
| 54 | |
| 55 | def create(final): |
| 56 | src_dir = ports.get_dir('sdl2_image', 'SDL_image-' + TAG) |
| 57 | ports.install_headers(src_dir, target='SDL2') |
| 58 | srcs = '''IMG.c IMG_bmp.c IMG_gif.c IMG_jpg.c IMG_lbm.c IMG_pcx.c IMG_png.c IMG_pnm.c IMG_tga.c |
| 59 | IMG_tif.c IMG_xcf.c IMG_xpm.c IMG_xv.c IMG_webp.c IMG_ImageIO.m |
| 60 | IMG_avif.c IMG_jxl.c IMG_svg.c IMG_qoi.c'''.split() |
| 61 | |
| 62 | flags = ['-sUSE_SDL=2', '-Wno-format-security'] |
| 63 | |
| 64 | formats = get_formats(settings) |
| 65 | |
| 66 | flags.extend(f'-DLOAD_{fmt.upper()}' for fmt in formats) |
| 67 | |
| 68 | if 'png' in formats: |
| 69 | flags += ['-sUSE_LIBPNG'] |
| 70 | |
| 71 | if 'jpg' in formats: |
| 72 | flags += ['-sUSE_LIBJPEG'] |
| 73 | |
| 74 | if settings.PTHREADS: |
| 75 | flags += ['-pthread'] |
| 76 | |
| 77 | if settings.SUPPORT_LONGJMP == 'wasm': |
| 78 | flags.append('-sSUPPORT_LONGJMP=wasm') |
| 79 | |
| 80 | ports.build_port(src_dir, final, 'sdl2_image', flags=flags, srcs=srcs) |
| 81 | |
| 82 | return [shared.cache.get_lib(libname, create, what='port')] |
| 83 | |
| 84 | |
| 85 | def clear(ports, settings, shared): |
nothing calls this directly
no test coverage detected