xmake.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. add_rules("mode.debug", "mode.release")
  2. target("newton")
  3. set_kind("$(kind)")
  4. set_languages("c89", "cxx11")
  5. if is_plat("windows") or is_plat("mingw") then
  6. add_defines("_WINDOWS", "_CRT_SECURE_NO_WARNINGS")
  7. if is_arch("x86") then
  8. add_defines("_WIN_32_VER")
  9. else
  10. add_defines("_WIN_64_VER")
  11. end
  12. if is_plat("mingw") then
  13. if is_arch("x86") then
  14. add_defines("_MINGW_32_VER")
  15. else
  16. add_defines("_MINGW_64_VER")
  17. end
  18. end
  19. elseif is_plat("linux", "android") then
  20. add_syslinks("dl")
  21. if is_arch("x86") then
  22. add_defines("_POSIX_VER")
  23. else
  24. add_defines("_POSIX_VER_64")
  25. end
  26. if is_plat("android") then
  27. add_defines("_ARM_VER")
  28. add_cxflags("-mfpu=neon", {force = true})
  29. add_cxflags("-mfloat-abi=soft", {force = true})
  30. add_cxflags("-include arm_neon.h", {force = true})
  31. else
  32. add_syslinks("pthread")
  33. end
  34. elseif is_plat("macosx", "iphoneos") then
  35. add_defines("_MACOSX_VER")
  36. if is_plat("iphoneos") then
  37. add_cxflags("-include emmintrin.h", {force = true})
  38. end
  39. end
  40. if is_plat("windows") then
  41. if is_kind("static") then
  42. add_defines("_NEWTON_STATIC_LIB", {public = true})
  43. else
  44. add_defines("_NEWTON_BUILD_DLL")
  45. end
  46. end
  47. if is_mode("release") and not is_plat("android") then
  48. add_vectorexts("sse", "sse2", "sse3")
  49. end
  50. add_includedirs("sdk", "sdk/dgCore", "sdk/dgMeshUtil", "sdk/dgPhysics", "sdk/dgNewton")
  51. add_files("sdk/dgCore/**.cpp")
  52. add_files("sdk/dgPhysics/**.cpp")
  53. add_files("sdk/dgMeshUtil/**.cpp")
  54. add_files("sdk/dgNewton/**.cpp")
  55. before_install(function (package)
  56. local targetHeader = path.join(package:installdir(), "include", "newton", "Newton.h")
  57. os.vcp("sdk/dgNewton/Newton.h", path.join(package:installdir(), "include", "newton", "Newton.h"))
  58. end)