xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("simplecpp")
  2. set_homepage("https://github.com/danmar/simplecpp")
  3. set_description("C++ preprocessor")
  4. set_license("OBSD")
  5. add_urls("https://github.com/danmar/simplecpp/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/danmar/simplecpp.git")
  7. add_versions("1.5.2", "ee2b0547f2a889a509263e4b3f6d5764aea2e9536c2f9db545451cbd7994a66c")
  8. add_versions("1.5.1", "68c893f6f8005fd47ebe720cc5d1cb1664ae282b7607854211248b413105ee50")
  9. on_install(function (package)
  10. if package:is_plat("windows") and package:config("shared") then
  11. package:add("defines", "SIMPLECPP_IMPORT")
  12. end
  13. io.writefile("xmake.lua", [[
  14. add_rules("mode.debug", "mode.release")
  15. set_languages("c++11")
  16. target("simplecpp")
  17. set_kind("$(kind)")
  18. add_files("simplecpp.cpp")
  19. add_headerfiles("simplecpp.h")
  20. if is_plat("windows") and is_kind("shared") then
  21. add_defines("SIMPLECPP_EXPORT")
  22. add_defines("SIMPLECPP_IMPORT", {interface = true})
  23. end
  24. ]])
  25. import("package.tools.xmake").install(package)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include <simplecpp.h>
  30. void test() {
  31. auto location = simplecpp::Location({});
  32. }
  33. ]]}, {configs = {languages = "c++11"}}))
  34. end)