Add NewtonDynamics (#381)
* Add newtondynamics * NewtonDynamics: Drop iphoneos and fix android * NewtonDynamics: Fix link order and build only core * NewtonDynamics: Add dl syslinks on Linux and Android * newtondynamics: Add pthread syslink * NewtonDynamics: Try to fix issues by using a xmake.lua port * NewtonDynamics: Try to fix android compilation * Newtondyanmics: reenable iphoneos to test support using xmake * NewtonDynamics: Enable neon support for Android * Try to fix android & iphoneos compilation * NewtonDynamics: Disable android and iOS supportpull/387/head
parent
38d64695cb
commit
d309cfb68d
2 changed files with 102 additions and 0 deletions
@ -0,0 +1,63 @@ |
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
target("newton") |
||||
set_kind("$(kind)") |
||||
set_languages("c89", "cxx11") |
||||
if is_plat("windows") or is_plat("mingw") then |
||||
add_defines("_WINDOWS", "_CRT_SECURE_NO_WARNINGS") |
||||
if is_arch("x86") then |
||||
add_defines("_WIN_32_VER") |
||||
else |
||||
add_defines("_WIN_64_VER") |
||||
end |
||||
if is_plat("mingw") then |
||||
if is_arch("x86") then |
||||
add_defines("_MINGW_32_VER") |
||||
else |
||||
add_defines("_MINGW_64_VER") |
||||
end |
||||
end |
||||
elseif is_plat("linux", "android") then |
||||
add_syslinks("dl") |
||||
if is_arch("x86") then |
||||
add_defines("_POSIX_VER") |
||||
else |
||||
add_defines("_POSIX_VER_64") |
||||
end |
||||
if is_plat("android") then |
||||
add_defines("_ARM_VER") |
||||
add_cxflags("-mfpu=neon", {force = true}) |
||||
add_cxflags("-mfloat-abi=soft", {force = true}) |
||||
add_cxflags("-include arm_neon.h", {force = true}) |
||||
else |
||||
add_syslinks("pthread") |
||||
end |
||||
elseif is_plat("macosx", "iphoneos") then |
||||
add_defines("_MACOSX_VER") |
||||
if is_plat("iphoneos") then |
||||
add_cxflags("-include emmintrin.h", {force = true}) |
||||
end |
||||
end |
||||
|
||||
if is_plat("windows") then |
||||
if is_kind("static") then |
||||
add_defines("_NEWTON_STATIC_LIB", {public = true}) |
||||
else |
||||
add_defines("_NEWTON_BUILD_DLL") |
||||
end |
||||
end |
||||
|
||||
if is_mode("release") and not is_plat("android") then |
||||
add_vectorexts("sse", "sse2", "sse3") |
||||
end |
||||
|
||||
add_includedirs("sdk", "sdk/dgCore", "sdk/dgMeshUtil", "sdk/dgPhysics", "sdk/dgNewton") |
||||
add_files("sdk/dgCore/**.cpp") |
||||
add_files("sdk/dgPhysics/**.cpp") |
||||
add_files("sdk/dgMeshUtil/**.cpp") |
||||
add_files("sdk/dgNewton/**.cpp") |
||||
|
||||
before_install(function (package) |
||||
local targetHeader = path.join(package:installdir(), "include", "newton", "Newton.h") |
||||
os.vcp("sdk/dgNewton/Newton.h", path.join(package:installdir(), "include", "newton", "Newton.h")) |
||||
end) |
@ -0,0 +1,39 @@ |
||||
package("newtondynamics") |
||||
set_homepage("http://newtondynamics.com") |
||||
set_description("Newton Dynamics is an integrated solution for real time simulation of physics environments.") |
||||
set_license("zlib") |
||||
|
||||
set_urls("https://github.com/MADEAPPS/newton-dynamics.git") |
||||
|
||||
add_versions("v3.14d", "e501c6d13e127a595c847d92b12ca3c7616a441d") |
||||
|
||||
if is_plat("linux", "android") then |
||||
add_syslinks("dl", "pthread") |
||||
end |
||||
|
||||
on_load(function (package) |
||||
if package:is_plat("windows") and not package:config("shared") then |
||||
package:add("defines", "_NEWTON_STATIC_LIB") |
||||
end |
||||
end) |
||||
|
||||
on_install("windows", "linux", "macosx", "mingw", function (package) |
||||
os.cd("newton-3.14") |
||||
local configs = {} |
||||
configs.kind = package:config("shared") and "shared" or "static" |
||||
configs.mode = package:debug() and "debug" or "release" |
||||
if not package:config("shared") and package:is_plat("linux", "android") and package:config("pic") ~= false then |
||||
configs.cxflags = "-fPIC" |
||||
end |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
import("package.tools.xmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
void test(int args, char** argv) { |
||||
NewtonWorld* world = NewtonCreate(); |
||||
NewtonDestroy(world); |
||||
} |
||||
]]}, {includes = "newton/Newton.h"})) |
||||
end) |
Loading…
Reference in new issue