SDL2: Statically link against SDL2 on OS X

This commit is contained in:
MerryMage 2016-03-06 15:19:35 +00:00
parent 2d40891b45
commit 6abd68cd87

View file

@ -123,8 +123,6 @@
message("<FindSDL2.cmake>") message("<FindSDL2.cmake>")
SET(SDL2_SEARCH_PATHS SET(SDL2_SEARCH_PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local /usr/local
/usr /usr
/sw # Fink /sw # Fink
@ -134,6 +132,7 @@ SET(SDL2_SEARCH_PATHS
${SDL2_PATH} ${SDL2_PATH}
) )
IF(NOT APPLE)
FIND_LIBRARY(SDL2_LIBRARY_TEMP FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2 NAMES SDL2
HINTS HINTS
@ -141,6 +140,16 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP
PATH_SUFFIXES lib64 lib PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS} PATHS ${SDL2_SEARCH_PATHS}
) )
ELSE()
# Statically link against SDL2 on OS X
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES libSDL2.a
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT APPLE)
IF(SDL2_LIBRARY_TEMP) IF(SDL2_LIBRARY_TEMP)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h FIND_PATH(SDL2_INCLUDE_DIR SDL.h
@ -195,7 +204,14 @@ IF(SDL2_LIBRARY_TEMP)
# So I use a temporary variable until the end so I can set the # So I use a temporary variable until the end so I can set the
# "real" variable in one-shot. # "real" variable in one-shot.
IF(APPLE) IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Carbon")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa") SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework ForceFeedback")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework IOKit")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework CoreAudio")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework CoreVideo")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework AudioToolbox")
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework AudioUnit")
ENDIF(APPLE) ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this. # For threads, as mentioned Apple doesn't need this.