Parcourir la source

access_private: add package (#3300)

* access_private: add package

* access_private: remove cmake

* access_private: fix test
Chi Huu Huynh il y a 1 an
Parent
commit
4bfb05a736
1 fichiers modifiés avec 32 ajouts et 0 suppressions
  1. 32 0
      packages/a/access_private/xmake.lua

+ 32 - 0
packages/a/access_private/xmake.lua

@@ -0,0 +1,32 @@
+package("access_private")
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/martong/access_private")
+    set_description("Access private members and statics of a C++ class")
+    set_license("MIT")
+
+    add_urls("https://github.com/martong/access_private.git")
+    add_versions("2024.02.01", "9e47d135067ecfe569158b2f42ead9c6db9aaedf")
+
+    on_install(function (package)
+        os.cp("include", package:installdir())
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <access_private.hpp>
+
+            class A {
+                int m_i = 3;
+                int m_f(int p) { return 14 * p; }
+            };
+
+            ACCESS_PRIVATE_FIELD(A, int, m_i)
+            ACCESS_PRIVATE_FUN(A, int(int), m_f)
+
+            void test() {
+                A a;
+                auto &i = access_private::m_i(a);
+                auto res = call_private::m_f(a, 3);
+            }
+        ]]}, {configs = {languages = "cxx11"}}))
+    end)