Add newton dynamics v4 (#1428)

* Add newton dynamics v4

* Rename newtondynamics to newtondynamics3

* Update xmake.lua

* Update xmake.lua

* Try without set_base

* Update xmake.lua

* Add missing cmake deps

* Improve newton

* Fix test

* Try to enable every platform to see which are failing

* Revert "Try to enable every platform to see which are failing"

This reverts commit c8227a7d7c.
pull/1436/head
Jérôme Leclercq 2 years ago committed by GitHub
parent c9d6fa57ed
commit 2be41185ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/n/newtondynamics/xmake.lua
  2. 63
      packages/n/newtondynamics3/port/xmake.lua
  3. 45
      packages/n/newtondynamics3/xmake.lua
  4. 127
      packages/n/newtondynamics4/patches/v4.01/cmake.patch
  5. 65
      packages/n/newtondynamics4/xmake.lua

@ -18,6 +18,7 @@ package("newtondynamics")
end
on_load(function (package)
wprint("newtondynamics package has been renamed to newtondynamics3 due to release of v4, please update your dependency to newtondynamics3 or newtondynamics4")
if package:is_plat("windows") and not package:config("shared") then
package:add("defines", "_NEWTON_STATIC_LIB")
end

@ -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,45 @@
package("newtondynamics3")
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("mingw") and is_subhost("msys") then
add_extsources("pacman::newton-dynamics")
elseif is_plat("linux") then
add_extsources("pacman::newton-dynamics")
end
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)

@ -0,0 +1,127 @@
diff --git a/newton-4.00/CMakeLists.txt b/newton-4.00/CMakeLists.txt
index c7f63370f..466bc9f72 100644
--- a/newton-4.00/CMakeLists.txt
+++ b/newton-4.00/CMakeLists.txt
@@ -97,30 +97,6 @@ if(UNIX)
endif ()
if (MSVC)
- if (PTR_SIZE EQUAL 8)
- set(CMAKE_INSTALL_PREFIX "win64sdk" CACHE PATH "..." FORCE)
- else()
- set(CMAKE_INSTALL_PREFIX "win32sdk" CACHE PATH "..." FORCE)
- endif ()
-
- if(NEWTON_STATIC_RUNTIME_LIBRARIES)
- message ("link to static runtime libraries")
- set(CMAKE_C_FLAGS_DEBUG "/MTd")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT")
- set(CMAKE_C_FLAGS_RELEASE "/MT")
- set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT")
- set(CMAKE_CXX_FLAGS_RELEASE "/MT")
- else()
- message ("link to dynamic runtime libraries")
- set(CMAKE_C_FLAGS_DEBUG "/MDd")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD")
- set(CMAKE_C_FLAGS_RELEASE "/MD")
- set(CMAKE_CXX_FLAGS_DEBUG "/MDd")
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD")
- set(CMAKE_CXX_FLAGS_RELEASE "/MD")
- endif()
-
if(${CMAKE_VS_PLATFORM_NAME} STREQUAL "x64")
message ("build 64 bit")
elseif(${CMAKE_VS_PLATFORM_NAME} STREQUAL "Win32")
diff --git a/newton-4.00/applications/ndSandbox/CMakeLists.txt b/newton-4.00/applications/ndSandbox/CMakeLists.txt
index f399754d6..dbfb7d4ab 100644
--- a/newton-4.00/applications/ndSandbox/CMakeLists.txt
+++ b/newton-4.00/applications/ndSandbox/CMakeLists.txt
@@ -96,8 +96,6 @@ if(MSVC OR MINGW)
target_link_libraries (${projectName} glu32 opengl32)
- target_link_options(${projectName} PUBLIC "/DEBUG")
-
if(CMAKE_VS_MSBUILD_COMMAND OR CMAKE_VS_DEVENV_COMMAND)
set_target_properties(${projectName} PROPERTIES COMPILE_FLAGS "/YundSandboxStdafx.h")
set_source_files_properties(ndSandboxStdafx.cpp PROPERTIES COMPILE_FLAGS "/YcndSandboxStdafx.h")
diff --git a/newton-4.00/sdk/CMakeLists.txt b/newton-4.00/sdk/CMakeLists.txt
index a2d501408..76ea3b175 100644
--- a/newton-4.00/sdk/CMakeLists.txt
+++ b/newton-4.00/sdk/CMakeLists.txt
@@ -112,11 +112,6 @@ else()
if (NEWTON_ENABLE_OPENCL_SOLVER)
target_link_libraries (${projectName} ndSolverOpenCL)
endif()
-
- if(MSVC OR MINGW)
- target_link_options(${projectName} PUBLIC "/DEBUG")
- endif()
-
else()
add_library(${projectName} STATIC ${CPP_SOURCE})
endif()
diff --git a/newton-4.00/sdk/dCollision/CMakeLists.txt b/newton-4.00/sdk/dCollision/CMakeLists.txt
index 78903dd0a..2e1d5be89 100644
--- a/newton-4.00/sdk/dCollision/CMakeLists.txt
+++ b/newton-4.00/sdk/dCollision/CMakeLists.txt
@@ -31,10 +31,6 @@ endif(MSVC)
if(NEWTON_BUILD_SHARED_LIBS)
add_definitions(-D_D_COLLISION_EXPORT_DLL)
add_library(${projectName} SHARED ${CPP_SOURCE})
-
- if(MSVC OR MINGW)
- target_link_options(${projectName} PUBLIC "/DEBUG")
- endif()
else()
add_library(${projectName} STATIC ${CPP_SOURCE})
endif()
diff --git a/newton-4.00/sdk/dCore/CMakeLists.txt b/newton-4.00/sdk/dCore/CMakeLists.txt
index 2786e5838..7fc55b76b 100644
--- a/newton-4.00/sdk/dCore/CMakeLists.txt
+++ b/newton-4.00/sdk/dCore/CMakeLists.txt
@@ -25,11 +25,6 @@ source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/" FILES ${CPP_SOURCE})
if(NEWTON_BUILD_SHARED_LIBS STREQUAL "ON")
add_definitions(-D_D_CORE_EXPORT_DLL)
add_library(${projectName} SHARED ${CPP_SOURCE})
-
- if(MSVC OR MINGW)
- target_link_options(${projectName} PUBLIC "/DEBUG")
- endif()
-
else()
add_library(${projectName} STATIC ${CPP_SOURCE})
endif()
diff --git a/newton-4.00/sdk/dExtensions/dAvx2/CMakeLists.txt b/newton-4.00/sdk/dExtensions/dAvx2/CMakeLists.txt
index eb6fc4bd5..97a366b77 100644
--- a/newton-4.00/sdk/dExtensions/dAvx2/CMakeLists.txt
+++ b/newton-4.00/sdk/dExtensions/dAvx2/CMakeLists.txt
@@ -51,10 +51,6 @@ if(UNIX)
add_library(${projectName} SHARED ${CPP_SOURCE})
endif()
-if(MSVC OR MINGW)
- target_link_options(${projectName} PUBLIC "/DEBUG")
-endif()
-
install(TARGETS ${projectName}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
diff --git a/newton-4.00/sdk/dNewton/CMakeLists.txt b/newton-4.00/sdk/dNewton/CMakeLists.txt
index 86ca89aca..6e2875b11 100644
--- a/newton-4.00/sdk/dNewton/CMakeLists.txt
+++ b/newton-4.00/sdk/dNewton/CMakeLists.txt
@@ -82,12 +82,6 @@ endif()
if(NEWTON_BUILD_SHARED_LIBS)
add_definitions(-D_D_NEWTON_EXPORT_DLL)
add_library(${projectName} SHARED ${CPP_SOURCE})
-
-
- if(MSVC OR MINGW)
- target_link_options(${projectName} PUBLIC "/DEBUG")
- endif()
-
else()
add_library(${projectName} STATIC ${CPP_SOURCE})
endif()

@ -0,0 +1,65 @@
package("newtondynamics4")
set_homepage("http://newtondynamics.com")
set_description("Newton Dynamics is an integrated solution for real time simulation of physics environments.")
set_license("zlib")
add_urls("https://github.com/MADEAPPS/newton-dynamics/archive/refs/tags/$(version).tar.gz",
"https://github.com/MADEAPPS/newton-dynamics.git")
add_versions("v4.01", "c92b64f33488c4774debc110418cbc713fd8e07f37b15e4917b92a7a8d5e785a")
add_patches("v4.01", path.join(os.scriptdir(), "patches", "v4.01", "cmake.patch"), "a189d6282640b6d46c5f9d0926930bbc2d7bb4f242383fae3521b6b211f569e7")
add_configs("symbols", {description = "Enable debug symbols in release", default = false, type = "boolean"})
add_includedirs("include", "include/ndCore", "include/ndCollision", "include/ndNewton")
add_deps("cmake")
add_links("ndNewton")
if is_plat("linux", "android") then
add_syslinks("dl", "pthread")
end
on_load(function (package)
if package:is_plat("windows") and package:config("shared") then
package:add("defines", "_D_CORE_DLL")
package:add("defines", "_D_COLLISION_DLL")
package:add("defines", "_D_NEWTON_DLL")
package:add("defines", "_D_D_TINY_DLL")
end
end)
on_install("windows", "linux", "macosx", "mingw", function (package)
os.cd("newton-4.00")
local configs = {
"-DNEWTON_BUILD_SANDBOX_DEMOS=OFF",
"-DNEWTON_BUILD_TEST=OFF",
"-DNEWTON_BUILD_CREATE_SUB_PROJECTS=OFF",
"-DNEWTON_ENABLE_AVX2_SOLVER=OFF"
}
if package:config("shared") then
table.insert(configs, "-DBUILD_SHARED_LIBS=ON")
table.insert(configs, "-DNEWTON_BUILD_SHARED_LIBS=ON")
else
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
table.insert(configs, "-DNEWTON_BUILD_SHARED_LIBS=OFF")
end
if package:debug() then
table.insert(configs, "-DCMAKE_BUILD_TYPE=Debug")
elseif package:config("symbols") then
table.insert(configs, "-DCMAKE_BUILD_TYPE=RelWithDebInfo")
else
table.insert(configs, "-DCMAKE_BUILD_TYPE=Release")
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test(int args, char** argv) {
ndWorld world;
world.Update(0.01f);
}
]]}, {configs = {languages = "c++11"}, includes = "ndNewton/ndNewton.h"}))
end)
Loading…
Cancel
Save