support pthread for mingw

pull/101/head
ruki 4 years ago
parent e3e8bf0e1e
commit f170ae8b62
No known key found for this signature in database
GPG Key ID: 809EF06AD42725BD
  1. 26
      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)

Loading…
Cancel
Save