xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("workspace_hanya")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/CodingHanYa/workspace")
  4. set_description("Workspace is a lightweight asynchronous execution framework based on C++11")
  5. set_license("Apache-2.0")
  6. set_urls("https://github.com/CodingHanYa/workspace.git")
  7. add_versions("2023.5.8", "d53b4f6a2900db328168ca7b496edc976308e4e6")
  8. add_deps("cmake")
  9. if is_plat("linux") then
  10. add_syslinks("pthread")
  11. end
  12. on_install("windows", "linux", "macosx", "mingw", function (package)
  13. if is_plat("linux") then
  14. io.replace("CMakeLists.txt", "install(DIRECTORY ${LIB_HEADER} DESTINATION ${INSTALL_INCLUDEDIR}/${LIB_NAME})", "install(DIRECTORY ${LIB_HEADER} DESTINATION ${LIB_NAME})", {plain = true})
  15. end
  16. import("package.tools.cmake").install(package, configs)
  17. os.cp("include", package:installdir())
  18. end)
  19. on_test(function (package)
  20. assert(package:check_cxxsnippets({test = [[
  21. #include <workspace/workspace.h>
  22. int main() {
  23. wsp::workbranch br("My First BR", 2);
  24. br.submit([]{ std::cout<<"hello world"<<std::endl; });
  25. auto result = br.submit([]{ return 2023; });
  26. std::cout<<"Got "<<result.get()<<std::endl;
  27. br.wait_tasks(1000);
  28. }
  29. ]]}, {configs = {languages = "c++17"}}))
  30. end)