Skip to content

a #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 119 commits into
base: master
Choose a base branch
from
Open

a #4

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
f8de2ca
Fix memory leaks in SDL2 cleanup
mateofio Apr 4, 2020
8ba5ab2
Refactor move type random
mateofio Feb 16, 2019
e307d8b
Fix canonical path logic not working anymore when the path is the roo…
Ghabry Apr 28, 2020
500ab6d
Bitmap: Initialize pixels as nullptr. Don't crash anymore when the im…
Ghabry Apr 28, 2020
b12cc51
Regression fix: Reintroduce edge-case: When a 2k ShowPicture command …
Ghabry Apr 29, 2020
c415648
Add Wii Platform Clock
mateofio May 1, 2020
8aa6d40
StdClock: always use steady_clock
mateofio May 1, 2020
ec3d7a5
Amiga: add a cmath wrapper for OS4
BSzili Apr 29, 2020
43dfe01
Amiga: Makefile update
BSzili Apr 29, 2020
9089544
Use SDL2 on MorphOS
BSzili May 1, 2020
577487a
Sprite: Don't reset bitmap_changed state when off screen
mateofio May 13, 2020
8509dc4
Add support for async message ops
mateofio May 14, 2020
f8aa42f
Wait for message box to close before starting inn sequence
mateofio May 15, 2020
894dd1a
Scene_Debug: Regression fixes
mateofio May 14, 2020
37d9fed
Fix Physical attack to hit algorithm
mateofio May 14, 2020
3219157
Game_Actor: reconstruct exp list when loading save game
mateofio May 14, 2020
69584ec
Battle 2k3: flash screen on critical hit
mateofio May 14, 2020
1f4d4c8
Version 0.6.2.1
carstene1ns May 20, 2020
22c9c79
Reset facing lock flag on event page change
mateofio May 3, 2020
ec1f471
Fix Variance algorithm for effects
mateofio Apr 15, 2020
bf58950
States were incorrectly removed when the battle ended (regression)
Ghabry May 14, 2020
42b1328
Fix distribution archive to include test files
carstene1ns May 20, 2020
e6f9bd3
Support for bash-completion 2.10
carstene1ns May 20, 2020
c69ff1c
Disable SDL2 timer subsystem.
mateofio Apr 3, 2020
e261384
Sdl1 - Don't use time subsystem
mateofio Apr 4, 2020
14dd095
Don't force vsync for Mac OSX
mateofio Apr 4, 2020
6d3439f
Remove some old sdl version code and require 2.0.5
mateofio Apr 4, 2020
b599588
Merge pull request #2223 from carstene1ns/version-0.6.2.1
Ghabry May 22, 2020
aed6fcc
Fix spritesheet save chunks when loading picture with no sheet
mateofio May 24, 2020
482f71b
Fix empty pictures save id
mateofio May 24, 2020
be726b2
Fix range of size 1 = variable bug
mateofio May 24, 2020
85cdab5
Fix unit tests on macos
Ghabry May 26, 2020
1229069
Allow debug flag from gamebrowser
tyrone-sudeium Jun 6, 2020
1b1559f
Fix constexpr compilation in Game_Character
mateofio Jun 14, 2020
1eece16
Properly check Teleport Targets on add/remove
carstene1ns Jun 24, 2020
3033e84
Tilemap: Fix opacity handling when the tilemap graphic is smaller tha…
Ghabry Jul 9, 2020
9e73b99
Fix "man" target not working properly with out-of-source builds
suve Aug 3, 2020
69c7a55
Add if(NOT TARGET) around circular find_package() calls in FindFreety…
suve Aug 9, 2020
12dcaee
Replace find_library() with find_package() in FindHarfbuzz.cmake
suve Aug 15, 2020
e4bee62
Android : sort the game list alphabetically
BlisterB Jun 29, 2020
c22d2b7
Android : add a favorite feature
BlisterB Jul 1, 2020
5569b5c
Android : simplify the code sorting games
BlisterB Jul 1, 2020
73efa2f
Block key input processing while message is active
mateofio Aug 21, 2020
90c3fa5
Change Warning to Debug on SE playback failure
fdelapena Aug 21, 2020
0cfa245
Stub support for DynRPG and ManiacPatch
Ghabry Aug 17, 2020
9493f2f
Allocate 2000 picture slots when DynRPG+RPG2003 is detected
Ghabry Aug 24, 2020
7924475
Fix artifacts (background not redrawn) on maps smaller than 20x15.
Ghabry Aug 21, 2020
7808786
Fix another range of size 1 = variable regression. This time for rand…
Ghabry Aug 21, 2020
ce9e065
Battle 2k3: Spell reflect change
Aug 21, 2020
133f401
Battle 2k3: Items of the type "Special" bypass spell reflection
Aug 21, 2020
4ff7c56
Moved reflection target logic to TargetFirst and remove IsReflected
Aug 23, 2020
0320e34
Remove unnecessary PlayAnimation calls
Aug 24, 2020
cfd0706
Re-add IsReflected and use it in TargetFirst only
Aug 24, 2020
cfa6f50
Add missing battle animation after the TargetFirst change
Aug 25, 2020
f5c992a
Skills: Fix self target
Feb 29, 2020
d0d6cf6
Update AUTHORS
Aug 25, 2020
66b6d4e
Implement 2k3 Escape algorithm
mateofio Apr 14, 2020
ba00540
Mac: create app bundle, use OpenGL SDL renderer
tyrone-sudeium Jun 11, 2020
9c58adf
Mac: use ICNS generated from SVG
tyrone-sudeium Jun 12, 2020
0204e69
Mac: package script can run anywhere
tyrone-sudeium Jun 16, 2020
4580541
Mac: cmake .app support, use NSBundle for finding app dir
tyrone-sudeium Jun 16, 2020
485aeb2
Mac: fix autotools compile, use EasyRPG Player for name
tyrone-sudeium Jun 16, 2020
a1ede06
Build: fix cmake out-of-tree, autoconf objcxx check unconditional
tyrone-sudeium Jun 17, 2020
e0dac76
Mac: set icon only if not running as bundle
tyrone-sudeium Jun 17, 2020
47cae98
Style: fix space indenting
tyrone-sudeium Jun 17, 2020
58c8603
Mac: cmake install target
tyrone-sudeium Jun 18, 2020
d94ebbf
Add Emscripten support to CMake
Ghabry Jan 10, 2020
233ed30
emscripten: Don't use pre/post_js commands, they require a fake C lib…
Ghabry Aug 27, 2020
2285a5d
emscripten: Don't allow configuring of prejs/postjs/shellfile. This i…
Ghabry Aug 27, 2020
57652e2
emscripten: Remove audio workaround for SDL2 and fix linking against …
Ghabry Aug 27, 2020
5c1893e
emscripten: Disable SDL2 async handling. This allows the usage of ASY…
Ghabry May 26, 2020
d6f1370
emscripten: Can't get Module.requestFullscreen to work but Module['ca…
Ghabry Aug 27, 2020
692fbdc
emscripten: Allow changing of the output name through PLAYER_JS_OUTPU…
Ghabry Aug 27, 2020
6fafb69
Tests: Fix linking in release build when libc++ is used by adding "#i…
Ghabry Aug 28, 2020
cafb331
Battle 2k3: Fix healing display
Mar 9, 2020
0e0286a
Backport emscripten-core/emscripten#7631 for focus on iframes
fdelapena Aug 27, 2020
a2530ed
CMake: Allow regenerating emscripten html shell file if modified
fdelapena Aug 30, 2020
3a7d9be
Use a language neutral full screen symbol, use pixel perfect canvas s…
fdelapena Aug 30, 2020
e248864
CMake: Allow emscripten memory growth for doctest, prevents OOM
fdelapena Aug 30, 2020
5de284b
Battle 2k: When selecting a previous actor (with ESC) the "NoMove" ac…
Ghabry Aug 29, 2020
da6e7f8
Minor accuracy adjustments for weather colors
mateofio Sep 1, 2020
29b2cae
version 0.6.2.2
Ghabry Aug 18, 2020
5cc777b
Android : UX improvements of the GameBrowser activity
BlisterB Jul 2, 2020
1400b6d
Android : respect the 4/3 ratio for thumbnails in landscape mode
BlisterB Jul 2, 2020
5c6f6ab
Merge pull request #2325 from Ghabry/0-6-2-2
fdelapena Sep 8, 2020
0aa7702
Fix enemy default state rank
Sep 12, 2020
8c0bc14
Fix crash caused by IsReflect
Sep 16, 2020
455e131
States: Damage and recovery is rounded down instead of up
Sep 16, 2020
1b12479
macOS: Always link against Foundation framework (fix non-SDL2 build s…
Ghabry Jul 13, 2020
8181341
libretro: Don't link against pthread when using MSVC
Ghabry Jul 14, 2020
2862da9
CMake: Support new MSVC_RUNTIME_LIBRARY option invented in CMake 3.15
Ghabry Sep 15, 2020
61159a6
Update libretro-common submodule to latest HEAD (4927669e)
Ghabry Sep 15, 2020
3713783
Readme: Fix typo. We want to build Player here :)
Ghabry Sep 15, 2020
8339309
CMake: When using -DPLAYER_BUILD_LIBLCF always build a static library.
Ghabry Sep 15, 2020
bc029cf
libretro: Enable position independent code (fPIC) when building a sha…
Ghabry Sep 15, 2020
8d5865b
CMake: Remove git clone of TestGame-2000.
Ghabry Sep 15, 2020
717e887
CMake: Move BUILD_SHARED_LIBS back to the top, otherwise this breaks …
Ghabry Sep 17, 2020
a29ac16
CMake: Refactor libretro library handling. Uses now an additional sha…
Ghabry Sep 23, 2020
b53acc0
CMake emscripten: Use EXE_NAME
Ghabry Sep 23, 2020
f8028ff
Update libretro submodule to c2b91f47
Ghabry Sep 23, 2020
7eeffa9
CMake: Only enable fPic when building a .so
Ghabry Sep 24, 2020
536e4bf
Guard DT_UNKNOWN, DT_REG and DT_DIR. Fixes build on Haiku where these…
kwyxz Sep 29, 2020
90a9cf3
Release 0.6.2.3
Ghabry Oct 3, 2020
4dd00a6
Merge pull request #2374 from Ghabry/0-6-2-3
fdelapena Oct 3, 2020
7dec95f
init
MaxSignal May 14, 2023
6b70467
init 2
MaxSignal May 15, 2023
59e4372
init 3
MaxSignal May 15, 2023
e63976b
upload wincehelper()
MaxSignal May 16, 2023
0612e03
update gitignore
MaxSignal May 16, 2023
99f2e0c
hogehoge
MaxSignal Dec 13, 2023
6b2a23a
v
MaxSignal Dec 13, 2023
b4862ce
set fps limit to 30, remve useless debug code, set key codes
MaxSignal Mar 4, 2024
acbcc68
fix some stuff
MaxSignal Mar 5, 2024
3eaa237
add source files to makefile.am
MaxSignal Mar 5, 2024
de028fc
revert changes
MaxSignal Mar 5, 2024
80a7970
fix build system
MaxSignal Mar 6, 2024
eb788f5
Update wincehelper.cpp
MaxSignal Mar 9, 2024
d08c467
Add KeyBinding
MaxSignal Mar 11, 2024
7ce47d0
convert string to widestring
MaxSignal Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/bin/
Makefile
easyrpg-player
/Makefile
/easyrpg-player
/Player.app
*.a
*.elf
*.o
Expand All @@ -18,7 +19,6 @@ aclocal.m4
config.h
config.h.in
config.status
configure
libtool
/builds/autoconf/aux/
/builds/autoconf/m4/*.m4
Expand All @@ -30,9 +30,11 @@ stamp-h1
/output
/utils
/directorytree
configure

# cmake
CMakeFiles/
CMakeScripts/
CMakeCache.txt
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
Expand Down Expand Up @@ -88,10 +90,22 @@ easyrpg-player-*.tar.*
__MACOSX
.DS_Store

# Xcode
/*.xcodeproj
/*.xcworkspace
/Debug/
/Release/
/MinSizeRel/
/RelWithDebInfo/
/*.build/

# legacy
/lib/liblcf/
liblcf.pc
.buildconfig

# Android
*.iml

# libretro
easyrpg_libretro.*
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ EasyRPG Player authors
* Matthew Fioravante (fmatthew5876)
* Patrick Müssig (Tondorian)
* Paulo "Zhek" Vizcaino (paulo_v)
* rueter37
* scurest
* Shin-NiL
* Takeshi Watanabe (takecheeze)
149 changes: 111 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.7)
cmake_policy(SET CMP0091 NEW) # Support MSVC_RUNTIME_LIBRARY

project(EasyRPG_Player VERSION 0.6.2 LANGUAGES CXX)
project(EasyRPG_Player VERSION 0.6.2.3 LANGUAGES CXX)

# Extra CMake Module files
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules")
Expand All @@ -12,8 +13,11 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Must be at global scope, otherwise breaks -DPLAYER_BUILD_LIBLCF (see CMP0077)
option(BUILD_SHARED_LIBS "Build shared easyrpg_libretro core" ON)

# Source Files
add_library(${PROJECT_NAME}
add_library(${PROJECT_NAME} STATIC
src/async_handler.cpp
src/async_handler.h
src/async_op.h
Expand Down Expand Up @@ -365,6 +369,8 @@ add_library(${PROJECT_NAME}
# These are actually unused when building in CMake
# src/sdl_ui.cpp
# src/sdl_ui.h
# src/platform/wii/wii_clock.cpp
# src/platform/wii/wii_clock.h
# src/platform/wii/wii_input_buttons.cpp
# src/platform/opendingux/opendingux_input_buttons.cpp
# src/platform/psp/psp_input_buttons.cpp
Expand All @@ -390,20 +396,11 @@ if(${PLAYER_TARGET_PLATFORM} STREQUAL "SDL2")
src/sdl2_ui.h)
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_SDL=2)

find_package(SDL2 REQUIRED)
find_package(SDL2 2.0.5 REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2main)
elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "libretro")
target_sources(${PROJECT_NAME} PRIVATE
src/platform/libretro/libretro_audio.cpp
src/platform/libretro/libretro_audio.h
src/platform/libretro/libretro_input_buttons.cpp
src/platform/libretro/libretro_ui.cpp
src/platform/libretro/libretro_ui.h)
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)
elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "3ds")
Expand Down Expand Up @@ -437,13 +434,35 @@ else()
message(FATAL_ERROR "Invalid target platform")
endif()

if(NOT PLAYER_BUILD_EXECUTABLE AND BUILD_SHARED_LIBS)
# Need fPIC when compiling a shared library (e.g. libretro.so)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()

if(WIN32)
target_sources(${PROJECT_NAME} PRIVATE
src/registry.cpp
src/platform/windows/utils.cpp
src/platform/windows/utils.h)
endif()

if(APPLE)
target_sources(${PROJECT_NAME} PRIVATE
src/platform/macos/utils.mm
src/platform/macos/utils.h)

find_library(MACOSFOUNDATION Foundation)
target_link_libraries(${PROJECT_NAME} ${MACOSFOUNDATION})
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
option(PLAYER_JS_BUILD_SHELL "Build the Player executable as a shell file (.html) instead of a standalone javascript file (.js)" OFF)
set(PLAYER_JS_GAME_URL "games/" CACHE STRING "Game URL/directory where the web player searches for games")
set(PLAYER_JS_OUTPUT_NAME "easyrpg-player" CACHE STRING "Output name of the js, html and wasm files")
set_property(SOURCE src/async_handler.cpp APPEND PROPERTY COMPILE_DEFINITIONS "EM_GAME_URL=\"${PLAYER_JS_GAME_URL}\"")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME} PUBLIC _DEBUG=1)
endif()
Expand All @@ -457,6 +476,14 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
endif()
endif()

# App Icon (for macOS)
set(${PROJECT_NAME}_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/osx/Player.icns")

# Do not code sign on Macs
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.easyrpg.player")

# liblcf
option(PLAYER_BUILD_LIBLCF "Instead of detecting liblcf the liblcf repository is cloned into lib/liblcf and built together with the Player. This is convenient for development" OFF)
set(PLAYER_BUILD_LIBLCF_GIT "https://github.com/EasyRPG/liblcf.git" CACHE STRING "Git repository of liblcf to clone when building liblcf. Requires PLAYER_BUILD_LIBLCF=ON.")
Expand All @@ -470,10 +497,14 @@ if(PLAYER_BUILD_LIBLCF)
"${PLAYER_BUILD_LIBLCF_GIT}"
"${LIBLCF_PATH}")
endif()
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build liblcf shared library")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/liblcf/builds/cmake/Modules")

add_subdirectory(${LIBLCF_PATH})
# Always build static liblcf
function(add_liblcf)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(${LIBLCF_PATH})
endfunction()
add_liblcf()
target_link_libraries(${PROJECT_NAME} lcf)
else()
# Use system package
Expand Down Expand Up @@ -686,30 +717,82 @@ endif()

# Executable
if (${PLAYER_BUILD_EXECUTABLE})
add_executable(${PROJECT_NAME}_exe WIN32 "src/main.cpp")
set_target_properties(${PROJECT_NAME}_exe PROPERTIES OUTPUT_NAME "easyrpg-player")
if(APPLE)
set(EXE_NAME "EasyRPG-Player.app")
set_source_files_properties(${${PROJECT_NAME}_BUNDLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable("${EXE_NAME}" MACOSX_BUNDLE "src/main.cpp" ${${PROJECT_NAME}_BUNDLE_ICON})
set_target_properties("${EXE_NAME}" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/osx/Info.plist")
set_target_properties("${EXE_NAME}" PROPERTIES OUTPUT_NAME "EasyRPG Player")
else()
set(EXE_NAME ${PROJECT_NAME}_exe)
add_executable(${EXE_NAME} WIN32 "src/main.cpp")
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "easyrpg-player")
endif()

if(WIN32)
# Open console for Debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_target_properties(${PROJECT_NAME}_exe PROPERTIES WIN32_EXECUTABLE FALSE)
set_target_properties(${EXE_NAME} PROPERTIES WIN32_EXECUTABLE FALSE)
endif()

# Add resources
target_sources(${PROJECT_NAME}_exe PRIVATE "resources/player.rc")
target_sources(${EXE_NAME} PRIVATE "resources/player.rc")

# Change executable name
set_target_properties(${PROJECT_NAME}_exe PROPERTIES OUTPUT_NAME "Player")
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "Player")
endif()

target_link_libraries(${PROJECT_NAME}_exe ${PROJECT_NAME})
target_link_libraries(${EXE_NAME} ${PROJECT_NAME})

if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(PLAYER_JS_PREJS "${CMAKE_CURRENT_SOURCE_DIR}/resources/emscripten/emscripten-pre.js")
set(PLAYER_JS_POSTJS "${CMAKE_CURRENT_SOURCE_DIR}/resources/emscripten/emscripten-post.js")
set(PLAYER_JS_SHELL "${CMAKE_CURRENT_SOURCE_DIR}/resources/emscripten/emscripten-shell.html")

set_property(TARGET ${EXE_NAME} PROPERTY LINK_FLAGS "-s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY -s ASYNCIFY_IGNORE_INDIRECT --pre-js ${PLAYER_JS_PREJS} --post-js ${PLAYER_JS_POSTJS} -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext']")
set_source_files_properties("src/main.cpp" PROPERTIES OBJECT_DEPENDS "${PLAYER_JS_PREJS};${PLAYER_JS_POSTJS};${PLAYER_JS_SHELL}")

if(PLAYER_JS_BUILD_SHELL)
set_target_properties(${EXE_NAME} PROPERTIES SUFFIX ".html")
set_property(TARGET ${EXE_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --shell-file ${PLAYER_JS_SHELL}")
endif()

target_link_libraries(${EXE_NAME} "idbfs.js")

set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "${PLAYER_JS_OUTPUT_NAME}")
endif()

# installation
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}_exe RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(APPLE)
install(TARGETS ${EXE_NAME} RUNTIME DESTINATION BUNDLE DESTINATION "${CMAKE_BINARY_DIR}/Package")
else()
install(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}_exe> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
install(FILES $<TARGET_PDB_FILE:${EXE_NAME}> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# Emscripten does not install the wasm file (or the js file when building a shell)
if(PLAYER_JS_BUILD_SHELL)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLAYER_JS_OUTPUT_NAME}.js DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLAYER_JS_OUTPUT_NAME}.wasm DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
else()
if(${PLAYER_TARGET_PLATFORM} STREQUAL "libretro")
add_library(easyrpg_libretro
src/platform/libretro/libretro_audio.cpp
src/platform/libretro/libretro_audio.h
src/platform/libretro/libretro_input_buttons.cpp
src/platform/libretro/libretro_ui.cpp
src/platform/libretro/libretro_ui.h)
target_link_libraries(easyrpg_libretro ${PROJECT_NAME})
set_target_properties(easyrpg_libretro PROPERTIES PREFIX "")
else()
message(FATAL_ERROR "Unsupported library target platform ${PLAYER_TARGET_PLATFORM}")
endif()
endif()

Expand All @@ -719,13 +802,14 @@ set(MAN_NAME easyrpg-player.6)
find_program(A2X_EXECUTABLE NAMES a2x a2x.py)
if(NOT A2X_EXECUTABLE STREQUAL "A2X_EXECUTABLE-NOTFOUND")
add_custom_command(OUTPUT resources/${MAN_NAME}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/resources
COMMAND ${A2X_EXECUTABLE} -a player_version="${PROJECT_VERSION}" -f manpage -D ${CMAKE_CURRENT_BINARY_DIR}/resources ${CMAKE_CURRENT_SOURCE_DIR}/resources/${MAN_NAME}.adoc
DEPENDS resources/${MAN_NAME}.adoc
COMMENT "(Re-)building manpage ${MAN_NAME}"
VERBATIM)
if(UNIX)
add_custom_target(man ALL DEPENDS resources/${MAN_NAME})
install(FILES resources/${MAN_NAME} DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/${MAN_NAME} DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)
else()
add_custom_target(man DEPENDS resources/${MAN_NAME})
endif()
Expand Down Expand Up @@ -763,21 +847,6 @@ endif()
option(PLAYER_ENABLE_TESTS "Execute unit tests after compilation finishes" ON)

if(PLAYER_ENABLE_TESTS)
set(TEST_GAME_REPOSITORY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/TestGame")
if(NOT EXISTS ${TEST_GAME_REPOSITORY_PATH})
execute_process(COMMAND ${GIT_EXECUTABLE} clone "--depth=1"
"https://github.com/EasyRPG/TestGame.git"
"${TEST_GAME_REPOSITORY_PATH}")
endif()
set(TEST_GAME_PATH "${TEST_GAME_REPOSITORY_PATH}/TestGame-2000")

set(TEST_ENVS "RPG_TEST_GAME_PATH=${TEST_GAME_PATH}")
if(EXISTS $ENV{RPG_RTP_PATH})
get_filename_component(RPG_RTP_PATH "$ENV{RPG_RTP_PATH}" ABSOLUTE)
message(STATUS "using rtp path ${RPG_RTP_PATH}")
list(APPEND TEST_ENVS "RPG_RTP_PATH=${RPG_RTP_PATH}")
endif()

file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp)
add_executable(test_runner_player EXCLUDE_FROM_ALL ${TEST_FILES})
set_target_properties(test_runner_player PROPERTIES OUTPUT_NAME "test_runner")
Expand All @@ -789,6 +858,10 @@ if(PLAYER_ENABLE_TESTS)
endif()
add_dependencies(check_player test_runner_player)
add_dependencies(check check_player)

if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set_property(TARGET test_runner_player APPEND_STRING PROPERTY LINK_FLAGS "-s ALLOW_MEMORY_GROWTH")
endif()
endif()

# Instrumentation framework
Expand Down
Loading