-
Notifications
You must be signed in to change notification settings - Fork 0
/
premake5.lua
107 lines (97 loc) · 4.06 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
workspace "GTALCS.GTAVCS.PCSX2F.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 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_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 "GTALCS.GTAVCS.PCSX2F.CLEO"
kind "Makefile"
targetname "cleo"
add_ps2sdk()
targetextension ".elf"
setbuildpaths_ps2("Z:/GitHub/PCSX2-Fork-With-Plugins/bin/", "pcsx2-qtx64-clang.exe", "PLUGINS/", "%{wks.location}/../external/ps2sdk/ee/bin/vsmake.ps1", "%{wks.location}/../source/", "cleo")
writemakefile_ps2("cleo", "PLUGINS/", "0x05000000", "-l:libstdc++.a -l:libm.a",
"../includes/pcsx2/memalloc.o", "../includes/pcsx2/log.o", "utils.o", "text.o", "libres.o", "armhook.o", "touch.o", "ui.o", "pattern.o", "core.o", "mutex.o", "strutils.o", "memutils.o", "psplang.o")
writelinkfile_ps2()