|
| 1 | +#!/usr/bin/env python |
| 2 | +from misc.utility.scons_hints import * |
| 3 | + |
| 4 | +Import("env") |
| 5 | + |
| 6 | +env_sdl = env.Clone() |
| 7 | + |
| 8 | +# Thirdparty source files |
| 9 | + |
| 10 | +thirdparty_obj = [] |
| 11 | + |
| 12 | +if env["builtin_sdl"]: |
| 13 | + thirdparty_dir = "#thirdparty/sdl/" |
| 14 | + |
| 15 | + # Use our own SDL_build_config_private.h. |
| 16 | + env_sdl.Prepend(CPPDEFINES=["SDL_PLATFORM_PRIVATE"]) |
| 17 | + |
| 18 | + # Common sources. |
| 19 | + |
| 20 | + env_sdl.Prepend( |
| 21 | + CPPPATH=[ |
| 22 | + thirdparty_dir, |
| 23 | + thirdparty_dir + "include", |
| 24 | + thirdparty_dir + "include/build_config", |
| 25 | + ".", # SDL_build_config_private.h |
| 26 | + ] |
| 27 | + ) |
| 28 | + |
| 29 | + thirdparty_sources = [ |
| 30 | + "SDL.c", |
| 31 | + "SDL_assert.c", |
| 32 | + "SDL_error.c", |
| 33 | + "SDL_guid.c", |
| 34 | + "SDL_hashtable.c", |
| 35 | + "SDL_hints.c", |
| 36 | + "SDL_list.c", |
| 37 | + "SDL_log.c", |
| 38 | + "SDL_properties.c", |
| 39 | + "SDL_utils.c", |
| 40 | + "atomic/SDL_atomic.c", |
| 41 | + "atomic/SDL_spinlock.c", |
| 42 | + "events/SDL_events.c", |
| 43 | + "events/SDL_eventwatch.c", |
| 44 | + "haptic/SDL_haptic.c", |
| 45 | + "io/SDL_iostream.c", |
| 46 | + "joystick/SDL_gamepad.c", |
| 47 | + "joystick/SDL_joystick.c", |
| 48 | + "joystick/SDL_steam_virtual_gamepad.c", |
| 49 | + "joystick/controller_type.c", |
| 50 | + "libm/e_atan2.c", |
| 51 | + "libm/e_exp.c", |
| 52 | + "libm/e_fmod.c", |
| 53 | + "libm/e_log.c", |
| 54 | + "libm/e_log10.c", |
| 55 | + "libm/e_pow.c", |
| 56 | + "libm/e_rem_pio2.c", |
| 57 | + "libm/e_sqrt.c", |
| 58 | + "libm/k_cos.c", |
| 59 | + "libm/k_rem_pio2.c", |
| 60 | + "libm/k_sin.c", |
| 61 | + "libm/k_tan.c", |
| 62 | + "libm/s_atan.c", |
| 63 | + "libm/s_copysign.c", |
| 64 | + "libm/s_cos.c", |
| 65 | + "libm/s_fabs.c", |
| 66 | + "libm/s_floor.c", |
| 67 | + "libm/s_isinf.c", |
| 68 | + "libm/s_isinff.c", |
| 69 | + "libm/s_isnan.c", |
| 70 | + "libm/s_isnanf.c", |
| 71 | + "libm/s_modf.c", |
| 72 | + "libm/s_scalbn.c", |
| 73 | + "libm/s_sin.c", |
| 74 | + "libm/s_tan.c", |
| 75 | + "sensor/SDL_sensor.c", |
| 76 | + "sensor/dummy/SDL_dummysensor.c", |
| 77 | + "stdlib/SDL_crc16.c", |
| 78 | + "stdlib/SDL_crc32.c", |
| 79 | + "stdlib/SDL_getenv.c", |
| 80 | + "stdlib/SDL_iconv.c", |
| 81 | + "stdlib/SDL_malloc.c", |
| 82 | + "stdlib/SDL_memcpy.c", |
| 83 | + "stdlib/SDL_memmove.c", |
| 84 | + "stdlib/SDL_memset.c", |
| 85 | + "stdlib/SDL_mslibc.c", |
| 86 | + "stdlib/SDL_murmur3.c", |
| 87 | + "stdlib/SDL_qsort.c", |
| 88 | + "stdlib/SDL_random.c", |
| 89 | + "stdlib/SDL_stdlib.c", |
| 90 | + "stdlib/SDL_string.c", |
| 91 | + "stdlib/SDL_strtokr.c", |
| 92 | + "thread/SDL_thread.c", |
| 93 | + "thread/generic/SDL_syscond.c", |
| 94 | + "thread/generic/SDL_sysrwlock.c", |
| 95 | + "thread/generic/SDL_systhread.c", |
| 96 | + "timer/SDL_timer.c", |
| 97 | + ] |
| 98 | + |
| 99 | + # HIDAPI |
| 100 | + thirdparty_sources += [ |
| 101 | + "hidapi/SDL_hidapi.c", |
| 102 | + "joystick/hidapi/SDL_hidapi_combined.c", |
| 103 | + "joystick/hidapi/SDL_hidapi_gamecube.c", |
| 104 | + "joystick/hidapi/SDL_hidapijoystick.c", |
| 105 | + "joystick/hidapi/SDL_hidapi_luna.c", |
| 106 | + "joystick/hidapi/SDL_hidapi_ps3.c", |
| 107 | + "joystick/hidapi/SDL_hidapi_ps4.c", |
| 108 | + "joystick/hidapi/SDL_hidapi_ps5.c", |
| 109 | + "joystick/hidapi/SDL_hidapi_rumble.c", |
| 110 | + "joystick/hidapi/SDL_hidapi_shield.c", |
| 111 | + "joystick/hidapi/SDL_hidapi_stadia.c", |
| 112 | + "joystick/hidapi/SDL_hidapi_steam.c", |
| 113 | + "joystick/hidapi/SDL_hidapi_steamdeck.c", |
| 114 | + "joystick/hidapi/SDL_hidapi_steam_hori.c", |
| 115 | + "joystick/hidapi/SDL_hidapi_switch.c", |
| 116 | + "joystick/hidapi/SDL_hidapi_wii.c", |
| 117 | + "joystick/hidapi/SDL_hidapi_xbox360.c", |
| 118 | + "joystick/hidapi/SDL_hidapi_xbox360w.c", |
| 119 | + "joystick/hidapi/SDL_hidapi_xboxone.c", |
| 120 | + ] |
| 121 | + |
| 122 | + # Platform specific sources. |
| 123 | + |
| 124 | + if env["platform"] == "linuxbsd": |
| 125 | + # TODO: Check support for BSD systems. |
| 126 | + env_sdl.Append(CPPDEFINES=["SDL_PLATFORM_LINUX"]) |
| 127 | + thirdparty_sources += [ |
| 128 | + "core/linux/SDL_dbus.c", |
| 129 | + "core/linux/SDL_evdev.c", |
| 130 | + "core/linux/SDL_evdev_capabilities.c", |
| 131 | + "core/linux/SDL_evdev_kbd.c", |
| 132 | + "core/linux/SDL_fcitx.c", |
| 133 | + "core/linux/SDL_ibus.c", |
| 134 | + "core/linux/SDL_ime.c", |
| 135 | + "core/linux/SDL_system_theme.c", |
| 136 | + "core/linux/SDL_threadprio.c", |
| 137 | + "core/linux/SDL_udev.c", |
| 138 | + "core/unix/SDL_appid.c", |
| 139 | + "core/unix/SDL_poll.c", |
| 140 | + "haptic/linux/SDL_syshaptic.c", |
| 141 | + "joystick/linux/SDL_sysjoystick.c", |
| 142 | + "loadso/dlopen/SDL_sysloadso.c", |
| 143 | + "thread/pthread/SDL_syscond.c", |
| 144 | + "thread/pthread/SDL_sysmutex.c", |
| 145 | + "thread/pthread/SDL_sysrwlock.c", |
| 146 | + "thread/pthread/SDL_syssem.c", |
| 147 | + "thread/pthread/SDL_systhread.c", |
| 148 | + "thread/pthread/SDL_systls.c", |
| 149 | + "timer/unix/SDL_systimer.c", |
| 150 | + ] |
| 151 | + |
| 152 | + elif env["platform"] == "macos": |
| 153 | + env_sdl.Append(CPPDEFINES=["SDL_PLATFORM_MACOS"]) |
| 154 | + thirdparty_sources += [ |
| 155 | + "core/unix/SDL_appid.c", |
| 156 | + "core/unix/SDL_poll.c", |
| 157 | + "haptic/darwin/SDL_syshaptic.c", |
| 158 | + "joystick/darwin/SDL_iokitjoystick.c", |
| 159 | + "joystick/apple/SDL_mfijoystick.m", |
| 160 | + "thread/pthread/SDL_syscond.c", |
| 161 | + "thread/pthread/SDL_sysmutex.c", |
| 162 | + "thread/pthread/SDL_sysrwlock.c", |
| 163 | + "thread/pthread/SDL_syssem.c", |
| 164 | + "thread/pthread/SDL_systhread.c", |
| 165 | + "thread/pthread/SDL_systls.c", |
| 166 | + "timer/unix/SDL_systimer.c", |
| 167 | + ] |
| 168 | + |
| 169 | + elif env["platform"] == "windows": |
| 170 | + env_sdl.Append(CPPDEFINES=["SDL_PLATFORM_WINDOWS"]) |
| 171 | + thirdparty_sources += [ |
| 172 | + "core/windows/SDL_gameinput.c", |
| 173 | + "core/windows/SDL_hid.c", |
| 174 | + "core/windows/SDL_immdevice.c", |
| 175 | + "core/windows/SDL_windows.c", |
| 176 | + "core/windows/SDL_xinput.c", |
| 177 | + "core/windows/pch.c", |
| 178 | + "haptic/windows/SDL_dinputhaptic.c", |
| 179 | + "haptic/windows/SDL_windowshaptic.c", |
| 180 | + "joystick/windows/SDL_dinputjoystick.c", |
| 181 | + "joystick/windows/SDL_rawinputjoystick.c", |
| 182 | + "joystick/windows/SDL_windows_gaming_input.c", |
| 183 | + "joystick/windows/SDL_windowsjoystick.c", |
| 184 | + "joystick/windows/SDL_xinputjoystick.c", |
| 185 | + "thread/windows/SDL_syscond_cv.c", |
| 186 | + "thread/windows/SDL_sysmutex.c", |
| 187 | + "thread/windows/SDL_sysrwlock_srw.c", |
| 188 | + "thread/windows/SDL_syssem.c", |
| 189 | + "thread/windows/SDL_systhread.c", |
| 190 | + "thread/windows/SDL_systls.c", |
| 191 | + "timer/windows/SDL_systimer.c", |
| 192 | + ] |
| 193 | + |
| 194 | + thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] |
| 195 | + |
| 196 | + env_thirdparty = env_sdl.Clone() |
| 197 | + env_thirdparty.disable_warnings() |
| 198 | + env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) |
| 199 | + env.drivers_sources += thirdparty_obj |
| 200 | + |
| 201 | +# Godot source files |
| 202 | + |
| 203 | +driver_obj = [] |
| 204 | + |
| 205 | +env_sdl.add_source_files(driver_obj, "*.cpp") |
| 206 | +env.drivers_sources += driver_obj |
| 207 | + |
| 208 | +# Needed to force rebuilding the driver files when the thirdparty library is updated. |
| 209 | +env.Depends(driver_obj, thirdparty_obj) |
0 commit comments