Skip to content
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

Support for customized OUTPUT_NAME of a given target in create_pbp_file macro #199

Merged
merged 2 commits into from
May 10, 2024

Conversation

dbeef
Copy link
Member

@dbeef dbeef commented May 8, 2024

Solves: #196

To reproduce this error provide a non-default OUTPUT_NAME for any valid CMake target that used to work before.
In example:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f6b4f4..fa53314 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,7 @@ else()
     add_executable(Spelunky_PSP src/Main.cpp)
 endif ()

+set_target_properties(Spelunky_PSP PROPERTIES OUTPUT_NAME SomeDummyNameDefinitelyNotSpelunkyPSP)
 add_subdirectory(vendor)
 add_subdirectory(src/entity-registry)
 add_subdirectory(src/viewport)

Relevant logs with the fix:

[100%] Building CXX object CMakeFiles/Spelunky_PSP.dir/src/Main.cpp.obj
/usr/local/pspdev/bin/psp-g++ -DPSP -DSPELUNKY_PSP_PLATFORM_PSP -D_PSP_FW_VERSION=600 -D__PSP__ -Dmain=SDL_main -I/root/vendor/logger/interface -I/root/src/video/interface -I/root/src/time/interface -I/root/src/viewport/interface -I/root/src/audio/interface -I/root/src/patterns/interface -I/root/src/level/interface -I/root/vendor/entt/interface -I/root/src/rendering-types/interface -I/root/src/texture-bank/interface -I/root/src/input/interface -I/root/src/game-loop/interface -I/root/src/camera/interface -I/root/src/entity-registry/interface -I/usr/local/pspdev/psp/include -I/usr/local/pspdev/psp/sdk/include -DPSP -O3 -DNDEBUG -std=c++17 -MD -MT CMakeFiles/Spelunky_PSP.dir/src/Main.cpp.obj -MF CMakeFiles/Spelunky_PSP.dir/src/Main.cpp.obj.d -o CMakeFiles/Spelunky_PSP.dir/src/Main.cpp.obj -c /root/src/Main.cpp
[100%] Linking CXX executable SomeDummyNameDefinitelyNotSpelunkyPSP
/usr/bin/cmake -E cmake_link_script CMakeFiles/Spelunky_PSP.dir/link.txt --verbose=1
/usr/local/pspdev/bin/psp-g++ -I/usr/local/pspdev/psp/include -I/usr/local/pspdev/psp/sdk/include -DPSP -O3 -DNDEBUG -L/usr/local/pspdev/lib -L/usr/local/pspdev/psp/lib -L/usr/local/pspdev/psp/sdk/lib -Wl,-zmax-page-size=128 CMakeFiles/Spelunky_PSP.dir/src/Main.cpp.obj -o SomeDummyNameDefinitelyNotSpelunkyPSP  -L/usr/local/pspdev/psp vendor/logger/libLogger.a src/video/libVideo.a src/audio/libAudio.a src/level/libLevel.a src/rendering-types/libRenderingTypes.a src/input/libInput.a src/game-loop/libGameLoop.a src/texture-bank/libTextureBank.a src/time/libTime.a src/audio/libAudio.a src/input/libInput.a -lSDL2_mixer -lSDL2main -lSDL2 src/camera/libCamera.a src/entity-registry/libEntityRegistry.a src/collisions/libCollisions.a src/level/libLevel.a src/rendering-types/libRenderingTypes.a src/texture-bank/libTextureBank.a src/rendering-types/libRenderingTypes.a src/texture-bank/libTextureBank.a src/graphics-utils/libGraphicsUtils.a vendor/logger/libLogger.a vendor/stb/libstb.a vendor/cjson/libcjson.a -lm -lc -lSDL_mixer -lSDLmain -lSDL -lGL -lmodplug -lvorbisenc -lvorbisfile -lvorbis -logg -L/usr/local/pspdev/psp/sdk/lib -lpspirkeyb -lpspdebug -lpspgu -lpspvram -lpspvfpu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspaudio -lpsppower_driver -lpsppower
Stripping binary
/usr/local/pspdev/bin/psp-strip /root/tmp/build-psp/SomeDummyNameDefinitelyNotSpelunkyPSP
Calling psp-fixup-imports
/usr/local/pspdev/bin/psp-fixup-imports /root/tmp/build-psp/SomeDummyNameDefinitelyNotSpelunkyPSP
/usr/bin/cmake -E cmake_echo_color --cyan Not\ building\ PRX
Not building PRX
Calling mksfoex
/usr/local/pspdev/bin/mksfoex -d MEMSIZE=1 -s APP_VER= NULL PARAM.SFO
Calling pack-pbp with ELF file
/usr/local/pspdev/bin/pack-pbp EBOOT.PBP PARAM.SFO /root/assets/metadata/icon.png NULL NULL /root/assets/metadata/background.png NULL /root/tmp/build-psp/SomeDummyNameDefinitelyNotSpelunkyPSP NULL
[0]        340 bytes | PARAM.SFO
[1]       1229 bytes | /root/assets/metadata/icon.png
[2]          0 bytes | NULL
[3]          0 bytes | NULL
[4]      13122 bytes | /root/assets/metadata/background.png
[5]          0 bytes | NULL
[6]   18270504 bytes | /root/tmp/build-psp/SomeDummyNameDefinitelyNotSpelunkyPSP
[7]          0 bytes | NULL
/usr/bin/cmake -E cmake_echo_color --cyan EBOOT.PBP\ file\ created.
EBOOT.PBP file created.
gmake[2]: Leaving directory '/root/tmp/build-psp'
[100%] Built target Spelunky_PSP
gmake[1]: Leaving directory '/root/tmp/build-psp'
/usr/bin/cmake -E cmake_progress_start /root/tmp/build-psp/CMakeFiles 0
/usr/bin/gmake  -f CMakeFiles/Makefile2 preinstall
gmake[1]: Entering directory '/root/tmp/build-psp'
gmake[1]: Nothing to be done for 'preinstall'.
gmake[1]: Leaving directory '/root/tmp/build-psp'
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing: /root/tmp/install-psp/Release/bin/SomeDummyNameDefinitelyNotSpelunkyPSP

Relevant logs without the fix (note non-existent file path passed to psp-fixup-imports):

[100%] Linking CXX executable SomeDummyNameDefinitelyNotSpelunkyPSP
/usr/bin/cmake -E cmake_link_script CMakeFiles/Spelunky_PSP.dir/link.txt --verbose=1
/usr/local/pspdev/bin/psp-g++ -I/usr/local/pspdev/psp/include -I/usr/local/pspdev/psp/sdk/include -DPSP -O3 -DNDEBUG -L/usr/local/pspdev/lib -L/usr/local/pspdev/psp/lib -L/usr/local/pspdev/psp/sdk/lib -Wl,-zmax-page-size=128 CMakeFiles/Spelunky_PSP.dir/src/Main.cpp.obj -o SomeDummyNameDefinitelyNotSpelunkyPSP  -L/usr/local/pspdev/psp vendor/logger/libLogger.a src/video/libVideo.a src/audio/libAudio.a src/level/libLevel.a src/rendering-types/libRenderingTypes.a src/input/libInput.a src/game-loop/libGameLoop.a src/texture-bank/libTextureBank.a src/time/libTime.a src/audio/libAudio.a src/input/libInput.a -lSDL2_mixer -lSDL2main -lSDL2 src/camera/libCamera.a src/entity-registry/libEntityRegistry.a src/collisions/libCollisions.a src/level/libLevel.a src/rendering-types/libRenderingTypes.a src/texture-bank/libTextureBank.a src/rendering-types/libRenderingTypes.a src/texture-bank/libTextureBank.a src/graphics-utils/libGraphicsUtils.a vendor/logger/libLogger.a vendor/stb/libstb.a vendor/cjson/libcjson.a -lm -lc -lSDL_mixer -lSDLmain -lSDL -lGL -lmodplug -lvorbisenc -lvorbisfile -lvorbis -logg -L/usr/local/pspdev/psp/sdk/lib -lpspirkeyb -lpspdebug -lpspgu -lpspvram -lpspvfpu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspaudio -lpsppower_driver -lpsppower
Stripping binary
/usr/local/pspdev/bin/psp-strip /root/tmp/build-psp/SomeDummyNameDefinitelyNotSpelunkyPSP
Calling psp-fixup-imports
/usr/local/pspdev/bin/psp-fixup-imports /root/tmp/build-psp/Spelunky_PSP
Error, could not find file /root/tmp/build-psp/Spelunky_PSP
gmake[2]: *** [CMakeFiles/Spelunky_PSP.dir/build.make:127: SomeDummyNameDefinitelyNotSpelunkyPSP] Error 1
gmake[2]: *** Deleting file 'SomeDummyNameDefinitelyNotSpelunkyPSP'
gmake[2]: Leaving directory '/root/tmp/build-psp'
gmake[1]: *** [CMakeFiles/Makefile2:503: CMakeFiles/Spelunky_PSP.dir/all] Error 2
gmake[1]: Leaving directory '/root/tmp/build-psp'
gmake: *** [Makefile:139: all] Error 2

Building under:

➜  ~/dev/spelunky-psp sudo docker images --digests
REPOSITORY      TAG       DIGEST                                                                    IMAGE ID       CREATED      SIZE
pspdev/pspdev   latest    sha256:53ab67064abbf53b839405330c9bd891633480622ed3c20751122eb415eea5ea   3b21003402bf   6 days ago   406MB

@sharkwouter please review.

Copy link
Member

@sharkwouter sharkwouter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dbeef, thanks for making this PR! Hope you're doing well :)

I had one question which applied to multiple places. It might not need a change, but let me know.

src/base/CreatePBP.cmake Outdated Show resolved Hide resolved
src/base/CreatePBP.cmake Outdated Show resolved Hide resolved
src/base/CreatePBP.cmake Outdated Show resolved Hide resolved
src/base/CreatePBP.cmake Outdated Show resolved Hide resolved
@sharkwouter sharkwouter merged commit 536953f into master May 10, 2024
2 checks passed
@sharkwouter
Copy link
Member

Thanks for making this change! Looks good

@sharkwouter sharkwouter deleted the issues/196-cmake-incorrect-output-name branch May 10, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants