From b6b80da91e65821a8b1e3f59aa011e43d4820573 Mon Sep 17 00:00:00 2001 From: Craig Carnell <1188869+cscd98@users.noreply.github.com> Date: Wed, 4 Nov 2026 16:24:19 +0000 Subject: [PATCH] Set custom hatari_libretro build and linking for optional deps for retro core --- CMakeLists.txt | 1 + src/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac82c5a93..b4a3e3575 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ option(ENABLE_TRACING "Enable tracing messages for debugging" ON) option(ENABLE_TOOLS "Build the Hatari tools" ON) option(LIBRETRO_STATIC "Set STATIC mode for compiling libretro core" OFF) +option(LIBRETRO_SUFFIX "Libretro core suffix" OFF) if(ENABLE_LIBRETRO) set(LIBRETRO_INCLUDE_DIR diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index db831f445..3a4311aa1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -336,6 +336,9 @@ if(ENABLE_LIBRETRO) $ $ $) + + # Support the target name expected by libretro CI. + add_custom_target(hatari_libretro DEPENDS retro-hatari) endif(ENABLE_LIBRETRO) if(ENABLE_HATARI) @@ -447,3 +450,35 @@ if(ENABLE_HATARI) endif(TOS_IMG_FILE) endif(ENABLE_OSX_BUNDLE) endif(ENABLE_HATARI) + + +if(ENABLE_LIBRETRO) + set_target_properties(retro-hatari PROPERTIES + PREFIX "" + ) + + if(APPLE) + set_target_properties(retro-hatari PROPERTIES + SUFFIX ".dylib" + ) + endif(APPLE) + + set_target_properties(retro-hatari PROPERTIES + PREFIX "" + OUTPUT_NAME "hatari_libretro" + ) + + if(LIBRETRO_SUFFIX) + set_target_properties(retro-hatari PROPERTIES + OUTPUT_NAME "hatari_libretro${LIBRETRO_SUFFIX}" + ) + endif() + + if(ZLIB_FOUND) + target_link_libraries(retro-hatari ${ZLIB_LIBRARY}) + endif(ZLIB_FOUND) + + if(CapsImage_FOUND) + target_link_libraries(retro-hatari ${CAPSIMAGE_LIBRARY}) + endif(CapsImage_FOUND) +endif(ENABLE_LIBRETRO)