2
0

xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("tinycthread")
  2. set_homepage("https://github.com/tinycthread/tinycthread")
  3. set_description("A small, portable implementation of the C11 threads API.")
  4. set_license("MIT")
  5. add_urls("https://github.com/tinycthread/tinycthread.git")
  6. add_versions("2016.09.30", "6957fc8383d6c7db25b60b8c849b29caab1caaee")
  7. if is_plat("linux", "bsd", "cross") then
  8. add_syslinks("pthread")
  9. end
  10. on_install(function (package)
  11. io.writefile("xmake.lua", [[
  12. add_rules("mode.debug", "mode.release")
  13. target("tinycthread")
  14. set_kind("$(kind)")
  15. add_files("source/*.c")
  16. add_headerfiles("source/*.h")
  17. if is_kind("shared") then
  18. add_rules("utils.symbols.export_all")
  19. end
  20. ]])
  21. import("package.tools.xmake").install(package)
  22. end)
  23. on_test(function (package)
  24. assert(package:check_csnippets({test = [[
  25. int thread_entrypoint(void* arg) {
  26. (void) arg;
  27. return 0;
  28. }
  29. void test() {
  30. thrd_t t;
  31. if (thrd_create(&t, thread_entrypoint, (void*)0) == thrd_success) {
  32. thrd_join(t, NULL);
  33. }
  34. }
  35. ]]}, {includes = {"tinycthread.h"}}))
  36. end)