Skip to content

Commit

Permalink
Build for PS2
Browse files Browse the repository at this point in the history
docker run -it -w /project -v $(pwd):/project ps2dev/ps2dev sh

apk add git make cmake gmp mpc1 mpfr

git clone https://github.com/fjtrujy/ps2_drivers
cd ps2_drivers/
make clean all install

git config --global --add safe.directory /project

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=/usr/local/ps2dev/ps2sdk/ps2dev.cmake
-DCMAKE_INSTALL_PREFIX=$PS2SDK/ports

cmake --build build -j $(nproc)
  • Loading branch information
AJenbo committed Aug 13, 2022
1 parent 4cf0053 commit dfb7f2a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions 3rdParty/SDL2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif()
include(functions/FetchContent_MakeAvailableExcludeFromAll)
include(FetchContent)
FetchContent_Declare(SDL2
URL https://github.com/libsdl-org/SDL/archive/727eef7064e02aea89281493d0c5f16ad9e3c16f.tar.gz
URL_HASH MD5=0fd8f95b01967423af7705250beb7208
URL https://github.com/libsdl-org/SDL/archive/cb46e1b3f06a08d57b4ccd83127d1ec3139e1c0f.tar.gz
URL_HASH MD5=b5539b578ef77f6364f621dc55c244d7
)
FetchContent_MakeAvailableExcludeFromAll(SDL2)
4 changes: 4 additions & 0 deletions CMake/Platforms.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ if(VITA)
include(platforms/vita)
endif()

if(PS2)
include(platforms/ps2)
endif()

if(PS4)
include(platforms/ps4)
endif()
Expand Down
3 changes: 0 additions & 3 deletions CMake/platforms/ctr/modules/FindThreads.cmake

This file was deleted.

1 change: 1 addition & 0 deletions CMake/platforms/n3ds.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(NOEXIT ON)
# 3DS libraries and compile definitions
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/ctr")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/ctr/modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/threads-stub")
find_package(CITRO3D REQUIRED)

list(APPEND DEVILUTIONX_PLATFORM_SUBDIRECTORIES platform/ctr)
Expand Down
18 changes: 18 additions & 0 deletions CMake/platforms/ps2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set(NONET ON)
set(NOSOUND ON)
set(DISABLE_DEMOMODE ON)
set(ASAN OFF)
set(UBSAN OFF)
set(BUILD_TESTING OFF)

set(DEVILUTIONX_SYSTEM_SDL2 OFF)
set(DEVILUTIONX_SYSTEM_BZIP2 OFF)
set(DEVILUTIONX_SYSTEM_LIBFMT OFF)
set(DEVILUTIONX_STATIC_LIBFMT ON)
set(PREFILL_PLAYER_NAME ON)
set(NOEXIT ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/threads-stub")

set(BUILD_ASSETS_MPQ OFF)

3 changes: 3 additions & 0 deletions CMake/platforms/threads-stub/FindThreads.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stub out the Threads package.
# Some platforms do not have a system threads library but SDL threads are supported.
add_library(Threads::Threads INTERFACE IMPORTED GLOBAL)
2 changes: 1 addition & 1 deletion Source/utils/file_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ bool ResizeFile(const char *path, std::uintmax_t size)
::CloseHandle(file);
return true;
#elif _POSIX_C_SOURCE >= 200112L || defined(_BSD_SOURCE) || defined(__APPLE__)
return ::truncate(path, static_cast<off_t>(size)) == 0;
return true;
#else
static_assert(false, "truncate not implemented for the current platform");
#endif
Expand Down

0 comments on commit dfb7f2a

Please sign in to comment.