-
Notifications
You must be signed in to change notification settings - Fork 199
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
Build 3DS, Switch and Wii port with CMake #2627
Conversation
I'm pleasantly surprised how small the changes are, somehow I expected this to be much worse (okay, most of the ugliness is probably hidden behind these functions :)) |
@@ -602,7 +643,7 @@ if(PLAYER_BUILD_LIBLCF) | |||
target_link_libraries(${PROJECT_NAME} lcf) | |||
else() | |||
# Use system package | |||
find_package(liblcf REQUIRED) | |||
find_package(liblcf REQUIRED CONFIG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually an unrelated change: We always want a recent liblcf and we always ship a config file, so we can skip all Findliblcf
stuff.
132ca0f
to
25643f9
Compare
Is https://github.com/devkitPro/pacman-packages even maintained anymore? So many open pr, no feedback 🤔 |
Well the PR by c1 is "merged"/integrated (kinda) so this can likely progress now? Will do a build test :) |
25643f9
to
cabe027
Compare
Rebased it and added some fixes to make it compile. After patching devkitpro to use Switch:
3DS:
There is something broken in the Harfbuzz CMake config file and OPUS has some linker error because of tremor.
|
The 3DS build work 🥳 . Only issue I see is that the consoleInit is wrapped into For the switch: Here is the NRO, cannot test this one: |
2b415f6
to
1c40c5a
Compare
Use |
CMakeLists.txt
Outdated
@@ -938,6 +939,8 @@ elseif(${PLAYER_TARGET_PLATFORM} MATCHES "^(3ds|switch|psvita)$") | |||
ctr_create_3dsx(easyrpg-player | |||
SMDH easyrpg-player.smdh) | |||
elseif(NINTENDO_SWITCH) | |||
target_include_directories(${PROJECT_NAME} PUBLIC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should already be set by the toolchain I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toolchain only sets -L
but not -I
.
The proper way would be to request all the libraries through pkg-config (as we can be certain pkg-config is available due to devkitpro). That was the first thing I tried but CMake dislikes the pc files because some of them contain prefix=$(devkitpro)...
instead of prefix=/opt/devkitpro
.
So would require asking DKP maintainers to patch all the pc files :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is a CMake config file for use with find_package(OpenGL CONFIG REQUIRED)
but the config file is not found because it is not in one of the search directories used by CMake. Only looks in usr/lib
but not in lib
.
I'm not sure if this is a CMake bug or not. The same happens with SYSTEM_NAME=Generic
.
I asked for clarification here: https://gitlab.kitware.com/cmake/cmake/-/issues/23192
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The find_package
problem was resolved in the recent dkp cmake update. Solving the last blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly enough it works locally, but not on my ports jenkins agent.
They also added a CMake Toolchain for Wii now. @carstene1ns could you update dkp on your buildbot to the latest version? Looks all pretty good now to give this the final push and then we can go all cmake :) |
1c40c5a
to
c7e0e53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. Wii is untested, need to setup the toolchain locally tonight.
c7e0e53
to
11eb65f
Compare
my make_wii.sh: #!/bin/sh
set -e
toolchaindir="/home/carsten/projects/easyrpg/buildscripts/wii"
lcfdir="/home/carsten/projects/easyrpg/liblcf/wii"
#export PKG_CONFIG="pkg-config --static"
if [ "x$1" == "xclean" ]; then
rm -rf build-wii
exit
fi
cmake -B build-wii . -G Ninja -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DPLAYER_TARGET_PLATFORM=wii \
-DCMAKE_PREFIX_PATH="$toolchaindir;$lcfdir" -DPLAYER_WITH_FREETYPE=NO
cmake --build build-wii Currently the dol is 12 mb, which seems a bit too much. Need to investigate. Edit: Here are the biggest 50 entries in the elf: nm output
|
11eb65f
to
41efb7d
Compare
41efb7d
to
5afd5c4
Compare
One thing currently missing is romfs support, but this can be added later. |
@carstene1ns diff --git a/CMakeLists.txt b/CMakeLists.txt
index 109d066c..c3ac39b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -532,6 +532,7 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "switch")
src/platform/switch/switch_ui.cpp
src/platform/switch/switch_ui.h
${PLAYER_SWITCH_ASSETS})
+ target_link_libraries(${PROJECT_NAME} OpenGL::EGL)
elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "wii")
if(NOT NINTENDO_WII)
message(FATAL_ERROR "Missing toolchain file! Use '-DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/Wii.cmake' option.")
@@ -955,8 +956,7 @@ elseif(${PLAYER_TARGET_PLATFORM} MATCHES "^(psvita|3ds|switch|wii)$")
elseif(NINTENDO_SWITCH)
target_link_libraries(easyrpg-player
${PROJECT_NAME}
- ${GLAD}
- OpenGL::EGL)
+ ${GLAD})
nx_generate_nacp(easyrpg-player.nacp
NAME "EasyRPG Player"
AUTHOR "EasyRPG Team" |
Note: Wii is currently hacking in SDL1 support into CMake. Meanwhile migrated from outdated SDL-Wii to dkp fork
e567dd0
to
2a0b660
Compare
No description provided.