xmake.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package("johnnyengine")
  2. set_homepage("https://github.com/PucklaJ/JohnnyEngine")
  3. set_description("A 2D/3D Engine using OpenGL and SDL for input and the window")
  4. set_license("zlib")
  5. add_urls("https://github.com/PucklaJ/JohnnyEngine/archive/refs/tags/$(version).zip",
  6. "https://github.com/PucklaJ/JohnnyEngine.git")
  7. add_versions("1.0.1", "53c11b827bea6fe30f9bca27adbd712eec85a0853c0402407930bae78ad54a8f")
  8. add_patches("1.0.1", path.join(os.scriptdir(), "patches", "1.0.1", "win32_shared_fix.patch"), "fbe22cb5a9f0485982c7755936d14de6da3ce80a42394d48946b14b922847611")
  9. add_deps("glew", "libsdl2", "libsdl2_ttf", "libsdl2_mixer", "libsdl2_gfx", "box2d 2.x", "assimp", "stb", "tmxparser")
  10. if is_plat("macosx") then
  11. add_frameworks("OpenGL")
  12. end
  13. on_install("windows|x86", "windows|x64", "linux", "macosx", function (package)
  14. io.writefile("xmake.lua", [[
  15. set_project("johnny-engine")
  16. add_requires("glew", "libsdl2", "libsdl2_ttf", "libsdl2_mixer", "libsdl2_gfx", "box2d 2.x", "assimp", "stb", "tmxparser")
  17. add_rules("mode.debug", "mode.release")
  18. target("johnny-engine")
  19. set_kind("$(kind)")
  20. add_defines("STB_IMAGE_IMPLEMENTATION")
  21. set_languages("c++11")
  22. add_packages("glew", "libsdl2", "libsdl2_ttf", "libsdl2_mixer", "libsdl2_gfx", "box2d", "assimp", "stb", "tmxparser")
  23. if is_kind("shared") then
  24. add_rules("utils.symbols.export_all", {export_classes = true})
  25. end
  26. if is_plat("macosx") then
  27. add_frameworks("OpenGL")
  28. end
  29. add_files("src/*.cpp")
  30. add_headerfiles("include/*.h")
  31. add_includedirs("include")
  32. ]])
  33. import("package.tools.xmake").install(package, {kind = (package:config("shared") and "shared" or "static")})
  34. end)
  35. on_test(function (package)
  36. assert(package:check_cxxsnippets({test = [[
  37. using namespace Johnny;
  38. class Game : public MainClass {
  39. public:
  40. Game() {}
  41. ~Game() {}
  42. bool init() override { return true; }
  43. bool update() override { return true; }
  44. bool render() override { return true; }
  45. void quit() override {}
  46. };
  47. void test(int argc, char** argv) {
  48. Vector2<double> v2(1.0, 2.0);
  49. auto m4(Matrix4<float>::identity());
  50. Rectangle<int> r(1, 2, 3, 4);
  51. Game().run();
  52. }
  53. ]]}, {configs = {defines = "SDL_MAIN_HANDLED", languages = "cxx11"}, includes = "Johnny.h"}))
  54. end)