Merge pull request #90 from madebr/macos_ps2_fix

Use ps2dev docker for playstation 2 + fix macos error
This commit is contained in:
aap 2021-08-19 15:36:42 +02:00 committed by GitHub
commit 57559969f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 95 additions and 70 deletions

View File

@ -1,12 +1,12 @@
image: Visual Studio 2017
configuration: Release
environment:
GLFW_BASE: glfw-3.2.1.bin.WIN64
GLFW_URL: https://github.com/glfw/glfw/releases/download/3.2.1/%GLFW_BASE%.zip
SDL2_BASE: SDL2-devel-2.0.8-VC
GLFW_BASE: glfw-3.3.4.bin.WIN64
GLFW_URL: https://github.com/glfw/glfw/releases/download/3.3.4/%GLFW_BASE%.zip
SDL2_BASE: SDL2-devel-2.0.14-VC
SDL2_URL: https://www.libsdl.org/release/%SDL2_BASE%.zip
SDL2_DIRAME: SDL2-2.0.8
PREMAKE5_URL: https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-windows.zip
SDL2_DIRAME: SDL2-2.0.14
PREMAKE5_URL: https://github.com/premake/premake-core/releases/download/v5.0.0-alpha16/premake-5.0.0-alpha16-windows.zip
matrix:
- PLATFORM: win-amd64-null
- PLATFORM: win-amd64-gl3

View File

@ -1,4 +1,4 @@
name: Build using conan+cmake
name: Conan
on:
pull_request:
push:
@ -9,11 +9,9 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
platform: ['null', 'gl3', 'd3d9', 'ps2']
platform: ['null', 'gl3', 'd3d9']
gl3_gfxlib: ['glfw', 'sdl2']
exclude:
- os: windows-latest
platform: ps2
- os: ubuntu-latest
platform: d3d9
- os: macos-latest
@ -22,10 +20,7 @@ jobs:
gl3_gfxlib: sdl2
- platform: d3d9
gl3_gfxlib: sdl2
- platform: ps2
gl3_gfxlib: sdl2
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.platform == 'ps2' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
@ -38,28 +33,10 @@ jobs:
conan config set log.print_run_commands=True
conan config set general.revisions_enabled=1
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
- name: "Add os=Playstation2 + gcc.version=3.2 to .conan/settings.yml"
if: ${{ matrix.platform == 'ps2' }}
shell: python
run: |
import os, yaml
settings_path = os.path.expanduser("~/.conan/settings.yml")
yml = yaml.safe_load(open(settings_path))
yml["os"]["Playstation2"] = None
yml["compiler"]["gcc"]["version"].append("3.2")
yml["compiler"]["gcc"]["version"].sort()
yaml.safe_dump(yml, open(settings_path, "w"))
- name: "Create host profile"
shell: bash
run: |
if test "${{ matrix.platform }}" = "ps2"; then
cp conan/playstation2 host_profile
else
cp ~/.conan/profiles/default host_profile
fi
- name: "Export Playstation 2 CMake toolchain conan recipe"
run: |
conan export cmake/ps2/cmaketoolchain ps2dev-cmaketoolchain/master@
cp ~/.conan/profiles/default host_profile
- name: "Download/build dependencies (conan install)"
run: |
conan install ${{ github.workspace }} librw/master@ -if build -o librw:platform=${{ matrix.platform }} -o librw:gl3_gfxlib=${{ matrix.gl3_gfxlib }} --build missing -pr:h ./host_profile -pr:b default

29
.github/workflows/build-ps2.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Playstation 2 (by ps2dev)
on:
pull_request:
push:
release:
types: published
jobs:
build-playstation-2:
runs-on: ubuntu-latest
container: ps2dev/ps2dev
steps:
- uses: actions/checkout@v2
- name: "Install dependencies"
run: |
apk add build-base cmake
- name: "Build files"
run: |
cmake -S. -Bbuild -DLIBRW_INSTALL=ON -DLIBRW_PLATFORM=PS2 -DCMAKE_TOOLCHAIN_FILE=cmake/ps2/cmaketoolchain/toolchain_ps2_ee.cmake
cmake --build build --parallel
- name: "Create binary package (cpack)"
working-directory: ./build
run: |
cpack
- name: "Archive binary package (github artifacts)"
uses: actions/upload-artifact@v2
with:
name: "ps2"
path: build/*.tar.xz
if-no-files-found: error

View File

@ -1,4 +1,4 @@
name: Build for Nintendo Switch using CMake provided by devkitPro
name: Nintendo Switch (by devkitPro)
on:
pull_request:
push:

View File

@ -16,7 +16,7 @@ elseif(NINTENDO_SWITCH)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nx")
include(NXFunctions)
elseif(PS2)
set(LIBRW_PLATFORMS "NULL" "PS2")
set(LIBRW_PLATFORMS "PS2")
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ps2")
include(PS2Functions)
@ -24,7 +24,8 @@ else()
set(LIBRW_PLATFORMS "NULL" "GL3")
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL ON)
endif()
set(LIBRW_PLATFORM "NULL" CACHE STRING "Platform")
list(GET LIBRW_PLATFORMS 0 LIBRW_PLATFORM_DEFAULT)
set(LIBRW_PLATFORM "${LIBRW_PLATFORM_DEFAULT}" CACHE STRING "Platform")
set_property(CACHE LIBRW_PLATFORM PROPERTY STRINGS ${LIBRW_PLATFORMS})
message(STATUS "LIBRW_PLATFORM = ${LIBRW_PLATFORM} (choices=${LIBRW_PLATFORMS})")
set("LIBRW_PLATFORM_${LIBRW_PLATFORM}" ON)
@ -55,7 +56,7 @@ include(CMakeDependentOption)
option(LIBRW_TOOLS "Build librw tools" ON)
option(LIBRW_INSTALL "Install librw files" OFF)
cmake_dependent_option(LIBRW_EXAMPLES "Build librw examples" ON "NOT LIBRW_PLATFORM_PS2;NOT LIBRW_PLATFORM_NULL" OFF)
cmake_dependent_option(LIBRW_EXAMPLES "Build librw examples" ON "LIBRW_TOOLS;NOT LIBRW_PLATFORM_NULL" OFF)
if(LIBRW_INSTALL)
include(GNUInstallDirs)
@ -127,12 +128,14 @@ if(LIBRW_INSTALL)
if(NOT LIBRW_PLATFORM_PS2)
if(WIN32)
set(os "-win")
elseif(NINTENDO_SWITCH)
set(os "-switch")
elseif(PS2)
set(os "-ps2")
elseif(APPLE)
set(os "-apple")
elseif(UNIX)
set(os "-linux")
elseif(NINTENDO_SWITCH)
set(os "-switch")
else()
set(compiler "-UNK")
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")

View File

@ -3,11 +3,9 @@ cmake_minimum_required(VERSION 3.7)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(CMAKE_SYSTEM_NAME "PlayStation2")
set(CMAKE_SYSTEM_PROCESSOR "mipsel")
set(CMAKE_SYSTEM_PROCESSOR "mips64r5900el")
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
@ -18,37 +16,47 @@ endif()
if(NOT DEFINED ENV{PS2SDK})
message(FATAL_ERROR "Need environment variable PS2SDK set")
endif()
if(NOT DEFINED ENV{GSKIT})
message(FATAL_ERROR "Need environment variable PS2SDK set")
endif()
set(PS2DEV "$ENV{PS2DEV}")
set(PS2SDK "$ENV{PS2SDK}")
set(GSKIT "$ENV{GSKIT}")
if(NOT IS_DIRECTORY "${PS2DEV}")
message(FATAL_ERROR "PS2DEV must contain a folder path (${PS2DEV})")
message(FATAL_ERROR "PS2DEV must be a folder path (${PS2DEV})")
endif()
if(NOT IS_DIRECTORY "${PS2SDK}")
message(FATAL_ERROR "PS2SDK must contain a folder path (${PS2SDK})")
message(FATAL_ERROR "PS2SDK must be a folder path (${PS2SDK})")
endif()
if(NOT IS_DIRECTORY "${GSKIT}")
message(FATAL_ERROR "GSKIT must be a folder path (${GSKIT})")
endif()
set(CMAKE_DSM_SOURCE_FILE_EXTENSIONS "dsm")
set(CMAKE_C_COMPILER "${PS2DEV}/ee/bin/ee-gcc")
set(CMAKE_CXX_COMPILER "${PS2DEV}/ee/bin/ee-g++")
set(CMAKE_ASM_COMPILER "${PS2DEV}/ee/bin/ee-g++")
set(CMAKE_DSM_COMPILER "${PS2DEV}/dvp/bin/dvp-as")
set(CMAKE_AR "${PS2DEV}/ee/bin/ee-ar" CACHE FILEPATH "archiver")
set(CMAKE_LINKER "${PS2DEV}/ee/bin/ee-ld")
set(CMAKE_RANLIB "${PS2DEV}/ee/bin/ee-ranlib" CACHE FILEPATH "ranlib")
set(CMAKE_STRIP "${PS2DEV}/ee/bin/ee-strip" CACHE FILEPATH "strip")
set(CMAKE_C_COMPILER "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-gcc" CACHE FILEPATH "C compiler")
set(CMAKE_CXX_COMPILER "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-g++" CACHE FILEPATH "CXX compiler")
set(CMAKE_ASM_COMPILER "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-g++" CACHE FILEPATH "ASM assembler")
set(CMAKE_DSM_COMPILER "${PS2DEV}/dvp/bin/dvp-as" CACHE FILEPATH "DSM assembler")
set(CMAKE_AR "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-ar" CACHE FILEPATH "archiver")
set(CMAKE_LINKER "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-ld" CACHE FILEPATH "Linker")
set(CMAKE_RANLIB "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-ranlib" CACHE FILEPATH "ranlib")
set(CMAKE_STRIP "${PS2DEV}/ee/bin/mips64r5900el-ps2-elf-strip" CACHE FILEPATH "strip")
set(CMAKE_ASM_FLAGS_INIT "-G0 -I\"${PS2SDK}/ee/include\" -I\"${PS2SDK}/common/include\"")
set(CMAKE_C_FLAGS_INIT "-G0 -fno-common -I\"${PS2SDK}/ee/include\" -I\"${PS2SDK}/common/include\"")
set(CMAKE_CXX_FLAGS_INIT "-G0 -fno-common -I\"${PS2SDK}/ee/include\" -I\"${PS2SDK}/common/include\"")
set(CMAKE_ASM_FLAGS_INIT "-G0 -I\"${PS2SDK}/ee/include\" -I\"${PS2SDK}/common/include\" -D_EE")
set(CMAKE_C_FLAGS_INIT "-G0 -fno-common -I\"${PS2SDK}/ee/include\" -I\"${PS2SDK}/common/include\" -D_EE")
set(CMAKE_CXX_FLAGS_INIT "-G0 -fno-common -I\"${PS2SDK}/ee/include\" -I\"${PS2SDK}/common/include\" -D_EE")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-G0 -L\"${PS2SDK}/ee/lib\" -Wl,-r -Wl,-d")
set(CMAKE_FIND_ROOT_PATH "${PS2DEV}/ee" "${PS2SDK}/ee")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH "${PS2DEV}/ee" "${PS2SDK}/ee" "${GSKIT}")
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(PS2 1)
set(EE 1)
@ -58,7 +66,10 @@ set(CMAKE_EXECUTABLE_SUFFIX ".elf")
function(add_erl_executable TARGET)
cmake_parse_arguments("AEE" "" "OUTPUT_VAR" "" ${ARGN})
get_target_property(output_dir ${TARGET} RUNTIME_OUTPUT_DIRECTORY)
get_target_property(output_dir "${TARGET}" RUNTIME_OUTPUT_DIRECTORY)
if(NOT output_dir)
set(output_dir ${CMAKE_CURRENT_BINARY_DIR})
endif()
get_target_property(output_name ${TARGET} OUTPUT_NAME)
if(NOT output_name)
@ -67,7 +78,7 @@ function(add_erl_executable TARGET)
set(outfile "${output_dir}/${output_name}.erl")
add_custom_command(OUTPUT "${outfile}"
COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${TARGET}>" "${outfile}"
COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${TARGET}>" "${outfile}"
COMMAND "${CMAKE_STRIP}" --strip-unneeded -R .mdebug.eabi64 -R .reginfo -R .comment "${outfile}"
DEPENDS ${TARGET}
)

View File

@ -13,21 +13,21 @@ newoption {
trigger = "glfwdir64",
value = "PATH",
description = "Directory of glfw",
default = "../glfw-3.3.2.bin.WIN64",
default = "../glfw-3.3.4.bin.WIN64",
}
newoption {
trigger = "glfwdir32",
value = "PATH",
description = "Directory of glfw",
default = "../glfw-3.3.2.bin.WIN32",
default = "../glfw-3.3.4.bin.WIN32",
}
newoption {
trigger = "sdl2dir",
value = "PATH",
description = "Directory of sdl2",
default = "../SDL2-2.0.8",
default = "../SDL2-2.0.14",
}
workspace "librw"
@ -56,7 +56,7 @@ workspace "librw"
defines { "NDEBUG" }
optimize "On"
filter "configurations:ReleaseStatic"
flags { "StaticRuntime" }
staticruntime("On")
filter { "platforms:*null" }
defines { "RW_NULL" }
@ -189,7 +189,7 @@ project "playground"
kind "WindowedApp"
characterset ("MBCS")
skeltool("playground")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" } -- for now
@ -197,7 +197,7 @@ project "imguitest"
kind "WindowedApp"
characterset ("MBCS")
skeltool("imguitest")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" }
@ -205,7 +205,7 @@ project "lights"
kind "WindowedApp"
characterset ("MBCS")
skeltool("lights")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" }
@ -213,7 +213,7 @@ project "subrast"
kind "WindowedApp"
characterset ("MBCS")
skeltool("subrast")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" }
@ -221,7 +221,7 @@ project "camera"
kind "WindowedApp"
characterset ("MBCS")
skeltool("camera")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" }
@ -229,7 +229,7 @@ project "im2d"
kind "WindowedApp"
characterset ("MBCS")
skeltool("im2d")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" }
@ -237,7 +237,7 @@ project "im3d"
kind "WindowedApp"
characterset ("MBCS")
skeltool("im3d")
flags { "WinMain" }
entrypoint("WinMainCRTStartup")
removeplatforms { "*null" }
removeplatforms { "ps2" }

View File

@ -29,6 +29,7 @@ set_target_properties(librw_skeleton
PROPERTIES
PREFIX ""
EXPORT_NAME skeleton
CXX_STANDARD 11
)
target_link_libraries(librw_skeleton

View File

@ -3,8 +3,12 @@ add_executable(ps2test
main.cpp
mem.h
ps2.h
vu/defaultpipe.dsm
vu/skinpipe.dsm
vu/light.vu
vu/setup_persp.vu
)
target_link_libraries(ps2test
@ -13,7 +17,7 @@ target_link_libraries(ps2test
kernel
)
librw_platform_target(ps2test)
librw_platform_target(ps2test INSTALL)
if(LIBRW_INSTALL)
install(TARGETS ps2test