cmake: Fix bug #5361.

src/joystick/*.c wasn't unconditionally added to source list even though
joystick is an SDL subsystem. Also removed the `SDL_JOYSTICK AND NOT APPLE`
condition from src/joystick/dummy/*.c source addition: the OSX unresolved
symbols issue, if it really is there, should be fixed separately.

Fixes https://github.com/libsdl-org/SDL/issues/5361, i.e. build failures
when SDL_JOYSTICK and SDL_HAPTIC are disabled.
This commit is contained in:
Ozkan Sezer 2022-02-23 18:10:02 +03:00
parent 94d43186f2
commit 4a43321c81
1 changed files with 3 additions and 8 deletions

View File

@ -471,6 +471,7 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/dynapi/*.c
${SDL2_SOURCE_DIR}/src/events/*.c
${SDL2_SOURCE_DIR}/src/file/*.c
${SDL2_SOURCE_DIR}/src/joystick/*.c
${SDL2_SOURCE_DIR}/src/haptic/*.c
${SDL2_SOURCE_DIR}/src/hidapi/*.c
${SDL2_SOURCE_DIR}/src/libm/*.c
@ -961,10 +962,6 @@ foreach(_SUB ${SDL_SUBSYSTEMS})
set(SDL_${_OPT}_DISABLED 1)
endif()
endforeach()
if(SDL_JOYSTICK)
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
endif()
if(SDL_HAPTIC)
if(NOT SDL_JOYSTICK)
# Haptic requires some private functions from the joystick subsystem.
@ -2558,10 +2555,8 @@ if(NOT HAVE_SDL_VIDEO)
endif()
if(NOT HAVE_SDL_JOYSTICK)
set(SDL_JOYSTICK_DUMMY 1)
if(SDL_JOYSTICK AND NOT APPLE) # results in unresolved symbols on OSX
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
endif()
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
endif()
if(NOT HAVE_SDL_HAPTIC)
set(SDL_HAPTIC_DUMMY 1)