Closed slouken closed 5 months ago
The satellite libraries expect an already configured SDL3 or already-built SDL3. What I do:
SDL3
is checked out in ~/projects/SDL
, builds in ~/projects/SDL/cmake-build-Debug
and installs in ~/projects/SDL/cmake-build-Debug/prefix
SDL3_image
is checked out in ~/projects/SDL_image
, builds in ~/projects/SDL_image/cmake-build-Debug
and installs in ~/projects/SDL_image/cmake-build-Debug/prefix
By configuring SDL3_image
with -DSDL3_ROOT=$HOME/projects/SDL/cmake-build-debug
(or -DSDL3_ROOT=$HOME/projects/SDL/cmake-build-debug/prefix
), the cmake project will pick up the already built SDL3.
So there's no need for rebuilding SDL3 for every satellite library.
Btw:
SDL3_ROOT
is for configuring the root folder of an SDL3 prefixSDL3_DIR
is for configuring the location of SDL3Config.cmake
(on nix, this is $prefix/lib/pkgconfig/SDL3
).By "already configured SDL3`, I mean users of SDL that do this in their cmake script:
add_subdirecty(externals/SDL)
add_subdirecty(externals/SDL_image)
I think maybe we need build instructions in the satellite libraries. :)
How do you set the install location to ~/projects/SDL/cmake-build-Debug/prefix
?
You can install to whatever location you desire with cmake --install ~/projects/SDL/cmake-build-debug --prefix /tmp/SDL-prefix
.
The installation path can be configured with CMAKE_INSTALL_PREFIX
.
When the path is not absolute, it installs relative to the working directory.
So in my example above, I configure with cmake -S ~/projects/SDL -B ~/projects/SDL/cmake-build-debug -DCMAKE_INSTALL_PREFIX=~/projects/SDL/cmake-build-debug/prefix
.
Also worth mentioning is the following would work as well:
for sdl in SDL SDL_image SDL_ttf SDL_mixer SDL_net SDL_rtf; do
cmake -S ~/projects/$sdllib -B ~/projects/$sdllib/cmake-build-debug -DCMAKE_INSTALL_PREFIX=/tmp/SDL-prefix
cmake --build ~/projects/$sdllib/cmake-build-debug
cmake --install ~/projects/$sdllib/cmake-build-debug
done
CMake also looks for dependencies in the installation prefix.
The commands above are very close to ../configure --prefix=/tmp/SDL-prefix && make && make install
.
I've run external/download.sh to get the dependencies, and then:
cmake -DCMAKE_BUILD_TYPE=Release .. -DSDL3_DIR=../external/SDL
fails with:
I'm sure I'm doing something silly, but there are no instructions on how to build this beast. :)