2
0
Эх сурвалжийг харах

Add JohnnyEngine (#1179)

* Add johnnyengine

* Fix missing source files of templates

* Change checksum

* Change test snippet

* Change checksum and kind

* Add patch to fix windows shared build

* Add 4 spaces indent to xmake.lua

* Change condition in patch
PucklaMotzer09 3 жил өмнө
parent
commit
41438b250b

+ 11 - 0
packages/j/johnnyengine/patches/1.0.1/win32_shared_fix.patch

@@ -0,0 +1,11 @@
+diff --git a/xmake.lua b/xmake.lua
+index dfad2e0..090d2b1 100644
+--- a/xmake.lua
++++ b/xmake.lua
+@@ -16,3 +16,6 @@ target("johnny-engine")
+     add_files("src/*.cpp")
+     add_headerfiles("include/*.h")
+     add_includedirs("include")
++    if is_plat("windows") and is_kind("shared") then
++        add_rules("utils.symbols.export_all", {export_classes = true})
++    end

+ 39 - 0
packages/j/johnnyengine/xmake.lua

@@ -0,0 +1,39 @@
+package("johnnyengine")
+
+    set_homepage("https://github.com/PucklaMotzer09/JohnnyEngine")
+    set_description("A 2D/3D Engine using OpenGL and SDL for input and the window")
+
+    add_urls("https://github.com/PucklaMotzer09/JohnnyEngine/archive/refs/tags/$(version).zip",
+            "https://github.com/PucklaMotzer09/JohnnyEngine.git")
+    add_versions("1.0.1", "53c11b827bea6fe30f9bca27adbd712eec85a0853c0402407930bae78ad54a8f")
+    add_patches("1.0.1", path.join(os.scriptdir(), "patches", "1.0.1", "win32_shared_fix.patch"), "fbe22cb5a9f0485982c7755936d14de6da3ce80a42394d48946b14b922847611")
+
+    add_deps("glew", "libsdl", "libsdl_ttf", "libsdl_mixer", "libsdl_gfx", "box2d", "assimp", "stb", "tmxparser")
+
+    on_install("windows", "linux", "macosx", function (package)
+        import("package.tools.xmake").install(package, {kind = (package:config("shared") and "shared" or "static")})
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+        using namespace Johnny;
+
+        class Game : public MainClass {
+        public:
+          Game() {}
+          ~Game() {}
+
+          bool init() override { return true; }
+          bool update() override { return true; }
+          bool render() override { return true; }
+          void quit() override {}
+        };
+
+        void test(int argc, char** argv) {
+          Vector2<double> v2(1.0, 2.0);
+          auto m4(Matrix4<float>::identity());
+          Rectangle<int> r(1, 2, 3, 4);
+          Game().run();
+        }
+        ]]}, {configs = {languages = "cxx11"}, includes = "Johnny.h"}))
+    end)