xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("fast_obj")
  2. set_homepage("https://github.com/thisistherk/fast_obj")
  3. set_description("Fast C OBJ parser")
  4. set_license("MIT")
  5. add_urls("https://github.com/thisistherk/fast_obj/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/thisistherk/fast_obj.git")
  7. add_versions("v1.3", "f0f175edbe60db2099b3d8266ff0085b21862a17d9a1dc00fd195258c5b622b1")
  8. add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
  9. on_load(function (package)
  10. if package:config("header_only") then
  11. package:set("kind", "library", {headeronly = true})
  12. end
  13. end)
  14. on_install(function (package)
  15. if package:config("header_only") then
  16. os.cp("fast_obj.h", package:installdir("include"))
  17. return
  18. end
  19. io.writefile("xmake.lua", [[
  20. add_rules("mode.debug", "mode.release")
  21. target("fast_obj")
  22. set_kind("$(kind)")
  23. add_files("fast_obj.c")
  24. add_headerfiles("fast_obj.h")
  25. if is_plat("windows") and is_kind("shared") then
  26. add_rules("utils.symbols.export_all", {export_classes = true})
  27. end
  28. ]])
  29. import("package.tools.xmake").install(package)
  30. end)
  31. on_test(function (package)
  32. assert(package:has_cfuncs("fast_obj_read", {includes = "fast_obj.h"}))
  33. end)