this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merged changes to build process (particularly to Android and iOS via CMake) from Eric Wing. Thanks Eric!

+590 -184
+53 -9
CMakeLists.txt
··· 4 4 5 5 if(UNIX) 6 6 set(SDL_gpu_INSTALL_BY_DEFAULT ON) 7 + elseif(WIN32) 8 + set(SDL_gpu_INSTALL_BY_DEFAULT ON) 7 9 else(UNIX) 8 10 set(SDL_gpu_INSTALL_BY_DEFAULT OFF) 9 11 endif(UNIX) ··· 14 16 set(SDL_gpu_DEFAULT_BUILD_DEMOS OFF) 15 17 set(SDL_gpu_DEFAULT_DISABLE_OPENGL ON) 16 18 set(SDL_gpu_DEFAULT_DISABLE_GLES OFF) 17 - else(IOS) 19 + elseif(ANDROID) 20 + set(SDL_gpu_INSTALL_BY_DEFAULT OFF) 21 + set(SDL_gpu_DEFAULT_BUILD_DEMOS OFF) 22 + set(SDL_gpu_DEFAULT_DISABLE_OPENGL ON) 23 + set(SDL_gpu_DEFAULT_DISABLE_GLES OFF) 24 + else() 18 25 set(SDL_gpu_DEFAULT_BUILD_DEMOS ON) 19 26 set(SDL_gpu_DEFAULT_DISABLE_OPENGL OFF) 20 27 set(SDL_gpu_DEFAULT_DISABLE_GLES ON) 21 - endif(IOS) 28 + endif() 22 29 23 30 option(SDL_gpu_INSTALL "Install SDL_gpu libs, includes, and CMake scripts" ${SDL_gpu_INSTALL_BY_DEFAULT}) 24 31 option(SDL_gpu_BUILD_DEBUG "Build with debugging symbols" ON) 25 - option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 26 - option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 27 32 option(SDL_gpu_BUILD_DEMOS "Build SDL_gpu demo programs" ${SDL_gpu_DEFAULT_BUILD_DEMOS}) 28 33 option(SDL_gpu_BUILD_TESTS "Build SDL_gpu test programs" OFF) 29 34 option(SDL_gpu_BUILD_VIDEO_TEST "Build SDL_gpu video test program (requires FFMPEG)" OFF) ··· 39 44 option(SDL_gpu_DISABLE_GLES_1 "Disable OpenGLES 1.X renderer" OFF) 40 45 option(SDL_gpu_DISABLE_GLES_2 "Disable OpenGLES 2.X renderer" OFF) 41 46 option(SDL_gpu_DISABLE_GLES_3 "Disable OpenGLES 3.X renderer" OFF) 47 + 48 + if(APPLE) 49 + if(IOS) 50 + # iOS 8 may need the framework option 51 + option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" OFF) 52 + option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 53 + else() 54 + option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 55 + option(SDL_gpu_BUILD_FRAMEWORK "Build SDL_gpu as Apple framework" ON) 56 + option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 57 + endif() 58 + elseif(ANDROID) 59 + option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 60 + option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" OFF) 61 + else() 62 + option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 63 + option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 64 + endif() 42 65 43 66 set(SDL_gpu_VERSION 0.11.0) 44 67 45 68 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/scripts) 46 69 70 + if(APPLE) 71 + include(ios-cmake/toolchain/XcodeDefaults) 72 + endif() 73 + 47 74 if ( SDL_gpu_BUILD_DEBUG ) 48 75 SET(CMAKE_BUILD_TYPE Debug) 49 76 else ( SDL_gpu_BUILD_DEBUG ) ··· 83 110 84 111 find_package(OpenGL REQUIRED) 85 112 include_directories(${OPENGL_INCLUDE_DIR}) 86 - link_libraries (${OPENGL_LIBRARIES}) 113 + if(APPLE AND NOT IOS) 114 + # CMake incorrectly includes AGL.framework in OPENGL_LIBRARIES which is obsolete. 115 + link_libraries(${OPENGL_gl_LIBRARY}) 116 + else() 117 + link_libraries(${OPENGL_LIBRARIES}) 118 + endif() 119 + 87 120 88 121 if (SDL_gpu_DISABLE_OPENGL_1_BASE) 89 122 add_definitions("-DSDL_GPU_DISABLE_OPENGL_1_BASE") ··· 131 164 add_definitions("-DSDL_GPU_DISABLE_GLES") 132 165 else (SDL_gpu_DISABLE_GLES) 133 166 134 - find_package(OpenGLES REQUIRED) 135 - include_directories(${OPENGLES_INCLUDE_DIR}) 136 - link_libraries (${OPENGLES_LIBRARIES}) 137 - 167 + if(ANDROID) 168 + find_library( ANDROID_LOG_LIBRARY log ) 169 + find_library( ANDROID_GLES2_LIBRARY GLESv2 ) 170 + find_library( ANDROID_GLES1_LIBRARY GLESv1_CM ) 171 + link_libraries( 172 + ${ANDROID_LOG_LIBRARY} 173 + ${ANDROID_GLES2_LIBRARY} 174 + ${ANDROID_GLES1_LIBRARY} 175 + ) 176 + else() 177 + find_package(OpenGLES REQUIRED) 178 + include_directories(${OPENGLES_INCLUDE_DIR}) 179 + link_libraries (${OPENGLES_LIBRARIES}) 180 + endif() 181 + 138 182 if (SDL_gpu_DISABLE_GLES_1) 139 183 add_definitions("-DSDL_GPU_DISABLE_GLES_1") 140 184 endif (SDL_gpu_DISABLE_GLES_1)
+299
scripts/FindPackageHandleStandardArgs.cmake
··· 1 + # FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... ) 2 + # 3 + # This function is intended to be used in FindXXX.cmake modules files. 4 + # It handles the REQUIRED, QUIET and version-related arguments to find_package(). 5 + # It also sets the <UPPERCASED_NAME>_FOUND variable. 6 + # The package is considered found if all variables <var1>... listed contain 7 + # valid results, e.g. valid filepaths. 8 + # 9 + # There are two modes of this function. The first argument in both modes is 10 + # the name of the Find-module where it is called (in original casing). 11 + # 12 + # The first simple mode looks like this: 13 + # FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) 14 + # If the variables <var1> to <varN> are all valid, then <UPPERCASED_NAME>_FOUND 15 + # will be set to TRUE. 16 + # If DEFAULT_MSG is given as second argument, then the function will generate 17 + # itself useful success and error messages. You can also supply a custom error message 18 + # for the failure case. This is not recommended. 19 + # 20 + # The second mode is more powerful and also supports version checking: 21 + # FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>] 22 + # [VERSION_VAR <versionvar>] 23 + # [HANDLE_COMPONENTS] 24 + # [CONFIG_MODE] 25 + # [FAIL_MESSAGE "Custom failure message"] ) 26 + # 27 + # As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND 28 + # will be set to TRUE. 29 + # After REQUIRED_VARS the variables which are required for this package are listed. 30 + # Following VERSION_VAR the name of the variable can be specified which holds 31 + # the version of the package which has been found. If this is done, this version 32 + # will be checked against the (potentially) specified required version used 33 + # in the find_package() call. The EXACT keyword is also handled. The default 34 + # messages include information about the required version and the version 35 + # which has been actually found, both if the version is ok or not. 36 + # If the package supports components, use the HANDLE_COMPONENTS option to enable 37 + # handling them. In this case, find_package_handle_standard_args() will report 38 + # which components have been found and which are missing, and the <NAME>_FOUND 39 + # variable will be set to FALSE if any of the required components (i.e. not the 40 + # ones listed after OPTIONAL_COMPONENTS) are missing. 41 + # Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for 42 + # a find_package(... NO_MODULE) call. In this case VERSION_VAR will be set 43 + # to <NAME>_VERSION and the macro will automatically check whether the 44 + # Config module was found. 45 + # Via FAIL_MESSAGE a custom failure message can be specified, if this is not 46 + # used, the default message will be displayed. 47 + # 48 + # Example for mode 1: 49 + # 50 + # FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 51 + # 52 + # LibXml2 is considered to be found, if both LIBXML2_LIBRARY and 53 + # LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. 54 + # If it is not found and REQUIRED was used, it fails with FATAL_ERROR, 55 + # independent whether QUIET was used or not. 56 + # If it is found, success will be reported, including the content of <var1>. 57 + # On repeated Cmake runs, the same message won't be printed again. 58 + # 59 + # Example for mode 2: 60 + # 61 + # FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE 62 + # VERSION_VAR BISON_VERSION) 63 + # In this case, BISON is considered to be found if the variable(s) listed 64 + # after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case. 65 + # Also the version of BISON will be checked by using the version contained 66 + # in BISON_VERSION. 67 + # Since no FAIL_MESSAGE is given, the default messages will be printed. 68 + # 69 + # Another example for mode 2: 70 + # 71 + # find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) 72 + # FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE) 73 + # In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 NO_MODULE) 74 + # and adds an additional search directory for automoc4. 75 + # The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper 76 + # success/error message. 77 + 78 + #============================================================================= 79 + # Copyright 2007-2009 Kitware, Inc. 80 + # 81 + # Distributed under the OSI-approved BSD License (the "License"); 82 + # see accompanying file Copyright.txt for details. 83 + # 84 + # This software is distributed WITHOUT ANY WARRANTY; without even the 85 + # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 86 + # See the License for more information. 87 + #============================================================================= 88 + # (To distribute this file outside of CMake, substitute the full 89 + # License text for the above reference.) 90 + 91 + include(FindPackageMessage) 92 + include(CMakeParseArguments) 93 + 94 + # internal helper macro 95 + macro(_FPHSA_FAILURE_MESSAGE _msg) 96 + if (${_NAME}_FIND_REQUIRED) 97 + message(FATAL_ERROR "${_msg}") 98 + else () 99 + if (NOT ${_NAME}_FIND_QUIETLY) 100 + message(STATUS "${_msg}") 101 + endif () 102 + endif () 103 + endmacro() 104 + 105 + 106 + # internal helper macro to generate the failure message when used in CONFIG_MODE: 107 + macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) 108 + # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: 109 + if(${_NAME}_CONFIG) 110 + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") 111 + else() 112 + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. 113 + # List them all in the error message: 114 + if(${_NAME}_CONSIDERED_CONFIGS) 115 + set(configsText "") 116 + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) 117 + math(EXPR configsCount "${configsCount} - 1") 118 + foreach(currentConfigIndex RANGE ${configsCount}) 119 + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) 120 + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) 121 + set(configsText "${configsText} ${filename} (version ${version})\n") 122 + endforeach() 123 + if (${_NAME}_NOT_FOUND_MESSAGE) 124 + set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") 125 + endif() 126 + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") 127 + 128 + else() 129 + # Simple case: No Config-file was found at all: 130 + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") 131 + endif() 132 + endif() 133 + endmacro() 134 + 135 + 136 + function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) 137 + 138 + # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in 139 + # new extended or in the "old" mode: 140 + set(options CONFIG_MODE HANDLE_COMPONENTS) 141 + set(oneValueArgs FAIL_MESSAGE VERSION_VAR) 142 + set(multiValueArgs REQUIRED_VARS) 143 + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) 144 + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) 145 + 146 + if(${INDEX} EQUAL -1) 147 + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) 148 + set(FPHSA_REQUIRED_VARS ${ARGN}) 149 + set(FPHSA_VERSION_VAR) 150 + else() 151 + 152 + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) 153 + 154 + if(FPHSA_UNPARSED_ARGUMENTS) 155 + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") 156 + endif() 157 + 158 + if(NOT FPHSA_FAIL_MESSAGE) 159 + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") 160 + endif() 161 + endif() 162 + 163 + # now that we collected all arguments, process them 164 + 165 + if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") 166 + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") 167 + endif() 168 + 169 + # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package() 170 + # when it successfully found the config-file, including version checking: 171 + if(FPHSA_CONFIG_MODE) 172 + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) 173 + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) 174 + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) 175 + endif() 176 + 177 + if(NOT FPHSA_REQUIRED_VARS) 178 + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") 179 + endif() 180 + 181 + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) 182 + 183 + string(TOUPPER ${_NAME} _NAME_UPPER) 184 + string(TOLOWER ${_NAME} _NAME_LOWER) 185 + 186 + # collect all variables which were not found, so they can be printed, so the 187 + # user knows better what went wrong (#6375) 188 + set(MISSING_VARS "") 189 + set(DETAILS "") 190 + set(${_NAME_UPPER}_FOUND TRUE) 191 + # check if all passed variables are valid 192 + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) 193 + if(NOT ${_CURRENT_VAR}) 194 + set(${_NAME_UPPER}_FOUND FALSE) 195 + set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") 196 + else() 197 + set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") 198 + endif() 199 + endforeach() 200 + 201 + # component handling 202 + unset(FOUND_COMPONENTS_MSG) 203 + unset(MISSING_COMPONENTS_MSG) 204 + 205 + if(FPHSA_HANDLE_COMPONENTS) 206 + foreach(comp ${${_NAME}_FIND_COMPONENTS}) 207 + if(${_NAME}_${comp}_FOUND) 208 + 209 + if(NOT DEFINED FOUND_COMPONENTS_MSG) 210 + set(FOUND_COMPONENTS_MSG "found components: ") 211 + endif() 212 + set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") 213 + 214 + else() 215 + 216 + if(NOT DEFINED MISSING_COMPONENTS_MSG) 217 + set(MISSING_COMPONENTS_MSG "missing components: ") 218 + endif() 219 + set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") 220 + 221 + if(${_NAME}_FIND_REQUIRED_${comp}) 222 + set(${_NAME_UPPER}_FOUND FALSE) 223 + set(MISSING_VARS "${MISSING_VARS} ${comp}") 224 + endif() 225 + 226 + endif() 227 + endforeach() 228 + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") 229 + set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") 230 + endif() 231 + 232 + # version handling: 233 + set(VERSION_MSG "") 234 + set(VERSION_OK TRUE) 235 + set(VERSION ${${FPHSA_VERSION_VAR}} ) 236 + if (${_NAME}_FIND_VERSION) 237 + 238 + if(VERSION) 239 + 240 + if(${_NAME}_FIND_VERSION_EXACT) # exact version required 241 + if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") 242 + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") 243 + set(VERSION_OK FALSE) 244 + else () 245 + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") 246 + endif () 247 + 248 + else() # minimum version specified: 249 + if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") 250 + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") 251 + set(VERSION_OK FALSE) 252 + else () 253 + set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") 254 + endif () 255 + endif() 256 + 257 + else() 258 + 259 + # if the package was not found, but a version was given, add that to the output: 260 + if(${_NAME}_FIND_VERSION_EXACT) 261 + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") 262 + else() 263 + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") 264 + endif() 265 + 266 + endif() 267 + else () 268 + if(VERSION) 269 + set(VERSION_MSG "(found version \"${VERSION}\")") 270 + endif() 271 + endif () 272 + 273 + if(VERSION_OK) 274 + set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") 275 + else() 276 + set(${_NAME_UPPER}_FOUND FALSE) 277 + endif() 278 + 279 + 280 + # print the result: 281 + if (${_NAME_UPPER}_FOUND) 282 + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") 283 + else () 284 + 285 + if(FPHSA_CONFIG_MODE) 286 + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() 287 + else() 288 + if(NOT VERSION_OK) 289 + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") 290 + else() 291 + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") 292 + endif() 293 + endif() 294 + 295 + endif () 296 + 297 + set(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE) 298 + 299 + endfunction()
+27 -155
scripts/FindSDL2.cmake
··· 1 - # Locate SDL2 library 2 - # This module defines 3 - # SDL2_LIBRARY, the name of the library to link against 4 - # SDL2_FOUND, if false, do not try to link to SDL2 5 - # SDL2_INCLUDE_DIR, where to find SDL.h 6 - # 7 - # This module responds to the the flag: 8 - # SDL2_BUILDING_LIBRARY 9 - # If this is defined, then no SDL2_main will be linked in because 10 - # only applications need main(). 11 - # Otherwise, it is assumed you are building an application and this 12 - # module will attempt to locate and set the the proper link flags 13 - # as part of the returned SDL2_LIBRARY variable. 14 - # 15 - # Don't forget to include SDL2main.h and SDL2main.m your project for the 16 - # OS X framework based version. (Other versions link to -lSDL2main which 17 - # this module will try to find on your behalf.) Also for OS X, this 18 - # module will automatically add the -framework Cocoa on your behalf. 19 - # 20 - # 21 - # Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration 22 - # and no SDL2_LIBRARY, it means CMake did not find your SDL2 library 23 - # (SDL2.dll, libsdl2.so, SDL2.framework, etc). 24 - # Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. 25 - # Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value 26 - # as appropriate. These values are used to generate the final SDL2_LIBRARY 27 - # variable, but when these values are unset, SDL2_LIBRARY does not get created. 1 + # - Find SDL 2 + # Find the SDL libraries (asound) 28 3 # 4 + # This module defines the following variables: 5 + # SDL_FOUND - True if SDL_INCLUDE_DIR & SDL_LIBRARY are found 6 + # SDL_LIBRARY - Set when SDL_LIBRARY is found 29 7 # 30 - # $SDL2DIR is an environment variable that would 31 - # correspond to the ./configure --prefix=$SDL2DIR 32 - # used in building SDL2. 33 - # l.e.galup 9-20-02 8 + # SDL_INCLUDE_DIR - where to find SDL.h, etc. 34 9 # 35 - # Modified by Eric Wing. 36 - # Added code to assist with automated building by using environmental variables 37 - # and providing a more controlled/consistent search behavior. 38 - # Added new modifications to recognize OS X frameworks and 39 - # additional Unix paths (FreeBSD, etc). 40 - # Also corrected the header search path to follow "proper" SDL2 guidelines. 41 - # Added a search for SDL2main which is needed by some platforms. 42 - # Added a search for threads which is needed by some platforms. 43 - # Added needed compile switches for MinGW. 44 - # 45 - # On OSX, this will prefer the Framework version (if found) over others. 46 - # People will have to manually change the cache values of 47 - # SDL2_LIBRARY to override this selection or set the CMake environment 48 - # CMAKE_INCLUDE_PATH to modify the search paths. 49 - # 50 - # Note that the header path has changed from SDL2/SDL.h to just SDL.h 51 - # This needed to change because "proper" SDL2 convention 52 - # is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability 53 - # reasons because not all systems place things in SDL2/ (see FreeBSD). 54 - # 55 - # Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake 56 - # module with the minor edit of changing "SDL" to "SDL2" where necessary. This 57 - # was not created for redistribution, and exists temporarily pending official 58 - # SDL2 CMake modules. 59 10 60 11 #============================================================================= 61 - # Copyright 2003-2009 Kitware, Inc. 12 + # Copyright Eric Wing 62 13 # 63 14 # Distributed under the OSI-approved BSD License (the "License"); 64 15 # see accompanying file Copyright.txt for details. ··· 70 21 # (To distribute this file outside of CMake, substitute the full 71 22 # License text for the above reference.) 72 23 73 - FIND_PATH(SDL2_INCLUDE_DIR SDL.h 74 - HINTS 75 - $ENV{SDL2DIR} 76 - PATH_SUFFIXES include/SDL2 include 77 - PATHS 78 - ~/Library/Frameworks 79 - /Library/Frameworks 80 - /usr/local/include/SDL2 81 - /usr/include/SDL2 82 - /sw # Fink 83 - /opt/local # DarwinPorts 84 - /opt/csw # Blastwave 85 - /opt 24 + find_path(SDL2_INCLUDE_DIR NAMES SDL.h 25 + PATH_SUFFIXES include/SDL2 include 26 + DOC "The SDL include directory" 86 27 ) 87 - #MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}") 88 28 89 - FIND_LIBRARY(SDL2_LIBRARY_TEMP 90 - NAMES SDL2 91 - HINTS 92 - $ENV{SDL2DIR} 93 - PATH_SUFFIXES lib64 lib 94 - PATHS 95 - /sw 96 - /opt/local 97 - /opt/csw 98 - /opt 29 + find_library(SDL2_LIBRARY NAMES SDL2 sdl2 sdl2 sdl-2.0 30 + DOC "The SDL library" 99 31 ) 100 32 101 - #MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}") 33 + if(WIN32) 34 + find_library(SDL2MAIN_LIBRARY NAMES SDL2main sdl2main 35 + DOC "The SDLmain library needed on some platforms when builing an application (opposed to a library)" 36 + ) 37 + else() 38 + set(SDL2MAIN_LIBRARY "") 39 + endif() 102 40 103 - IF(NOT SDL2_BUILDING_LIBRARY) 104 - IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") 105 - # Non-OS X framework versions expect you to also dynamically link to 106 - # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms 107 - # seem to provide SDL2main for compatibility even though they don't 108 - # necessarily need it. 109 - FIND_LIBRARY(SDL2MAIN_LIBRARY 110 - NAMES SDL2main 111 - HINTS 112 - $ENV{SDL2DIR} 113 - PATH_SUFFIXES lib64 lib 114 - PATHS 115 - /sw 116 - /opt/local 117 - /opt/csw 118 - /opt 119 - ) 120 - ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") 121 - ENDIF(NOT SDL2_BUILDING_LIBRARY) 122 41 123 - # SDL2 may require threads on your system. 124 - # The Apple build may not need an explicit flag because one of the 125 - # frameworks may already provide it. 126 - # But for non-OSX systems, I will use the CMake Threads package. 127 - IF(NOT APPLE) 128 - FIND_PACKAGE(Threads) 129 - ENDIF(NOT APPLE) 42 + # handle the QUIETLY and REQUIRED arguments and set SDL_FOUND to TRUE if 43 + # all listed variables are TRUE 44 + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) 130 45 131 - # MinGW needs an additional library, mwindows 132 - # It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows 133 - # (Actually on second look, I think it only needs one of the m* libraries.) 134 - IF(MINGW) 135 - SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") 136 - ENDIF(MINGW) 46 + FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 47 + REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR 48 + VERSION_VAR SDL2_VERSION_STRING) 49 + 50 + #mark_as_advanced(SDL_INCLUDE_DIR SDL_LIBRARIES) 137 51 138 - SET(SDL2_FOUND "NO") 139 - IF(SDL2_LIBRARY_TEMP) 140 - # For SDL2main 141 - IF(NOT SDL2_BUILDING_LIBRARY) 142 - IF(SDL2MAIN_LIBRARY) 143 - SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP}) 144 - ENDIF(SDL2MAIN_LIBRARY) 145 - ENDIF(NOT SDL2_BUILDING_LIBRARY) 146 52 147 - # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa. 148 - # CMake doesn't display the -framework Cocoa string in the UI even 149 - # though it actually is there if I modify a pre-used variable. 150 - # I think it has something to do with the CACHE STRING. 151 - # So I use a temporary variable until the end so I can set the 152 - # "real" variable in one-shot. 153 - IF(APPLE) 154 - SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa") 155 - ENDIF(APPLE) 156 - 157 - # For threads, as mentioned Apple doesn't need this. 158 - # In fact, there seems to be a problem if I used the Threads package 159 - # and try using this line, so I'm just skipping it entirely for OS X. 160 - IF(NOT APPLE) 161 - SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) 162 - ENDIF(NOT APPLE) 163 - 164 - # For MinGW library 165 - IF(MINGW) 166 - SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP}) 167 - ENDIF(MINGW) 168 - 169 - # Set the final string here so the GUI reflects the final state. 170 - SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") 171 - # Set the temp variable to INTERNAL so it is not seen in the CMake GUI 172 - SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") 173 - 174 - SET(SDL2_FOUND "YES") 175 - ENDIF(SDL2_LIBRARY_TEMP) 176 - 177 - INCLUDE(FindPackageHandleStandardArgs) 178 - 179 - FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 180 - REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
+55
scripts/ios-cmake/toolchain/XcodeDefaults.cmake
··· 1 + # This file is here to initial Xcode to better default settings. 2 + 3 + macro(SDL_gpu_CONFIGURE_XCODE_DEFAULTS _EXE_NAME) 4 + 5 + # This iOS toolchain provides this convenience macro, but this is not in the mainline Mac, so let's define it. 6 + if(APPLE AND NOT IOS) 7 + macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) 8 + set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE}) 9 + endmacro (set_xcode_property) 10 + endif() 11 + 12 + 13 + if(APPLE) 14 + if(IOS) 15 + 16 + # We need to make sure dead code stripping is off for "plugins" since we must statically link. 17 + # set_xcode_property(${_EXE_NAME} DEAD_CODE_STRIPPING "No") 18 + 19 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] YES) 20 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=MinSizeRel] YES) 21 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=RelWithDebInfo] YES) 22 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Release] YES) 23 + 24 + set_xcode_property(${_EXE_NAME} IPHONEOS_DEPLOYMENT_TARGET 5.1) 25 + set_xcode_property(${_EXE_NAME} TARGETED_DEVICE_FAMILY "1,2") 26 + 27 + # OSX 28 + else() 29 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] YES) 30 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=MinSizeRel] YES) 31 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=RelWithDebInfo] YES) 32 + set_xcode_property(${_EXE_NAME} GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Release] YES) 33 + 34 + set_xcode_property(${_EXE_NAME} MACOSX_DEPLOYMENT_TARGET 10.6) 35 + 36 + 37 + endif(IOS) 38 + 39 + # Common to both 40 + # Use Apple's recommended standard architectures 41 + set_xcode_property(${_EXE_NAME} ARCHS "$(ARCHS_STANDARD)") 42 + 43 + 44 + 45 + set_xcode_property(${_EXE_NAME} GCC_OPTIMIZATION_LEVEL[variant=Debug] "0") 46 + set_xcode_property(${_EXE_NAME} GCC_OPTIMIZATION_LEVEL[variant=MinSizeRel] "s") 47 + set_xcode_property(${_EXE_NAME} GCC_OPTIMIZATION_LEVEL[variant=RelWithDebInfo] "s") 48 + set_xcode_property(${_EXE_NAME} GCC_OPTIMIZATION_LEVEL[variant=Release] "s") 49 + 50 + 51 + set_xcode_property(${_EXE_NAME} ONLY_ACTIVE_ARCH NO) 52 + set_xcode_property(${_EXE_NAME} DEBUG_INFORMATION_FORMAT "dwarf-with-dsym") 53 + 54 + endif(APPLE) 55 + endmacro(SDL_gpu_CONFIGURE_XCODE_DEFAULTS)
+101 -15
scripts/ios-cmake/toolchain/iOS.cmake
··· 18 18 # In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path. 19 19 # If set manually, this will force the use of a specific SDK version 20 20 21 + # Macros: 22 + # 23 + # set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE) 24 + # A convenience macro for setting xcode specific properties on targets 25 + # example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1") 26 + # 27 + # find_host_package (PROGRAM ARGS) 28 + # A macro used to find executable programs on the host system, not within the iOS environment. 29 + # Thanks to the android-cmake project for providing the command 30 + 31 + 21 32 # Standard settings 22 33 set (CMAKE_SYSTEM_NAME Darwin) 23 - set (CMAKE_SYSTEM_VERSION 1 ) 34 + set (CMAKE_SYSTEM_VERSION 1) 24 35 set (UNIX True) 25 36 set (APPLE True) 26 37 set (IOS True) 27 38 28 - # Force the compilers to gcc for iOS 39 + # Required as of cmake 2.8.10 40 + set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE) 41 + 42 + # Determine the cmake host system version so we know where to find the iOS SDKs 43 + find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin) 44 + if (CMAKE_UNAME) 45 + exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) 46 + string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") 47 + endif (CMAKE_UNAME) 48 + 49 + # Force the compilers to clang for iOS 29 50 include (CMakeForceCompiler) 30 - CMAKE_FORCE_C_COMPILER (gcc gcc) 31 - CMAKE_FORCE_CXX_COMPILER (g++ g++) 51 + CMAKE_FORCE_C_COMPILER (/usr/bin/clang clang) 52 + CMAKE_FORCE_CXX_COMPILER (/usr/bin/clang++ clang++) 32 53 33 54 # Skip the platform compiler checks for cross compiling 34 55 set (CMAKE_CXX_COMPILER_WORKS TRUE) ··· 48 69 set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") 49 70 50 71 # Hidden visibilty is required for cxx on iOS 51 - set (CMAKE_C_FLAGS "") 52 - set (CMAKE_CXX_FLAGS "-headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden") 72 + set (CMAKE_C_FLAGS_INIT "") 73 + set (CMAKE_CXX_FLAGS_INIT "-headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden") 53 74 54 75 set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") 55 76 set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") ··· 69 90 find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool) 70 91 endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL) 71 92 72 - # Setup iOS platform 93 + # Setup iOS platform unless specified manually with IOS_PLATFORM 73 94 if (NOT DEFINED IOS_PLATFORM) 74 95 set (IOS_PLATFORM "OS") 75 96 endif (NOT DEFINED IOS_PLATFORM) ··· 78 99 # Check the platform selection and setup for developer root 79 100 if (${IOS_PLATFORM} STREQUAL "OS") 80 101 set (IOS_PLATFORM_LOCATION "iPhoneOS.platform") 102 + 103 + # This causes the installers to properly locate the output libraries 104 + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos") 81 105 elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR") 82 106 set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform") 107 + 108 + # This causes the installers to properly locate the output libraries 109 + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") 83 110 else (${IOS_PLATFORM} STREQUAL "OS") 84 111 message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") 85 112 endif (${IOS_PLATFORM} STREQUAL "OS") 86 113 87 - # Setup iOS developer location 114 + # Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT 115 + # Note Xcode 4.3 changed the installation location, choose the most recent one available 116 + set (XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer") 117 + set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer") 88 118 if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) 89 - set (CMAKE_IOS_DEVELOPER_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer") 119 + if (EXISTS ${XCODE_POST_43_ROOT}) 120 + set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT}) 121 + elseif(EXISTS ${XCODE_PRE_43_ROOT}) 122 + set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT}) 123 + endif (EXISTS ${XCODE_POST_43_ROOT}) 90 124 endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) 91 125 set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") 92 126 93 - # Find and use the most recent iOS sdk 127 + # Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT 94 128 if (NOT DEFINED CMAKE_IOS_SDK_ROOT) 95 129 file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*") 96 130 if (_CMAKE_IOS_SDKS) ··· 98 132 list (REVERSE _CMAKE_IOS_SDKS) 99 133 list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT) 100 134 else (_CMAKE_IOS_SDKS) 101 - message (FATAL_ERROR "No iOS SDK's found in default seach path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") 135 + message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") 102 136 endif (_CMAKE_IOS_SDKS) 103 137 message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}") 104 138 endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) 105 139 set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") 106 140 107 141 # Set the sysroot default to the most recent SDK 108 - set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") 142 + # The generic "iphoneos" is used to trigger the "Latest" setting. The full SDK path which CMake has been trying to do actually breaks functionality in subtle ways. 143 + set (CMAKE_OSX_SYSROOT iphoneos CACHE PATH "Sysroot used for iOS support") 144 + #set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") 109 145 110 - # set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv6,armv7 and appears to be XCode's standard. 111 - # The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only 112 - set (CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)" CACHE string "Build architecture for iOS") 146 + # set the architecture for iOS 147 + # NOTE: Currently both ARCHS_STANDARD_32_BIT and ARCHS_UNIVERSAL_IPHONE_OS set armv7 only, so set both manually 148 + # NOTE: EW: I'm disabling this because it breaks arm64. Apple has dropped armv6. Time to move on. 149 + #if (${IOS_PLATFORM} STREQUAL "OS") 150 + # set (IOS_ARCH armv6 armv7) 151 + #else (${IOS_PLATFORM} STREQUAL "OS") 152 + # set (IOS_ARCH i386) 153 + #endif (${IOS_PLATFORM} STREQUAL "OS") 154 + 155 + set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS") 113 156 114 157 # Set the find root to the iOS developer roots and to user defined paths 115 158 set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root") ··· 129 172 set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 130 173 set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 131 174 175 + 176 + # This little macro lets you set any XCode specific property 177 + macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) 178 + set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE}) 179 + endmacro (set_xcode_property) 180 + 181 + 182 + # This macro lets you find executable programs on the host system 183 + macro (find_host_package) 184 + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 185 + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) 186 + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) 187 + set (IOS FALSE) 188 + 189 + find_package(${ARGN}) 190 + 191 + set (IOS TRUE) 192 + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) 193 + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 194 + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 195 + endmacro (find_host_package) 196 + 197 + 198 + # We need to make sure dead code stripping is off for "plugins" since we must statically link. 199 + set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING NO) 200 + 201 + # Not working correctly 202 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] YES) 203 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=MinSizeRel] NO) 204 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=RelWithDebInfo] YES) 205 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Release] NO) 206 + 207 + # Not working correctly 208 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL[variant=Debug] "0") 209 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL[variant=MinSizeRel] "s") 210 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL[variant=RelWithDebInfo] "fast") 211 + #set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL[variant=Release] "fast") 212 + 213 + # Common to both 214 + # Use Apple's recommended standard architectures 215 + set(CMAKE_XCODE_ATTRIBUTE_ARCHS "$(ARCHS_STANDARD)") 216 + 217 +
+55 -5
src/CMakeLists.txt
··· 61 61 set (SDL_gpu_OUTPUT_NAME "SDL2_gpu") 62 62 endif ( SDL_gpu_USE_SDL1) 63 63 64 + if(APPLE) 65 + set(CMAKE_MACOSX_RPATH 1) 66 + # use, i.e. don't skip the full RPATH for the build tree 67 + # SET(CMAKE_SKIP_BUILD_RPATH FALSE) 68 + 69 + # when building, don't use the install RPATH already 70 + # (but later on when installing) 71 + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 72 + 73 + # add the automatically determined parts of the RPATH 74 + # which point to directories outside the build tree to the install RPATH 75 + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) 76 + endif() 77 + 64 78 # Build the shared library (.so or .dll) 65 79 if(SDL_gpu_BUILD_SHARED) 66 80 add_library(SDL_gpu_shared SHARED 67 81 ${SDL_gpu_HDRS} 68 82 ${SDL_gpu_SRCS} 69 83 ) 70 - set_target_properties(SDL_gpu_shared PROPERTIES 71 - OUTPUT_NAME ${SDL_gpu_OUTPUT_NAME} 72 - CLEAN_DIRECT_OUTPUT 1 73 - VERSION ${SDL_gpu_VERSION} 74 - ) 84 + if(SDL_gpu_BUILD_FRAMEWORK) 85 + set_target_properties(SDL_gpu_shared PROPERTIES 86 + FRAMEWORK TRUE 87 + FRAMEWORK_VERSION "A" 88 + PUBLIC_HEADER "${SDL_gpu_install_HDRS}" 89 + #RESOURCE "${RESOURCE_FILES}" 90 + VERSION ${SDL_gpu_VERSION} 91 + SOVERSION ${SDL_gpu_VERSION} 92 + OUTPUT_NAME ${SDL_gpu_OUTPUT_NAME} 93 + ) 94 + # Short Version is the "marketing version". It is the version 95 + # the user sees in an information panel. 96 + SET(MACOSX_FRAMEWORK_SHORT_VERSION_STRING "${SDL_gpu_VERSION}") 97 + # Bundle version is the version the OS looks at. 98 + SET(MACOSX_FRAMEWORK_BUNDLE_VERSION "${SDL_gpu_VERSION}") 99 + # FIXME: org.libsdl probably isn't the right domain 100 + SET(MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.sdl-gpu") 101 + 102 + 103 + 104 + else() 105 + if(ANDROID) 106 + set_target_properties(SDL_gpu_shared PROPERTIES 107 + OUTPUT_NAME ${SDL_gpu_OUTPUT_NAME} 108 + CLEAN_DIRECT_OUTPUT 1 109 + ) 110 + else() 111 + set_target_properties(SDL_gpu_shared PROPERTIES 112 + OUTPUT_NAME ${SDL_gpu_OUTPUT_NAME} 113 + CLEAN_DIRECT_OUTPUT 1 114 + # VERSION ${SDL_gpu_VERSION} 115 + ) 116 + endif() 117 + 118 + endif() 75 119 set_target_properties(SDL_gpu_shared PROPERTIES LINKER_LANGUAGE C) 120 + if(APPLE) 121 + SDL_gpu_CONFIGURE_XCODE_DEFAULTS(SDL_gpu_shared) 122 + endif() 76 123 endif() 77 124 78 125 # Build the static library (.a or .lib) ··· 87 134 VERSION ${SDL_gpu_VERSION} 88 135 ) 89 136 set_target_properties(SDL_gpu PROPERTIES LINKER_LANGUAGE C) 137 + if(APPLE) 138 + SDL_gpu_CONFIGURE_XCODE_DEFAULTS(SDL_gpu) 139 + endif() 90 140 endif() 91 141 92 142 # These are used to create visual studio folders.