Skip to content

Commit

Permalink
Add option to specify the desired C++ standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Faless committed Feb 14, 2024
1 parent 6b6f596 commit d5a27cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/default_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def exists(env):
def generate(env):
# Require C++17
if env.get("is_msvc", False):
env.Append(CXXFLAGS=["/std:c++17"])
env.Append(CXXFLAGS=["/std:" + env["cpp_standard"]])
else:
env.Append(CXXFLAGS=["-std=c++17"])
env.Append(CXXFLAGS=["-std=" + env["cpp_standard"]])

# Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time.
Expand Down
6 changes: 6 additions & 0 deletions tools/godotcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ def options(opts, env):
)
)

opts.Add(
key="cpp_standard",
help="The C++ standard to use. Minimum required: 'c++17'.",
default=env.get("cpp_standard", "c++17"),
)

opts.Add(
EnumVariable(
"optimize",
Expand Down

0 comments on commit d5a27cb

Please sign in to comment.