Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migeran LibGodot Feature #90510

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ env.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix

env.__class__.add_shared_library = methods.add_shared_library
env.__class__.add_library = methods.add_library
env.__class__.add_program = methods.add_program

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line shouldn't be removed as it can be used later on with the addition of an option to build a program wrapper around the library.

env.__class__.CommandNoCache = methods.CommandNoCache
env.__class__.Run = methods.Run
env.__class__.disable_warnings = methods.disable_warnings
Expand Down Expand Up @@ -226,6 +225,14 @@ opts.Add("custom_modules", "A list of comma-separated directory paths containing
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))

# Advanced options
opts.Add(
EnumVariable(
"library_type",
"Build library type",
"executable",
("executable", "static_library", "shared_library"),
)
)
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("fast_unsafe", "Enable unsafe options for faster rebuilds", False))
Expand Down Expand Up @@ -317,7 +324,18 @@ if env["import_env_vars"]:
if env.scons_version < (4, 3) and not env["platform"]:
env["platform"] = env["p"]

if env["platform"] == "":
if env["library_type"] == "static_library":
env.Append(CPPDEFINES=["LIBRARY_ENABLED"])
elif env["library_type"] == "shared_library":
env.Append(CPPDEFINES=["LIBRARY_ENABLED"])
env.Append(CCFLAGS=["-fPIC"])
env.Append(STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME=True)
else:
env.__class__.add_program = methods.add_program
Comment on lines +333 to +334

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per above, these two lines should be removed.


if env["platform"] != "":
selected_platform = env["platform"]
else:
# Missing `platform` argument, try to detect platform automatically
if (
sys.platform.startswith("linux")
Expand Down
5 changes: 5 additions & 0 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ const PackedStringArray ProjectSettings::get_required_features() {
// Returns the features supported by this build of Godot. Includes all required features.
const PackedStringArray ProjectSettings::_get_supported_features() {
PackedStringArray features = get_required_features();

#ifdef LIBRARY_ENABLED
features.append("LibGodot");
#endif

#ifdef MODULE_MONO_ENABLED
features.append("C#");
#endif
Expand Down
Loading
Loading