From 6863ac82611c0fdb35b76ee62be035b7bdfd07ed Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 8 Dec 2022 11:28:52 +0100 Subject: [PATCH] Updated the project to use the pandemonium engine. --- .clang-format | 128 ----------- .clangd | 2 - .gitignore | 65 +++--- HEADS | 53 ++++- LICENSE | 2 +- Readme.md | 253 +++++++++++++++++----- SConstruct | 494 ++++++++----------------------------------- build.config.example | 12 +- build.sh | 1 - editor.bat | 6 + editor.sh | 6 + export_all.sh | 4 + ged.sh | 6 + leditor.sh | 6 + lged.sh | 6 + main.cpp | 63 ------ make_release.sh | 4 + migrate.sh | 1 - module_config.py | 94 ++++++++ play.sh | 6 + run.sh | 1 - 21 files changed, 514 insertions(+), 699 deletions(-) delete mode 100644 .clang-format delete mode 100644 .clangd delete mode 100755 build.sh create mode 100644 editor.bat create mode 100755 editor.sh create mode 100755 export_all.sh create mode 100755 ged.sh create mode 100755 leditor.sh create mode 100755 lged.sh delete mode 100644 main.cpp create mode 100755 make_release.sh delete mode 100755 migrate.sh create mode 100644 module_config.py create mode 100755 play.sh delete mode 100755 run.sh diff --git a/.clang-format b/.clang-format deleted file mode 100644 index cb67d39..0000000 --- a/.clang-format +++ /dev/null @@ -1,128 +0,0 @@ -# Commented out parameters are those with the same value as base LLVM style -# We can uncomment them if we want to change their value, or enforce the -# chosen value in case the base style changes (last sync: Clang 6.0.1). ---- -### General config, applies to all languages ### -BasedOnStyle: LLVM -AccessModifierOffset: -4 -AlignAfterOpenBracket: DontAlign -# AlignConsecutiveAssignments: false -# AlignConsecutiveDeclarations: false -# AlignEscapedNewlines: Right -# AlignOperands: true -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -# AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: true -# AllowShortLoopsOnASingleLine: false -# AlwaysBreakAfterDefinitionReturnType: None -# AlwaysBreakAfterReturnType: None -# AlwaysBreakBeforeMultilineStrings: false -# AlwaysBreakTemplateDeclarations: false -# BinPackArguments: true -# BinPackParameters: true -# BraceWrapping: -# AfterClass: false -# AfterControlStatement: false -# AfterEnum: false -# AfterFunction: false -# AfterNamespace: false -# AfterObjCDeclaration: false -# AfterStruct: false -# AfterUnion: false -# AfterExternBlock: false -# BeforeCatch: false -# BeforeElse: false -# IndentBraces: false -# SplitEmptyFunction: true -# SplitEmptyRecord: true -# SplitEmptyNamespace: true -# BreakBeforeBinaryOperators: None -# BreakBeforeBraces: Attach -# BreakBeforeInheritanceComma: false -BreakBeforeTernaryOperators: false -# BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: AfterColon -# BreakStringLiterals: true -ColumnLimit: 0 -# CommentPragmas: '^ IWYU pragma:' -# CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: true -ConstructorInitializerIndentWidth: 8 -ContinuationIndentWidth: 8 -Cpp11BracedListStyle: false -# DerivePointerAlignment: false -# DisableFormat: false -# ExperimentalAutoDetectBinPacking: false -# FixNamespaceComments: true -# ForEachMacros: -# - foreach -# - Q_FOREACH -# - BOOST_FOREACH -# IncludeBlocks: Preserve -IncludeCategories: - - Regex: '".*"' - Priority: 1 - - Regex: '^<.*\.h>' - Priority: 2 - - Regex: '^<.*' - Priority: 3 -# IncludeIsMainRegex: '(Test)?$' -IndentCaseLabels: true -# IndentPPDirectives: None -IndentWidth: 4 -# IndentWrappedFunctionNames: false -# JavaScriptQuotes: Leave -# JavaScriptWrapImports: true -# KeepEmptyLinesAtTheStartOfBlocks: true -# MacroBlockBegin: '' -# MacroBlockEnd: '' -# MaxEmptyLinesToKeep: 1 -# NamespaceIndentation: None -# PenaltyBreakAssignment: 2 -# PenaltyBreakBeforeFirstCallParameter: 19 -# PenaltyBreakComment: 300 -# PenaltyBreakFirstLessLess: 120 -# PenaltyBreakString: 1000 -# PenaltyExcessCharacter: 1000000 -# PenaltyReturnTypeOnItsOwnLine: 60 -# PointerAlignment: Right -# RawStringFormats: -# - Delimiter: pb -# Language: TextProto -# BasedOnStyle: google -# ReflowComments: true -# SortIncludes: true -# SortUsingDeclarations: true -# SpaceAfterCStyleCast: false -# SpaceAfterTemplateKeyword: true -# SpaceBeforeAssignmentOperators: true -# SpaceBeforeParens: ControlStatements -# SpaceInEmptyParentheses: false -# SpacesBeforeTrailingComments: 1 -# SpacesInAngles: false -# SpacesInContainerLiterals: true -# SpacesInCStyleCastParentheses: false -# SpacesInParentheses: false -# SpacesInSquareBrackets: false -TabWidth: 4 -UseTab: Always ---- -### C++ specific config ### -Language: Cpp -Standard: Cpp03 ---- -### ObjC specific config ### -Language: ObjC -Standard: Cpp03 -ObjCBlockIndentWidth: 4 -# ObjCSpaceAfterProperty: false -# ObjCSpaceBeforeProtocolList: true ---- -### Java specific config ### -Language: Java -# BreakAfterJavaFieldAnnotations: false -JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax'] -... diff --git a/.clangd b/.clangd deleted file mode 100644 index b06f3c4..0000000 --- a/.clangd +++ /dev/null @@ -1,2 +0,0 @@ -CompileFlags: - CompilationDatabase: ./engine/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index a081312..fdd8bcd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,33 @@ -engine -modules/* -logs/* - -*.d -*.o -*.meta -game/.import/** -game/.prop_tool_temp/** -.sconsign.dblite -.DS_Store - -export/** -release/** - -.vs/* -.kdev4/* -.vscode/* - -TestRWTextures - -_build/* -_binaries/* -game/android/build/* -.cache/* - -*.blend1 -.dir-locals.el - -build.config - -database.sqlite +engine +pandemonium_engine +modules/* +logs/* +game/roms/* + +*.d +*.o +*.meta +game/.import/** +game/.prop_tool_temp/** +.sconsign.dblite +.DS_Store + +export/** +release/** + +.vs/* +.kdev4/* +.vscode/* + +TestRWTextures + +_build/* +_binaries/* +game/android/build/* + +*.blend1 +.dir-locals.el + +build.config + +__pycache__/* \ No newline at end of file diff --git a/HEADS b/HEADS index 3f52622..68f0c37 100644 --- a/HEADS +++ b/HEADS @@ -1 +1,52 @@ -{"engine": {"master": "9b78fb066e5c22c8b173609aaa0f06e50ab3fb3f"}} \ No newline at end of file +{ + "engine": { + "3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", + "master": "8c73e813134001e575b6f59e3b0100471c007410", + "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7" + }, + "world_generator": { + "master": "260c430f11b0b591eaf4714516419aa327d2842c" + }, + "entity_spell_system": { + "master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade" + }, + "ui_extensions": { + "master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a" + }, + "voxelman": { + "master": "65485930a20f65844d496b4ba47dec5b6ed70b91" + }, + "texture_packer": { + "master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed" + }, + "fastnoise": { + "master": "46bb1f610bfb7171613b5c708d312bcf94e89356" + }, + "mesh_data_resource": { + "master": "a062d871d49d954c5466b9de54b4075cb61cbef4" + }, + "procedural_animations": { + "master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f" + }, + "ess_data": { + "master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de" + }, + "props": { + "master": "983090d21a08ebed30a5ce06681269819ab12e48" + }, + "mesh_utils": { + "master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da" + }, + "broken_seals_module": { + "master": "52c5a81350db1c29d375c63d95010260911ec034" + }, + "thread_pool": { + "master": "0917511d04bb1aa308385b63ec88d3c182990628" + }, + "terraman": { + "master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f" + }, + "pandemonium_engine": { + "master": "47e2a193c4d1ef86028ea02cbe267d7e9fcac3bb" + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 748251f..542b31b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 Péter Magyar +Copyright (c) 2022 Péter Magyar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Readme.md b/Readme.md index 82d25b7..e58ac03 100644 --- a/Readme.md +++ b/Readme.md @@ -1,81 +1,228 @@ -# MemeR +# MemR -A very likely dump app, that I plan to use to implement the rendering and window management for (rcpp_framework)[https://github.com/Relintai/rcpp_framework]. +Small cross platform utility to help you organize images into folders. -It will make a folder of images / videos easily searchable locally on lots of platforms. +The project itself resides in the game folder. Open that with the proper version of the pandemonium engine. -Note: this readme has been taken from an another project of mine, it will be updated later. +For now you can see the required engine commit hash in the [engine's master entry in this file](https://github.com/Relintai/pandemonium_cms/blob/master/HEADS), +which you can use to get an executable from the engine's [github actions tab](https://github.com/Relintai/pandemonium_engine/actions), or you can +[compile](#compiling) it yourself. -## Compilation +## Project overview -Will only work on linux! Works on the rasberry pi. +The project's workflow has been set up so you can easily compile the proper version of the engine for yourself if you want to. -### Dependencies +See the [Compiling](#compiling) section if you want to know how to do this. -Arch/Manjaro: +## Compiling -``` -pacman -S --needed scons pkgconf gcc yasm -``` +First make sure, that you have everything installed to be able to compile the engine. +See the [official docs for compiling Godot](https://docs.godotengine.org/en/3.4/development/compiling/index.html) for more info +(the pandemonium engine is a godot fork, the same instructions will work). -Debian/Raspian: +My setup/compile script uses the same tools, so you don't need to install anything else. -``` -sudo apt-get install build-essential scons pkg-config libudev-dev yasm -``` +Even though the project doesn't use godot anymore, their docs are still sufficient. -Optionally if you install MariaDB/MySQL and/or PostgreSQL the compile system should pick it up. Make sure to get a version -whoch contains the development headers (A bunch of .h files). +Now let's clone this repository: -### Initial setup +``` git clone https://github.com/Relintai/pandemonium_cms ``` -clone this repo, then call `scons`, it will clone rcpp cms into a new engine directory. Run this every time you update the project. -You don't have to run it before / between builds. +cd into the new folder: -``` -# git clone git@github.com:Relintai/MemeR.git Memer -# cd crystal_cms -# scons -``` +``` cd pandemonium_cms ``` -Now you can build the project like: `scons bl`. ([b]uild [l]inux) +Now let's run the project's setup script, by calling scons without arguments. -Adding -jX to the build command will run the build on that many threads. Like: `scons bl -j4`. +``` scons ``` -``` -# scons bl -j4 -- or - -# ./build.sh -``` -Now you can run it. +This will clone and setup the engine, and all of the required modules into a new `engine` folder inside the project, using http. -First run migrations, this will create the necessary database tables: +(If you want to use the github's ssh links append `repository_type=ssh` like ``` scons repository_type=ssh ```) -``` -# ./engine/bin/server m -- or - -# ./migrate.sh -``` +Once it is done you can compile the engine. -Now you can start the server: +To build the editor on windows with 4 threads run the following command: -``` -# ./engine/bin/server -- or - -# ./run.sh -``` +``` scons bew -j4 ``` -Make sure to run it from the project's directory, as it needs data files. +To build the editor on linux with 4 threads run the following command: -Now just open http://127.0.0.1:8080 +``` scons bel -j4 ``` -You can push floats to the "a/b" MQTT topics, and the new values will be save in the `database.sqlite` file, and will appear -in your browser. +I call this feature of the setup script build words. [See](#build-words). -## Structure +Once the build finishes you can find the editor executable inside the `./engine/bin/` folder. + +For convenience there is a provided `editor.sh`, or `editor.bat` for running it from the project's folder. +These will create a copy, so you can even compile while the editor is running. + +Alternatively if you don't want to use build words, you can also just go into the engine folder: + +``` cd engine ``` + +And compile godot as per the [official docs](https://docs.godotengine.org/en/latest/development/compiling/index.html). + +### Build words + +The project's setup script contains support for "build words". These can be used from the root of this project. + +For example to build the editor for windows with 4 threads you can use: + +``` scons bew -j4 ``` + +The first argument must start with b (build), then it needs to be followed by a few abbreviations (the order does not matters) + +The rest of the arguments will be passed directly to godot's scons script. + +#### Editor + +Append `e` to build with `tools=yes` a.k.a. the editor. + +``` scons bew -j4 ``` + +if you omit `e`, the system will build the export template for you. For example: + +``` scons bw -j4 ``` + +This will be the `release_debug` windows export template. + +#### Platform abbreviations + +`l`: linux \ +`w`: windows \ +`a`: android \ +`j`: Javascript \ +`i`: iphone (Not yet finished, use `build_ios.sh`, and `build_ios_release.sh`) \ +Mac OSX: Not yet finished, use `build_osx.sh` + +#### Target abbreviations + +By default the system builds in release_debug. + +Append `d` for debug, or `r` for release. + +``` scons bewd -j4 ``` + +build editor windows debug + +``` scons bwr -j4 ``` + +build windows release (this will build the windows release export template) + +#### Shared modules + +Note: This only works on linux! + +append `s` to the build string. + +Optionally you can also make the build system only build a target module, by appending one of these: + +`E`: Entity Spell System \ +`T`: Texture Packer \ +`V`: Voxelman \ +`W`: World Generator \ +`P`: Procedural Animations + +Example: + +``` scons belsE -j4 ``` + +build editor linux shared (Entity Spell System) with 4 threads + +Note: to easily run the editor you can use the `editor.sh` or `editor.bat` in the root of the project. + +#### Other + +Append `v` to pass the `vsproj=yes` parameter to the build script. This will generate Visual Studio project files.\ +Append `c` to pass the `compiledb=yes` parameter to the build script. This is a new feature in 3.x to have this disabled by default to lessen compile times. + +#### Postfixes + +There are a few postfixes for the build words. These are more complex options. You have to append them to your build word with an underscore. + +You can use as many as you want. + +For example: + +``` scons bel_slim_latomic -j4 ``` + +##### slim + +With this postfix you can build a slimmed down version of the engine. This disables quite a few unneeded modules. + +``` scons bel_slim -j4 ``` + +##### latomic + +If you get linker errors while building the game/editor about undefined referenced with atomic related functions you can use this postfix. +It will add the ` -latomic ` command line switch to the linker flags. + +I ran into this issue while building on a raspberry pi 4 with the x11 platform. It might be related to the recent reworks to threading. + +``` scons bel_latomic -j4 ``` + +##### strip + +Appends `debug_symbols=no` to the build command, which will strip the resulting binary from debug symbols. + +``` scons bel_strip -j4 ``` + +##### threads + +Appends `threads_enabled=yes` to the build command. Useful for building the editor for html. + +``` scons bej_threads -j4 ``` + +#### Scons cache, and sdk locations + +In order to use scons cache and to tell the build system where some of the required sdks are located you usually +have to use environment variables. Most of the time you might just want to add them globally, +howewer this is sometimes unfeasible (e.g. you don't have administrator access, or you just want to have +multiple sdk versions installed). + +In order to solve this a build config file was added. + +If you want to use the config simply rename the provided `build.config.example` to `build.config`, and customize +the settings inside. + +### Manual Setup + +If you you don't want to use the setup script (or just want to know what it actually does), +this section will explain how to set everything up manually. + +First clone the engine: + +``` git clone https://github.com/Relintai/pandemonium_engine ``` + +Now if you look at the [HEADS file](https://github.com/Relintai/pandemonium_cms/blob/master/HEADS). + +It contains the commit hashes for that particular revision for every module and the engine. +The engine now contains all the modules, so at the moment only worry about the engine's commit hash. + +You need to go and checkout the proper commit for it. + +Now you can go ahead and compile the engine normally. + +## Pulling upstream changes + +First pull the changes by calling + +``` git pull orgin master ``` + +Then just run `scons`, to will update the modules. + +## Upgrading the modules + +Note: this is how to update the HEADS file. Normally you don't need to do this. + +If you want to update the modules, and the engine to the latest, you can use (`action=update`): + +``` scons a=u ``` + +You can also update different targets: `all`, `engine`, `modules`, `all_addons`, `addons`, `third_party_addons` + +For example to update the engine to the latest: ``` scons a=u target=engine ``` -The main Application implementation is `app/ic_application.h`. -The `main.cpp` contains the initialization code for the framework. -The `content/www` folder is the wwwroot. diff --git a/SConstruct b/SConstruct index 86b5e62..f00ad67 100644 --- a/SConstruct +++ b/SConstruct @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (c) 2019-2021 Péter Magyar +# Copyright (c) 2019-2022 Péter Magyar # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -21,94 +21,49 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -EnsureSConsVersion(0, 98, 1) - -import sys import os import subprocess import json -import shutil -import traceback +import sys - -folders = [ - #'app', -] - -module_folders = [ - '../custom_modules', -] - -databases=True - -main_file = 'main.cpp' +import module_config repository_index = 0 -module_clone_path = '/modules/' clone_command = 'git clone {0} {1}' - -visual_studio_call_vcvarsall = False -visual_studio_vcvarsall_path = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat' -visual_studio_arch = 'amd64' - -exports = { - 'global': [], - 'linux': [], - 'windows': [], - 'android': [], - 'javascript': [], -} - -engine_repository = [ ['https://github.com/Relintai/rcpp_cms.git', 'git@github.com:Relintai/rcpp_cms.git'], 'engine', '' ] - -module_repositories = [ -] - -addon_repositories = [ -] - -third_party_addon_repositories = [ -] - target_commits = {} -engine_branch = 'master' +def setup_repository(data, clone_path, branch = 'master'): + cwd = os.getcwd() -def onerror(func, path, exc_info): - """ - https://stackoverflow.com/questions/2656322/shutil-rmtree-fails-on-windows-with-access-is-denied + full_path = cwd + clone_path + data[1] + '/' + + if not os.path.isdir(full_path): + os.chdir(cwd + clone_path) - Because Windows. + subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True) - Error handler for ``shutil.rmtree``. + os.chdir(full_path) - If the error is due to an access error (read only file) - it attempts to add write permission and then retries. + subprocess.call('git reset', shell=True) + subprocess.call('git reset --hard', shell=True) + subprocess.call('git clean -f -d', shell=True) + subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True) + subprocess.call('git pull origin ' + branch, shell=True) + subprocess.call('git reset', shell=True) + subprocess.call('git reset --hard', shell=True) - If the error is for another reason it re-raises the error. + target = "" - Usage : ``shutil.rmtree(path, onerror=onerror)`` - """ - import stat - if not os.access(path, os.W_OK): - # Is the error an access error ? - os.chmod(path, stat.S_IWUSR) - func(path) - else: - raise + if data[1] in target_commits: + target = target_commits[data[1]][branch] -def load_target_commits_array(): - global target_commits + subprocess.call('git checkout -B ' + branch + ' ' + target, shell=True) + subprocess.call('git clean -f -d', shell=True) + subprocess.call('git reset', shell=True) + subprocess.call('git reset --hard', shell=True) - if os.path.isfile('./HEADS'): - with open('./HEADS', 'r') as infile: - target_commits = json.load(infile) - else: - target_commits = {} + os.chdir(cwd) -def save_target_commits_array(): - with open('./HEADS', 'w') as outfile: - json.dump(target_commits, outfile) def update_repository(data, clone_path, branch = 'master'): cwd = os.getcwd() @@ -141,361 +96,78 @@ def update_repository(data, clone_path, branch = 'master'): os.chdir(cwd) -def setup_repository(data, clone_path, branch = 'master'): - cwd = os.getcwd() +def validate_repository_origin(data, clone_path, branch = 'master'): + full_path = os.path.abspath(clone_path) - full_path = cwd + clone_path + data[1] + '/' - if not os.path.isdir(full_path): - os.chdir(cwd + clone_path) - - subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True) + return + cwd = os.getcwd() os.chdir(full_path) - subprocess.call('git reset', shell=True) - subprocess.call('git reset --hard', shell=True) - subprocess.call('git clean -f -d', shell=True) - subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True) - subprocess.call('git pull origin ' + branch, shell=True) - subprocess.call('git reset', shell=True) - subprocess.call('git reset --hard', shell=True) + res = subprocess.run('git remote -v', shell=True, capture_output=True) - if data[1] in target_commits: - target = target_commits[data[1]][branch] + resstr = res.stdout.decode('ascii') + resarr = resstr.split("\n") + res_orig = [] - subprocess.call('git checkout -B ' + branch + ' ' + target, shell=True) - subprocess.call('git clean -f -d', shell=True) - subprocess.call('git reset', shell=True) - subprocess.call('git reset --hard', shell=True) + for l in resarr: + if "origin" in l: + res_orig.append(l) + + if len(res_orig) == 0: + print("The repository " + clone_path + " does not seem to have an origin remote. Adding it.") + + subprocess.call('git remote add origin ' + data[0][repository_index], shell=True) + + os.chdir(cwd) + + return + + for l in data[0]: + for ll in res_orig: + if l in ll: + os.chdir(cwd) + + return + + rind = 0 + + if 'git@' in res_orig[0]: + rind = 1 + + subprocess.call('git remote remove origin', shell=True) + subprocess.call('git remote add origin ' + data[0][rind], shell=True) + subprocess.call('git pull origin', shell=True) + subprocess.call('git checkout origin/' + branch, shell=True) + + print('Updated git remote origin in ' + clone_path) os.chdir(cwd) -def copy_repository(data, target_folder, clone_path): - copytree(os.path.abspath(clone_path + data[1] + '/' + data[2]), os.path.abspath(target_folder + data[1])) - -def copytree(src, dst): - for item in os.listdir(src): - sp = os.path.join(src, item) - dp = os.path.join(dst, item) - - if os.path.isdir(sp): - if os.path.isdir(dp): - shutil.rmtree(dp, onerror=onerror) - - shutil.copytree(sp, dp) - else: - if not os.path.isdir(dst): - os.makedirs(dst) - - shutil.copy2(sp, dp) - def update_engine(): - update_repository(engine_repository, '/', engine_branch) + validate_repository_origin(module_config.engine_repository, './pandemonium_engine/', module_config.pandemonium_branch) + update_repository(module_config.engine_repository, '/', module_config.pandemonium_branch) -def update_modules(): - for rep in module_repositories: - update_repository(rep, module_clone_path) - copy_repository(rep, './engine/modules/', '.' + module_clone_path) - -def update_addons(): - for rep in addon_repositories: - update_repository(rep, module_clone_path) - copy_repository(rep, './game/addons/', '.' + module_clone_path) - -def update_addons_third_party_addons(): - for rep in third_party_addon_repositories: - update_repository(rep, module_clone_path) - copy_repository(rep, './game/addons/', '.' + module_clone_path) - -def update_all(): - update_engine() - update_modules() - update_addons() - update_addons_third_party_addons() - - save_target_commits_array() - - -def setup_engine(): - setup_repository(engine_repository, '/', engine_branch) - -def setup_modules(): - for rep in module_repositories: - setup_repository(rep, module_clone_path) - copy_repository(rep, './engine/modules/', '.' + module_clone_path) - -def setup_addons(): - for rep in addon_repositories: - setup_repository(rep, module_clone_path) - copy_repository(rep, './game/addons/', '.' + module_clone_path) - -def setup_addons_third_party_addons(): - for rep in third_party_addon_repositories: - setup_repository(rep, module_clone_path) - copy_repository(rep, './game/addons/', '.' + module_clone_path) - -def setup_all(): - setup_engine() - setup_modules() - setup_addons() - setup_addons_third_party_addons() - -def format_path(path): - if 'win' in sys.platform: - path = path.replace('/', '\\') - path = path.replace('~', '%userprofile%') - - return path - -def get_exports_for(platform): - export_command = 'export ' - command_separator = ';' - - if 'win' in sys.platform: - command_separator = '&' - export_command = 'set ' - - command = '' - - for p in exports[platform]: - command += export_command + p + command_separator - - return command - - -def parse_config(): - global visual_studio_vcvarsall_path - global visual_studio_arch - global visual_studio_call_vcvarsall - global exports - - if not os.path.isfile('build.config'): - return - - with open('build.config', 'r') as f: - - for line in f: - ls = line.strip() - if ls == '' or ls.startswith('#'): - continue - - words = line.split() - - if (len(words) < 2): - print('This build.config line is malformed, and got ignored: ' + ls) - continue - - if words[0] == 'visual_studio_vcvarsall_path': - visual_studio_vcvarsall_path = format_path(ls[29:]) - elif words[0] == 'visual_studio_arch': - visual_studio_arch = format_path(ls[19:]) - elif words[0] == 'visual_studio_call_vcvarsall': - visual_studio_call_vcvarsall = words[1].lower() in [ 'true', '1', 't', 'y', 'yes' ] - elif words[0] == 'export': - if (len(words) < 3) or not words[1] in exports: - print('This build.config line is malformed, and got ignored: ' + ls) - continue - - export_path = format_path(ls[8 + len(words[1]):]) - - exports[words[1]].append(export_path) - -parse_config() - -env = Environment() - -if len(sys.argv) > 1: - - arg = sys.argv[1] - - arg_split = arg.split('_') - arg = arg_split[0] - arg_split = arg_split[1:] - - if arg[0] == 'b': - build_string = get_exports_for('global') + 'scons ' - - build_string += 'target=' - if 'r' in arg: - build_string += 'release' - elif 'd' in arg: - build_string += 'debug' - else: - build_string += 'release_debug' - build_string += ' ' - - if 'm' in arg: - build_string += 'use_mingw=yes' - else: - if 'win' in sys.platform and visual_studio_call_vcvarsall: - build_string = 'call "{0}" {1}&'.format(visual_studio_vcvarsall_path, visual_studio_arch) + build_string - - if 'o' in arg: - build_string += 'use_llvm=yes' - - if 'v' in arg: - build_string += 'vsproj=yes' - - if databases: - build_string += " databases=yes " - - build_string += 'folders="' - - for f in folders: - build_string += '../' + f - build_string += ';' - - build_string += '" ' - - build_string += 'main_file="../' + main_file + '" ' - - for i in range(2, len(sys.argv)): - build_string += ' ' + sys.argv[i] + ' ' - - cwd = os.getcwd() - full_path = cwd + '/engine/' - - if not os.path.isdir(full_path): - print('engine directory doesnt exists.') - exit() - - os.chdir(full_path) - - if 'l' in arg: - build_string += 'platform=x11' - - build_string = get_exports_for('linux') + build_string - - print('Running command: ' + build_string) - - subprocess.call(build_string, shell=True) - elif 'w' in arg: - build_string += 'platform=windows' - - build_string = get_exports_for('windows') + build_string - - print('Running command: ' + build_string) - - subprocess.call(build_string, shell=True) - elif 'a' in arg: - build_string += 'platform=android' - - build_string = get_exports_for('android') + build_string - - print('Running command: ' + build_string + ' android_arch=armv7') - subprocess.call(build_string + ' android_arch=armv7', shell=True) - print('Running command: ' + build_string + ' android_arch=arm64v8') - subprocess.call(build_string + ' android_arch=arm64v8', shell=True) - print('Running command: ' + build_string + ' android_arch=x86') - subprocess.call(build_string + ' android_arch=x86', shell=True) - - os.chdir(full_path + 'platform/android/java/') - - print('Running command: ' + get_exports_for('global') + get_exports_for('android') + './gradlew generateGodotTemplates') - subprocess.call(get_exports_for('global') + get_exports_for('android') + './gradlew generateGodotTemplates', shell=True) - elif 'j' in arg: - build_string += 'platform=javascript' - - build_string = get_exports_for('javascript') + build_string - - print('Running command: ' + build_string) - subprocess.call(build_string, shell=True) - - else: - print('No platform specified') - exit() - - exit() - elif arg[0] == 'p': - if arg == 'p': - #print("Applies a patch. Append c for the compilation database patch. For example: pc") - print("Applies a patch. No Patches right now.") - exit() - - cwd = os.getcwd() - full_path = cwd + '/engine/' - - if not os.path.isdir(full_path): - print('engine directory doesnt exists.') - exit() - - os.chdir(full_path) - - #apply the patch to just the working directory, without creating a commit - - #if 'c' in arg: - # subprocess.call('git apply --index ../patches/compilation_db.patch', shell=True) - - #unstage all files - subprocess.call('git reset', shell=True) +engine_abspath = os.path.abspath(module_config.engine_repository[1]) +if not os.path.isdir(engine_abspath): + if not os.path.isfile('./HEADS'): + print("Error! HEADS file doesn't exists! Exiting.") exit() -opts = Variables(args=ARGUMENTS) + with open('./HEADS', 'r') as infile: + target_commits = json.load(infile) -opts.Add('a', 'What to do', '') -opts.Add(EnumVariable('action', 'What to do', 'setup', ('setup', 'update'))) -opts.Add('t', 'Action target', '') -opts.Add(EnumVariable('target', 'Action target', 'all', ('all', 'engine', 'modules', 'all_addons', 'addons', 'third_party_addons'))) -opts.Add(EnumVariable('repository_type', 'Type of repositories to clone from first', 'http', ('http', 'ssh'))) + if 'repository_type=ssh' in sys.argv: + repository_index = 1 -opts.Update(env) -Help(opts.GenerateHelpText(env)) - -load_target_commits_array() - -rt = env['repository_type'] - -if rt == 'ssh': - repository_index = 1 - -action = env['action'] -target = env['target'] - -if env['a']: - action = env['a'] - -if env['t']: - target = env['t'] - -if not os.path.isdir('./modules'): - os.mkdir('./modules') - -if 'm' in action: - godot_branch = 'master' - -if 'setup' in action or action[0] == 's': - if target == 'all': - setup_all() - elif target == 'engine': - setup_engine() - elif target == 'modules': - setup_modules() - elif target == 'all_addons': - setup_addons() - setup_addons_third_party_addons() - elif target == 'addons': - setup_addons() - elif target == 'third_party_addons': - setup_addons_third_party_addons() -elif 'update' in action or action[0] == 'u': - if target == 'all': - update_all() - elif target == 'engine': + setup_repository(module_config.engine_repository, '/', module_config.pandemonium_branch) +else: + if not os.path.isfile('pandemonium_engine/misc/scripts_app/SConstruct'): update_engine() - save_target_commits_array() - elif target == 'modules': - update_modules() - save_target_commits_array() - elif target == 'all_addons': - update_addons() - update_addons_third_party_addons() - save_target_commits_array() - elif target == 'addons': - update_addons() - save_target_commits_array() - elif target == 'third_party_addons': - update_addons_third_party_addons() - save_target_commits_array() - + + +SConscript("pandemonium_engine/misc/scripts_app/SConstruct") + + diff --git a/build.config.example b/build.config.example index 317567f..f612e5b 100644 --- a/build.config.example +++ b/build.config.example @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2020 Péter Magyar +# Copyright (c) 2019-2022 Péter Magyar # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -32,13 +32,15 @@ visual_studio_call_vcvarsall True visual_studio_vcvarsall_path C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvarsall.bat visual_studio_arch amd64 -# export related setup -# available export targets: global, linux, windows, android, javascript +# You can export variables with the export keyword +# You can run commands with the run keywords +# +# available export/run targets: global, linux, windows, android, javascript export global SCONS_CACHE=~/.scons_cache export global SCONS_CACHE_LIMIT=5000 -export android ANDROID_NDK_ROOT=~/SDKs/Android/NDK/android-ndk-r20b -export android ANDROID_NDK_HOME=~/SDKs/Android/NDK/android-ndk-r20b export android ANDROID_HOME=~/SDKs/Android/SDK +export android ANDROID_SDK_ROOT=~/SDKs/Android/SDK +run javascript source ~/SDKs/emsdk/emsdk_env.sh diff --git a/build.sh b/build.sh deleted file mode 100755 index 8830c0c..0000000 --- a/build.sh +++ /dev/null @@ -1 +0,0 @@ -scons bl -j4 \ No newline at end of file diff --git a/editor.bat b/editor.bat new file mode 100644 index 0000000..6259159 --- /dev/null +++ b/editor.bat @@ -0,0 +1,6 @@ + +copy "pandemonium_engine\bin\pandemonium.windows.opt.tools.64.exe" "pandemonium_engine\bin\run_pandemonium.windows.opt.tools.64.exe" /y +copy "pandemonium_engine\bin\pandemonium.windows.opt.tools.64.pdb" "pandemonium_engine\bin\run_pandemonium.windows.opt.tools.64.pdb" /y +copy "pandemonium_engine\bin\pandemonium.windows.opt.tools.64.exp" "pandemonium_engine\bin\run_pandemonium.windows.opt.tools.64.exp" /y + +cmd /c pandemonium_engine\bin\run_pandemonium.windows.opt.tools.64.exe \ No newline at end of file diff --git a/editor.sh b/editor.sh new file mode 100755 index 0000000..1aec724 --- /dev/null +++ b/editor.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cp -u ./pandemonium_engine/bin/pandemonium.x11.opt.tools.64 ./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 + +export LD_LIBRARY_PATH=`pwd`/pandemonium_engine/bin/ +./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 -v diff --git a/export_all.sh b/export_all.sh new file mode 100755 index 0000000..f09ea91 --- /dev/null +++ b/export_all.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +./pandemonium_engine/misc/scripts_app/export_all.sh memr mr $1 + diff --git a/ged.sh b/ged.sh new file mode 100755 index 0000000..51ef2eb --- /dev/null +++ b/ged.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cp -u ./pandemonium_engine/bin/pandemonium.x11.opt.tools.64 ./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 + +export LD_LIBRARY_PATH=`pwd`/pandemonium_engine/bin/ +./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 -e --path ./game/ diff --git a/leditor.sh b/leditor.sh new file mode 100755 index 0000000..4d49417 --- /dev/null +++ b/leditor.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cp -u ./pandemonium_engine/bin/pandemonium.x11.opt.tools.64.llvm ./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64.llvm + +export LD_LIBRARY_PATH=`pwd`/pandemonium_engine/bin/ +./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64.llvm diff --git a/lged.sh b/lged.sh new file mode 100755 index 0000000..8d6c525 --- /dev/null +++ b/lged.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cp -u ./pandemonium_engine/bin/pandemonium.x11.opt.tools.64.llvm ./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64.llvm + +export LD_LIBRARY_PATH=`pwd`/pandemonium_engine/bin/ +./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64.llvm -e --path ./game/ diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 5cd8433..0000000 --- a/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include -#include - -#include "core/bry_http/http_server.h" -#include "core/file_cache.h" -#include "core/http/web_application.h" - -#include "database/db_init.h" - -#include "core/settings.h" - -#include "core/http/session_manager.h" - -//Backends -#include "backends/hash_hashlib/setup.h" - -#include "core/os/platform.h" -#include "platform/platform_initializer.h" - -#include "core/database/database_manager.h" - -void initialize_backends() { - initialize_database_backends(); - backend_hash_hashlib_install_providers(); -} - -void create_databases() { - DatabaseManager *dbm = DatabaseManager::get_singleton(); - - uint32_t index = dbm->create_database("sqlite"); - Database *db = dbm->databases[index]; - db->connect("database.sqlite"); -} - -int main(int argc, char **argv, char **envp) { - PlatformInitializer::allocate_all(); - PlatformInitializer::arg_setup(argc, argv, envp); - - initialize_backends(); - - ::SessionManager *session_manager = new ::SessionManager(); - - Settings *settings = new Settings(true); - //settings->parse_file("settings.json"); - - FileCache *file_cache = new FileCache(true); - file_cache->wwwroot = "./www"; - file_cache->wwwroot_refresh_cache(); - - DatabaseManager *dbm = new DatabaseManager(); - - create_databases(); - - delete dbm; - delete file_cache; - delete settings; - delete session_manager; - - PlatformInitializer::free_all(); - - return 0; -} \ No newline at end of file diff --git a/make_release.sh b/make_release.sh new file mode 100755 index 0000000..eb995ef --- /dev/null +++ b/make_release.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +./pandemonium_engine/misc/scripts_app/make_release.sh memr mr $1 + diff --git a/migrate.sh b/migrate.sh deleted file mode 100755 index 5ae21d3..0000000 --- a/migrate.sh +++ /dev/null @@ -1 +0,0 @@ -./engine/bin/server m \ No newline at end of file diff --git a/module_config.py b/module_config.py new file mode 100644 index 0000000..2fa460e --- /dev/null +++ b/module_config.py @@ -0,0 +1,94 @@ + +pandemonium_branch = 'master' + +engine_repository = [ ['https://github.com/Relintai/pandemonium_engine.git', 'git@github.com:Relintai/pandemonium_engine.git'], 'pandemonium_engine', '' ] + +# Relative to this script's directory +module_install_folder = './pandemonium_engine/custom_modules/' + +module_repositories = [ + #[ ['https://github.com/Relintai/entity_spell_system.git', 'git@github.com:Relintai/entity_spell_system.git'], 'entity_spell_system', '' ], + #[ ['https://github.com/Relintai/ui_extensions.git', 'git@github.com:Relintai/ui_extensions.git'], 'ui_extensions', '' ], + #[ ['https://github.com/Relintai/texture_packer.git', 'git@github.com:Relintai/texture_packer.git'], 'texture_packer', '' ], + #[ ['https://github.com/Relintai/godot_fastnoise.git', 'git@github.com:Relintai/godot_fastnoise.git'], 'fastnoise', '' ], + #[ ['https://github.com/Relintai/mesh_data_resource.git', 'git@github.com:Relintai/mesh_data_resource.git'], 'mesh_data_resource', '' ], + #[ ['https://github.com/Relintai/props.git', 'git@github.com:Relintai/props.git'], 'props', '' ], + #[ ['https://github.com/Relintai/mesh_utils.git', 'git@github.com:Relintai/mesh_utils.git'], 'mesh_utils', '' ], + #[ ['https://github.com/Relintai/broken_seals_module.git', 'git@github.com:Relintai/broken_seals_module.git'], 'broken_seals_module', '' ], + #[ ['https://github.com/Relintai/thread_pool.git', 'git@github.com:Relintai/thread_pool.git'], 'thread_pool', '' ], + #[ ['https://github.com/Relintai/terraman.git', 'git@github.com:Relintai/terraman.git'], 'terraman', '' ], +] + +removed_modules = [ + #[ ['https://github.com/Relintai/voxelman.git', 'git@github.com:Relintai/voxelman.git'], 'voxelman', '' ], + #[ ['https://github.com/Relintai/procedural_animations.git', 'git@github.com:Relintai/procedural_animations.git'], 'procedural_animations', '' ], + #[ ['https://github.com/Relintai/world_generator.git', 'git@github.com:Relintai/world_generator.git'], 'world_generator', '' ], +] + +addon_repositories = [ +] + +third_party_addon_repositories = [ +] + +# Relative to the engine directory +custom_module_folders = 'custom_modules' + +slim_args = '' +slim_args += 'module_bmp_enabled=no ' +slim_args += 'module_broken_seals_module_enabled=no ' +slim_args += 'module_cscript_enabled=no ' +slim_args += 'module_cvtt_enabled=no ' +slim_args += 'module_database_enabled=no ' +slim_args += 'module_database_sqlite_enabled=no ' +slim_args += 'module_dds_enabled=no ' +slim_args += 'module_enet_enabled=no ' +slim_args += 'module_entity_spell_system_enabled=no ' +slim_args += 'module_fastnoise_enabled=no ' +#slim_args += 'module_freetype_enabled=no ' +#slim_args += 'module_gdscript_enabled=no ' +slim_args += 'module_gridmap_enabled=no ' +slim_args += 'module_hdr_enabled=no ' +slim_args += 'module_http_server_simple_enabled=no ' +slim_args += 'module_jpg_enabled=no ' +slim_args += 'module_material_maker_enabled=no ' +#slim_args += 'module_mbedtls_enabled=no ' +slim_args += 'module_mesh_data_resource_enabled=no ' +slim_args += 'module_mesh_utils_enabled=no ' +slim_args += 'module_minimp3_enabled=no ' +#slim_args += 'module_navigation_enabled=no ' +slim_args += 'module_network_synchronizer_enabled=no ' +slim_args += 'module_ogg_enabled=no ' +slim_args += 'module_opensimplex_enabled=no ' +slim_args += 'module_opus_enabled=no ' +#slim_args += 'module_paint_enabled=no ' +slim_args += 'module_props_enabled=no ' +slim_args += 'module_props_2d_enabled=no ' +slim_args += 'module_pvr_enabled=no ' +#slim_args += 'module_regex_enabled=no ' +slim_args += 'module_skeleton_2d_enabled=no ' +slim_args += 'module_skeleton_3d_enabled=no ' +slim_args += 'module_squish_enabled=no ' +slim_args += 'module_stb_vorbis_enabled=no ' +#slim_args += 'module_svg_enabled=no ' +slim_args += 'module_terraman_enabled=no ' +slim_args += 'module_terraman_2d_enabled=no ' +slim_args += 'module_texture_packer_enabled=no ' +slim_args += 'module_tga_enabled=no ' +slim_args += 'module_theora_enabled=no ' +slim_args += 'module_tile_map_enabled=no ' +slim_args += 'module_ui_extensions_enabled=no ' +slim_args += 'module_upnp_enabled=no ' +slim_args += 'module_users_enabled=no ' +slim_args += 'module_vhacd_enabled=no ' +slim_args += 'module_vorbis_enabled=no ' +slim_args += 'module_voxelman_enabled=no ' +slim_args += 'module_web_enabled=no ' +slim_args += 'module_websocket_enabled=no ' +slim_args += 'module_wfc_enabled=no ' +#slim_args += 'module_etc_enabled=no ' +slim_args += 'module_gltf_enabled=no ' +#slim_args += 'module_plugin_refresher_enabled=no ' +#slim_args += 'module_text_editor_enabled=no ' +slim_args += 'module_tinyexr_enabled=no ' +slim_args += 'module_lz4_enabled=no ' diff --git a/play.sh b/play.sh new file mode 100755 index 0000000..385f12b --- /dev/null +++ b/play.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cp -u ./pandemonium_engine/bin/pandemonium.x11.opt.tools.64 ./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 + +export LD_LIBRARY_PATH=`pwd`/pandemonium_engine/bin/ +./pandemonium_engine/bin/run.pandemonium.x11.opt.tools.64 -v --path ./game/ diff --git a/run.sh b/run.sh deleted file mode 100755 index 633e0e5..0000000 --- a/run.sh +++ /dev/null @@ -1 +0,0 @@ -./engine/bin/server \ No newline at end of file