Closed dbeef closed 4 years ago
Relevant MR:
What I dislike here is that you push your very specific use case (-> using SDL) to all possible users of cmake building. There are some others options, not involving SDL. I agree, that we cannot make this work without headache for everyone, but "one thing to do it right for everyone" is a concept that does not work.
I see your point, but the libraries that I add are still from within the core PSP SDK - they won't conflict with anyone's dependencies, and linking them in correct order is already troubling, so that's a time saver.
This change did make me able to build a small SDL2 game I started working on a while back using the following CMakeLists.txt file: https://github.com/sharkwouter/jewelpop/blob/master/CMakeLists.txt
It builds for both Linux and PSP without additional changes now.
@dbeef: I see your point. My idea is here that SDL2 should specify the needed libraries, so they get pulled in there. @sharkwouter: Of course it does. So does likely many others (based on SDL). However, overlinking occurs when you use a different library that does not need the same dependencies.
After discussions it was decided to not add PSP_LIBRARIES
to cmake's global link flags, and instead, serve them as a variable so anyone interested would link them via:
target_link_libraries(sometarget ${PSP_LIBRARIES})
Will commit relevant changes in a moment.
This is to use Joel16's SDL2 port from https://github.com/pspdev/psplibraries/pull/45 without explicitly linking to PSP-SDK libraries.
Test snippet:
CMakeLists.txt
main.cpp
I passed absolute path to
libSDL2main.a
as it's not currently built and installed by default, there's an ongoing work on fixing this.