xmake.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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("1.0.4", "8f3d56b0cbc4b84436d8baf4c8346cd2ee7ffb257bba5ddd9892c41bf516edc4")
  8. add_versions("4.0.0", "9848d106dc88dc0b907d5667c09da3ca53241fbcf17e982d8c234fe3e0d6ddcc")
  9. add_patches("1.0.4", path.join(os.scriptdir(), "patches", "1.0.4", "build.patch"), "1f51148afccef7b9bf079ef4137c12d578fb7a76f7aed6e282ca2ceaf4a188ba")
  10. add_deps("cmake")
  11. add_deps("urdfdom-headers", "console-bridge")
  12. on_load("windows", "linux", "macosx", function (package)
  13. if package:version():ge("4.0.0") then
  14. package:add("deps", "tinyxml2")
  15. else
  16. package:add("deps", "tinyxml")
  17. end
  18. end)
  19. on_install("windows", "linux", "macosx", function (package)
  20. local configs = {}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <string>
  28. void test() {
  29. std::string easy{"1.0"};
  30. double conv = urdf::strToDouble(easy.c_str());
  31. }
  32. ]]}, {configs = {languages = "c++11"}, includes = "urdf_model/utils.h"}))
  33. end)