Update icon entries during scons build

This commit is contained in:
Serhii Snitsaruk 2024-08-07 17:19:51 +02:00
parent 2528741333
commit 629062ea26
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
2 changed files with 35 additions and 25 deletions

View File

@ -35,9 +35,19 @@ env = SConscript("godot-cpp/SConstruct")
# - LINKFLAGS are for linking flags
# Generate version header.
import limboai_version
from limboai_version import generate_module_version_header
limboai_version.generate_module_version_header()
print("Generating LimboAI version header...")
generate_module_version_header()
# Update icon entries in limboai.gdextension file.
# Note: This will remove everything after [icons] section, and rebuild it with generated icon entries.
sys.path.append("gdextension")
from update_icon_entries import update_icon_entries
print("Updating LimboAI icon entries...")
update_icon_entries(silent=True)
sys.path.remove("gdextension")
# Tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPDEFINES=["LIMBOAI_GDEXTENSION"])

View File

@ -28,28 +28,7 @@ def get_script_dir():
return os.path.dirname(os.path.realpath(__file__))
def main():
silent = False
try:
opts, args = getopt.getopt(sys.argv[1:], "s", ["silent"])
except getopt.GetoptError as e:
print(
"%s: %s!\n"
% (
os.path.basename(__file__),
e.msg,
)
)
usage()
sys.exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit(0)
elif opt in ("-s", "--silent"):
silent = True
def update_icon_entries(silent=False):
config_dir = get_script_dir()
config_path = os.path.join(config_dir, "limboai.gdextension")
content = ""
@ -83,4 +62,25 @@ def main():
if __name__ == "__main__":
main()
silent = False
try:
opts, args = getopt.getopt(sys.argv[1:], "s", ["silent"])
except getopt.GetoptError as e:
print(
"%s: %s!\n"
% (
os.path.basename(__file__),
e.msg,
)
)
usage()
sys.exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit(0)
elif opt in ("-s", "--silent"):
silent = True
update_icon_entries(silent)