xmake.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. set_project("pocketpy")
  2. set_allowedplats("windows", "linux", "macosx", "wasm")
  3. option("dev", {default = false, showmenu = true, description = ""})
  4. add_requires("python", {kind = "binary"})
  5. add_rules("mode.debug", "mode.release")
  6. set_languages("c++17")
  7. add_cxflags("/utf-8", {tools = "cl"})
  8. add_includedirs("include")
  9. if is_plat("linux", "macosx") then
  10. add_syslinks("dl")
  11. end
  12. target("pocketpy")
  13. if has_config("dev") then
  14. set_kind("shared")
  15. else
  16. set_kind("$(kind)")
  17. end
  18. add_files("src/*.cpp")
  19. add_headerfiles("include/(**.h)")
  20. if is_plat("windows") and is_kind("shared") then
  21. add_rules("utils.symbols.export_all")
  22. end
  23. before_build(function (target)
  24. local python = assert(import("lib.detect.find_tool")("python3"), "python3 not found!")
  25. os.execv(python.program, {"prebuild.py"})
  26. end)
  27. target("main")
  28. set_kind("binary")
  29. add_files("src2/main.cpp")
  30. add_deps("pocketpy")
  31. on_load(function (target)
  32. if not has_config("dev") then
  33. target:set("enabled", false)
  34. end
  35. end)