@@ -173,7 +173,7 @@ option(UNITTEST "Set to ON to generate the unittest target" ${UNITTEST})
173173option (SIMULATOR "Set to ON when targeting an x86 simulator of an ARM platform" ${SIMULATOR} )
174174option (LIBRETRO "Set to ON to generate the libretro target" OFF )
175175# :: Options
176- option (USE_LIBNX "Set to ON to build for Switch(libnx)" OFF )
176+ option (USE_LIBNX "Set to ON to build for Switch (libnx)" OFF )
177177option (USE_FFMPEG "Build with FFMPEG support" ON )
178178option (USE_DISCORD "Build with Discord support" ON )
179179option (USE_MINIUPNPC "Build with miniUPnPc support" ON )
@@ -221,12 +221,21 @@ endif()
221221
222222if (LIBRETRO)
223223 add_definitions (-D__LIBRETRO__)
224- add_definitions (-DGLEW_NO_GLU )
224+ set (GLEW_NO_GLU ON )
225225 if (NOT MSVC )
226226 add_compile_options (-fPIC)
227227 endif ()
228228endif ()
229229
230+ if (USE_LIBNX)
231+ add_definitions (-DHAVE_LIBNX)
232+ set (GLEW_NO_GLU ON )
233+ endif ()
234+
235+ if (GLEW_NO_GLU)
236+ add_definitions (-DGLEW_NO_GLU)
237+ endif ()
238+
230239if (ANDROID)
231240 set (MOBILE_DEVICE ON )
232241 set (USING_GLES2 ON )
@@ -1468,7 +1477,17 @@ else()
14681477 message (WARNING "Found SDL2_ttf <2.0.18 - this is too old, falling back to atlas" )
14691478 endif ()
14701479 if (SDL2_ttf_FOUND)
1471- set (nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf)
1480+ if (TARGET SDL2_ttf::SDL2_ttf)
1481+ set (nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf)
1482+ else ()
1483+ set (nativeExtraLibs ${nativeExtraLibs} SDL2_ttf::SDL2_ttf-static )
1484+ if (USE_LIBNX)
1485+ # devkitpro switch portlibs SDL2_ttf is pulling -lpng16. Remove it to use libpng17
1486+ get_target_property (SDL2_ttf_extra_libs SDL2_ttf::SDL2_ttf-static INTERFACE_LINK_LIBRARIES)
1487+ string (REPLACE "png16" "" SDL2_ttf_extra_libs_fixed "${SDL2_ttf_extra_libs} " )
1488+ set_target_properties (SDL2_ttf::SDL2_ttf-static PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_ttf_extra_libs_fixed} " )
1489+ endif ()
1490+ endif ()
14721491 elseif (SDL2_ttf_PKGCONFIG_FOUND)
14731492 set (nativeExtraLibs ${nativeExtraLibs} PkgConfig::SDL2_ttf_PKGCONFIG)
14741493 endif ()
@@ -2490,7 +2509,7 @@ endif()
24902509include_directories (ext /libchdr/include )
24912510
24922511target_link_libraries (${CoreLibName} Common native chdr kirk cityhash sfmt19937 xbrz xxhash rcheevos minimp3 at3_standalone lua ${GlslangLibs}
2493- ${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${ CMAKE_DL_LIBS} )
2512+ ${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} $<$< NOT :$< BOOL : ${USE_LIBNX} >>: ${ CMAKE_DL_LIBS}> )
24942513
24952514# Winsock
24962515if (WIN32 )
0 commit comments