Created
November 1, 2017 15:25
-
-
Save Zer0xFF/fc4688245e4ea9407f42c110ee96070c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
set(triple "x86_64-scei-ps4") | |
set(CMAKE_SYSTEM_NAME "FreeBSD") | |
set(CMAKE_C_COMPILER "clang") | |
set(CMAKE_CXX_COMPILER "clang++") | |
set(CMAKE_C_COMPILER_AR "ar") | |
set(CMAKE_LINKER "clang") | |
set(CMAKE_ASM_COMPILER "clang") | |
set(CMAKE_FIND_ROOT_PATH "$ENV{PS4SDK}/usr" CACHE STRING "") | |
set(CMAKE_SYSROOT "$ENV{PS4SDK}/usr" CACHE STRING "") | |
set(CMAKE_CXX_COMPILER_FORCED on) | |
set(CMAKE_C_COMPILER_TARGET "${triple}") | |
set(CMAKE_CXX_COMPILER_TARGET "${triple}") | |
# only search for libraries and includes in the PS4SDK directory | |
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | |
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | |
set(CMAKE_SKIP_RPATH true) | |
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "") | |
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" CACHE STRING "") | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -pedantic -m64 -mcmodel=large -nostdlib -nostdinc -ffreestanding -fPIE -fno-builtin -fno-stack-protector -D__PS4__" CACHE STRING "") | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -m64 -mcmodel=large -nostdlib -nostdinc -ffreestanding -fPIE -fno-stack-protector -D__PS4__" CACHE STRING "") | |
set(CMAKE_EXE_LINKER_FLAGS "-O3 -Wall -m64 -pie -nostartfiles -nostdlib $ENV{PS4SDK}/crt0.s " CACHE STRING "") | |
link_directories("$ENV{PS4SDK}/lib") | |
set(TOOLCHAIN_PS4SDK_LIBS) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_extension_kernel_execute_dynlib_prepare_dlclose Ps4_extension_kernel_call_standard) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_common_kernel Ps4_common_user Ps4_common_generic) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_common_generic) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4LibCInternalAdaptive_stub Ps4LibKernelAdaptive_stub) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS SceLibcInternal_stub kernel_stub) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS ps4Kernel_stub) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_stub_resolve_minimal) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_kernel_dlsym_standard Ps4_base_kernel_seek_elf_address_standard) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_assembler_register_parameter_standard) | |
LIST(APPEND TOOLCHAIN_PS4SDK_LIBS Ps4_base_assembler_system_call_rop_0x93a4FFFF8) | |
# this is a work around to avoid duplicate library warning, | |
# as the toolchain file can be proccessed multiple times | |
# people over cmake IRC suggest I move this to a find module | |
if(NOT TARGET PS4::LIBS) | |
add_library(PS4LIBS INTERFACE) | |
add_library(PS4::LIBS ALIAS PS4LIBS) | |
target_link_libraries(PS4LIBS INTERFACE ${TOOLCHAIN_PS4SDK_LIBS}) | |
endif() | |
if(NOT TARGET PS4::HEADERS) | |
add_library(PS4HEADERS INTERFACE) | |
add_library(PS4::HEADERS ALIAS PS4HEADERS) | |
target_include_directories(PS4HEADERS INTERFACE "$ENV{PS4SDK}/include/c++/v1/" "$ENV{PS4SDK}/include/" "$ENV{PS4SDK}/include/sce/" "$ENV{PS4SDK}/include/ps4/") | |
include_directories(SYSTEM "$ENV{PS4SDK}/include/c++/v1/" "$ENV{PS4SDK}/include/" "$ENV{PS4SDK}/include/sce/" "$ENV{PS4SDK}/include/ps4/") | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment