xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
  12. add_deps("cmake")
  13. add_deps("urdfdom-headers", "console-bridge")
  14. on_load("windows", "linux", "macosx", function (package)
  15. if package:version():ge("4.0.0") then
  16. package:add("deps", "tinyxml2")
  17. else
  18. package:add("deps", "tinyxml")
  19. end
  20. end)
  21. on_install("windows", "linux", "macosx", function (package)
  22. local configs = {}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include <string>
  30. void test() {
  31. std::string easy{"1.0"};
  32. double conv = urdf::strToDouble(easy.c_str());
  33. }
  34. ]]}, {configs = {languages = "c++11"}, includes = "urdf_model/utils.h"}))
  35. end)