From 41438b250b916fc09e0d661e866632eb1b2e96c9 Mon Sep 17 00:00:00 2001 From: PucklaMotzer09 Date: Sun, 1 May 2022 11:59:13 +0200 Subject: [PATCH] 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 --- .../patches/1.0.1/win32_shared_fix.patch | 11 ++++++ packages/j/johnnyengine/xmake.lua | 39 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 packages/j/johnnyengine/patches/1.0.1/win32_shared_fix.patch create mode 100644 packages/j/johnnyengine/xmake.lua diff --git a/packages/j/johnnyengine/patches/1.0.1/win32_shared_fix.patch b/packages/j/johnnyengine/patches/1.0.1/win32_shared_fix.patch new file mode 100644 index 000000000..c1853cdd3 --- /dev/null +++ b/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 diff --git a/packages/j/johnnyengine/xmake.lua b/packages/j/johnnyengine/xmake.lua new file mode 100644 index 000000000..c54e5fd17 --- /dev/null +++ b/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 v2(1.0, 2.0); + auto m4(Matrix4::identity()); + Rectangle r(1, 2, 3, 4); + Game().run(); + } + ]]}, {configs = {languages = "cxx11"}, includes = "Johnny.h"})) + end)