From 651acbcbdbb8a423493222e845daf2dafe8fbc49 Mon Sep 17 00:00:00 2001 From: Faisal Alghamdi <80383169+PunchCakee@users.noreply.github.com> Date: Tue, 18 Jul 2023 10:57:55 +0300 Subject: [PATCH] Add The Boehm-Demers-Weiser conservative Garbage Collector (#2339) * Create Boehm Add the Boehm-Demers-Weiser conservative Garbage Collector * Delete Boehm * Add Boehm GC * Delete directory to apply fixed code. * Add files via upload * Add config with assert. * Fix C++ standard version. * Remove unneeded C++ version. * Fix stupid * Fix mistake * fix stupid with the help of lynix * Update xmake.lua * Update to reflect review. * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua --------- Co-authored-by: ruki --- packages/b/bdwgc/xmake.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/b/bdwgc/xmake.lua diff --git a/packages/b/bdwgc/xmake.lua b/packages/b/bdwgc/xmake.lua new file mode 100644 index 000000000..af75120f0 --- /dev/null +++ b/packages/b/bdwgc/xmake.lua @@ -0,0 +1,29 @@ +package("bdwgc") + set_homepage("https://www.hboehm.info/gc/") + set_description("The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (bdwgc, also known as bdw-gc, boehm-gc, libgc)") + + add_urls("https://github.com/ivmai/bdwgc/-/archive/$(version).tar.gz", + "https://github.com/ivmai/bdwgc.git") + + add_versions("v8.2.4", "18e63ab1428bd52e691da107a6a56651c161210b11fbe22e2aa3c31f7fa00ca5") + + add_deps("cmake") + + on_install("macosx", "linux", "android", "iphoneos", function (package) + local configs = {} + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs({test=[[ + void test() { + GC_INIT(); + int *ptr = GC_MALLOC(sizeof(int)); + *ptr = 42; + printf("Value: %d\n", *ptr); + return 0; + } + ]]}),{configs = {includes = "gc.h"}}) + end)