Last active
April 30, 2022 06:35
-
-
Save Pikachuxxxx/cd3d204bcfac69ce5143a0b5e3c8a6bd to your computer and use it in GitHub Desktop.
PSVita premake custom arm-vita-eabi tool chain build test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VITASDK = os.getenv("VITASDK") | |
if VITASDK ~= nil then | |
print("VITASDK found at : " .. VITASDK) | |
else | |
print("VITASDK Env variable not set, please check your environment settings") | |
end | |
-- define custom arm-vita-eabi toolchain for compilation and VPK creation | |
premake.tools.arm_gcc = {} | |
local arm_gcc = premake.tools.arm_gcc | |
local gcc = premake.tools.gcc | |
arm_gcc.getcflags = gcc.getcflags | |
arm_gcc.getcxxflags = gcc.getcxxflags | |
arm_gcc.getforceincludes = gcc.getforceincludes | |
arm_gcc.getldflags = gcc.getldflags | |
arm_gcc.getcppflags = gcc.getcppflags | |
arm_gcc.getdefines = gcc.getdefines | |
arm_gcc.getincludedirs = gcc.getincludedirs | |
arm_gcc.getrunpathdirs = gcc.getrunpathdirs | |
arm_gcc.getundefines = gcc.getundefines | |
arm_gcc.getLibraryDirectories = gcc.getLibraryDirectories | |
arm_gcc.getlinks = gcc.getlinks | |
arm_gcc.getmakesettings = gcc.getmakesettings | |
function arm_gcc.gettoolname (cfg, tool) | |
local prefix = VITASDK--path.getabsolute("vendor/vitasdk") | |
prefix = prefix .. "/bin/arm-vita-eabi-" | |
if tool == "cc" then | |
name = prefix .. "gcc" | |
elseif tool == "cxx" then | |
name = prefix .. "g++" | |
elseif tool == "ar" then | |
name = prefix .. "ar" | |
else | |
name = nil | |
end | |
return name | |
end | |
-- Various build configuration for the engine | |
configurations | |
{ | |
"Debug", | |
"Release" | |
} | |
workspace "PSVitaStuff" | |
toolset "arm_gcc" | |
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" | |
location "build_premake" | |
kind "ConsoleApp" | |
project "debugprint" | |
cppdialect "C++11" | |
--targetextension ".elf" | |
buildoptions { "-Wl,-q" } | |
linkoptions { "-Wl,-q" } | |
files | |
{ | |
"src/**.h", | |
"src/**.c", | |
"src/**.cpp", | |
"src/**.inl", | |
"../common/debugScreen.c" | |
} | |
includedirs | |
{ | |
"%{VITASDK}/" .. "include/", | |
"%{VITASDK}/" .. "/arm-vita-eabi/include/", | |
"../common" | |
} | |
sysincludedirs | |
{ | |
"%{VITASDK}/" .. "include/", | |
"%{VITASDK}/" .. "/arm-vita-eabi/include/", | |
"../common" | |
} | |
libdirs | |
{ | |
"%{VITASDK}/" .. "lib/", | |
"%{VITASDK}/" .. "/arm-vita-eabi/lib/" | |
} | |
links | |
{ | |
"SceDisplay_stub", | |
"SceIofilemgr_stub", | |
"SceIofilemgrForDriver_stub" | |
} | |
postbuildcommands | |
{ | |
--"echo Stripping debug symbols from elf", | |
--"%{VITASDK}/bin/arm-vita-eabi-strip -g %{cfg.buildtarget.abspath}/%{prj.name}", | |
"echo Converting to Sony ELF velf", | |
"%{VITASDK}/bin/vita-elf-create %{cfg.buildtarget.directory}/%{prj.name} %{cfg.buildtarget.directory}/%{prj.name}.velf", | |
"echo generating self.out", | |
"%{VITASDK}/bin/vita-make-fself -c -s %{cfg.buildtarget.directory}/%{prj.name}.velf %{cfg.buildtarget.directory}/%{prj.name}.self.out", | |
"echo chaning self.out to .self by copying back in here", | |
"{COPY} %{cfg.buildtarget.directory}/%{prj.name}.self.out %{cfg.buildtarget.directory}/%{prj.name}.self", | |
"echo generating param.sfo", | |
"%{VITASDK}/bin/vita-mksfoex -s APP_VER=01.00 -s TITLE_ID=VSPM00001 debugprint %{cfg.buildtarget.directory}/%{prj.name}.vpk_param.sfo", | |
"echo creating VPK.out", | |
"%{VITASDK}/bin/vita-pack-vpk -s %{cfg.buildtarget.directory}/%{prj.name}.vpk_param.sfo -b %{cfg.buildtarget.directory}/%{prj.name}.self %{cfg.buildtarget.directory}/%{prj.name}.vpk" | |
} | |
filter "configurations:Debug" | |
symbols "On" | |
optimize "Off" | |
filter "configurations:Release" | |
optimize "Speed" | |
symbols "On" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment