xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("newtondynamics")
  2. set_homepage("http://newtondynamics.com")
  3. set_description("Newton Dynamics is an integrated solution for real time simulation of physics environments.")
  4. set_license("zlib")
  5. set_urls("https://github.com/MADEAPPS/newton-dynamics.git")
  6. add_versions("v3.14d", "e501c6d13e127a595c847d92b12ca3c7616a441d")
  7. if is_plat("mingw") and is_subhost("msys") then
  8. add_extsources("pacman::newton-dynamics")
  9. elseif is_plat("linux") then
  10. add_extsources("pacman::newton-dynamics")
  11. end
  12. if is_plat("linux", "android") then
  13. add_syslinks("dl", "pthread")
  14. end
  15. on_load(function (package)
  16. wprint("newtondynamics package has been renamed to newtondynamics3 due to release of v4, please update your dependency to newtondynamics3 or newtondynamics4")
  17. if package:is_plat("windows") and not package:config("shared") then
  18. package:add("defines", "_NEWTON_STATIC_LIB")
  19. end
  20. end)
  21. on_install("windows", "linux", "macosx", "mingw", function (package)
  22. os.cd("newton-3.14")
  23. local configs = {}
  24. configs.kind = package:config("shared") and "shared" or "static"
  25. configs.mode = package:debug() and "debug" or "release"
  26. if not package:config("shared") and package:is_plat("linux", "android") and package:config("pic") ~= false then
  27. configs.cxflags = "-fPIC"
  28. end
  29. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  30. import("package.tools.xmake").install(package, configs)
  31. end)
  32. on_test(function (package)
  33. assert(package:check_cxxsnippets({test = [[
  34. void test(int args, char** argv) {
  35. NewtonWorld* world = NewtonCreate();
  36. NewtonDestroy(world);
  37. }
  38. ]]}, {includes = "newton/Newton.h"}))
  39. end)