xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.git")
  6. add_versions("2023.08.08", "2bb0b1f6509a4f63f04df5019b805f14e199a681")
  7. add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
  8. on_load(function (package)
  9. if package:config("header_only") then
  10. package:set("kind", "library", {headeronly = true})
  11. end
  12. end)
  13. on_install(function (package)
  14. if package:config("header_only") then
  15. os.cp("fast_obj.h", package:installdir("include"))
  16. return
  17. end
  18. io.writefile("xmake.lua", [[
  19. add_rules("mode.debug", "mode.release")
  20. target("fast_obj")
  21. set_kind("$(kind)")
  22. add_files("fast_obj.c")
  23. add_headerfiles("fast_obj.h")
  24. if is_plat("windows") and is_kind("shared") then
  25. add_rules("utils.symbols.export_all", {export_classes = true})
  26. end
  27. ]])
  28. import("package.tools.xmake").install(package)
  29. end)
  30. on_test(function (package)
  31. assert(package:has_cfuncs("fast_obj_read", {includes = "fast_obj.h"}))
  32. end)