2
0

xmake.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("stc")
  2. set_homepage("https://github.com/stclib/STC")
  3. set_description("A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers.")
  4. set_license("MIT")
  5. add_urls("https://github.com/stclib/STC/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/stclib/STC.git")
  7. add_versions("v5.0", "d61353852b9d7ef69b56fa32edcbc7934f2153385f3778536234201ceebcc950")
  8. add_versions("v4.2", "f16c3185ba5693f0257e5b521f0b6b3c11041433a4abbbbc531370364eb75d0c")
  9. add_configs("checkscoped", {description = "Build checkscoped tool for c_guard* blocks", default = false, type = "boolean"})
  10. if is_plat("windows", "wasm") then
  11. add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean", readonly = true})
  12. end
  13. on_load(function (package)
  14. if package:version() and package:version():ge("5.0.0") then
  15. package:add("deps", "meson", "ninja")
  16. if package:config("checkscoped") then
  17. package:add("deps", "flex", {kind = "binary"})
  18. end
  19. else
  20. package:set("kind", "library", {headeronly = true})
  21. end
  22. end)
  23. on_install(function (package)
  24. if package:version() and package:version():ge("5.0.0") then
  25. local configs = {"-Dtests=disabled", "-Dexamples=disabled"}
  26. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  27. table.insert(configs, "-Dcheckscoped=" .. (package:config("checkscoped") and "enabled" or "disabled"))
  28. import("package.tools.meson").install(package, configs)
  29. else
  30. os.cp("include", package:installdir())
  31. end
  32. end)
  33. on_test(function (package)
  34. local opt = {}
  35. opt.configs = {
  36. defines = {"i_type=Floats", "i_val=float"}
  37. }
  38. if package:version() and package:version():ge("5.0.0") then
  39. opt.includes = "stc/vec.h"
  40. else
  41. opt.includes = "stc/cvec.h"
  42. end
  43. assert(package:has_cfuncs("Floats_push", opt))
  44. end)