-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathremake_lunar.lua
69 lines (61 loc) · 2.17 KB
/
remake_lunar.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
DEBUG_FOLDER = "debug"
RELEASE_FOLDER = "release"
MAKEFILE = "Makefile"
MAKEFILE_DEBUG = "Makeutil.debug"
MAKEFILE_RELEASE = "Makeutil.release"
function rebuild(pro_file, append_to_pro_file, makefile, make)
print("clear...")
util.pathRemoveAll(DEBUG_FOLDER)
util.pathRemoveAll(RELEASE_FOLDER)
util.pathRemove(MAKEFILE)
util.pathRemove(MAKEFILE_DEBUG)
util.pathRemove(MAKEFILE_RELEASE)
util.pathRemove(pro_file)
print("clear debug,release,makefile successfully!")
print("process cpp/cxx/c/hpp/hxx/h files in publish directory.")
local publish_files = util.findFilesInDirRecursively("./publish")
for _, v in ipairs(publish_files) do
if util.strEndWith(v, ".cpp", false) or
util.strEndWith(v, ".cxx", false) or
util.strEndWith(v, ".hpp", false) or
util.strEndWith(v, ".hxx", false) or
util.strEndWith(v, ".c", false) or
util.strEndWith(v, ".h", false) then
util.pathRename(v, v .. ".tmpback")
end
end
print("qmake -project")
os.execute("qmake -project")
print("restore cpp/cxx/c/hpp/hxx/h files in publish directory.")
local publish_files = util.findFilesInDirRecursively("./publish")
for _, v in ipairs(publish_files) do
if util.strEndWith(v, ".tmpback", false) then
util.pathRename(v, util.strLeft(v, string.len(v) - 8))
end
end
print("append " .. append_to_pro_file .. " to " .. pro_file)
util.writeTextFile(pro_file, util.readTextFile(append_to_pro_file), true)
print("qmake")
os.execute("qmake")
print("qmake successfully!")
print(make)
os.execute(make .. " -f " .. makefile)
end
-- start
PRO = "Lunar.pro"
if util.strContains(util.platformInfo(), "unix", false) then
if util.strContains(util.platformInfo(), "macos", false) then
ADDTOPRO = "build_config_macos"
else
ADDTOPRO = "build_config_unix"
end
MAKE = "make"
elseif util.strContains(util.platformInfo(), "windows", false) then
ADDTOPRO = "build_config_windows"
MAKE = "mingw32-make"
else
print("rebuild release fail!")
exit(0)
end
rebuild(PRO, ADDTOPRO, MAKEFILE, MAKE)
print("rebuild release finished!")