(final)
| 36 | ports.fetch_project('sdl2', f'https://github.com/libsdl-org/SDL/archive/{TAG}.zip', sha512hash=HASH) |
| 37 | |
| 38 | def create(final): |
| 39 | # copy includes to a location so they can be used as 'SDL2/' |
| 40 | src_dir = ports.get_dir('sdl2', SUBDIR) |
| 41 | source_include_path = os.path.join(src_dir, 'include') |
| 42 | ports.install_headers(source_include_path, target='SDL2') |
| 43 | ports.make_pkg_config('sdl2', VERSION, '-sUSE_SDL=2') |
| 44 | |
| 45 | # copy sdl2-config.cmake |
| 46 | cmake_file = os.path.join(os.path.dirname(__file__), 'sdl2/sdl2-config.cmake') |
| 47 | ports.install_file(cmake_file, 'lib/cmake/SDL2/sdl2-config.cmake') |
| 48 | |
| 49 | # build |
| 50 | srcs = '''SDL.c SDL_assert.c SDL_dataqueue.c SDL_error.c SDL_guid.c SDL_hints.c SDL_list.c SDL_log.c |
| 51 | SDL_utils.c atomic/SDL_atomic.c atomic/SDL_spinlock.c audio/SDL_audio.c audio/SDL_audiocvt.c |
| 52 | audio/SDL_audiodev.c audio/SDL_audiotypecvt.c audio/SDL_mixer.c audio/SDL_wave.c cpuinfo/SDL_cpuinfo.c |
| 53 | dynapi/SDL_dynapi.c events/SDL_clipboardevents.c events/SDL_displayevents.c events/SDL_dropevents.c |
| 54 | events/SDL_events.c events/SDL_gesture.c events/SDL_keyboard.c events/SDL_keysym_to_scancode.c |
| 55 | events/SDL_scancode_tables.c events/SDL_mouse.c events/SDL_quit.c |
| 56 | events/SDL_touch.c events/SDL_windowevents.c file/SDL_rwops.c haptic/SDL_haptic.c hidapi/SDL_hidapi.c |
| 57 | joystick/controller_type.c joystick/SDL_gamecontroller.c joystick/SDL_joystick.c |
| 58 | joystick/SDL_steam_virtual_gamepad.c |
| 59 | power/SDL_power.c render/SDL_d3dmath.c render/SDL_render.c |
| 60 | render/SDL_yuv_sw.c render/direct3d/SDL_render_d3d.c render/direct3d11/SDL_render_d3d11.c |
| 61 | render/opengl/SDL_render_gl.c render/opengl/SDL_shaders_gl.c render/opengles/SDL_render_gles.c |
| 62 | render/opengles2/SDL_render_gles2.c render/opengles2/SDL_shaders_gles2.c |
| 63 | render/psp/SDL_render_psp.c render/software/SDL_blendfillrect.c render/software/SDL_blendline.c |
| 64 | render/software/SDL_blendpoint.c render/software/SDL_drawline.c render/software/SDL_drawpoint.c |
| 65 | render/software/SDL_render_sw.c render/software/SDL_rotate.c render/software/SDL_triangle.c |
| 66 | sensor/SDL_sensor.c sensor/dummy/SDL_dummysensor.c |
| 67 | stdlib/SDL_crc16.c stdlib/SDL_crc32.c stdlib/SDL_getenv.c stdlib/SDL_iconv.c stdlib/SDL_malloc.c |
| 68 | stdlib/SDL_qsort.c stdlib/SDL_stdlib.c stdlib/SDL_string.c stdlib/SDL_strtokr.c |
| 69 | thread/SDL_thread.c timer/SDL_timer.c |
| 70 | video/SDL_RLEaccel.c video/SDL_blit.c video/SDL_blit_0.c video/SDL_blit_1.c video/SDL_blit_A.c |
| 71 | video/SDL_blit_N.c video/SDL_blit_auto.c video/SDL_blit_copy.c video/SDL_blit_slow.c |
| 72 | video/SDL_bmp.c video/SDL_clipboard.c video/SDL_egl.c video/SDL_fillrect.c video/SDL_pixels.c |
| 73 | video/SDL_rect.c video/SDL_shape.c video/SDL_stretch.c video/SDL_surface.c video/SDL_video.c |
| 74 | video/SDL_yuv.c video/emscripten/SDL_emscriptenevents.c |
| 75 | video/emscripten/SDL_emscriptenframebuffer.c video/emscripten/SDL_emscriptenmouse.c |
| 76 | video/emscripten/SDL_emscriptenopengles.c video/emscripten/SDL_emscriptenvideo.c |
| 77 | audio/emscripten/SDL_emscriptenaudio.c video/dummy/SDL_nullevents.c |
| 78 | video/dummy/SDL_nullframebuffer.c video/dummy/SDL_nullvideo.c video/yuv2rgb/yuv_rgb_std.c |
| 79 | audio/disk/SDL_diskaudio.c audio/dummy/SDL_dummyaudio.c loadso/dlopen/SDL_sysloadso.c |
| 80 | power/emscripten/SDL_syspower.c joystick/emscripten/SDL_sysjoystick.c |
| 81 | filesystem/emscripten/SDL_sysfilesystem.c timer/unix/SDL_systimer.c haptic/dummy/SDL_syshaptic.c |
| 82 | main/dummy/SDL_dummy_main.c locale/SDL_locale.c locale/emscripten/SDL_syslocale.c misc/SDL_url.c |
| 83 | misc/emscripten/SDL_sysurl.c'''.split() |
| 84 | thread_srcs = ['SDL_syscond.c', 'SDL_sysmutex.c', 'SDL_syssem.c', 'SDL_systhread.c', 'SDL_systls.c'] |
| 85 | thread_backend = 'generic' if not settings.PTHREADS else 'pthread' |
| 86 | srcs += ['thread/%s/%s' % (thread_backend, s) for s in thread_srcs] |
| 87 | |
| 88 | srcs = [os.path.join(src_dir, 'src', s) for s in srcs] |
| 89 | # TODO: Remove fwrapv when we update to a version which includes https://github.com/libsdl-org/SDL/pull/12581 |
| 90 | flags = ['-sUSE_SDL=0', '-fwrapv-pointer'] |
| 91 | includes = [ports.get_include_dir('SDL2')] |
| 92 | if settings.PTHREADS: |
| 93 | flags += ['-pthread'] |
| 94 | ports.build_port(src_dir, final, 'sdl2', srcs=srcs, includes=includes, flags=flags) |
| 95 |
nothing calls this directly
no test coverage detected