2
0

xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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/archive/refs/tags/$(version).tar.gz")
  6. add_urls("https://github.com/hsutter/cppfront.git")
  7. add_versions("v0.7.0", "d4ffb37d19a2b7c054d005cf4687439577ef2f3d93b340a342704e064cd1d047")
  8. on_fetch(function (package, opt)
  9. if opt.system then
  10. return package:find_tool("cppfront", {check = "-h"})
  11. end
  12. end)
  13. on_install("windows", "linux", "macosx|x86_64", function (package)
  14. local configs = {}
  15. io.writefile("xmake.lua", [[
  16. add_rules("mode.release", "mode.debug")
  17. target("cppfront")
  18. set_kind("binary")
  19. add_files("source/*.cpp")
  20. add_includedirs("include")
  21. set_languages("c++20")
  22. ]])
  23. import("package.tools.xmake").install(package, configs)
  24. os.cp("include", package:installdir())
  25. end)
  26. on_test(function (package)
  27. io.writefile("main.cpp2", [[
  28. main: () -> int =
  29. println("Hello world!\n");
  30. println: (msg: _) -> int = {
  31. std::cout << "msg: " << msg;
  32. return 0;
  33. }]])
  34. os.vrun("cppfront -o main.cpp main.cpp2")
  35. end)