chipmunk2d: Set CP_USE_CGTYPES if precision is set (#3689)

* chipmunk2d: Set CP_USE_CGTYPES if precision is set

on macOS / iOS, if CP_USE_CGTYPES is not defined, it overrides CP_USE_DOUBLES value
pull/3690/head
Jérôme Leclercq 8 months ago committed by GitHub
parent 81b799f1f1
commit 29541c1f43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      packages/c/chipmunk2d/xmake.lua

@ -31,8 +31,14 @@ package("chipmunk2d")
on_load(function (package)
if package:config("precision") == "double" then
package:add("defines", "CP_USE_DOUBLES=1")
if package:is_plat("macosx", "iphoneos") then
package:add("defines", "CP_USE_CGTYPES=1")
end
elseif package:config("precision") == "single" then
package:add("defines", "CP_USE_DOUBLES=0")
if package:is_plat("macosx", "iphoneos") then
package:add("defines", "CP_USE_CGTYPES=0")
end
end
end)
@ -50,9 +56,15 @@ package("chipmunk2d")
end
local opt = {}
if package:config("precision") == "double" then
opt.cxflags = "-DCP_USE_DOUBLES=1"
opt.cxflags = {"-DCP_USE_DOUBLES=1"}
if package:is_plat("macosx", "iphoneos") then
table.insert(opt.cxflags, "CP_USE_CGTYPES=1")
end
elseif package:config("precision") == "single" then
opt.cxflags = "-DCP_USE_DOUBLES=0"
opt.cxflags = {"-DCP_USE_DOUBLES=0"}
if package:is_plat("macosx", "iphoneos") then
table.insert(opt.cxflags, "CP_USE_CGTYPES=0")
end
end
import("package.tools.cmake").install(package, configs, opt)
os.vcp("include/chipmunk", package:installdir("include"))

Loading…
Cancel
Save