xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("urdfdom")
  2. set_homepage("https://wiki.ros.org/urdf")
  3. set_description("A C++ parser for the Unified Robot Description Format (URDF)")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/ros/urdfdom/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ros/urdfdom.git")
  7. add_versions("4.0.1", "46b122c922f44ec32674a56e16fd4b5d068b53265898cbea2c3e1939ecccc62a")
  8. add_versions("1.0.4", "8f3d56b0cbc4b84436d8baf4c8346cd2ee7ffb257bba5ddd9892c41bf516edc4")
  9. add_versions("4.0.0", "9848d106dc88dc0b907d5667c09da3ca53241fbcf17e982d8c234fe3e0d6ddcc")
  10. add_patches("1.0.4", path.join(os.scriptdir(), "patches", "1.0.4", "build.patch"), "1f51148afccef7b9bf079ef4137c12d578fb7a76f7aed6e282ca2ceaf4a188ba")
  11. add_deps("cmake")
  12. add_deps("urdfdom-headers", "console-bridge")
  13. on_load("windows", "linux", "macosx", function (package)
  14. if package:version():ge("4.0.0") then
  15. package:add("deps", "tinyxml2")
  16. else
  17. package:add("deps", "tinyxml")
  18. end
  19. end)
  20. on_install("windows", "linux", "macosx", function (package)
  21. local configs = {}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <string>
  29. void test() {
  30. std::string easy{"1.0"};
  31. double conv = urdf::strToDouble(easy.c_str());
  32. }
  33. ]]}, {configs = {languages = "c++11"}, includes = "urdf_model/utils.h"}))
  34. end)