forked from jingkaimori/midieditor
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxmake.lua
122 lines (113 loc) · 4.13 KB
/
xmake.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
local MIDIEDITOR_RELEASE_VERSION_STRING = "3.8.1"
set_version(MIDIEDITOR_RELEASE_VERSION_STRING)
includes("scripts/xmake/packages.lua")
add_all_requires()
target("ProMidEdit") do
add_packages({
"rtmidi",
"qt5widgets"
})
add_rules("qt.widgetapp")
add_frameworks({
"QtGui",
"QtWidgets",
"QtCore",
"QtNetwork",
"QtXml",
"QtMultimedia",
"QtMultimediaWidgets"
})
add_files("src/**.cpp")
add_files("src/**.h")
add_files("resources.qrc")
if is_arch("x86_64") then
add_defines("__ARCH64__")
end
add_defines("MIDIEDITOR_RELEASE_VERSION_ID_DEF=" .. 0)
add_defines("MIDIEDITOR_RELEASE_DATE_DEF=" .. os.date("%x"))
add_defines("MIDIEDITOR_RELEASE_VERSION_STRING_DEF=" .. MIDIEDITOR_RELEASE_VERSION_STRING)
if is_plat("linux", "bsd") then
add_defines({
"__LINUX_ALSASEQ__",
"__LINUX_ALSA__"
})
add_syslinks("asound")
elseif is_plat("windows", "mingw") then
add_defines("__WINDOWS_MM__")
add_syslinks("winmm")
add_files("midieditor.rc")
elseif is_plat("macosx") then
add_defines("__MACOSX_CORE__")
add_frameworks("CoreMidi", "CoreAudio", "CoreFoundation")
-- TODO: icons
add_installfiles("midieditor.icns")
end
local installdir = "packaging/org.midieditor.midieditor/data/"
local bindir = path.join(installdir, "bin")
local plugindir = path.join(bindir, "plugins")
set_installdir(installdir)
if is_plat("windows") then
set_values("qt.deploy.flags", {
"--plugindir", plugindir,
"--libdir", bindir
})
after_install(function (target)
os.rm(path.join(bindir, "**", "dsengine.dll"))
end)
elseif is_plat("mingw") then
after_install(function (target)
print("after_install of target ProMidEdit")
import("core.base.option")
import("core.project.config")
import("lib.detect.find_tool")
-- get windeployqt
local windeployqt_tool = assert(
find_tool("windeployqt", {check = "--help"}),
"windeployqt.exe not found!")
local windeployqt = windeployqt_tool.program
-- deploy necessary dll
-- mingw with posix thread should be used, or dll error will be reported
local deploy_argv = {"--compiler-runtime", "--release"}
if option.get("diagnosis") then
table.insert(deploy_argv, "--verbose=2")
elseif option.get("verbose") then
table.insert(deploy_argv, "--verbose=1")
else
table.insert(deploy_argv, "--verbose=0")
end
local bindir = path.join(target:installdir(), "bin")
local plugindir = path.join(bindir, "plugins")
-- print(plugindir)
table.join2(deploy_argv, {"--plugindir", plugindir})
table.join2(deploy_argv, {"--libdir", bindir})
table.insert(deploy_argv, bindir)
os.iorunv(windeployqt, deploy_argv)
os.rm(path.join(bindir, "**", "dsengine.dll"))
end)
end
end
target("installer") do
set_kind("phony")
local installdir =
set_installdir("packaging/org.midieditor.manual/data/manual")
add_installfiles("manual/(**)")
add_packages("qtifw")
add_deps("ProMidEdit")
after_install(function (target, opt)
if is_plat("windows", "mingw") then
print("generate off-line installer")
import("core.project.config")
import("lib.detect.find_tool")
local qtifw_dir = target:pkg("qtifw"):installdir()
local binarycreator_path = path.join(qtifw_dir, "/bin/binarycreator.exe")
-- generate windows package
local buildir = config.buildir()
local package_argv = {
"--config", "scripts/packaging/windows/config.xml",
"--packages", "packaging",
"packaging/Install.exe"
}
os.iorunv(binarycreator_path, package_argv)
end
end)
end