-
Notifications
You must be signed in to change notification settings - Fork 1
/
premake5.lua
176 lines (162 loc) · 6.99 KB
/
premake5.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
workspace "GTALCS.GTAVCS.PSP.CLEO"
configurations { "Release", "Debug" }
platforms { "Win64" }
architecture "x64"
location "build"
objdir ("build/obj")
buildlog ("build/log/%{prj.name}.log")
cppdialect "C++latest"
include "makefile.lua"
kind "SharedLib"
language "C++"
targetdir "data/scripts"
targetextension ".asi"
characterset ("UNICODE")
staticruntime "On"
files { "source/*.h" }
files { "source/*.cpp" }
files { "Resources/*.rc" }
includedirs { "source" }
pbcommands = {
"setlocal EnableDelayedExpansion",
--"set \"path=" .. (gamepath) .. "\"",
"set file=$(TargetPath)",
"FOR %%i IN (\"%file%\") DO (",
"set filename=%%~ni",
"set fileextension=%%~xi",
"set target=!path!!filename!!fileextension!",
"if exist \"!target!\" copy /y \"%%~fi\" \"!target!\"",
")" }
function setpaths(gamepath, exepath, scriptspath)
scriptspath = scriptspath or "scripts/"
if (gamepath) then
cmdcopy = { "set \"path=" .. gamepath .. scriptspath .. "\"" }
table.insert(cmdcopy, pbcommands)
postbuildcommands (cmdcopy)
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
targetdir ("data/%{prj.name}/" .. scriptspath)
end
function setbuildpaths_psp(gamepath, exepath, scriptspath, pspsdkpath, sourcepath, prj_name)
-- local pbcmd = {}
-- for k,v in pairs(pbcommands) do
-- pbcmd[k] = v
-- end
if (gamepath) then
buildcommands {"setlocal EnableDelayedExpansion"}
rebuildcommands {"setlocal EnableDelayedExpansion"}
local ppsspppath = os.getenv "PPSSPPMemstick"
if (ppsspppath == nil) then
buildcommands {"set _PPSSPPMemstick=" .. gamepath .. "memstick/PSP"}
rebuildcommands {"set _PPSSPPMemstick=" .. gamepath .. "memstick/PSP"}
else
buildcommands {"set _PPSSPPMemstick=!PPSSPPMemstick!"}
rebuildcommands {"set _PPSSPPMemstick=!PPSSPPMemstick!"}
end
buildcommands {
"powershell -ExecutionPolicy Bypass -File \"" .. pspsdkpath .. "\" -C \"" .. sourcepath .. "\"\r\n" ..
"if !errorlevel! neq 0 exit /b !errorlevel!\r\n" ..
"if not defined _PPSSPPMemstick goto :eof\r\n" ..
"if not exist !_PPSSPPMemstick! goto :eof\r\n" ..
"if not exist !_PPSSPPMemstick!/PLUGINS/ mkdir !_PPSSPPMemstick!/PLUGINS/\r\n" ..
"set target=!_PPSSPPMemstick!/PLUGINS/$(ProjectName)\r\n" ..
"copy /y $(NMakeOutput) \"!target!\"\r\n"
}
rebuildcommands {
"powershell -ExecutionPolicy Bypass -File \"" .. pspsdkpath .. "\" -C \"" .. sourcepath .. "\" clean\r\n" ..
"powershell -ExecutionPolicy Bypass -File \"" .. pspsdkpath .. "\" -C \"" .. sourcepath .. "\"\r\n" ..
"if !errorlevel! neq 0 exit /b !errorlevel!\r\n" ..
"if not defined _PPSSPPMemstick goto :eof\r\n" ..
"if not exist !_PPSSPPMemstick! goto :eof\r\n" ..
"set target=!_PPSSPPMemstick!/PLUGINS/$(ProjectName)\r\n" ..
"copy /y $(NMakeOutput) \"!target!\"\r\n"
}
cleancommands {
"setlocal EnableDelayedExpansion\r\n" ..
"powershell -ExecutionPolicy Bypass -File \"" .. pspsdkpath .. "\" -C \"" .. sourcepath .. "\" clean\r\n" ..
"if !errorlevel! neq 0 exit /b !errorlevel!\r\n"
}
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
targetdir ("data/" .. scriptspath)
end
function setbuildpaths_ps2(gamepath, exepath, scriptspath, ps2sdkpath, sourcepath, prj_name)
-- local pbcmd = {}
-- for k,v in pairs(pbcommands) do
-- pbcmd[k] = v
-- end
if (gamepath) then
buildcommands {"setlocal EnableDelayedExpansion"}
rebuildcommands {"setlocal EnableDelayedExpansion"}
local pcsx2fpath = os.getenv "PCSX2FDir"
if (pcsx2fpath == nil) then
buildcommands {"set _PCSX2FDir=" .. gamepath}
rebuildcommands {"set _PCSX2FDir=" .. gamepath}
else
buildcommands {"set _PCSX2FDir=!PCSX2FDir!"}
rebuildcommands {"set _PCSX2FDir=!PCSX2FDir!"}
end
buildcommands {
"powershell -ExecutionPolicy Bypass -File \"" .. ps2sdkpath .. "\" -C \"" .. sourcepath .. "\"\r\n" ..
"if !errorlevel! neq 0 exit /b !errorlevel!\r\n" ..
"if not defined _PCSX2FDir goto :eof\r\n" ..
"if not exist !_PCSX2FDir! goto :eof\r\n" ..
"if not exist !_PCSX2FDir!/PLUGINS mkdir !_PCSX2FDir!/PLUGINS\r\n" ..
"set target=!_PCSX2FDir!/PLUGINS/\r\n" ..
"copy /y $(NMakeOutput) \"!target!\"\r\n"
}
rebuildcommands {
"powershell -ExecutionPolicy Bypass -File \"" .. ps2sdkpath .. "\" -C \"" .. sourcepath .. "\" clean\r\n" ..
"powershell -ExecutionPolicy Bypass -File \"" .. ps2sdkpath .. "\" -C \"" .. sourcepath .. "\"\r\n" ..
"if !errorlevel! neq 0 exit /b !errorlevel!\r\n" ..
"if not defined _PCSX2FDir goto :eof\r\n" ..
"if not exist !_PCSX2FDir! goto :eof\r\n" ..
"if not exist !_PCSX2FDir!/PLUGINS mkdir !_PCSX2FDir!/PLUGINS\r\n" ..
"set target=!_PCSX2FDir!/PLUGINS/\r\n" ..
"copy /y $(NMakeOutput) \"!target!\"\r\n"
}
cleancommands {
"setlocal EnableDelayedExpansion\r\n" ..
"powershell -ExecutionPolicy Bypass -File \"" .. ps2sdkpath .. "\" -C \"" .. sourcepath .. "\" clean\r\n" ..
"if !errorlevel! neq 0 exit /b !errorlevel!"
}
debugdir (gamepath)
if (exepath) then
debugcommand (gamepath .. exepath)
dir, file = exepath:match'(.*/)(.*)'
debugdir (gamepath .. (dir or ""))
end
end
targetdir ("data/" .. scriptspath)
end
function add_pspsdk()
includedirs { "external/pspsdk/usr/local/pspdev/psp/sdk/include" }
includedirs { "external/pspsdk/usr/local/pspdev/bin" }
files { "source/*.h", "source/*.c", "source/*.cpp", "source/makefile" }
end
function add_ps2sdk()
includedirs { "external/ps2sdk/ps2sdk/ee" }
files { "source/*.h", "source/*.c", "source/*.cpp", "source/makefile" }
end
filter "configurations:Debug*"
defines "DEBUG"
symbols "On"
filter "configurations:Release*"
defines "NDEBUG"
optimize "On"
project "cleo"
kind "Makefile"
add_pspsdk()
targetextension ".prx"
setbuildpaths_psp("Z:/WFP/Games/PPSSPP/", "PPSSPPWindows64.exe", "memstick/PSP/PLUGINS/cleo/", "%{wks.location}/../external/pspsdk/vsmake.ps1", "%{wks.location}/../source/", "cleo")
writemakefile_psp("cleo", "utils.o", "text.o", "libres.o", "armhook.o", "touch.o", "ui.o", "plugins.o", "pattern.o", "core.o", "mutex.o", "strutils.o", "memutils.o", "psplang.o")