1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-03 19:11:41 +00:00

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.
This commit is contained in:
Rémi Verschelde
2022-09-22 08:28:55 +02:00
parent b9a64c7736
commit 39facb35a0
42 changed files with 215 additions and 338 deletions

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ env:
GODOT_BASE_BRANCH: master
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: false
DOTNET_CLI_TELEMETRY_OPTOUT: true
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
@@ -21,57 +21,52 @@ jobs:
fail-fast: false
matrix:
include:
- name: Editor w Mono (target=release_debug, tools=yes, tests=yes)
- name: Editor w/ Mono (target=editor)
cache-name: linux-editor-mono
target: release_debug
tools: true
target: editor
tests: false # Disabled due freeze caused by mix Mono build and CI
sconsflags: module_mono_enabled=yes
doc-test: true
bin: "./bin/godot.linuxbsd.opt.tools.x86_64.mono"
bin: "./bin/godot.linuxbsd.editor.x86_64.mono"
build-mono: true
proj-conv: 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
target: debug
tools: true
target: editor
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
# 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.
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
# Skip 2GiB artifact speeding up action.
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
target: debug
tools: true
target: editor
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
# Skip 2GiB artifact speeding up action.
artifact: false
- name: Template w/ Mono (target=release, tools=no)
- name: Template w/ Mono (target=template_release)
cache-name: linux-template-mono
target: release
tools: false
target: template_release
tests: false
sconsflags: module_mono_enabled=yes debug_symbols=no
sconsflags: module_mono_enabled=yes
build-mono: false
artifact: true
- name: Minimal Template (target=release, tools=no, everything disabled)
- name: Minimal template (target=template_release, everything disabled)
cache-name: linux-template-minimal
target: release
tools: false
target: template_release
tests: false
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
artifact: true
@@ -113,7 +108,6 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: linuxbsd
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
tests: ${{ matrix.tests }}
- name: Generate C# glue
@@ -221,7 +215,7 @@ jobs:
if: ${{ matrix.godot-cpp-test }}
run: |
cd godot-cpp/test
scons target=${{ matrix.target }}
scons target=debug
cd ../..
- name: Prepare artifact

View File

@@ -19,17 +19,15 @@ jobs:
fail-fast: false
matrix:
include:
- name: Editor (target=release_debug, tools=yes, tests=yes)
- name: Editor (target=editor, tests=yes)
cache-name: macos-editor
target: release_debug
tools: true
target: editor
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
target: release
tools: false
target: template_release
tests: false
sconsflags: debug_symbols=no
@@ -55,7 +53,6 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }}
platform: macos
target: ${{ matrix.target }}
tools: ${{ matrix.tools }}
tests: ${{ matrix.tests }}
# Execute unit tests for the editor

View File

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

View File

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