Update xmake.lua

SirLynix-patch-6
Jérôme Leclercq 11 months ago committed by GitHub
parent 24a1c3ff54
commit 28caec2cc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      packages/c/chipmunk2d/xmake.lua

@ -10,7 +10,7 @@ package("chipmunk2d")
add_versions("github:7.0.3", "87340c216bf97554dc552371bbdecf283f7c540e")
add_patches("7.0.3", path.join(os.scriptdir(), "patches", "7.0.3", "android.patch"), "d0bbefe66852cdadb974dce24d4383c356bc3fa88656739ff1d5baf4e3792a96")
add_configs("double_precision", {description = "Use double instead of float (not supported on ARM 32bits)", default = false, type = "boolean"})
add_configs("precision", {description = "Which precision to use (defaults is double on most platforms except ARM 32bits)", default = "default", type = "string", values = {"default", "single", "double"}})
if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::chipmunk")
@ -29,9 +29,9 @@ package("chipmunk2d")
end
on_load(function (package)
if package:config("double_precision") then
if package:config("precision") == "double" then
package:add("defines", "CP_USE_DOUBLES=1")
else
elseif package:config("precision") == "single" then
package:add("defines", "CP_USE_DOUBLES=0")
end
end)
@ -50,7 +50,11 @@ package("chipmunk2d")
table.insert(configs, "-DINSTALL_STATIC=ON")
end
local opt = {}
opt.cxflags = compiler.map_flags("c", "define", "CP_USE_DOUBLES=" .. (package:config("double_precision") and "1" or "0"), {target = self})
if package:config("precision") == "double" then
opt.cxflags = compiler.map_flags("c", "define", "CP_USE_DOUBLES=1", {target = self})
elseif package:config("precision") == "single" then
opt.cxflags = compiler.map_flags("c", "define", "CP_USE_DOUBLES=0", {target = self})
end
import("package.tools.cmake").install(package, configs, opt)
os.vcp("include/chipmunk", package:installdir("include"))
end)

Loading…
Cancel
Save