| 1 |
|
| 2 |
from misc.utility.scons_hints import * |
| 3 |
|
| 4 |
Import("env") |
| 5 |
|
| 6 |
env_sdl = env.Clone() |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
thirdparty_obj = [] |
| 11 |
|
| 12 |
if env["builtin_sdl"]: |
| 13 |
thirdparty_dir = "#thirdparty/sdl/" |
| 14 |
|
| 15 |
|
| 16 |
env_sdl.Prepend(CPPDEFINES=["SDL_PLATFORM_PRIVATE"]) |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
env_sdl.Prepend( |
| 21 |
CPPPATH=[ |
| 22 |
thirdparty_dir, |
| 23 |
thirdparty_dir + "include", |
| 24 |
thirdparty_dir + "include/build_config", |
| 25 |
".", |
| 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 |
"timer/SDL_timer.c", |
| 94 |
] |
| 95 |
|
| 96 |
|
| 97 |
thirdparty_sources += [ |
| 98 |
"hidapi/SDL_hidapi.c", |
| 99 |
"joystick/hidapi/SDL_hidapi_combined.c", |
| 100 |
"joystick/hidapi/SDL_hidapi_gamecube.c", |
| 101 |
"joystick/hidapi/SDL_hidapijoystick.c", |
| 102 |
"joystick/hidapi/SDL_hidapi_luna.c", |
| 103 |
"joystick/hidapi/SDL_hidapi_ps3.c", |
| 104 |
"joystick/hidapi/SDL_hidapi_ps4.c", |
| 105 |
"joystick/hidapi/SDL_hidapi_ps5.c", |
| 106 |
"joystick/hidapi/SDL_hidapi_rumble.c", |
| 107 |
"joystick/hidapi/SDL_hidapi_shield.c", |
| 108 |
"joystick/hidapi/SDL_hidapi_stadia.c", |
| 109 |
"joystick/hidapi/SDL_hidapi_steam.c", |
| 110 |
"joystick/hidapi/SDL_hidapi_steamdeck.c", |
| 111 |
"joystick/hidapi/SDL_hidapi_steam_hori.c", |
| 112 |
"joystick/hidapi/SDL_hidapi_switch.c", |
| 113 |
"joystick/hidapi/SDL_hidapi_wii.c", |
| 114 |
"joystick/hidapi/SDL_hidapi_xbox360.c", |
| 115 |
"joystick/hidapi/SDL_hidapi_xbox360w.c", |
| 116 |
"joystick/hidapi/SDL_hidapi_xboxone.c", |
| 117 |
] |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
if env["platform"] == "linuxbsd": |
| 122 |
|
| 123 |
env_sdl.Append(CPPDEFINES=["SDL_PLATFORM_LINUX"]) |
| 124 |
thirdparty_sources += [ |
| 125 |
"core/linux/SDL_dbus.c", |
| 126 |
"core/linux/SDL_evdev.c", |
| 127 |
"core/linux/SDL_evdev_capabilities.c", |
| 128 |
"core/linux/SDL_evdev_kbd.c", |
| 129 |
"core/linux/SDL_threadprio.c", |
| 130 |
"core/linux/SDL_udev.c", |
| 131 |
"core/unix/SDL_appid.c", |
| 132 |
"core/unix/SDL_poll.c", |
| 133 |
"haptic/linux/SDL_syshaptic.c", |
| 134 |
"joystick/linux/SDL_sysjoystick.c", |
| 135 |
"loadso/dlopen/SDL_sysloadso.c", |
| 136 |
"thread/pthread/SDL_syscond.c", |
| 137 |
"thread/pthread/SDL_sysmutex.c", |
| 138 |
"thread/pthread/SDL_sysrwlock.c", |
| 139 |
"thread/pthread/SDL_syssem.c", |
| 140 |
"thread/pthread/SDL_systhread.c", |
| 141 |
"thread/pthread/SDL_systls.c", |
| 142 |
"timer/unix/SDL_systimer.c", |
| 143 |
] |
| 144 |
env_sdl.Prepend(CPPPATH=[thirdparty_dir + "core/linux"]) |
| 145 |
|
| 146 |
elif env["platform"] == "macos": |
| 147 |
env_sdl.Append(CPPDEFINES=["SDL_PLATFORM_MACOS"]) |
| 148 |
thirdparty_sources += [ |
| 149 |
"core/unix/SDL_appid.c", |
| 150 |
"core/unix/SDL_poll.c", |
| 151 |
"haptic/darwin/SDL_syshaptic.c", |
| 152 |
"joystick/darwin/SDL_iokitjoystick.c", |
| 153 |
"joystick/apple/SDL_mfijoystick.m", |
| 154 |
"thread/pthread/SDL_syscond.c", |
| 155 |
"thread/pthread/SDL_sysmutex.c", |
| 156 |
"thread/pthread/SDL_sysrwlock.c", |
| 157 |
"thread/pthread/SDL_syssem.c", |
| 158 |
"thread/pthread/SDL_systhread.c", |
| 159 |
"thread/pthread/SDL_systls.c", |
| 160 |
"timer/unix/SDL_systimer.c", |
| 161 |
] |
| 162 |
|
| 163 |
elif env["platform"] == "windows": |
| 164 |
env_sdl.Append(CPPDEFINES=["SDL_PLATFORM_WINDOWS"]) |
| 165 |
thirdparty_sources += [ |
| 166 |
"core/windows/SDL_gameinput.c", |
| 167 |
"core/windows/SDL_hid.c", |
| 168 |
"core/windows/SDL_immdevice.c", |
| 169 |
"core/windows/SDL_windows.c", |
| 170 |
"core/windows/SDL_xinput.c", |
| 171 |
"core/windows/pch.c", |
| 172 |
"haptic/windows/SDL_dinputhaptic.c", |
| 173 |
"haptic/windows/SDL_windowshaptic.c", |
| 174 |
"joystick/windows/SDL_dinputjoystick.c", |
| 175 |
"joystick/windows/SDL_rawinputjoystick.c", |
| 176 |
"joystick/windows/SDL_windows_gaming_input.c", |
| 177 |
"joystick/windows/SDL_windowsjoystick.c", |
| 178 |
"joystick/windows/SDL_xinputjoystick.c", |
| 179 |
"thread/generic/SDL_syscond.c", |
| 180 |
"thread/generic/SDL_sysrwlock.c", |
| 181 |
"sensor/windows/SDL_windowssensor.c", |
| 182 |
"thread/windows/SDL_syscond_cv.c", |
| 183 |
"thread/windows/SDL_sysmutex.c", |
| 184 |
"thread/windows/SDL_sysrwlock_srw.c", |
| 185 |
"thread/windows/SDL_syssem.c", |
| 186 |
"thread/windows/SDL_systhread.c", |
| 187 |
"thread/windows/SDL_systls.c", |
| 188 |
"timer/windows/SDL_systimer.c", |
| 189 |
] |
| 190 |
|
| 191 |
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] |
| 192 |
|
| 193 |
env_thirdparty = env_sdl.Clone() |
| 194 |
env_thirdparty.disable_warnings() |
| 195 |
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) |
| 196 |
env.drivers_sources += thirdparty_obj |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
driver_obj = [] |
| 201 |
|
| 202 |
env_sdl.add_source_files(driver_obj, "*.cpp") |
| 203 |
env.drivers_sources += driver_obj |
| 204 |
|
| 205 |
|
| 206 |
env.Depends(driver_obj, thirdparty_obj) |