xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930
  1. package("bdwgc")
  2. set_homepage("https://www.hboehm.info/gc/")
  3. set_description("The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (bdwgc, also known as bdw-gc, boehm-gc, libgc)")
  4. add_urls("https://github.com/ivmai/bdwgc/-/archive/$(version).tar.gz",
  5. "https://github.com/ivmai/bdwgc.git")
  6. add_versions("v8.2.6", "3bfc2b1dd385bfb46d2dab029211a66249a309795b6893f4e00554904999e40a")
  7. add_versions("v8.2.4", "18e63ab1428bd52e691da107a6a56651c161210b11fbe22e2aa3c31f7fa00ca5")
  8. add_deps("cmake")
  9. on_install("macosx", "linux", "android", "iphoneos", function (package)
  10. local configs = {}
  11. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  12. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  13. import("package.tools.cmake").install(package, configs)
  14. end)
  15. on_test(function (package)
  16. assert(package:has_cfuncs({test=[[
  17. void test() {
  18. GC_INIT();
  19. int *ptr = GC_MALLOC(sizeof(int));
  20. *ptr = 42;
  21. printf("Value: %d\n", *ptr);
  22. return 0;
  23. }
  24. ]]}),{configs = {includes = "gc.h"}})
  25. end)