Skip to content

Commit

Permalink
some changes to help OpenOrbis SDK builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiller423 committed Mar 6, 2020
1 parent 2e534e7 commit 3b54548
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 8 deletions.
35 changes: 28 additions & 7 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"environments": [
{
// Could set things up here instead of the toolchain file, instead make this global env. and use a TOOLCHAIN var
//"INCLUDE": "${env.INCLUDE};",

"TOOLCHAIN_FILE": "ps4sdk.cmake",
"environment": "toolchain.generic"
"BuildPath": "${projectDir}\\out\\build\\${name}",
"InstallPath": "${projectDir}\\out\\install\\${name}"
},
{
"name": "clang_ext",
"namespace": "cl",
"inheritEnvironments": [ "clang_cl_x64" ],
"cc": "clang",
"cxx": "clang++"
}
],
"configurations": [
Expand All @@ -22,17 +26,34 @@
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "PS4 OpenOrbis",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",

"buildRoot": "${env.BuildPath}",
"installRoot": "${env.InstallPath}",

"cmakeToolchain": "${projectDir}\\cmake\\oosdk.cmake",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",

"inheritEnvironments": [ "clang_ext" ],
"variables": []
},
{
//"variables": [ { "TOOLCHAIN_FILE": "ps4sdk.cmake" } ], // This doesn't seem to override toolchain.generic:: [env.]TOOLCHAIN_FILE , or pass to the cmake cache

"name": "PS4 SDK",
"name": "PS4 (SCEI) SDK",
"generator": "Ninja",
"description": "TemplateDescription_Localize_PS4SDK",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "toolchain.generic" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "D:\\dev\\orbis_sdk_500\\portlibs\\SDL",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=${projectDir}\\cmake\\ps4sdk.cmake", // ${projectDir}/cmake/${env.TOOLCHAIN_FILE}
"cmakeToolchain": "${projectDir}\\cmake\\ps4sdk.cmake",
"cmakeCommandArgs": "", // ${projectDir}/cmake/${env.TOOLCHAIN_FILE}
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
Expand Down
81 changes: 81 additions & 0 deletions cmake/oosdk.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
## ps4sdk.cmake - Playstation4 cross-compile
#
set(CMAKE_SYSTEM_NAME FreeBSD) # this one is important
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_SYSTEM_VERSION 9) # this one not so much



set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) # for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)





if (NOT "" STREQUAL "$ENV{OO_PS4_TOOLCHAIN}")
#
file(TO_CMAKE_PATH $ENV{OO_PS4_TOOLCHAIN} PS4SDK)
#
elseif(NOT "" STREQUAL "$ENV{PS4SDK}")
#
file(TO_CMAKE_PATH $ENV{PS4SDK} PS4SDK)
#
else()
#
error("Need PS4SDK set!")
#
endif()




set(triple "x86_64-scei-ps4-elf")

set(CMAKE_CXX_COMPILER_FORCED ON)

set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)

set(CMAKE_C_COMPILER_TARGET ${triple})


set(CMAKE_LINKER "ld.lld")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>") # <FLAGS> <CMAKE_C_LINK_FLAGS> ")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")

set(CMAKE_C_FLAGS_INIT "-v -target x86_64-scei-ps4 -Xclang -emit-obj -Xclang -munwind-tables")
#set(CMAKE_C_FLAGS "-target x86_64-scei-ps4")


include_directories(${PS4SDK}/include)
include_directories(${PS4SDK}/include/orbis)

link_directories(${PS4SDK}/lib)


set(OO_LDS "${PS4SDK}/link.x")
set(OO_CRT "${PS4SDK}/lib/crt1.o")

set(OO_LIBS -lc -lkernel)
#link_libraries(-lc -lkernel) This is adding dir w. -Wl,-rpath even though it's already set with -L ;smdh;

#-m elf_x86_64 -pie --script "%OO_PS4_TOOLCHAIN%\link.x" --eh-frame-hdr -o "%outputElf%" "-L%OO_PS4_TOOLCHAIN%\\lib" %libraries% --verbose "%OO_PS4_TOOLCHAIN%\lib\crt1.o" %obj_files%
add_link_options(-m elf_x86_64 -pie --script "${OO_LDS}" --eh-frame-hdr --verbose "${OO_CRT}" ${OO_LIBS})



#set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
#set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf")


set(PS4 ON)
set(ORBIS ON)

add_definitions(-DPS4 -D__Orbis__ -DOO)





2 changes: 1 addition & 1 deletion src/thread/pthread/SDL_systhread.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

#include "SDL_assert.h"

#ifndef __NACL__
#if !defined(__NACL__) && !defined(__ORBIS__) && !defined(PS4)
/* List of signals to mask in the subthreads */
static const int sig_list[] = {
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
Expand Down
4 changes: 4 additions & 0 deletions src/video/ps4/SDL_ps4video.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
#include "../../SDL_internal.h"
#include "../SDL_sysvideo.h"

#ifdef OO
#include <VideoOut.h>
#else
#include <video_out.h>
#endif

#define VOUT_NUM_BUFFERS 2

Expand Down

0 comments on commit 3b54548

Please sign in to comment.