Browse Source

modules: link also all required frameworks when finding SDL2 on iOS.

pull/134/merge
Vladimír Vondruš 10 years ago
parent
commit
ad27e192f4
  1. 4
      modules/FindMagnum.cmake
  2. 30
      modules/FindSDL2.cmake
  3. 2
      src/Magnum/Platform/CMakeLists.txt

4
modules/FindMagnum.cmake

@ -402,8 +402,8 @@ foreach(component ${Magnum_FIND_COMPONENTS})
elseif(${component} STREQUAL Sdl2Application)
find_package(SDL2)
if(SDL2_FOUND)
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${SDL2_LIBRARY})
set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
set(_MAGNUM_${_COMPONENT}_LIBRARIES ${SDL2_LIBRARIES})
set(_MAGNUM_${_COMPONENT}_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
else()
unset(MAGNUM_${_COMPONENT}_LIBRARY)
endif()

30
modules/FindSDL2.cmake

@ -3,8 +3,12 @@
# This module defines:
#
# SDL2_FOUND - True if SDL2 library is found
# SDL2_LIBRARY - SDL2 dynamic library
# SDL2_INCLUDE_DIR - Include dir
# SDL2_LIBRARIES - SDL2 library and dependent libraries
# SDL2_INCLUDE_DIRS - Root include dir and include dirs of dependencies
#
# Additionally these variables are defined for internal usage:
# SDL2_INCLUDE_DIR - Root include dir (w/o dependencies)
# SDL2_LIBRARY - SDL2 library (w/o dependencies)
#
#
@ -61,7 +65,29 @@ find_path(SDL2_INCLUDE_DIR
NAMES SDL_scancode.h
PATH_SUFFIXES ${_SDL2_PATH_SUFFIXES})
# iOS dependencies
if(CORRADE_TARGET_IOS)
set(_SDL2_FRAMEWORKS
AudioToolbox
CoreGraphics
CoreMotion
Foundation
GameController
QuartzCore
UIKit)
set(_SDL2_FRAMEWORK_LIBRARIES )
foreach(framework ${_SDL2_FRAMEWORKS})
find_library(_SDL2_${framework}_LIBRARY ${framework})
list(APPEND _SDL2_FRAMEWORK_LIBRARIES ${_SDL2_${framework}_LIBRARY})
list(APPEND _SDL2_FRAMEWORK_LIBRARY_NAMES _SDL2_${framework}_LIBRARY)
endforeach()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("SDL2" DEFAULT_MSG
${SDL2_LIBRARY_NEEDED}
${_SDL2_FRAMEWORK_LIBRARY_NAMES}
SDL2_INCLUDE_DIR)
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
set(SDL2_LIBRARIES ${SDL2_LIBRARY} ${_SDL2_FRAMEWORK_LIBRARIES})

2
src/Magnum/Platform/CMakeLists.txt

@ -127,7 +127,7 @@ if(WITH_SDL2APPLICATION)
message(FATAL_ERROR "SDL2 library, required by Sdl2Application, was not found. Set WITH_SDL2APPLICATION to OFF to skip building it.")
endif()
include_directories(${SDL2_INCLUDE_DIR})
include_directories(${SDL2_INCLUDE_DIRS})
set(MagnumSdl2Application_SRCS
Sdl2Application.cpp

Loading…
Cancel
Save