@ -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 )