Skip to content

Commit

Permalink
libretro: Add libretro-common submodule & Cmake file, update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Apr 18, 2019
1 parent 2efb8eb commit b4a01df
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "builds/libretro/libretro-common"]
path = builds/libretro/libretro-common
url = https://github.com/libretro/libretro-common
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,11 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "libretro")
src/libretro_wrapper.cpp)
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_LIBRETRO=1)
set(PLAYER_BUILD_EXECUTABLE OFF)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "easyrpg_libretro")

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/builds/libretro)
target_link_libraries(${PROJECT_NAME} retro_common)
else()
message(FATAL_ERROR "Invalid target platform")
endif()
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ https://wiki.easyrpg.org/development/compiling/player/autotools

Building requirements:

- pkg-config (Not on Windows)
- CMake
- pkg-config (only on Linux)
- CMake 3.7 or newer

Step-by-step instructions:

Expand All @@ -112,6 +112,23 @@ https://wiki.easyrpg.org/development/compiling/player/cmake
CMake is the only supported way to build liblcf for Windows. All dependencies
must be installed with [vcpkg].

### Building a libretro core:

Building for libretro is based on the CMake method.

Additional commands required before building:

git submodule init # Init submodules
git submodule update # Clone libretro-common submodule

Invoke CMake with these additional parameters:

cmake . -DPLAYER_TARGET_PLATFORM=libretro -DBUILD_SHARED_LIBS=ON|OFF

Set shared libs to ON or OFF depending on which type of libraries RetroArch
uses on the platform you are targeting.


## Running EasyRPG Player

Run the `easyrpg-player` executable from a RPG Maker 2000 or 2003 game
Expand Down
22 changes: 22 additions & 0 deletions builds/libretro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.7)

project(retro_common VERSION 1.0 LANGUAGES C)

# Check availability of libretro-common submodule
file(GLOB RETRO_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libretro-common/*)
list(LENGTH RETRO_COMMON_DIR RETRO_COMMON_DIR_LEN)
if(RETRO_COMMON_DIR_LEN EQUAL 0)
message(FATAL_ERROR "libretro-common is empty. Run \"git submodule update --init\" and try again.")
endif()

add_library(retro_common STATIC
libretro-common/rthreads/rthreads.c
)

target_include_directories(retro_common PUBLIC
libretro-common/include)

# FIXME: Likely won't work on all platforms
target_link_libraries(retro_common "pthread")

mark_as_advanced(RETRO_COMMON_DIR RETRO_COMMON_DIR_LEN)
1 change: 1 addition & 0 deletions builds/libretro/libretro-common
Submodule libretro-common added at 5cd072

0 comments on commit b4a01df

Please sign in to comment.