summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-03-30 08:28:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-03-30 09:05:53 +0200
commitcd4e46ee65dab6baa6a143bf3b3f64244be36712 (patch)
tree689e53265691e782ae35a961445c975219e1155d /drivers
parent0168709978154a89f137b44f33647e5d28a46250 (diff)
SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters. psf/black is very opinionated and purposely doesn't leave much room for configuration. The output is mostly OK so that should be fine for us, but some things worth noting: - Manually wrapped strings will be reflowed, so by using a line length of 120 for the sake of preserving readability for our long command calls, it also means that some manually wrapped strings are back on the same line and should be manually merged again. - Code generators using string concatenation extensively look awful, since black puts each operand on a single line. We need to refactor these generators to use more pythonic string formatting, for which many options are available (`%`, `format` or f-strings). - CI checks and a pre-commit hook will be added to ensure that future buildsystem changes are well-formatted.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/SCsub35
-rw-r--r--drivers/alsa/SCsub2
-rw-r--r--drivers/alsamidi/SCsub2
-rw-r--r--drivers/coreaudio/SCsub2
-rw-r--r--drivers/coremidi/SCsub2
-rw-r--r--drivers/dummy/SCsub2
-rw-r--r--drivers/gl_context/SCsub8
-rw-r--r--drivers/gles2/SCsub2
-rw-r--r--drivers/gles2/shaders/SCsub40
-rw-r--r--drivers/png/SCsub9
-rw-r--r--drivers/pulseaudio/SCsub2
-rw-r--r--drivers/spirv-reflect/SCsub6
-rw-r--r--drivers/unix/SCsub4
-rw-r--r--drivers/vulkan/SCsub88
-rw-r--r--drivers/wasapi/SCsub2
-rw-r--r--drivers/windows/SCsub2
-rw-r--r--drivers/winmidi/SCsub2
-rw-r--r--drivers/xaudio2/SCsub6
18 files changed, 113 insertions, 103 deletions
diff --git a/drivers/SCsub b/drivers/SCsub
index 41c20d81ad..cc7bcbc640 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -1,41 +1,42 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.drivers_sources = []
# OS drivers
-SConscript('unix/SCsub')
-SConscript('windows/SCsub')
+SConscript("unix/SCsub")
+SConscript("windows/SCsub")
# Sounds drivers
-SConscript('alsa/SCsub')
-SConscript('coreaudio/SCsub')
-SConscript('pulseaudio/SCsub')
-if (env["platform"] == "windows"):
+SConscript("alsa/SCsub")
+SConscript("coreaudio/SCsub")
+SConscript("pulseaudio/SCsub")
+if env["platform"] == "windows":
SConscript("wasapi/SCsub")
-if env['xaudio2']:
+if env["xaudio2"]:
SConscript("xaudio2/SCsub")
# Midi drivers
-SConscript('alsamidi/SCsub')
-SConscript('coremidi/SCsub')
-SConscript('winmidi/SCsub')
+SConscript("alsamidi/SCsub")
+SConscript("coremidi/SCsub")
+SConscript("winmidi/SCsub")
# Graphics drivers
-if (env["platform"] != "server" and env["platform"] != "javascript"):
-# SConscript('gles2/SCsub')
- SConscript('vulkan/SCsub')
- SConscript('gl_context/SCsub')
+if env["platform"] != "server" and env["platform"] != "javascript":
+ # SConscript('gles2/SCsub')
+ SConscript("vulkan/SCsub")
+ SConscript("gl_context/SCsub")
else:
- SConscript('dummy/SCsub')
+ SConscript("dummy/SCsub")
# Core dependencies
SConscript("png/SCsub")
SConscript("spirv-reflect/SCsub")
-if env['vsproj']:
+if env["vsproj"]:
import os
+
path = os.getcwd()
# Change directory so the path resolves correctly in the function call.
os.chdir("..")
diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/alsa/SCsub
+++ b/drivers/alsa/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/alsamidi/SCsub b/drivers/alsamidi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/alsamidi/SCsub
+++ b/drivers/alsamidi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/coreaudio/SCsub b/drivers/coreaudio/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/coreaudio/SCsub
+++ b/drivers/coreaudio/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/coremidi/SCsub b/drivers/coremidi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/coremidi/SCsub
+++ b/drivers/coremidi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/dummy/SCsub b/drivers/dummy/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/dummy/SCsub
+++ b/drivers/dummy/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index d6945ee2eb..ddeec6f4c6 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
-if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]):
+if env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]:
# Thirdparty source files
thirdparty_dir = "#thirdparty/glad/"
thirdparty_sources = [
@@ -12,8 +12,8 @@ if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]):
env.Prepend(CPPPATH=[thirdparty_dir])
- env.Append(CPPDEFINES=['GLAD_ENABLED'])
- env.Append(CPPDEFINES=['GLES_OVER_GL'])
+ env.Append(CPPDEFINES=["GLAD_ENABLED"])
+ env.Append(CPPDEFINES=["GLES_OVER_GL"])
env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()
diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub
index 9923e52c73..987ddcd16e 100644
--- a/drivers/gles2/SCsub
+++ b/drivers/gles2/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub
index d7ae0243e6..bcd6ea79fb 100644
--- a/drivers/gles2/shaders/SCsub
+++ b/drivers/gles2/shaders/SCsub
@@ -1,23 +1,23 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
-if 'GLES2_GLSL' in env['BUILDERS']:
- env.GLES2_GLSL('copy.glsl');
-# env.GLES2_GLSL('resolve.glsl');
- env.GLES2_GLSL('canvas.glsl');
- env.GLES2_GLSL('canvas_shadow.glsl');
- env.GLES2_GLSL('scene.glsl');
- env.GLES2_GLSL('cubemap_filter.glsl');
- env.GLES2_GLSL('cube_to_dp.glsl');
-# env.GLES2_GLSL('blend_shape.glsl');
-# env.GLES2_GLSL('screen_space_reflection.glsl');
- env.GLES2_GLSL('effect_blur.glsl');
-# env.GLES2_GLSL('subsurf_scattering.glsl');
-# env.GLES2_GLSL('ssao.glsl');
-# env.GLES2_GLSL('ssao_minify.glsl');
-# env.GLES2_GLSL('ssao_blur.glsl');
-# env.GLES2_GLSL('exposure.glsl');
- env.GLES2_GLSL('tonemap.glsl');
-# env.GLES2_GLSL('particles.glsl');
- env.GLES2_GLSL('lens_distorted.glsl');
+if "GLES2_GLSL" in env["BUILDERS"]:
+ env.GLES2_GLSL("copy.glsl")
+ # env.GLES2_GLSL('resolve.glsl');
+ env.GLES2_GLSL("canvas.glsl")
+ env.GLES2_GLSL("canvas_shadow.glsl")
+ env.GLES2_GLSL("scene.glsl")
+ env.GLES2_GLSL("cubemap_filter.glsl")
+ env.GLES2_GLSL("cube_to_dp.glsl")
+ # env.GLES2_GLSL('blend_shape.glsl');
+ # env.GLES2_GLSL('screen_space_reflection.glsl');
+ env.GLES2_GLSL("effect_blur.glsl")
+ # env.GLES2_GLSL('subsurf_scattering.glsl');
+ # env.GLES2_GLSL('ssao.glsl');
+ # env.GLES2_GLSL('ssao_minify.glsl');
+ # env.GLES2_GLSL('ssao_blur.glsl');
+ # env.GLES2_GLSL('exposure.glsl');
+ env.GLES2_GLSL("tonemap.glsl")
+ # env.GLES2_GLSL('particles.glsl');
+ env.GLES2_GLSL("lens_distorted.glsl")
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 87b54cecaf..db08be0c47 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -1,11 +1,11 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_png = env.Clone()
# Thirdparty source files
-if env['builtin_libpng']:
+if env["builtin_libpng"]:
thirdparty_dir = "#thirdparty/libpng/"
thirdparty_sources = [
"png.c",
@@ -32,6 +32,7 @@ if env['builtin_libpng']:
# Currently .ASM filter_neon.S does not compile on NT.
import os
+
use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt"
if use_neon:
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)])
@@ -45,7 +46,7 @@ if env['builtin_libpng']:
if use_neon:
env_neon = env_thirdparty.Clone()
if "S_compiler" in env:
- env_neon['CC'] = env['S_compiler']
+ env_neon["CC"] = env["S_compiler"]
neon_sources = []
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
@@ -56,4 +57,4 @@ if env['builtin_libpng']:
# Godot source files
env_png.add_source_files(env.drivers_sources, "*.cpp")
-Export('env')
+Export("env")
diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/pulseaudio/SCsub
+++ b/drivers/pulseaudio/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/spirv-reflect/SCsub b/drivers/spirv-reflect/SCsub
index 8ff27da114..d0ffaf068d 100644
--- a/drivers/spirv-reflect/SCsub
+++ b/drivers/spirv-reflect/SCsub
@@ -1,17 +1,17 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_spirv_reflect = env.Clone()
env_spirv_reflect.disable_warnings()
thirdparty_dir = "#thirdparty/spirv-reflect/"
thirdparty_sources = [
- "spirv_reflect.c"
+ "spirv_reflect.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_spirv_reflect.add_source_files(env.drivers_sources, thirdparty_sources)
-Export('env')
+Export("env")
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub
index 4888f56099..91ef613546 100644
--- a/drivers/unix/SCsub
+++ b/drivers/unix/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
-env["check_c_headers"] = [ [ "mntent.h", "HAVE_MNTENT" ] ]
+env["check_c_headers"] = [["mntent.h", "HAVE_MNTENT"]]
diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub
index de776b19b2..7ffdac27d5 100644
--- a/drivers/vulkan/SCsub
+++ b/drivers/vulkan/SCsub
@@ -1,10 +1,10 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
-if env['builtin_vulkan']:
+if env["builtin_vulkan"]:
# Use bundled Vulkan headers
thirdparty_dir = "#thirdparty/vulkan"
env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include", thirdparty_dir + "/loader"])
@@ -27,48 +27,56 @@ if env['builtin_vulkan']:
]
vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"]
- if env['platform'] == "windows":
+ if env["platform"] == "windows":
loader_sources.append("dirent_on_windows.c")
loader_sources.append("dxgi_loader.c")
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_WIN32_KHR',
- 'VULKAN_NON_CMAKE_BUILD',
- 'WIN32_LEAN_AND_MEAN',
- 'API_NAME=\\"%s\\"' % 'Vulkan'
- ])
- if not env.msvc: # Windows 7+, missing in mingw headers
- env_thirdparty.AppendUnique(CPPDEFINES=[
- "CM_GETIDLIST_FILTER_CLASS=0x00000200",
- "CM_GETIDLIST_FILTER_PRESENT=0x00000100"
- ])
- elif env['platform'] == "osx":
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_MACOS_MVK',
- 'VULKAN_NON_CMAKE_BUILD',
- 'SYSCONFDIR=\\"%s\\"' % '/etc',
- 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
- 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
- ])
- elif env['platform'] == "iphone":
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_IOS_MVK',
- 'VULKAN_NON_CMAKE_BUILD',
- 'SYSCONFDIR=\\"%s\\"' % '/etc',
- 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
- 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
- ])
- elif env['platform'] == "linuxbsd":
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_XLIB_KHR',
- 'VULKAN_NON_CMAKE_BUILD',
- 'SYSCONFDIR=\\"%s\\"' % '/etc',
- 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
- 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
- ])
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_WIN32_KHR",
+ "VULKAN_NON_CMAKE_BUILD",
+ "WIN32_LEAN_AND_MEAN",
+ 'API_NAME=\\"%s\\"' % "Vulkan",
+ ]
+ )
+ if not env.msvc: # Windows 7+, missing in mingw headers
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=["CM_GETIDLIST_FILTER_CLASS=0x00000200", "CM_GETIDLIST_FILTER_PRESENT=0x00000100"]
+ )
+ elif env["platform"] == "osx":
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_MACOS_MVK",
+ "VULKAN_NON_CMAKE_BUILD",
+ 'SYSCONFDIR=\\"%s\\"' % "/etc",
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share",
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg",
+ ]
+ )
+ elif env["platform"] == "iphone":
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_IOS_MVK",
+ "VULKAN_NON_CMAKE_BUILD",
+ 'SYSCONFDIR=\\"%s\\"' % "/etc",
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share",
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg",
+ ]
+ )
+ elif env["platform"] == "linuxbsd":
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_XLIB_KHR",
+ "VULKAN_NON_CMAKE_BUILD",
+ 'SYSCONFDIR=\\"%s\\"' % "/etc",
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share",
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg",
+ ]
+ )
import platform
- if (platform.system() == "Linux"):
+
+ if platform.system() == "Linux":
# In glibc since 2.17 and musl libc since 1.1.24. Used by loader.c.
- env_thirdparty.AppendUnique(CPPDEFINES=['HAVE_SECURE_GETENV'])
+ env_thirdparty.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
loader_sources = [thirdparty_dir + "/loader/" + file for file in loader_sources]
env_thirdparty.add_source_files(env.drivers_sources, loader_sources)
diff --git a/drivers/wasapi/SCsub b/drivers/wasapi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/wasapi/SCsub
+++ b/drivers/wasapi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/windows/SCsub b/drivers/windows/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/windows/SCsub
+++ b/drivers/windows/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/winmidi/SCsub b/drivers/winmidi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/winmidi/SCsub
+++ b/drivers/winmidi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/xaudio2/SCsub b/drivers/xaudio2/SCsub
index de750525ab..6778ad281e 100644
--- a/drivers/xaudio2/SCsub
+++ b/drivers/xaudio2/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
-env.Append(CPPDEFINES=['XAUDIO2_ENABLED'])
-env.Append(LINKFLAGS=['xaudio2_8.lib'])
+env.Append(CPPDEFINES=["XAUDIO2_ENABLED"])
+env.Append(LINKFLAGS=["xaudio2_8.lib"])