Bläddra i källkod

SCons: Unify tools/target build type configuration

Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
Rémi Verschelde 2 år sedan
förälder
incheckning
39facb35a0
42 ändrade filer med 216 tillägg och 339 borttagningar
  1. 7 10
      .github/actions/godot-build/action.yml
  2. 3 5
      .github/workflows/android_builds.yml
  3. 2 3
      .github/workflows/ios_builds.yml
  4. 18 24
      .github/workflows/linux_builds.yml
  5. 5 8
      .github/workflows/macos_builds.yml
  6. 2 3
      .github/workflows/web_builds.yml
  7. 5 8
      .github/workflows/windows_builds.yml
  8. 93 62
      SConstruct
  9. 1 1
      core/SCsub
  10. 1 1
      editor/SCsub
  11. 12 13
      methods.py
  12. 2 2
      misc/dist/html/editor.html
  13. 1 1
      misc/dist/html/manifest.json
  14. 2 2
      modules/basis_universal/SCsub
  15. 1 1
      modules/csg/SCsub
  16. 1 1
      modules/cvtt/config.py
  17. 1 1
      modules/denoise/config.py
  18. 1 1
      modules/etcpak/config.py
  19. 1 1
      modules/freetype/SCsub
  20. 1 1
      modules/gdscript/SCsub
  21. 1 1
      modules/gltf/SCsub
  22. 1 1
      modules/gridmap/SCsub
  23. 1 1
      modules/mono/SCsub
  24. 3 6
      modules/mono/build_scripts/mono_configure.py
  25. 1 1
      modules/mono/config.py
  26. 1 1
      modules/multiplayer/SCsub
  27. 1 1
      modules/navigation/SCsub
  28. 1 1
      modules/openxr/SCsub
  29. 2 2
      modules/text_server_adv/SCsub
  30. 1 1
      modules/text_server_adv/gdextension_build/SConstruct
  31. 1 1
      modules/text_server_fb/gdextension_build/SConstruct
  32. 1 1
      modules/tinyexr/config.py
  33. 1 1
      modules/websocket/SCsub
  34. 1 1
      modules/xatlas_unwrap/config.py
  35. 5 5
      platform/android/SCsub
  36. 2 16
      platform/android/detect.py
  37. 5 24
      platform/ios/detect.py
  38. 4 23
      platform/linuxbsd/detect.py
  39. 2 21
      platform/macos/detect.py
  40. 7 16
      platform/web/detect.py
  41. 7 7
      platform/web/emscripten_helpers.py
  42. 7 58
      platform/windows/detect.py

+ 7 - 10
.github/actions/godot-build/action.yml

@@ -2,16 +2,13 @@ name: Build Godot
 description: Build Godot with the provided options.
 description: Build Godot with the provided options.
 inputs:
 inputs:
   target:
   target:
-    description: The scons target (debug/release_debug/release).
-    default: "debug"
-  tools:
-    description: If tools are to be built.
-    default: false
+    description: Build target (editor, template_release, template_debug).
+    default: "editor"
   tests:
   tests:
-    description: If tests are to be built.
+    description: Unit tests.
     default: false
     default: false
   platform:
   platform:
-    description: The Godot platform to build.
+    description: Target platform.
     required: false
     required: false
   sconsflags:
   sconsflags:
     default: ""
     default: ""
@@ -33,7 +30,7 @@ runs:
           SCONS_CACHE: ${{ inputs.scons-cache }}
           SCONS_CACHE: ${{ inputs.scons-cache }}
           SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
           SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
       run: |
       run: |
-        echo "Building with flags:" ${{ env.SCONSFLAGS }}
-        if ! ${{ inputs.tools }}; then rm -rf editor; fi  # Ensure we don't include editor code.
-        scons p=${{ inputs.platform }} target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
+        echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
+        if [ "${{ inputs.target }}" != "editor" ]; then rm -rf editor; fi  # Ensure we don't include editor code.
+        scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
         ls -l bin/
         ls -l bin/

+ 3 - 5
.github/workflows/android_builds.yml

@@ -14,7 +14,7 @@ concurrency:
 jobs:
 jobs:
   android-template:
   android-template:
     runs-on: "ubuntu-20.04"
     runs-on: "ubuntu-20.04"
-    name: Template (target=release, tools=no)
+    name: Template (target=template_release)
 
 
     steps:
     steps:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
@@ -44,8 +44,7 @@ jobs:
         with:
         with:
           sconsflags: ${{ env.SCONSFLAGS }} arch=arm32
           sconsflags: ${{ env.SCONSFLAGS }} arch=arm32
           platform: android
           platform: android
-          target: release
-          tools: false
+          target: template_release
           tests: false
           tests: false
 
 
       - name: Compilation (arm64)
       - name: Compilation (arm64)
@@ -53,8 +52,7 @@ jobs:
         with:
         with:
           sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
           sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
           platform: android
           platform: android
-          target: release
-          tools: false
+          target: template_release
           tests: false
           tests: false
 
 
       - name: Generate Godot templates
       - name: Generate Godot templates

+ 2 - 3
.github/workflows/ios_builds.yml

@@ -14,7 +14,7 @@ concurrency:
 jobs:
 jobs:
   ios-template:
   ios-template:
     runs-on: "macos-latest"
     runs-on: "macos-latest"
-    name: Template (target=release, tools=no)
+    name: Template (target=template_release)
 
 
     steps:
     steps:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
@@ -31,8 +31,7 @@ jobs:
         with:
         with:
           sconsflags: ${{ env.SCONSFLAGS }}
           sconsflags: ${{ env.SCONSFLAGS }}
           platform: ios
           platform: ios
-          target: release
-          tools: false
+          target: template_release
           tests: false
           tests: false
 
 
       - name: Upload artifact
       - name: Upload artifact

+ 18 - 24
.github/workflows/linux_builds.yml

@@ -7,7 +7,7 @@ env:
   GODOT_BASE_BRANCH: master
   GODOT_BASE_BRANCH: master
   SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
   SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
   DOTNET_NOLOGO: true
   DOTNET_NOLOGO: true
-  DOTNET_CLI_TELEMETRY_OPTOUT: false
+  DOTNET_CLI_TELEMETRY_OPTOUT: true
 
 
 concurrency:
 concurrency:
   group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
   group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
@@ -21,57 +21,52 @@ jobs:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         include:
         include:
-          - name: Editor w Mono (target=release_debug, tools=yes, tests=yes)
+          - name: Editor w/ Mono (target=editor)
             cache-name: linux-editor-mono
             cache-name: linux-editor-mono
-            target: release_debug
-            tools: true
+            target: editor
             tests: false # Disabled due freeze caused by mix Mono build and CI
             tests: false # Disabled due freeze caused by mix Mono build and CI
             sconsflags: module_mono_enabled=yes
             sconsflags: module_mono_enabled=yes
             doc-test: true
             doc-test: true
-            bin: "./bin/godot.linuxbsd.opt.tools.x86_64.mono"
+            bin: "./bin/godot.linuxbsd.editor.x86_64.mono"
             build-mono: true
             build-mono: true
             proj-conv: true
             proj-conv: true
             artifact: true
             artifact: true
 
 
-          - name: Editor with doubles and GCC sanitizers (target=debug, tools=yes, float=64, tests=yes, use_asan=yes, use_ubsan=yes, linker=gold)
+          - name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, float=64, use_asan=yes, use_ubsan=yes, linker=gold)
             cache-name: linux-editor-double-sanitizers
             cache-name: linux-editor-double-sanitizers
-            target: debug
-            tools: true
+            target: editor
             tests: true
             tests: true
-            sconsflags: float=64 use_asan=yes use_ubsan=yes linker=gold
+            sconsflags: dev_build=yes float=64 use_asan=yes use_ubsan=yes linker=gold
             proj-test: true
             proj-test: true
             # Can be turned off for PRs that intentionally break compat with godot-cpp,
             # Can be turned off for PRs that intentionally break compat with godot-cpp,
             # until both the upstream PR and the matching godot-cpp changes are merged.
             # until both the upstream PR and the matching godot-cpp changes are merged.
             godot-cpp-test: true
             godot-cpp-test: true
-            bin: "./bin/godot.linuxbsd.double.tools.x86_64.san"
+            bin: "./bin/godot.linuxbsd.editor.dev.double.x86_64.san"
             build-mono: false
             build-mono: false
             # Skip 2GiB artifact speeding up action.
             # Skip 2GiB artifact speeding up action.
             artifact: false
             artifact: false
 
 
-          - name: Editor with clang sanitizers (target=debug, tools=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
+          - name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
             cache-name: linux-editor-llvm-sanitizers
             cache-name: linux-editor-llvm-sanitizers
-            target: debug
-            tools: true
+            target: editor
             tests: true
             tests: true
-            sconsflags: use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
-            bin: "./bin/godot.linuxbsd.tools.x86_64.llvm.san"
+            sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
+            bin: "./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san"
             build-mono: false
             build-mono: false
             # Skip 2GiB artifact speeding up action.
             # Skip 2GiB artifact speeding up action.
             artifact: false
             artifact: false
 
 
-          - name: Template w/ Mono (target=release, tools=no)
+          - name: Template w/ Mono (target=template_release)
             cache-name: linux-template-mono
             cache-name: linux-template-mono
-            target: release
-            tools: false
+            target: template_release
             tests: false
             tests: false
-            sconsflags: module_mono_enabled=yes debug_symbols=no
+            sconsflags: module_mono_enabled=yes
             build-mono: false
             build-mono: false
             artifact: true
             artifact: true
 
 
-          - name: Minimal Template (target=release, tools=no, everything disabled)
+          - name: Minimal template (target=template_release, everything disabled)
             cache-name: linux-template-minimal
             cache-name: linux-template-minimal
-            target: release
-            tools: false
+            target: template_release
             tests: false
             tests: false
             sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
             sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
             artifact: true
             artifact: true
@@ -113,7 +108,6 @@ jobs:
           sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
           sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
           platform: linuxbsd
           platform: linuxbsd
           target: ${{ matrix.target }}
           target: ${{ matrix.target }}
-          tools: ${{ matrix.tools }}
           tests: ${{ matrix.tests }}
           tests: ${{ matrix.tests }}
 
 
       - name: Generate C# glue
       - name: Generate C# glue
@@ -221,7 +215,7 @@ jobs:
         if: ${{ matrix.godot-cpp-test }}
         if: ${{ matrix.godot-cpp-test }}
         run: |
         run: |
           cd godot-cpp/test
           cd godot-cpp/test
-          scons target=${{ matrix.target }}
+          scons target=debug
           cd ../..
           cd ../..
 
 
       - name: Prepare artifact
       - name: Prepare artifact

+ 5 - 8
.github/workflows/macos_builds.yml

@@ -19,17 +19,15 @@ jobs:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         include:
         include:
-          - name: Editor (target=release_debug, tools=yes, tests=yes)
+          - name: Editor (target=editor, tests=yes)
             cache-name: macos-editor
             cache-name: macos-editor
-            target: release_debug
-            tools: true
+            target: editor
             tests: true
             tests: true
-            bin: "./bin/godot.macos.opt.tools.x86_64"
+            bin: "./bin/godot.macos.editor.x86_64"
 
 
-          - name: Template (target=release, tools=no)
+          - name: Template (target=template_release)
             cache-name: macos-template
             cache-name: macos-template
-            target: release
-            tools: false
+            target: template_release
             tests: false
             tests: false
             sconsflags: debug_symbols=no
             sconsflags: debug_symbols=no
 
 
@@ -55,7 +53,6 @@ jobs:
           sconsflags: ${{ env.SCONSFLAGS }}
           sconsflags: ${{ env.SCONSFLAGS }}
           platform: macos
           platform: macos
           target: ${{ matrix.target }}
           target: ${{ matrix.target }}
-          tools: ${{ matrix.tools }}
           tests: ${{ matrix.tests }}
           tests: ${{ matrix.tests }}
 
 
       # Execute unit tests for the editor
       # Execute unit tests for the editor

+ 2 - 3
.github/workflows/web_builds.yml

@@ -16,7 +16,7 @@ concurrency:
 jobs:
 jobs:
   web-template:
   web-template:
     runs-on: "ubuntu-20.04"
     runs-on: "ubuntu-20.04"
-    name: Template (target=release, tools=no)
+    name: Template (target=template_release)
 
 
     steps:
     steps:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
@@ -43,8 +43,7 @@ jobs:
         with:
         with:
           sconsflags: ${{ env.SCONSFLAGS }}
           sconsflags: ${{ env.SCONSFLAGS }}
           platform: web
           platform: web
-          target: release
-          tools: false
+          target: template_release
           tests: false
           tests: false
 
 
       - name: Upload artifact
       - name: Upload artifact

+ 5 - 8
.github/workflows/windows_builds.yml

@@ -22,19 +22,17 @@ jobs:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         include:
         include:
-          - name: Editor (target=release_debug, tools=yes, tests=yes)
+          - name: Editor (target=editor, tests=yes)
             cache-name: windows-editor
             cache-name: windows-editor
-            target: release_debug
-            tools: true
+            target: editor
             tests: true
             tests: true
             # Skip debug symbols, they're way too big with MSVC.
             # Skip debug symbols, they're way too big with MSVC.
             sconsflags: debug_symbols=no
             sconsflags: debug_symbols=no
-            bin: "./bin/godot.windows.opt.tools.x86_64.exe"
+            bin: "./bin/godot.windows.editor.x86_64.exe"
 
 
-          - name: Template (target=release, tools=no)
+          - name: Template (target=template_release, tools=no)
             cache-name: windows-template
             cache-name: windows-template
-            target: release
-            tools: false
+            target: template_release
             tests: false
             tests: false
             sconsflags: debug_symbols=no
             sconsflags: debug_symbols=no
 
 
@@ -57,7 +55,6 @@ jobs:
           sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
           sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
           platform: windows
           platform: windows
           target: ${{ matrix.target }}
           target: ${{ matrix.target }}
-          tools: ${{ matrix.tools }}
           tests: ${{ matrix.tests }}
           tests: ${{ matrix.tests }}
 
 
       # Execute unit tests for the editor
       # Execute unit tests for the editor

+ 93 - 62
SConstruct

@@ -57,7 +57,7 @@ import glsl_builders
 import gles3_builders
 import gles3_builders
 from platform_methods import architectures, architecture_aliases
 from platform_methods import architectures, architecture_aliases
 
 
-if methods.get_cmdline_bool("tools", True):
+if ARGUMENTS.get("target", "editor") == "editor":
     _helper_module("editor.editor_builders", "editor/editor_builders.py")
     _helper_module("editor.editor_builders", "editor/editor_builders.py")
     _helper_module("editor.template_builders", "editor/template_builders.py")
     _helper_module("editor.template_builders", "editor/template_builders.py")
 
 
@@ -164,27 +164,33 @@ opts = Variables(customs, ARGUMENTS)
 # Target build options
 # Target build options
 opts.Add("platform", "Target platform (%s)" % ("|".join(platform_list),), "")
 opts.Add("platform", "Target platform (%s)" % ("|".join(platform_list),), "")
 opts.Add("p", "Platform (alias for 'platform')", "")
 opts.Add("p", "Platform (alias for 'platform')", "")
-opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True))
-opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "release_debug", "release")))
+opts.Add(EnumVariable("target", "Compilation target", "editor", ("editor", "template_release", "template_debug")))
 opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases))
 opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases))
-opts.Add(EnumVariable("float", "Floating-point precision", "32", ("32", "64")))
-opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size", "none")))
+opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False))
+opts.Add(
+    EnumVariable(
+        "optimize", "Optimization level", "speed_trace", ("none", "custom", "debug", "speed", "speed_trace", "size")
+    )
+)
+opts.Add(BoolVariable("debug_symbols", "Build with debugging symbols", True))
+opts.Add(BoolVariable("separate_debug_symbols", "Extract debugging symbols to a separate file", False))
+opts.Add(EnumVariable("lto", "Link-time optimization (production builds)", "none", ("none", "auto", "thin", "full")))
 opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
 opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
-opts.Add(EnumVariable("lto", "Link-time optimization (for production buids)", "none", ("none", "auto", "thin", "full")))
 
 
 # Components
 # Components
 opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True))
 opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True))
+opts.Add(EnumVariable("float", "Floating-point precision", "32", ("32", "64")))
 opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
 opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
 opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
 opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
 opts.Add(BoolVariable("vulkan", "Enable the vulkan video driver", True))
 opts.Add(BoolVariable("vulkan", "Enable the vulkan video driver", True))
 opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 video driver", True))
 opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 video driver", True))
 opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
 opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
+opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
 opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
 opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
 opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
 opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
-opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
 
 
 # Advanced options
 # Advanced options
-opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False))
+opts.Add(BoolVariable("dev_mode", "Alias for dev options: verbose=yes warnings=extra werror=yes tests=yes", False))
 opts.Add(BoolVariable("tests", "Build the unit tests", False))
 opts.Add(BoolVariable("tests", "Build the unit tests", False))
 opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster rebuilds", False))
 opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster rebuilds", False))
 opts.Add(BoolVariable("compiledb", "Generate compilation DB (`compile_commands.json`) for external tools", False))
 opts.Add(BoolVariable("compiledb", "Generate compilation DB (`compile_commands.json`) for external tools", False))
@@ -376,13 +382,36 @@ env_base.Prepend(CPPPATH=["#"])
 env_base.platform_exporters = platform_exporters
 env_base.platform_exporters = platform_exporters
 env_base.platform_apis = platform_apis
 env_base.platform_apis = platform_apis
 
 
-# Build type defines - more platform-specific ones can be in detect.py.
-if env_base["target"] == "release_debug" or env_base["target"] == "debug":
+# Configuration of build targets:
+# - Editor or template
+# - Debug features (DEBUG_ENABLED code)
+# - Dev only code (DEV_ENABLED code)
+# - Optimization level
+# - Debug symbols for crash traces / debuggers
+
+env_base.editor_build = env_base["target"] == "editor"
+env_base.dev_build = env_base["dev_build"]
+env_base.debug_features = env_base["target"] in ["editor", "template_debug"]
+
+if env_base.dev_build:
+    opt_level = "none"
+elif env_base.debug_features:
+    opt_level = "speed_trace"
+else:  # Release
+    opt_level = "speed"
+
+env_base["optimize"] = ARGUMENTS.get("optimize", opt_level)
+env_base["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", env_base.dev_build)
+
+if env_base.editor_build:
+    env_base.Append(CPPDEFINES=["TOOLS_ENABLED"])
+
+if env_base.debug_features:
     # DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended
     # DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended
     # to give *users* extra debugging information for their game development.
     # to give *users* extra debugging information for their game development.
     env_base.Append(CPPDEFINES=["DEBUG_ENABLED"])
     env_base.Append(CPPDEFINES=["DEBUG_ENABLED"])
 
 
-if env_base["target"] == "debug":
+if env_base.dev_build:
     # DEV_ENABLED enables *engine developer* code which should only be compiled for those
     # DEV_ENABLED enables *engine developer* code which should only be compiled for those
     # working on the engine itself.
     # working on the engine itself.
     env_base.Append(CPPDEFINES=["DEV_ENABLED"])
     env_base.Append(CPPDEFINES=["DEV_ENABLED"])
@@ -395,7 +424,7 @@ else:
 # Unsafe as they reduce the certainty of rebuilding all changed files, so it's
 # Unsafe as they reduce the certainty of rebuilding all changed files, so it's
 # enabled by default for `debug` builds, and can be overridden from command line.
 # enabled by default for `debug` builds, and can be overridden from command line.
 # Ref: https://github.com/SCons/scons/wiki/GoFastButton
 # Ref: https://github.com/SCons/scons/wiki/GoFastButton
-if methods.get_cmdline_bool("fast_unsafe", env_base["target"] == "debug"):
+if methods.get_cmdline_bool("fast_unsafe", env_base.dev_build):
     # Renamed to `content-timestamp` in SCons >= 4.2, keeping MD5 for compat.
     # Renamed to `content-timestamp` in SCons >= 4.2, keeping MD5 for compat.
     env_base.Decider("MD5-timestamp")
     env_base.Decider("MD5-timestamp")
     env_base.SetOption("implicit_cache", 1)
     env_base.SetOption("implicit_cache", 1)
@@ -470,32 +499,64 @@ if selected_platform in platform_list:
         if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto":  # Allow command line to override platform flags
         if not (f[0] in ARGUMENTS) or ARGUMENTS[f[0]] == "auto":  # Allow command line to override platform flags
             env[f[0]] = f[1]
             env[f[0]] = f[1]
 
 
-    # 'dev' and 'production' are aliases to set default options if they haven't been
+    # 'dev_mode' and 'production' are aliases to set default options if they haven't been
     # set manually by the user.
     # set manually by the user.
     # These need to be checked *after* platform specific flags so that different
     # These need to be checked *after* platform specific flags so that different
     # default values can be set (e.g. to keep LTO off for `production` on some platforms).
     # default values can be set (e.g. to keep LTO off for `production` on some platforms).
-    if env["dev"]:
+    if env["dev_mode"]:
         env["verbose"] = methods.get_cmdline_bool("verbose", True)
         env["verbose"] = methods.get_cmdline_bool("verbose", True)
         env["warnings"] = ARGUMENTS.get("warnings", "extra")
         env["warnings"] = ARGUMENTS.get("warnings", "extra")
         env["werror"] = methods.get_cmdline_bool("werror", True)
         env["werror"] = methods.get_cmdline_bool("werror", True)
-        if env["tools"]:
-            env["tests"] = methods.get_cmdline_bool("tests", True)
+        env["tests"] = methods.get_cmdline_bool("tests", True)
     if env["production"]:
     if env["production"]:
         env["use_static_cpp"] = methods.get_cmdline_bool("use_static_cpp", True)
         env["use_static_cpp"] = methods.get_cmdline_bool("use_static_cpp", True)
         env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", False)
         env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", False)
         # LTO "auto" means we handle the preferred option in each platform detect.py.
         # LTO "auto" means we handle the preferred option in each platform detect.py.
         env["lto"] = ARGUMENTS.get("lto", "auto")
         env["lto"] = ARGUMENTS.get("lto", "auto")
-        if not env["tools"] and env["target"] == "debug":
-            print(
-                "WARNING: Requested `production` build with `tools=no target=debug`, "
-                "this will give you a full debug template (use `target=release_debug` "
-                "for an optimized template with debug features)."
-            )
 
 
     # Must happen after the flags' definition, as configure is when most flags
     # Must happen after the flags' definition, as configure is when most flags
     # are actually handled to change compile options, etc.
     # are actually handled to change compile options, etc.
     detect.configure(env)
     detect.configure(env)
 
 
+    print(f'Building for platform "{selected_platform}", architecture "{env["arch"]}", target "{env["target"]}.')
+    if env.dev_build:
+        print("NOTE: Developer build, with debug optimization level and debug symbols (unless overridden).")
+
+    # Set optimize and debug_symbols flags.
+    # "custom" means do nothing and let users set their own optimization flags.
+    # Needs to happen after configure to have `env.msvc` defined.
+    if env.msvc:
+        if env["debug_symbols"]:
+            env.Append(CCFLAGS=["/Zi", "/FS"])
+            env.Append(LINKFLAGS=["/DEBUG:FULL"])
+
+        if env["optimize"] == "speed" or env["optimize"] == "speed_trace":
+            env.Append(CCFLAGS=["/O2"])
+            env.Append(LINKFLAGS=["/OPT:REF"])
+        elif env["optimize"] == "size":
+            env.Append(CCFLAGS=["/O1"])
+            env.Append(LINKFLAGS=["/OPT:REF"])
+        elif env["optimize"] == "debug" or env["optimize"] == "none":
+            env.Append(CCFLAGS=["/Od"])
+    else:
+        if env["debug_symbols"]:
+            if env.dev_build:
+                env.Append(CCFLAGS=["-g3"])
+            else:
+                env.Append(CCFLAGS=["-g2"])
+
+        if env["optimize"] == "speed":
+            env.Append(CCFLAGS=["-O3"])
+        # `-O2` is friendlier to debuggers than `-O3`, leading to better crash backtraces.
+        elif env["optimize"] == "speed_trace":
+            env.Append(CCFLAGS=["-O2"])
+        elif env["optimize"] == "size":
+            env.Append(CCFLAGS=["-Os"])
+        elif env["optimize"] == "debug":
+            env.Append(CCFLAGS=["-Og"])
+        elif env["optimize"] == "none":
+            env.Append(CCFLAGS=["-O0"])
+
     # Needs to happen after configure to handle "auto".
     # Needs to happen after configure to handle "auto".
     if env["lto"] != "none":
     if env["lto"] != "none":
         print("Using LTO: " + env["lto"])
         print("Using LTO: " + env["lto"])
@@ -514,11 +575,6 @@ if selected_platform in platform_list:
         # We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
         # We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
         env.Prepend(CCFLAGS=["/std:c++17"])
         env.Prepend(CCFLAGS=["/std:c++17"])
 
 
-    print(
-        'Building for platform "%s", architecture "%s", %s, target "%s".'
-        % (selected_platform, env["arch"], "editor" if env["tools"] else "template", env["target"])
-    )
-
     # Enforce our minimal compiler version requirements
     # Enforce our minimal compiler version requirements
     cc_version = methods.get_compiler_version(env) or {
     cc_version = methods.get_compiler_version(env) or {
         "major": None,
         "major": None,
@@ -663,32 +719,13 @@ if selected_platform in platform_list:
     else:
     else:
         suffix = "." + selected_platform
         suffix = "." + selected_platform
 
 
+    suffix += "." + env["target"]
+    if env.dev_build:
+        suffix += ".dev"
+
     if env_base["float"] == "64":
     if env_base["float"] == "64":
         suffix += ".double"
         suffix += ".double"
 
 
-    if env["target"] == "release":
-        if env["tools"]:
-            print("ERROR: The editor can only be built with `target=debug` or `target=release_debug`.")
-            print("       Use `tools=no target=release` to build a release export template.")
-            Exit(255)
-        suffix += ".opt"
-    elif env["target"] == "release_debug":
-        if env["tools"]:
-            suffix += ".opt.tools"
-        else:
-            suffix += ".opt.debug"
-    else:
-        if env["tools"]:
-            print(
-                "Note: Building a debug binary (which will run slowly). Use `target=release_debug` to build an optimized release binary."
-            )
-            suffix += ".tools"
-        else:
-            print(
-                "Note: Building a debug binary (which will run slowly). Use `target=release` to build an optimized release binary."
-            )
-            suffix += ".debug"
-
     suffix += "." + env["arch"]
     suffix += "." + env["arch"]
     suffix += env.extra_suffix
     suffix += env.extra_suffix
 
 
@@ -753,9 +790,6 @@ if selected_platform in platform_list:
     env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
     env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
     env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
     env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
 
 
-    if env["tools"]:
-        env.Append(CPPDEFINES=["TOOLS_ENABLED"])
-
     disabled_classes = []
     disabled_classes = []
 
 
     if env["build_feature_profile"] != "":
     if env["build_feature_profile"] != "":
@@ -777,19 +811,16 @@ if selected_platform in platform_list:
     methods.write_disabled_classes(disabled_classes)
     methods.write_disabled_classes(disabled_classes)
 
 
     if env["disable_3d"]:
     if env["disable_3d"]:
-        if env["tools"]:
-            print(
-                "Build option 'disable_3d=yes' cannot be used with 'tools=yes' (editor), "
-                "only with 'tools=no' (export template)."
-            )
+        if env.editor_build:
+            print("Build option 'disable_3d=yes' cannot be used for editor builds, but only for export templates.")
             Exit(255)
             Exit(255)
         else:
         else:
             env.Append(CPPDEFINES=["_3D_DISABLED"])
             env.Append(CPPDEFINES=["_3D_DISABLED"])
     if env["disable_advanced_gui"]:
     if env["disable_advanced_gui"]:
-        if env["tools"]:
+        if env.editor_build:
             print(
             print(
-                "Build option 'disable_advanced_gui=yes' cannot be used with 'tools=yes' (editor), "
-                "only with 'tools=no' (export template)."
+                "Build option 'disable_advanced_gui=yes' cannot be used for editor builds, "
+                "but only for export templates."
             )
             )
             Exit(255)
             Exit(255)
         else:
         else:
@@ -847,7 +878,7 @@ if selected_platform in platform_list:
     SConscript("core/SCsub")
     SConscript("core/SCsub")
     SConscript("servers/SCsub")
     SConscript("servers/SCsub")
     SConscript("scene/SCsub")
     SConscript("scene/SCsub")
-    if env["tools"]:
+    if env.editor_build:
         SConscript("editor/SCsub")
         SConscript("editor/SCsub")
     SConscript("drivers/SCsub")
     SConscript("drivers/SCsub")
 
 

+ 1 - 1
core/SCsub

@@ -85,7 +85,7 @@ if env["builtin_zlib"]:
     env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
     env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
     # Needs to be available in main env too
     # Needs to be available in main env too
     env.Prepend(CPPPATH=[thirdparty_zlib_dir])
     env.Prepend(CPPPATH=[thirdparty_zlib_dir])
-    if env["target"] == "debug":
+    if env.dev_build:
         env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
         env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
 
 
     env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
     env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)

+ 1 - 1
editor/SCsub

@@ -24,7 +24,7 @@ def _make_doc_data_class_path(to_path):
     g.close()
     g.close()
 
 
 
 
-if env["tools"]:
+if env.editor_build:
     # Register exporters
     # Register exporters
     reg_exporters_inc = '#include "register_exporters.h"\n'
     reg_exporters_inc = '#include "register_exporters.h"\n'
     reg_exporters = "void register_exporters() {\n"
     reg_exporters = "void register_exporters() {\n"

+ 12 - 13
methods.py

@@ -64,7 +64,7 @@ def disable_warnings(self):
 
 
 def force_optimization_on_debug(self):
 def force_optimization_on_debug(self):
     # 'self' is the environment
     # 'self' is the environment
-    if self["target"] != "debug":
+    if self["target"] != "template-release":
         return
         return
 
 
     if self.msvc:
     if self.msvc:
@@ -737,20 +737,19 @@ def generate_vs_project(env, num_jobs):
     if batch_file:
     if batch_file:
 
 
         class ModuleConfigs(Mapping):
         class ModuleConfigs(Mapping):
-            # This version information (Win32, x64, Debug, Release, Release_Debug seems to be
+            # This version information (Win32, x64, Debug, Release) seems to be
             # required for Visual Studio to understand that it needs to generate an NMAKE
             # required for Visual Studio to understand that it needs to generate an NMAKE
             # project. Do not modify without knowing what you are doing.
             # project. Do not modify without knowing what you are doing.
             PLATFORMS = ["Win32", "x64"]
             PLATFORMS = ["Win32", "x64"]
             PLATFORM_IDS = ["x86_32", "x86_64"]
             PLATFORM_IDS = ["x86_32", "x86_64"]
-            CONFIGURATIONS = ["debug", "release", "release_debug"]
-            CONFIGURATION_IDS = ["tools", "opt", "opt.tools"]
+            CONFIGURATIONS = ["editor", "template_release", "template_debug"]
+            DEV_SUFFIX = ["", ".dev"]
 
 
             @staticmethod
             @staticmethod
             def for_every_variant(value):
             def for_every_variant(value):
                 return [value for _ in range(len(ModuleConfigs.CONFIGURATIONS) * len(ModuleConfigs.PLATFORMS))]
                 return [value for _ in range(len(ModuleConfigs.CONFIGURATIONS) * len(ModuleConfigs.PLATFORMS))]
 
 
             def __init__(self):
             def __init__(self):
-
                 shared_targets_array = []
                 shared_targets_array = []
                 self.names = []
                 self.names = []
                 self.arg_dict = {
                 self.arg_dict = {
@@ -779,16 +778,16 @@ def generate_vs_project(env, num_jobs):
                     for platform in ModuleConfigs.PLATFORMS
                     for platform in ModuleConfigs.PLATFORMS
                 ]
                 ]
                 self.arg_dict["runfile"] += [
                 self.arg_dict["runfile"] += [
-                    f'bin\\godot.windows.{config_id}.{plat_id}{f".{name}" if name else ""}.exe'
-                    for config_id in ModuleConfigs.CONFIGURATION_IDS
+                    f'bin\\godot.windows.{config}{dev}.{plat_id}{f".{name}" if name else ""}.exe'
+                    for config in ModuleConfigs.CONFIGURATIONS
                     for plat_id in ModuleConfigs.PLATFORM_IDS
                     for plat_id in ModuleConfigs.PLATFORM_IDS
+                    for dev in ModuleConfig.DEV_SUFFIX
                 ]
                 ]
                 self.arg_dict["cpppaths"] += ModuleConfigs.for_every_variant(env["CPPPATH"] + [includes])
                 self.arg_dict["cpppaths"] += ModuleConfigs.for_every_variant(env["CPPPATH"] + [includes])
                 self.arg_dict["cppdefines"] += ModuleConfigs.for_every_variant(env["CPPDEFINES"] + defines)
                 self.arg_dict["cppdefines"] += ModuleConfigs.for_every_variant(env["CPPDEFINES"] + defines)
                 self.arg_dict["cmdargs"] += ModuleConfigs.for_every_variant(cli_args)
                 self.arg_dict["cmdargs"] += ModuleConfigs.for_every_variant(cli_args)
 
 
             def build_commandline(self, commands):
             def build_commandline(self, commands):
-
                 configuration_getter = (
                 configuration_getter = (
                     "$(Configuration"
                     "$(Configuration"
                     + "".join([f'.Replace("{name}", "")' for name in self.names[1:]])
                     + "".join([f'.Replace("{name}", "")' for name in self.names[1:]])
@@ -799,8 +798,6 @@ def generate_vs_project(env, num_jobs):
                 common_build_prefix = [
                 common_build_prefix = [
                     'cmd /V /C set "plat=$(PlatformTarget)"',
                     'cmd /V /C set "plat=$(PlatformTarget)"',
                     '(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))',
                     '(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))',
-                    'set "tools=%s"' % env["tools"],
-                    f'(if "{configuration_getter}"=="release" (set "tools=no"))',
                     'call "' + batch_file + '" !plat!',
                     'call "' + batch_file + '" !plat!',
                 ]
                 ]
 
 
@@ -813,10 +810,12 @@ def generate_vs_project(env, num_jobs):
                     "platform=windows",
                     "platform=windows",
                     f"target={configuration_getter}",
                     f"target={configuration_getter}",
                     "progress=no",
                     "progress=no",
-                    "tools=!tools!",
                     "-j%s" % num_jobs,
                     "-j%s" % num_jobs,
                 ]
                 ]
 
 
+                if env["dev_build"]:
+                    common_build_postfix.append("dev_build=yes")
+
                 if env["tests"]:
                 if env["tests"]:
                     common_build_postfix.append("tests=yes")
                     common_build_postfix.append("tests=yes")
 
 
@@ -846,7 +845,7 @@ def generate_vs_project(env, num_jobs):
         add_to_vs_project(env, env.servers_sources)
         add_to_vs_project(env, env.servers_sources)
         if env["tests"]:
         if env["tests"]:
             add_to_vs_project(env, env.tests_sources)
             add_to_vs_project(env, env.tests_sources)
-        if env["tools"]:
+        if env.editor_build:
             add_to_vs_project(env, env.editor_sources)
             add_to_vs_project(env, env.editor_sources)
 
 
         for header in glob_recursive("**/*.h"):
         for header in glob_recursive("**/*.h"):
@@ -855,7 +854,7 @@ def generate_vs_project(env, num_jobs):
         module_configs = ModuleConfigs()
         module_configs = ModuleConfigs()
 
 
         if env.get("module_mono_enabled"):
         if env.get("module_mono_enabled"):
-            mono_defines = [("GD_MONO_HOT_RELOAD",)] if env["tools"] else []
+            mono_defines = [("GD_MONO_HOT_RELOAD",)] if env.editor_build else []
             module_configs.add_mode(
             module_configs.add_mode(
                 "mono",
                 "mono",
                 cli_args="module_mono_enabled=yes",
                 cli_args="module_mono_enabled=yes",

+ 2 - 2
misc/dist/html/editor.html

@@ -411,7 +411,7 @@
 			}
 			}
 		}
 		}
 	//]]></script>
 	//]]></script>
-	<script src="godot.tools.js"></script>
+	<script src="godot.editor.js"></script>
 	<script>//<![CDATA[
 	<script>//<![CDATA[
 
 
 		var editor = null;
 		var editor = null;
@@ -706,7 +706,7 @@
 				displayFailureNotice('WebGL not available');
 				displayFailureNotice('WebGL not available');
 			} else {
 			} else {
 				setStatusMode('indeterminate');
 				setStatusMode('indeterminate');
-				editor.init('godot.tools').then(function() {
+				editor.init('godot.editor').then(function() {
 					if (zip) {
 					if (zip) {
 						editor.copyToFS("/tmp/preload.zip", zip);
 						editor.copyToFS("/tmp/preload.zip", zip);
 					}
 					}

+ 1 - 1
misc/dist/html/manifest.json

@@ -3,7 +3,7 @@
   "short_name": "Godot",
   "short_name": "Godot",
   "description": "Multi-platform 2D and 3D game engine with a feature-rich editor (Web edition)",
   "description": "Multi-platform 2D and 3D game engine with a feature-rich editor (Web edition)",
   "lang": "en",
   "lang": "en",
-  "start_url": "./godot.tools.html",
+  "start_url": "./godot.editor.html",
   "display": "standalone",
   "display": "standalone",
   "theme_color": "#202531",
   "theme_color": "#202531",
   "icons": [
   "icons": [

+ 2 - 2
modules/basis_universal/SCsub

@@ -40,12 +40,12 @@ if not env.msvc:
 else:
 else:
     env_basisu.Prepend(CPPPATH=[thirdparty_dir])
     env_basisu.Prepend(CPPPATH=[thirdparty_dir])
 
 
-if env["target"] == "debug":
+if env.dev_build:
     env_basisu.Append(CPPDEFINES=[("BASISU_DEVEL_MESSAGES", 1), ("BASISD_ENABLE_DEBUG_FLAGS", 1)])
     env_basisu.Append(CPPDEFINES=[("BASISU_DEVEL_MESSAGES", 1), ("BASISD_ENABLE_DEBUG_FLAGS", 1)])
 
 
 env_thirdparty = env_basisu.Clone()
 env_thirdparty = env_basisu.Clone()
 env_thirdparty.disable_warnings()
 env_thirdparty.disable_warnings()
-if env["tools"]:
+if env.editor_build:
     env_thirdparty.Append(CPPDEFINES=["BASISU_NO_IMG_LOADERS"])
     env_thirdparty.Append(CPPDEFINES=["BASISU_NO_IMG_LOADERS"])
     env_thirdparty.add_source_files(thirdparty_obj, encoder_sources)
     env_thirdparty.add_source_files(thirdparty_obj, encoder_sources)
 env_thirdparty.add_source_files(thirdparty_obj, transcoder_sources)
 env_thirdparty.add_source_files(thirdparty_obj, transcoder_sources)

+ 1 - 1
modules/csg/SCsub

@@ -7,5 +7,5 @@ env_csg = env_modules.Clone()
 
 
 # Godot source files
 # Godot source files
 env_csg.add_source_files(env.modules_sources, "*.cpp")
 env_csg.add_source_files(env.modules_sources, "*.cpp")
-if env["tools"]:
+if env.editor_build:
     env_csg.add_source_files(env.modules_sources, "editor/*.cpp")
     env_csg.add_source_files(env.modules_sources, "editor/*.cpp")

+ 1 - 1
modules/cvtt/config.py

@@ -1,5 +1,5 @@
 def can_build(env, platform):
 def can_build(env, platform):
-    return env["tools"]
+    return env.editor_build
 
 
 
 
 def configure(env):
 def configure(env):

+ 1 - 1
modules/denoise/config.py

@@ -5,7 +5,7 @@ def can_build(env, platform):
     # as doing lightmap generation and denoising on Android or Web
     # as doing lightmap generation and denoising on Android or Web
     # would be a bit far-fetched.
     # would be a bit far-fetched.
     desktop_platforms = ["linuxbsd", "macos", "windows"]
     desktop_platforms = ["linuxbsd", "macos", "windows"]
-    return env["tools"] and platform in desktop_platforms and env["arch"] == "x86_64"
+    return env.editor_build and platform in desktop_platforms and env["arch"] == "x86_64"
 
 
 
 
 def configure(env):
 def configure(env):

+ 1 - 1
modules/etcpak/config.py

@@ -1,5 +1,5 @@
 def can_build(env, platform):
 def can_build(env, platform):
-    return env["tools"]
+    return env.editor_build
 
 
 
 
 def configure(env):
 def configure(env):

+ 1 - 1
modules/freetype/SCsub

@@ -90,7 +90,7 @@ if env["builtin_freetype"]:
     env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
     env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
 
 
     env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
     env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
-    if env["target"] == "debug":
+    if env.dev_build:
         env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
         env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
 
 
     # Also requires libpng headers
     # Also requires libpng headers

+ 1 - 1
modules/gdscript/SCsub

@@ -7,7 +7,7 @@ env_gdscript = env_modules.Clone()
 
 
 env_gdscript.add_source_files(env.modules_sources, "*.cpp")
 env_gdscript.add_source_files(env.modules_sources, "*.cpp")
 
 
-if env["tools"]:
+if env.editor_build:
     env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp")
     env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp")
 
 
     SConscript("editor/script_templates/SCsub")
     SConscript("editor/script_templates/SCsub")

+ 1 - 1
modules/gltf/SCsub

@@ -9,5 +9,5 @@ env_gltf = env_modules.Clone()
 env_gltf.add_source_files(env.modules_sources, "*.cpp")
 env_gltf.add_source_files(env.modules_sources, "*.cpp")
 env_gltf.add_source_files(env.modules_sources, "structures/*.cpp")
 env_gltf.add_source_files(env.modules_sources, "structures/*.cpp")
 SConscript("extensions/SCsub")
 SConscript("extensions/SCsub")
-if env["tools"]:
+if env.editor_build:
     env_gltf.add_source_files(env.modules_sources, "editor/*.cpp")
     env_gltf.add_source_files(env.modules_sources, "editor/*.cpp")

+ 1 - 1
modules/gridmap/SCsub

@@ -7,5 +7,5 @@ env_gridmap = env_modules.Clone()
 
 
 # Godot source files
 # Godot source files
 env_gridmap.add_source_files(env.modules_sources, "*.cpp")
 env_gridmap.add_source_files(env.modules_sources, "*.cpp")
-if env["tools"]:
+if env.editor_build:
     env_gridmap.add_source_files(env.modules_sources, "editor/*.cpp")
     env_gridmap.add_source_files(env.modules_sources, "editor/*.cpp")

+ 1 - 1
modules/mono/SCsub

@@ -26,6 +26,6 @@ if env["platform"] in ["macos", "ios"]:
 elif env["platform"] == "android":
 elif env["platform"] == "android":
     env_mono.add_source_files(env.modules_sources, "mono_gd/android_mono_config.gen.cpp")
     env_mono.add_source_files(env.modules_sources, "mono_gd/android_mono_config.gen.cpp")
 
 
-if env["tools"]:
+if env.editor_build:
     env_mono.add_source_files(env.modules_sources, "editor/*.cpp")
     env_mono.add_source_files(env.modules_sources, "editor/*.cpp")
     SConscript("editor/script_templates/SCsub")
     SConscript("editor/script_templates/SCsub")

+ 3 - 6
modules/mono/build_scripts/mono_configure.py

@@ -20,10 +20,7 @@ def configure(env, env_mono):
     # is_ios = env["platform"] == "ios"
     # is_ios = env["platform"] == "ios"
     # is_ios_sim = is_ios and env["arch"] in ["x86_32", "x86_64"]
     # is_ios_sim = is_ios and env["arch"] in ["x86_32", "x86_64"]
 
 
-    tools_enabled = env["tools"]
-
-    if tools_enabled and not module_supports_tools_on(env["platform"]):
-        raise RuntimeError("This module does not currently support building for this platform with tools enabled")
-
-    if env["tools"]:
+    if env.editor_build:
+        if not module_supports_tools_on(env["platform"]):
+            raise RuntimeError("This module does not currently support building for this platform for editor builds.")
         env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])
         env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])

+ 1 - 1
modules/mono/config.py

@@ -7,7 +7,7 @@ def can_build(env, platform):
     if env["arch"].startswith("rv"):
     if env["arch"].startswith("rv"):
         return False
         return False
 
 
-    if env["tools"]:
+    if env.editor_build:
         env.module_add_dependencies("mono", ["regex"])
         env.module_add_dependencies("mono", ["regex"])
 
 
     return True
     return True

+ 1 - 1
modules/multiplayer/SCsub

@@ -8,7 +8,7 @@ env_mp = env_modules.Clone()
 module_obj = []
 module_obj = []
 env_mp.add_source_files(module_obj, "*.cpp")
 env_mp.add_source_files(module_obj, "*.cpp")
 
 
-if env["tools"]:
+if env.editor_build:
     env_mp.add_source_files(module_obj, "editor/*.cpp")
     env_mp.add_source_files(module_obj, "editor/*.cpp")
 
 
 env.modules_sources += module_obj
 env.modules_sources += module_obj

+ 1 - 1
modules/navigation/SCsub

@@ -57,7 +57,7 @@ env.modules_sources += thirdparty_obj
 module_obj = []
 module_obj = []
 
 
 env_navigation.add_source_files(module_obj, "*.cpp")
 env_navigation.add_source_files(module_obj, "*.cpp")
-if env["tools"]:
+if env.editor_build:
     env_navigation.add_source_files(module_obj, "editor/*.cpp")
     env_navigation.add_source_files(module_obj, "editor/*.cpp")
 env.modules_sources += module_obj
 env.modules_sources += module_obj
 
 

+ 1 - 1
modules/openxr/SCsub

@@ -96,7 +96,7 @@ env_openxr.add_source_files(module_obj, "extensions/openxr_hand_tracking_extensi
 
 
 env.modules_sources += module_obj
 env.modules_sources += module_obj
 
 
-if env["tools"]:
+if env.editor_build:
     SConscript("editor/SCsub")
     SConscript("editor/SCsub")
 
 
 # Needed to force rebuilding the module files when the thirdparty library is updated.
 # Needed to force rebuilding the module files when the thirdparty library is updated.

+ 2 - 2
modules/text_server_adv/SCsub

@@ -445,7 +445,7 @@ if env["builtin_icu"]:
 
 
     icu_data_name = "icudt71l.dat"
     icu_data_name = "icudt71l.dat"
 
 
-    if env_icu["tools"]:
+    if env.editor_build:
         env_icu.Depends("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name)
         env_icu.Depends("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name)
         env_icu.Command("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name, make_icu_data)
         env_icu.Command("#thirdparty/icu4c/icudata.gen.h", "#thirdparty/icu4c/" + icu_data_name, make_icu_data)
         env_text_server_adv.Prepend(CPPPATH=["#thirdparty/icu4c/"])
         env_text_server_adv.Prepend(CPPPATH=["#thirdparty/icu4c/"])
@@ -479,7 +479,7 @@ if env["builtin_icu"]:
             "-DICU_DATA_NAME=" + icu_data_name,
             "-DICU_DATA_NAME=" + icu_data_name,
         ]
         ]
     )
     )
-    if env_text_server_adv["tools"]:
+    if env.editor_build:
         env_text_server_adv.Append(CXXFLAGS=["-DICU_STATIC_DATA"])
         env_text_server_adv.Append(CXXFLAGS=["-DICU_STATIC_DATA"])
 
 
     env_text_server_adv.Prepend(CPPPATH=["#thirdparty/icu4c/common/", "#thirdparty/icu4c/i18n/"])
     env_text_server_adv.Prepend(CPPPATH=["#thirdparty/icu4c/common/", "#thirdparty/icu4c/i18n/"])

+ 1 - 1
modules/text_server_adv/gdextension_build/SConstruct

@@ -193,7 +193,7 @@ if env["freetype_enabled"]:
             "FT_CONFIG_OPTION_SYSTEM_ZLIB",
             "FT_CONFIG_OPTION_SYSTEM_ZLIB",
         ]
         ]
     )
     )
-    if env["target"] == "debug":
+    if env.dev_build:
         env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
         env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
 
 
     env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
     env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])

+ 1 - 1
modules/text_server_fb/gdextension_build/SConstruct

@@ -188,7 +188,7 @@ if env["freetype_enabled"]:
             "FT_CONFIG_OPTION_SYSTEM_ZLIB",
             "FT_CONFIG_OPTION_SYSTEM_ZLIB",
         ]
         ]
     )
     )
-    if env["target"] == "debug":
+    if env.dev_build:
         env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
         env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
 
 
     env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
     env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])

+ 1 - 1
modules/tinyexr/config.py

@@ -1,5 +1,5 @@
 def can_build(env, platform):
 def can_build(env, platform):
-    return env["tools"]
+    return env.editor_build
 
 
 
 
 def configure(env):
 def configure(env):

+ 1 - 1
modules/websocket/SCsub

@@ -41,7 +41,7 @@ elif env["builtin_wslay"]:
 module_obj = []
 module_obj = []
 
 
 env_ws.add_source_files(module_obj, "*.cpp")
 env_ws.add_source_files(module_obj, "*.cpp")
-if env["tools"]:
+if env.editor_build:
     env_ws.add_source_files(module_obj, "editor/*.cpp")
     env_ws.add_source_files(module_obj, "editor/*.cpp")
 env.modules_sources += module_obj
 env.modules_sources += module_obj
 
 

+ 1 - 1
modules/xatlas_unwrap/config.py

@@ -1,5 +1,5 @@
 def can_build(env, platform):
 def can_build(env, platform):
-    return env["tools"] and platform not in ["android", "ios"]
+    return env.editor_build and platform not in ["android", "ios"]
 
 
 
 
 def configure(env):
 def configure(env):

+ 5 - 5
platform/android/SCsub

@@ -53,14 +53,14 @@ else:
     print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin")
     print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin")
 
 
 if lib_arch_dir != "":
 if lib_arch_dir != "":
-    if env["target"] == "release":
-        lib_type_dir = "release"
-    elif env["target"] == "release_debug":
+    if env.debug_features:
         lib_type_dir = "debug"
         lib_type_dir = "debug"
-    else:  # debug
+    elif env.dev_build:
         lib_type_dir = "dev"
         lib_type_dir = "dev"
+    else:  # Release
+        lib_type_dir = "release"
 
 
-    if env["tools"]:
+    if env.editor_build:
         lib_tools_dir = "tools/"
         lib_tools_dir = "tools/"
     else:
     else:
         lib_tools_dir = ""
         lib_tools_dir = ""

+ 2 - 16
platform/android/detect.py

@@ -46,7 +46,7 @@ def get_ndk_version():
 def get_flags():
 def get_flags():
     return [
     return [
         ("arch", "arm64"),  # Default for convenience.
         ("arch", "arm64"),  # Default for convenience.
-        ("tools", False),
+        ("target", "template_debug"),
     ]
     ]
 
 
 
 
@@ -114,20 +114,6 @@ def configure(env):
     env.Append(CCFLAGS=target_option)
     env.Append(CCFLAGS=target_option)
     env.Append(LINKFLAGS=target_option)
     env.Append(LINKFLAGS=target_option)
 
 
-    # Build type
-
-    if env["target"].startswith("release"):
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
-            # when using `target=release_debug`.
-            opt = "-O3" if env["target"] == "release" else "-O2"
-            env.Append(CCFLAGS=[opt])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Append(CCFLAGS=["-Oz"])
-    elif env["target"] == "debug":
-        env.Append(LINKFLAGS=["-O0"])
-        env.Append(CCFLAGS=["-O0", "-g"])
-
     # LTO
     # LTO
 
 
     if env["lto"] == "auto":  # LTO benefits for Android (size, performance) haven't been clearly established yet.
     if env["lto"] == "auto":  # LTO benefits for Android (size, performance) haven't been clearly established yet.
@@ -168,7 +154,7 @@ def configure(env):
     env["AS"] = compiler_path + "/clang"
     env["AS"] = compiler_path + "/clang"
 
 
     # Disable exceptions and rtti on non-tools (template) builds
     # Disable exceptions and rtti on non-tools (template) builds
-    if env["tools"]:
+    if env.editor_build:
         env.Append(CXXFLAGS=["-frtti"])
         env.Append(CXXFLAGS=["-frtti"])
     elif env["builtin_icu"]:
     elif env["builtin_icu"]:
         env.Append(CXXFLAGS=["-frtti", "-fno-exceptions"])
         env.Append(CXXFLAGS=["-frtti", "-fno-exceptions"])

+ 5 - 24
platform/ios/detect.py

@@ -37,7 +37,7 @@ def get_opts():
 def get_flags():
 def get_flags():
     return [
     return [
         ("arch", "arm64"),  # Default for convenience.
         ("arch", "arm64"),  # Default for convenience.
-        ("tools", False),
+        ("target", "template_debug"),
         ("use_volk", False),
         ("use_volk", False),
     ]
     ]
 
 
@@ -52,23 +52,6 @@ def configure(env):
         )
         )
         sys.exit()
         sys.exit()
 
 
-    ## Build type
-
-    if env["target"].startswith("release"):
-        env.Append(CPPDEFINES=[("NS_BLOCK_ASSERTIONS", 1)])
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            # `-O2` is more friendly to debuggers than `-O3`, leading to better crash backtraces
-            # when using `target=release_debug`.
-            opt = "-O3" if env["target"] == "release" else "-O2"
-            env.Append(CCFLAGS=[opt])
-            env.Append(LINKFLAGS=[opt])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Append(CCFLAGS=["-Os"])
-            env.Append(LINKFLAGS=["-Os"])
-
-    elif env["target"] == "debug":
-        env.Append(CCFLAGS=["-g", "-O0"])
-
     ## LTO
     ## LTO
 
 
     if env["lto"] == "auto":  # Disable by default as it makes linking in Xcode very slow.
     if env["lto"] == "auto":  # Disable by default as it makes linking in Xcode very slow.
@@ -145,12 +128,10 @@ def configure(env):
         env.Append(ASFLAGS=["-arch", "arm64"])
         env.Append(ASFLAGS=["-arch", "arm64"])
         env.Append(CPPDEFINES=["NEED_LONG_INT"])
         env.Append(CPPDEFINES=["NEED_LONG_INT"])
 
 
-    # Disable exceptions on non-tools (template) builds
-    if not env["tools"]:
-        if env["ios_exceptions"]:
-            env.Append(CCFLAGS=["-fexceptions"])
-        else:
-            env.Append(CCFLAGS=["-fno-exceptions"])
+    if env["ios_exceptions"]:
+        env.Append(CCFLAGS=["-fexceptions"])
+    else:
+        env.Append(CCFLAGS=["-fno-exceptions"])
 
 
     # Temp fix for ABS/MAX/MIN macros in iOS SDK blocking compilation
     # Temp fix for ABS/MAX/MIN macros in iOS SDK blocking compilation
     env.Append(CCFLAGS=["-Wno-ambiguous-macro"])
     env.Append(CCFLAGS=["-Wno-ambiguous-macro"])

+ 4 - 23
platform/linuxbsd/detect.py

@@ -44,8 +44,6 @@ def get_opts():
         BoolVariable("fontconfig", "Detect and use fontconfig for system fonts support", True),
         BoolVariable("fontconfig", "Detect and use fontconfig for system fonts support", True),
         BoolVariable("udev", "Use udev for gamepad connection callbacks", True),
         BoolVariable("udev", "Use udev for gamepad connection callbacks", True),
         BoolVariable("x11", "Enable X11 display", True),
         BoolVariable("x11", "Enable X11 display", True),
-        BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True),
-        BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
         BoolVariable("touch", "Enable touch events", True),
         BoolVariable("touch", "Enable touch events", True),
         BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
         BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
     ]
     ]
@@ -69,26 +67,9 @@ def configure(env):
 
 
     ## Build type
     ## Build type
 
 
-    if env["target"] == "release":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Prepend(CCFLAGS=["-O3"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "release_debug":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Prepend(CCFLAGS=["-O2"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "debug":
-        env.Prepend(CCFLAGS=["-g3"])
+    if env.dev_build:
+        # This is needed for our crash handler to work properly.
+        # gdb works fine without it though, so maybe our crash handler could too.
         env.Append(LINKFLAGS=["-rdynamic"])
         env.Append(LINKFLAGS=["-rdynamic"])
 
 
     # CPU architecture flags.
     # CPU architecture flags.
@@ -383,7 +364,7 @@ def configure(env):
     if env["execinfo"]:
     if env["execinfo"]:
         env.Append(LIBS=["execinfo"])
         env.Append(LIBS=["execinfo"])
 
 
-    if not env["tools"]:
+    if not env.editor_build:
         import subprocess
         import subprocess
         import re
         import re
 
 

+ 2 - 21
platform/macos/detect.py

@@ -27,8 +27,6 @@ def get_opts():
         ("MACOS_SDK_PATH", "Path to the macOS SDK", ""),
         ("MACOS_SDK_PATH", "Path to the macOS SDK", ""),
         ("vulkan_sdk_path", "Path to the Vulkan SDK", ""),
         ("vulkan_sdk_path", "Path to the Vulkan SDK", ""),
         EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")),
         EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")),
-        BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True),
-        BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False),
         BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
         BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
         BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False),
         BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False),
         BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
         BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
@@ -86,27 +84,10 @@ def configure(env):
 
 
     ## Build type
     ## Build type
 
 
-    if env["target"] == "release":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Prepend(CCFLAGS=["-O3"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
+    if env["target"] == "template_release":
         if env["arch"] != "arm64":
         if env["arch"] != "arm64":
             env.Prepend(CCFLAGS=["-msse2"])
             env.Prepend(CCFLAGS=["-msse2"])
-
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "release_debug":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Prepend(CCFLAGS=["-O2"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "debug":
-        env.Prepend(CCFLAGS=["-g3"])
+    elif env.dev_build:
         env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"])
         env.Prepend(LINKFLAGS=["-Xlinker", "-no_deduplicate"])
 
 
     ## Compiler configuration
     ## Compiler configuration

+ 7 - 16
platform/web/detect.py

@@ -47,7 +47,7 @@ def get_opts():
 def get_flags():
 def get_flags():
     return [
     return [
         ("arch", "wasm32"),
         ("arch", "wasm32"),
-        ("tools", False),
+        ("target", "template_debug"),
         ("builtin_pcre2_with_jit", False),
         ("builtin_pcre2_with_jit", False),
         ("vulkan", False),
         ("vulkan", False),
         # Use -Os to prioritize optimizing for reduced file size. This is
         # Use -Os to prioritize optimizing for reduced file size. This is
@@ -77,26 +77,17 @@ def configure(env):
         sys.exit(255)
         sys.exit(255)
 
 
     ## Build type
     ## Build type
-    if env["target"].startswith("release"):
-        if env["optimize"] == "size":
-            env.Append(CCFLAGS=["-Os"])
-            env.Append(LINKFLAGS=["-Os"])
-        elif env["optimize"] == "speed":
-            env.Append(CCFLAGS=["-O3"])
-            env.Append(LINKFLAGS=["-O3"])
-
-        if env["target"] == "release_debug":
-            # Retain function names for backtraces at the cost of file size.
-            env.Append(LINKFLAGS=["--profiling-funcs"])
-    else:  # "debug"
-        env.Append(CCFLAGS=["-O1", "-g"])
-        env.Append(LINKFLAGS=["-O1", "-g"])
+
+    if env.debug_features:
+        # Retain function names for backtraces at the cost of file size.
+        env.Append(LINKFLAGS=["--profiling-funcs"])
+    else:
         env["use_assertions"] = True
         env["use_assertions"] = True
 
 
     if env["use_assertions"]:
     if env["use_assertions"]:
         env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"])
         env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"])
 
 
-    if env["tools"]:
+    if env.editor_build:
         if env["initial_memory"] < 64:
         if env["initial_memory"] < 64:
             print('Note: Forcing "initial_memory=64" as it is required for the web editor.')
             print('Note: Forcing "initial_memory=64" as it is required for the web editor.')
             env["initial_memory"] = 64
             env["initial_memory"] = 64

+ 7 - 7
platform/web/emscripten_helpers.py

@@ -38,7 +38,7 @@ def create_engine_file(env, target, source, externs):
 
 
 
 
 def create_template_zip(env, js, wasm, worker, side):
 def create_template_zip(env, js, wasm, worker, side):
-    binary_name = "godot.tools" if env["tools"] else "godot"
+    binary_name = "godot.editor" if env.editor_build else "godot"
     zip_dir = env.Dir("#bin/.web_zip")
     zip_dir = env.Dir("#bin/.web_zip")
     in_files = [
     in_files = [
         js,
         js,
@@ -58,19 +58,19 @@ def create_template_zip(env, js, wasm, worker, side):
         out_files.append(zip_dir.File(binary_name + ".side.wasm"))
         out_files.append(zip_dir.File(binary_name + ".side.wasm"))
 
 
     service_worker = "#misc/dist/html/service-worker.js"
     service_worker = "#misc/dist/html/service-worker.js"
-    if env["tools"]:
+    if env.editor_build:
         # HTML
         # HTML
         html = "#misc/dist/html/editor.html"
         html = "#misc/dist/html/editor.html"
         cache = [
         cache = [
-            "godot.tools.html",
+            "godot.editor.html",
             "offline.html",
             "offline.html",
-            "godot.tools.js",
-            "godot.tools.worker.js",
-            "godot.tools.audio.worklet.js",
+            "godot.editor.js",
+            "godot.editor.worker.js",
+            "godot.editor.audio.worklet.js",
             "logo.svg",
             "logo.svg",
             "favicon.png",
             "favicon.png",
         ]
         ]
-        opt_cache = ["godot.tools.wasm"]
+        opt_cache = ["godot.editor.wasm"]
         subst_dict = {
         subst_dict = {
             "@GODOT_VERSION@": get_build_version(),
             "@GODOT_VERSION@": get_build_version(),
             "@GODOT_NAME@": "GodotEngine",
             "@GODOT_NAME@": "GodotEngine",

+ 7 - 58
platform/windows/detect.py

@@ -173,17 +173,7 @@ def get_opts():
             "Targeted Windows version, >= 0x0601 (Windows 7)",
             "Targeted Windows version, >= 0x0601 (Windows 7)",
             "0x0601",
             "0x0601",
         ),
         ),
-        BoolVariable(
-            "debug_symbols",
-            "Add debugging symbols to release/release_debug builds",
-            True,
-        ),
         EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("gui", "console")),
         EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("gui", "console")),
-        BoolVariable(
-            "separate_debug_symbols",
-            "Create a separate file containing debugging symbols",
-            False,
-        ),
         (
         (
             "msvc_version",
             "msvc_version",
             "MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.",
             "MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.",
@@ -330,31 +320,11 @@ def setup_mingw(env):
 def configure_msvc(env, vcvars_msvc_config):
 def configure_msvc(env, vcvars_msvc_config):
     """Configure env to work with MSVC"""
     """Configure env to work with MSVC"""
 
 
-    # Build type
-    if env["target"] == "release":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Append(CCFLAGS=["/O2"])
-            env.Append(LINKFLAGS=["/OPT:REF"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Append(CCFLAGS=["/O1"])
-            env.Append(LINKFLAGS=["/OPT:REF"])
-        env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
-
-    elif env["target"] == "release_debug":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Append(CCFLAGS=["/O2"])
-            env.Append(LINKFLAGS=["/OPT:REF"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Append(CCFLAGS=["/O1"])
-            env.Append(LINKFLAGS=["/OPT:REF"])
-
-    elif env["target"] == "debug":
-        env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"])
-        env.Append(LINKFLAGS=["/DEBUG"])
+    ## Build type
 
 
-    if env["debug_symbols"]:
-        env.AppendUnique(CCFLAGS=["/Zi", "/FS"])
-        env.AppendUnique(LINKFLAGS=["/DEBUG"])
+    # TODO: Re-evaluate the need for this / streamline with common config.
+    if env["target"] == "template_release":
+        env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
 
 
     if env["windows_subsystem"] == "gui":
     if env["windows_subsystem"] == "gui":
         env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
         env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
@@ -491,31 +461,10 @@ def configure_mingw(env):
     if env["use_llvm"] and not try_cmd("clang --version", env["mingw_prefix"], env["arch"]):
     if env["use_llvm"] and not try_cmd("clang --version", env["mingw_prefix"], env["arch"]):
         env["use_llvm"] = False
         env["use_llvm"] = False
 
 
-    if env["target"] == "release":
+    # TODO: Re-evaluate the need for this / streamline with common config.
+    if env["target"] == "template_release":
         env.Append(CCFLAGS=["-msse2"])
         env.Append(CCFLAGS=["-msse2"])
-
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            if env["arch"] == "x86_32":
-                env.Append(CCFLAGS=["-O2"])
-            else:
-                env.Append(CCFLAGS=["-O3"])
-        else:  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "release_debug":
-        env.Append(CCFLAGS=["-O2"])
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Append(CCFLAGS=["-O2"])
-        else:  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-
-    elif env["target"] == "debug":
-        env.Append(CCFLAGS=["-g3"])
+    elif env.dev_build:
         # Allow big objects. It's supposed not to have drawbacks but seems to break
         # Allow big objects. It's supposed not to have drawbacks but seems to break
         # GCC LTO, so enabling for debug builds only (which are not built with LTO
         # GCC LTO, so enabling for debug builds only (which are not built with LTO
         # and are the only ones with too big objects).
         # and are the only ones with too big objects).