xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package("cppfront")
  2. set_kind("toolchain")
  3. set_homepage("https://github.com/hsutter/cppfront")
  4. set_description("A personal experimental C++ Syntax 2 -> Syntax 1 compiler")
  5. add_urls("https://github.com/hsutter/cppfront.git")
  6. add_versions("2023.08.29", "b757afd9b0051a40278706cdfc57971e371e4e32")
  7. on_fetch(function (package, opt)
  8. if opt.system then
  9. return package:find_tool("cppfront", {check = "-h"})
  10. end
  11. end)
  12. on_install("windows", "linux", function (package)
  13. local configs = {}
  14. io.writefile("xmake.lua", [[
  15. add_rules("mode.release", "mode.debug")
  16. target("cppfront")
  17. set_kind("binary")
  18. add_files("source/*.cpp")
  19. add_includedirs("include")
  20. set_languages("c++20")
  21. ]])
  22. import("package.tools.xmake").install(package, configs)
  23. os.cp("include", package:installdir())
  24. end)
  25. on_test(function (package)
  26. io.writefile("main.cpp2", [[
  27. main: () -> int =
  28. println("Hello world!\n");
  29. println: (msg: _) -> int = {
  30. std::cout << "msg: " << msg;
  31. return 0;
  32. }]])
  33. os.vrun("cppfront -o main.cpp main.cpp2")
  34. end)