2
0

xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("tinyobjloader")
  2. set_homepage("https://github.com/tinyobjloader/tinyobjloader")
  3. set_description("Tiny but powerful single file wavefront obj loader")
  4. set_license("MIT")
  5. add_urls("https://github.com/tinyobjloader/tinyobjloader/archive/$(version).tar.gz")
  6. add_urls("https://github.com/tinyobjloader/tinyobjloader.git")
  7. add_versions("v1.0.7", "b9d08b675ba54b9cb00ffc99eaba7616d0f7e6f6b8947a7e118474e97d942129")
  8. add_versions("v2.0.0rc10", "e1bc2e5547b562d33ca4a90b581717984a70d58113d83208dbc97c82e137b9fe")
  9. add_versions("v2.0.0rc13", "0feb92b838f8ce4aa6eb0ccc32dff30cb64a891e0ec3bde837fca49c78d44334")
  10. add_configs("double", {description = "Use double precision floating numbers.", default = false, type = "boolean"})
  11. if is_plat("windows") then
  12. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  13. end
  14. on_load(function (package)
  15. if package:config("double") then
  16. package:add("defines", "TINYOBJLOADER_USE_DOUBLE")
  17. end
  18. end)
  19. on_install("macosx", "linux", "windows", "mingw", "android", "iphoneos", "cross", function (package)
  20. io.writefile("xmake.lua", string.format([[
  21. add_rules("mode.debug", "mode.release")
  22. add_rules("utils.install.cmake_importfiles")
  23. target("tinyobjloader")
  24. set_kind("$(kind)")
  25. %s
  26. add_files("tiny_obj_loader.cc")
  27. add_headerfiles("tiny_obj_loader.h")
  28. ]], package:config("double") and "add_defines(\"TINYOBJLOADER_USE_DOUBLE\")" or ""))
  29. import("package.tools.xmake").install(package)
  30. end)
  31. on_test(function (package)
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <vector>
  34. void test() {
  35. tinyobj::attrib_t attrib;
  36. std::vector<tinyobj::shape_t> shapes;
  37. std::vector<tinyobj::material_t> materials;
  38. }
  39. ]]}, {configs = {languages = "c++11"}, includes = "tiny_obj_loader.h"}))
  40. end)