diff options
| author | _Tradam <[email protected]> | 2022-04-04 08:03:11 -0400 |
|---|---|---|
| committer | _Tradam <[email protected]> | 2022-04-04 08:03:11 -0400 |
| commit | b34254cba4e8d950b2fc87d2dd2fef83fcf3b002 (patch) | |
| tree | 557cccd670ce8730332e3ec74a11851de4b938a6 | |
| parent | 7a01019a57b8f200affa0e6bfe49483361172226 (diff) | |
| download | FelFlameEngine-b34254cba4e8d950b2fc87d2dd2fef83fcf3b002.tar.gz FelFlameEngine-b34254cba4e8d950b2fc87d2dd2fef83fcf3b002.zip | |
progress on reworking build configs
| -rw-r--r-- | core/boilerplate_entry.c | 11 | ||||
| -rw-r--r-- | core/mruby_build.rb | 291 | ||||
| -rw-r--r-- | core/shell.html | 83 |
3 files changed, 385 insertions, 0 deletions
diff --git a/core/boilerplate_entry.c b/core/boilerplate_entry.c new file mode 100644 index 0000000..a324597 --- /dev/null +++ b/core/boilerplate_entry.c @@ -0,0 +1,11 @@ +#include "mruby.h" +#include "mruby/irep.h" +#include "bytecode.h" + +int main() { + mrb_state *mrb = mrb_open(); + if (!mrb) { /* handle error */ } + mrb_load_irep(mrb, bytecode); + mrb_close(mrb); + return 0; +} diff --git a/core/mruby_build.rb b/core/mruby_build.rb new file mode 100644 index 0000000..e295f87 --- /dev/null +++ b/core/mruby_build.rb @@ -0,0 +1,291 @@ +configure_project_root = '..' +configure_mrbgem_dir = "#{configure_project_root}/mrbgems" + + +MRuby::Build.new do |conf| + # load specific toolchain settings + conf.toolchain :clang + #conf.toolchain + + disable_lock # disables being stuck on a single commit + + # -- CORE GEMS -- + conf.gembox "stdlib" + conf.gembox "stdlib-ext" + conf.gembox "math" + conf.gembox "metaprog" + #conf.gembox "stdlib-io" + + # Use standard IO/File class + conf.gem :core => "mruby-io" + + # TODO: this gem doesnt current work + # with windows export + #conf.gem :core => "mruby-socket" + + # Use standard print/puts/p + conf.gem :core => "mruby-print" + + # Generate mrbc command + conf.gem :core => "mruby-bin-mrbc" + + # Generate mirb command + conf.gem :core => "mruby-bin-mirb" + + # Generate mruby command + conf.gem :core => "mruby-bin-mruby" + + # Generate mruby-strip command + conf.gem :core => "mruby-bin-strip" + + # Generate mruby-config command + conf.gem :core => "mruby-bin-config" + + # -- POTENTIAL GEMS -- + # gems that we may want incorperated + + # Simple Http + #conf.gem :git => 'https://github.com/matsumotory/mruby-simplehttp' + + # Memory Profiler + #conf.gem :git => 'https://github.com/iij/mruby-memprof' + + # Testing Framework + #conf.gem :git => 'https://github.com/iij/mruby-mtest' + + # Regex + #conf.gem :git => 'https://github.com/iij/mruby-regexp-pcre' + + # JSON + #conf.gem :git => 'https://github.com/iij/mruby-iijson' + + # Dir + #conf.gem :git => 'https://github.com/iij/mruby-dir' + + # -- YOUR GAMES -- + # gems added into the mrbgems directory + + Dir.each_child(configure_mrbgem_dir) do |mrb_gem| + conf.gem mrb_gem + end + + # --- + + # C compiler settings + conf.cc do |cc| + cc.command = 'zig cc -target native -O2' + end + + # Linker settings + conf.linker do |linker| + #linker.command = ENV['LD'] || 'gcc' + linker.command = 'zig c++ -target native -O2' + end + + conf.cxx.command = 'zig c++ -target native -O2' + + conf.cc do |cc| + cc.include_paths << ["#{configure_project_root}/vendor/tux/include"] + end + conf.linker do |linker| + linker.flags << ['-lraylib -lGL -lm -lpthread -ldl -lrt -lX11'] + linker.library_paths << ["#{configure_project_root}/vendor/tux/lib"] + end + + # Turn on `enable_debug` for better debugging + # conf.enable_debug + conf.enable_bintest + conf.enable_test +end +=begin +MRuby::CrossBuild.new("tux") do |conf| + conf.toolchain :clang + + # Use mrbgems + disable_lock # disables being stuck on a single commit + # conf.gem 'examples/mrbgems/ruby_extension_example' + # conf.gem 'examples/mrbgems/c_extension_example' do |g| + # g.cc.flags << '-g' # append cflags in this gem + # end + # conf.gem 'examples/mrbgems/c_and_ruby_extension_example' + # conf.gem :core => 'mruby-eval' + # conf.gem :mgem => 'mruby-onig-regexp' + # conf.gem :github => 'mattn/mruby-onig-regexp' + conf.gem :core => 'mruby-bin-mirb' + conf.gem :git => '[email protected]:realtradam/sample-mruby-gem.git', :branch => 'test', :options => '-v' + + # include the GEM box + #conf.gembox 'default' + conf.gembox "stdlib" + conf.gembox "stdlib-ext" + + #conf.gembox "stdlib-io" + # Use standard print/puts/p + conf.gem :core => "mruby-print" + # Use standard IO/File class + conf.gem :core => "mruby-socket" + # Use standard IO/File class + conf.gem :core => "mruby-io" + + conf.gembox "math" + conf.gembox "metaprog" + # Generate mrbc command + conf.gem :core => "mruby-bin-mrbc" + # Generate mirb command + conf.gem :core => "mruby-bin-mirb" + # Generate mruby command + conf.gem :core => "mruby-bin-mruby" + # Generate mruby-strip command + conf.gem :core => "mruby-bin-strip" + # Generate mruby-config command + conf.gem :core => "mruby-bin-config" + + + conf.cc do |cc| + cc.command = 'zig cc -target x86_64-linux-gnu' + cc.include_paths = ["#{root}/include", '../raylib/src'] + end + + + conf.linker do |linker| + linker.command = 'zig cc -target x86_64-linux-gnu' + linker.flags = ['-lraylib -lOpenGL -lrt -ldl -lm -X11 -lpthread' ] + linker.library_paths = ['../raylib_lib_files'] + end + + conf.cxx.command = "zig c++ -target x86_64-linux-gnu" +end +=end +=begin +MRuby::CrossBuild.new("win") do |conf| + conf.toolchain :clang + + disable_lock # disables being stuck on a single commit + + # include the GEM box + conf.gembox 'felflame' + + conf.host_target = "x86_64-w64-mingw32" + + conf.cc do |cc| + cc.command = 'zig cc -target x86_64-windows-gnu' + cc.include_paths = ["#{root}/include", '../raylib/src'] + end + + + conf.linker do |linker| + linker.command = 'zig cc -target x86_64-windows-gnu' + linker.flags = ['-lraylib -lwinmm -lgdi32 -lopengl32' ] + linker.library_paths = ['../raylib_lib_files'] + end + + conf.cxx.command = "zig c++ -target x86_64-windows-gnu" +end +=end +=begin +MRuby::CrossBuild.new("web") do |conf| + conf.toolchain :clang + + # Use mrbgems + disable_lock # disables being stuck on a single commit + #conf.gem :git => '[email protected]:realtradam/sample-mruby-gem.git', :branch => 'test', :options => '-v' + + + # -- CORE GEMS -- + conf.gembox "stdlib" + conf.gembox "stdlib-ext" + conf.gembox "math" + conf.gembox "metaprog" + #conf.gembox "stdlib-io" + + # Use standard IO/File class + conf.gem :core => "mruby-io" + + # TODO: this gem doesnt current work + # with windows export + #conf.gem :core => "mruby-socket" + + # Use standard print/puts/p + conf.gem :core => "mruby-print" + + # Generate mrbc command + conf.gem :core => "mruby-bin-mrbc" + + # Generate mirb command + conf.gem :core => "mruby-bin-mirb" + + # Generate mruby command + conf.gem :core => "mruby-bin-mruby" + + # Generate mruby-strip command + conf.gem :core => "mruby-bin-strip" + + # Generate mruby-config command + conf.gem :core => "mruby-bin-config" + + # -- POTENTIAL GEMS -- + # gems that we may want incorperated + + # Simple Http + #conf.gem :git => 'https://github.com/matsumotory/mruby-simplehttp' + + # Memory Profiler + #conf.gem :git => 'https://github.com/iij/mruby-memprof' + + # Testing Framework + #conf.gem :git => 'https://github.com/iij/mruby-mtest' + + # Regex + #conf.gem :git => 'https://github.com/iij/mruby-regexp-pcre' + + # JSON + #conf.gem :git => 'https://github.com/iij/mruby-iijson' + + # Dir + #conf.gem :git => 'https://github.com/iij/mruby-dir' + + # -- YOUR GAMES -- + # gems added into the mrbgems directory + + Dir.each_child(configure_mrbgem_dir) do |mrb_gem| + conf.gem mrb_gem + end + + # --- + + conf.cc do |cc| + cc.command = 'emcc' + cc.flags = ['-std=c99'] + end + + conf.linker do |linker| + linker.command = 'emcc' + linker.flags = ["-std=c99 --shell-file #{configure_project_root}/raylib/src/shell.html"] + linker.library_paths = ['.'] + end + + conf.archiver do |archiver| + archiver.command = 'emar' + end + + conf.cxx do |cxx| + cxx.command = "em++" + end + + # FelECS + conf.gem github: 'realtradam/FelECS', path: 'mrbgem' + + # Raylib + #conf.gem :git => '[email protected]:realtradam/mruby-raylib.git', :branch => 'master' + conf.gem '../../mruby-raylib'# do |g| + conf.cc do |cc| + cc.include_paths << ["#{configure_project_root}/include", "#{configure_project_root}/vendor/include/raylib"] + cc.flags << ['-Wall', '-D_DEFAULT_SOURCE', '-Wno-missing-braces', '-Os', '-DPLATFORM_WEB'] + end + conf.linker do |linker| + linker.flags << ["-lraylib -Wall -D_DEFAULT_SOURCE -Wno-missing-braces -Os -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1"] + linker.library_paths << ["#{configure_project_root}/raylib/src", "#{configure_project_root}/vendor/lib/web/raylib"] + end + +end +=end diff --git a/core/shell.html b/core/shell.html new file mode 100644 index 0000000..85ea388 --- /dev/null +++ b/core/shell.html @@ -0,0 +1,83 @@ +<!doctype html> +<html lang="en-us"> + <head> + <meta charset="utf-8"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + + <title>Orc: Arena of Time</title> + + <meta name="title" content="raylib web game"> + <meta name="description" content="New raylib web videogame, developed using raylib videogames library"> + <meta name="keywords" content="raylib, games, html5, programming, C, C++, library, learn, videogames"> + <meta name="viewport" content="width=device-width"> + + <!-- Open Graph metatags for sharing --> + <meta property="og:title" content="raylib web game"> + <meta property="og:image:type" content="image/png"> + <meta property="og:image" content="https://www.raylib.com/common/img/raylib_logo.png"> + <meta property="og:site_name" content="raylib.com"> + <meta property="og:url" content="https://www.raylib.com/games.html"> + <meta property="og:description" content="New raylib web videogame, developed using raylib videogames library"> + + <!-- Twitter metatags for sharing --> + <meta name="twitter:card" content="summary"> + <meta name="twitter:site" content="@raysan5"> + <meta name="twitter:title" content="raylib web game"> + <meta name="twitter:image" content="https://www.raylib.com/common/raylib_logo.png"> + <meta name="twitter:url" content="https://www.raylib.com/games.html"> + <meta name="twitter:description" content="New raylib web game, developed using raylib videogames library"> + + <!-- Favicon --> + <link rel="shortcut icon" href="https://www.raylib.com/favicon.ico"> + + <style> +canvas.emscripten { border: 0px none; background-color: black; } + </style> + <script type='text/javascript' src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"> </script> + <script type='text/javascript'> + function saveFileFromMEMFSToDisk(memoryFSname, localFSname) // This can be called by C/C++ code + { + var isSafari = false; // Not supported, navigator.userAgent access is being restricted + //var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + var data = FS.readFile(memoryFSname); + var blob; + + if (isSafari) blob = new Blob([data.buffer], { type: "application/octet-stream" }); + else blob = new Blob([data.buffer], { type: "application/octet-binary" }); + + // NOTE: SaveAsDialog is a browser setting. For example, in Google Chrome, + // in Settings/Advanced/Downloads section you have a setting: + // 'Ask where to save each file before downloading' - which you can set true/false. + // If you enable this setting it would always ask you and bring the SaveAsDialog + saveAs(blob, localFSname); + } + </script> + </head> + <body style="height:100vh; margin:0; position:relative;"> + <div style="display: flex; justify-content: center; align-items: center; height: 100%"> + <canvas class=emscripten id=canvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0px; outline:0px; aspect-ratio: attr(width)/attr(height); max-width:100vw; max-height:100vh;"></canvas> + </div> + <p id="output" /> + <script> + var Module = { + print: (function() { + var element = document.getElementById('output'); + if (element) element.value = ''; // clear browser cache + return function(text) { + if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); + console.log(text); + if (element) { + element.value += text + "\n"; + element.scrollTop = element.scrollHeight; // focus on bottom + } + }; + })(), + canvas: (function() { + var canvas = document.getElementById('canvas'); + return canvas; + })() + }; + </script> + {{{ SCRIPT }}} + </body> +</html> |
