@@ -171,7 +171,7 @@ private void BuildForLinuxAArch64()
171171 var buildFile = Path . Combine ( buildDir , m_LibName ) ;
172172 File . Copy ( buildFile , libFile , true ) ;
173173 }
174-
174+
175175 private void BuildForMac ( )
176176 {
177177 var abiName = Target . Architecture ;
@@ -212,6 +212,38 @@ private void BuildForIOS()
212212 PublicAdditionalLibraries . Add ( libFile ) ;
213213 }
214214
215+ private void BuildForPS5 ( )
216+ {
217+ var libFile = GetLibraryPath ( ) ;
218+ PublicAdditionalLibraries . Add ( libFile ) ;
219+ PublicIncludePaths . Add ( Path . Combine ( ModuleDirectory , m_LuaDirName , "src-ps5" ) ) ;
220+
221+ if ( File . Exists ( libFile ) )
222+ return ;
223+
224+ var sceRootDir = Environment . GetEnvironmentVariable ( "SCE_ROOT_DIR" ) ;
225+ if ( string . IsNullOrEmpty ( sceRootDir ) )
226+ throw new BuildException ( "SCE_ROOT_DIR environment variable needed." ) ;
227+
228+ var sceSdkDir = Environment . GetEnvironmentVariable ( "SCE_PROSPERO_SDK_DIR" ) ;
229+ if ( string . IsNullOrEmpty ( sceSdkDir ) )
230+ throw new BuildException ( "SCE_PROSPERO_SDK_DIR environment variable needed." ) ;
231+
232+ EnsureDirectoryExists ( libFile ) ;
233+ var sysRoot = Path . Combine ( sceSdkDir , @"target" ) ;
234+ var clangPath = Path . Combine ( sceSdkDir , @"host_tools/bin/prospero-clang.exe" ) ;
235+ var clangPlusPlusPath = Path . Combine ( sceSdkDir , @"host_tools/bin/prospero-clang.exe" ) ;
236+ var arPath = Path . Combine ( sceSdkDir , @"host_tools/bin/prospero-llvm-ar.exe" ) ;
237+ var args = new Dictionary < string , string >
238+ {
239+ { "CMAKE_TOOLCHAIN_FILE" , Path . Combine ( sceRootDir , @"Prospero\Tools\CMake\PS5.cmake" ) } ,
240+ { "PS5" , "1" }
241+ } ;
242+ var buildDir = CMake ( args ) ;
243+ var buildFile = Path . Combine ( buildDir , m_Config , m_LibName ) ;
244+ File . Copy ( buildFile , libFile , true ) ;
245+ }
246+
215247 #endregion
216248
217249 private string CMake ( Dictionary < string , string > extraArgs = null )
@@ -284,7 +316,7 @@ private string CMake(Dictionary<string, string> extraArgs = null)
284316 foreach ( var arg in extraArgs )
285317 writer . Write ( " -D{0}={1}" , arg . Key , arg . Value ) ;
286318 writer . WriteLine ( ) ;
287- writer . WriteLine ( "cd ../.." ) ;
319+ writer . WriteLine ( "cd ../.." ) ;
288320 writer . WriteLine ( "cmake --build {0}/build --config {1}" , m_LuaDirName , m_Config ) ;
289321 }
290322
@@ -391,6 +423,7 @@ private string GetBuildSystem()
391423 return "Xcode" ;
392424 return "Unix Makefiles" ;
393425 }
426+
394427 return null ;
395428 }
396429
@@ -410,4 +443,4 @@ private void SetupForRuntimeDependency(string fullPath, string platform)
410443 private readonly string m_LuaDirName ;
411444 private readonly string m_BuildSystem ;
412445 private readonly bool m_CompileAsCpp ;
413- }
446+ }
0 commit comments