generated from Persson-dev/Godot-Xmake
72 lines
1.9 KiB
Lua
72 lines
1.9 KiB
Lua
|
|
if is_mode("debug") then
|
|
add_defines("DEBUG_ENABLED")
|
|
end
|
|
|
|
|
|
-- more on https://xmake.io/#/manual/project_target
|
|
target(PROJECT_NAME)
|
|
set_kind("shared")
|
|
set_default(true)
|
|
|
|
add_packages("godotcpp4")
|
|
|
|
-- more on https://xmake.io/#/manual/project_target?id=targetadd_files
|
|
add_files("../src/**.cpp")
|
|
|
|
-- change the output name
|
|
set_basename(PROJECT_NAME .. ".$(os)_$(mode)_$(arch)")
|
|
|
|
-- libraries will saved in os level folder
|
|
set_targetdir("../" .. GODOT_PROJECT_FOLDER .. "/lib")
|
|
|
|
-- where to save .obj files
|
|
-- we use a seprate folder, so that it will not populate the targer folder
|
|
set_objectdir("../build/.objs")
|
|
|
|
-- where .d files are saved
|
|
set_dependir("../build/.deps")
|
|
|
|
-- set_optimize("smallest")
|
|
|
|
-- handlers
|
|
|
|
-- before_run(function (target) end)
|
|
-- after_run(function (target) end)
|
|
-- before_build(function (target) end)
|
|
-- after_build(function (target) end)
|
|
-- before_clean(function (target) end)
|
|
-- after_clean(function (target) end)
|
|
|
|
on_run(
|
|
(function(godot_project_folder)
|
|
return function(target)
|
|
local cmd = format("godot --path %s", godot_project_folder)
|
|
os.execv("echo", {cmd})
|
|
os.exec(cmd)
|
|
end
|
|
end)(GODOT_PROJECT_FOLDER)
|
|
)
|
|
|
|
on_package(function(target)
|
|
import("core.base.task")
|
|
|
|
target_platform = "Unknown"
|
|
|
|
if is_plat("windows") then
|
|
target_platform = "Windows Desktop"
|
|
elseif is_plat("macosx") then
|
|
target_platform = "macOS"
|
|
elseif is_plat("linux") then
|
|
target_platform = "Linux/X11"
|
|
elseif is_plat("android") then
|
|
target_platform = "Android"
|
|
end
|
|
|
|
task.run("export", {}, target_platform)
|
|
end)
|
|
|
|
after_clean(function (target)
|
|
import("core.base.task")
|
|
task.run("clean-publish")
|
|
end) |