From f170ae8b62682a40fba84c2e9e9bf1852a628603 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 4 Nov 2020 00:53:13 +0800 Subject: [PATCH] support pthread for mingw --- packages/p/pthreads4w/xmake.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/p/pthreads4w/xmake.lua b/packages/p/pthreads4w/xmake.lua index 5e1603549..3a17bbb0e 100644 --- a/packages/p/pthreads4w/xmake.lua +++ b/packages/p/pthreads4w/xmake.lua @@ -11,6 +11,10 @@ package("pthreads4w") add_includedirs("include/pthread") + if is_host("linux", "macosx") and is_plat("mingw") then + add_deps("autoconf", "automake") + end + on_install("windows", function (package) local target = "VC" if not package:config("shared") then @@ -31,6 +35,28 @@ package("pthreads4w") end end) + on_install("mingw@macosx,linux", function (package) + local configs = {} + if package:config("shared") then + table.insert(configs, "--enable-shared=yes") + else + table.insert(configs, "--enable-shared=no") + end + if package:debug() then + table.insert(configs, "--enable-debug") + end + import("package.tools.autoconf").configure(package, configs) + + local target = "GC" + if not package:config("shared") then + target = target .. "-static" + end + if package:debug() then + target = target .. "-debug" + end + os.vrunv("make", {"V=1", target}) + end) + on_test(function (package) assert(package:has_cfuncs("pthread_create", {includes = "pthread.h"})) end)