Skip to content

Commit

Permalink
Print build info used when using godot --build-info
Browse files Browse the repository at this point in the history
  • Loading branch information
Anutrix committed Oct 17, 2021
1 parent 468b987 commit bf0fa87
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions main/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Import("env")

import main_builders
import sys
import os

env.main_sources = []

Expand Down Expand Up @@ -36,3 +38,16 @@ env_main.CommandNoCache(

lib = env_main.add_library("main", env.main_sources)
env.Prepend(LIBS=[lib])

build_args = " ".join(sys.argv[1:])

SCONSFLAGS = os.environ.get("SCONSFLAGS")
if SCONSFLAGS:
build_args = SCONSFLAGS + " " + build_args

with open("build_arguments.gen.h", "w") as fd:
fd.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
fd.write("#ifndef BUILD_ARGUMENTS_GEN_H\n")
fd.write("#define BUILD_ARGUMENTS_GEN_H\n")
fd.write('#define BUILD_ARGUMENTS "' + build_args + '"\n')
fd.write("#endif // BUILD_ARGUMENTS_GEN_H\n")
6 changes: 6 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "core/version_hash.gen.h"
#include "drivers/register_driver_types.h"
#include "main/app_icon.gen.h"
#include "main/build_arguments.gen.h"
#include "main/main_timer_sync.h"
#include "main/performance.h"
#include "main/splash.gen.h"
Expand Down Expand Up @@ -647,6 +648,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
print_line(get_full_version_string());
goto error;

} else if (I->get() == "--build-info") {
print_line(get_full_version_string());
print_line("Build arguments: " + String(BUILD_ARGUMENTS));
goto error;

} else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output

OS::get_singleton()->_verbose_stdout = true;
Expand Down

0 comments on commit bf0fa87

Please sign in to comment.