From 6abd68cd87811d401743021a55f42fda49fcdae1 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 6 Mar 2016 15:19:35 +0000 Subject: [PATCH] SDL2: Statically link against SDL2 on OS X --- externals/cmake-modules/FindSDL2.cmake | 34 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/externals/cmake-modules/FindSDL2.cmake b/externals/cmake-modules/FindSDL2.cmake index 0af86840a..c289d960b 100644 --- a/externals/cmake-modules/FindSDL2.cmake +++ b/externals/cmake-modules/FindSDL2.cmake @@ -123,8 +123,6 @@ message("") SET(SDL2_SEARCH_PATHS - ~/Library/Frameworks - /Library/Frameworks /usr/local /usr /sw # Fink @@ -134,13 +132,24 @@ SET(SDL2_SEARCH_PATHS ${SDL2_PATH} ) -FIND_LIBRARY(SDL2_LIBRARY_TEMP - NAMES SDL2 - HINTS - $ENV{SDL2DIR} - PATH_SUFFIXES lib64 lib - PATHS ${SDL2_SEARCH_PATHS} -) +IF(NOT APPLE) + FIND_LIBRARY(SDL2_LIBRARY_TEMP + NAMES SDL2 + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES lib64 lib + 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) 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 # "real" variable in one-shot. 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 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) # For threads, as mentioned Apple doesn't need this.