this repo has no description
0
fork

Configure Feed

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

at Multitexture 276 lines 9.0 kB view raw
1cmake_minimum_required(VERSION 2.6) 2 3project(SDL_gpu) 4 5if(UNIX) 6 set(SDL_gpu_INSTALL_BY_DEFAULT ON) 7elseif(WIN32) 8 set(SDL_gpu_INSTALL_BY_DEFAULT ON) 9else(UNIX) 10 set(SDL_gpu_INSTALL_BY_DEFAULT OFF) 11endif(UNIX) 12 13if(IOS) 14 message(" Using iOS defaults.") 15 set(SDL_gpu_INSTALL_BY_DEFAULT OFF) 16 set(SDL_gpu_DEFAULT_BUILD_DEMOS OFF) 17 set(SDL_gpu_DEFAULT_DISABLE_OPENGL ON) 18 set(SDL_gpu_DEFAULT_DISABLE_GLES OFF) 19elseif(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) 24elseif(("${CMAKE_SYSTEM}" MATCHES "Linux") AND ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")) 25 26 # Assuming Raspberry Pi 2 for now. 27 # There is a bug with the shipping GLES v1 library where 3 of the symbols are misnamed. 28 # If you have an arm/ES device without this problem, don't enable this macro. 29 # TODO: Need way to identify Raspberry Pi/Broadcom 30 add_definitions(-DSDL_GPU_USE_BROADCOM_RASPBERRYPI_WORKAROUND) 31 32 set(SDL_gpu_DEFAULT_BUILD_DEMOS OFF) 33 set(SDL_gpu_DEFAULT_DISABLE_OPENGL ON) 34 set(SDL_gpu_DEFAULT_DISABLE_GLES OFF) 35else() 36 set(SDL_gpu_DEFAULT_BUILD_DEMOS ON) 37 set(SDL_gpu_DEFAULT_DISABLE_OPENGL OFF) 38 set(SDL_gpu_DEFAULT_DISABLE_GLES ON) 39endif() 40 41option(SDL_gpu_INSTALL "Install SDL_gpu libs, includes, and CMake scripts" ${SDL_gpu_INSTALL_BY_DEFAULT}) 42#option(SDL_gpu_BUILD_DEBUG "Build with debugging symbols" ON) 43option(SDL_gpu_BUILD_DEMOS "Build SDL_gpu demo programs" ${SDL_gpu_DEFAULT_BUILD_DEMOS}) 44option(SDL_gpu_BUILD_TESTS "Build SDL_gpu test programs" OFF) 45option(SDL_gpu_BUILD_VIDEO_TEST "Build SDL_gpu video test program (requires FFMPEG)" OFF) 46option(SDL_gpu_BUILD_TOOLS "Build SDL_gpu tool programs" OFF) 47option(SDL_gpu_USE_SDL1 "Use SDL 1.2 headers and library instead of SDL 2" OFF) 48option(SDL_gpu_DISABLE_OPENGL "Disable OpenGL renderers. Overrides specific OpenGL renderer flags." ${SDL_gpu_DEFAULT_DISABLE_OPENGL}) 49option(SDL_gpu_DISABLE_GLES "Disable OpenGLES renderers. Overrides specific GLES renderer flags." ${SDL_gpu_DEFAULT_DISABLE_GLES}) 50option(SDL_gpu_DISABLE_OPENGL_1_BASE "Disable OpenGL 1 BASE renderer" OFF) 51option(SDL_gpu_DISABLE_OPENGL_1 "Disable OpenGL 1.X renderer" OFF) 52option(SDL_gpu_DISABLE_OPENGL_2 "Disable OpenGL 2.X renderer" OFF) 53option(SDL_gpu_DISABLE_OPENGL_3 "Disable OpenGL 3.X renderer" OFF) 54option(SDL_gpu_DISABLE_OPENGL_4 "Disable OpenGL 4.X renderer" OFF) 55option(SDL_gpu_DISABLE_GLES_1 "Disable OpenGLES 1.X renderer" OFF) 56option(SDL_gpu_DISABLE_GLES_2 "Disable OpenGLES 2.X renderer" OFF) 57option(SDL_gpu_DISABLE_GLES_3 "Disable OpenGLES 3.X renderer" OFF) 58 59option(SDL_gpu_USE_SYSTEM_GLEW "Attempt to use the system GLEW library (may not support GL 3+)" OFF) 60 61if(APPLE) 62 if(IOS) 63 # iOS 8 may need the framework option 64 option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" OFF) 65 option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 66 else() 67 option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 68 option(SDL_gpu_BUILD_FRAMEWORK "Build SDL_gpu as Apple framework" ON) 69 option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 70 endif() 71elseif(ANDROID) 72 option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 73 option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" OFF) 74else() 75 option(SDL_gpu_BUILD_SHARED "Build SDL_gpu shared libraries" ON) 76 option(SDL_gpu_BUILD_STATIC "Build SDL_gpu static libraries" ON) 77endif() 78 79set(SDL_gpu_VERSION 0.11.0) 80 81set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/scripts) 82 83if(APPLE) 84 include(ios-cmake/toolchain/XcodeDefaults) 85endif() 86 87#if ( SDL_gpu_BUILD_DEBUG ) 88# SET(CMAKE_BUILD_TYPE Debug) 89#else ( SDL_gpu_BUILD_DEBUG ) 90# SET(CMAKE_BUILD_TYPE Release) 91#endif ( SDL_gpu_BUILD_DEBUG ) 92 93# Find the package for SDL or SDL2 94if ( SDL_gpu_USE_SDL1 ) 95 find_package(SDL REQUIRED) 96 97 if ( NOT SDL_FOUND ) 98 message ( FATAL_ERROR "SDL not found!" ) 99 endif ( NOT SDL_FOUND ) 100 101 include_directories(${SDL_INCLUDE_DIR}) 102 link_libraries(${SDL_LIBRARY}) 103else ( SDL_gpu_USE_SDL1 ) 104 find_package(SDL2 REQUIRED) 105 106 if ( NOT SDL2_FOUND ) 107 message ( FATAL_ERROR "SDL2 not found!" ) 108 endif ( NOT SDL2_FOUND ) 109 110 if ( NOT SDL2MAIN_LIBRARY ) 111 message ( WARNING "SDL2MAIN_LIBRARY is NOTFOUND" ) 112 SET( SDL2MAIN_LIBRARY "" ) 113 endif ( NOT SDL2MAIN_LIBRARY ) 114 115 include_directories(${SDL2_INCLUDE_DIR}) 116 link_libraries(${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY}) 117endif( SDL_gpu_USE_SDL1 ) 118 119# Find the package for OpenGL 120if (SDL_gpu_DISABLE_OPENGL) 121 add_definitions("-DSDL_GPU_DISABLE_OPENGL") 122else (SDL_gpu_DISABLE_OPENGL) 123 124 find_package(OpenGL REQUIRED) 125 include_directories(${OPENGL_INCLUDE_DIR}) 126 if(APPLE AND NOT IOS) 127 # CMake incorrectly includes AGL.framework in OPENGL_LIBRARIES which is obsolete. 128 # link_libraries(${OPENGL_gl_LIBRARY}) 129 set(SDL_gpu_GL_LIBRARIES ${OPENGL_gl_LIBRARY}) 130 else() 131 # link_libraries(${OPENGL_LIBRARIES}) 132 set(SDL_gpu_GL_LIBRARIES ${OPENGL_LIBRARIES}) 133 endif() 134 135 136 if (SDL_gpu_DISABLE_OPENGL_1_BASE) 137 add_definitions("-DSDL_GPU_DISABLE_OPENGL_1_BASE") 138 endif (SDL_gpu_DISABLE_OPENGL_1_BASE) 139 if (SDL_gpu_DISABLE_OPENGL_1) 140 add_definitions("-DSDL_GPU_DISABLE_OPENGL_1") 141 endif (SDL_gpu_DISABLE_OPENGL_1) 142 if (SDL_gpu_DISABLE_OPENGL_2) 143 add_definitions("-DSDL_GPU_DISABLE_OPENGL_2") 144 endif (SDL_gpu_DISABLE_OPENGL_2) 145 if (SDL_gpu_DISABLE_OPENGL_3) 146 add_definitions("-DSDL_GPU_DISABLE_OPENGL_3") 147 endif (SDL_gpu_DISABLE_OPENGL_3) 148 if (SDL_gpu_DISABLE_OPENGL_4) 149 add_definitions("-DSDL_GPU_DISABLE_OPENGL_4") 150 endif (SDL_gpu_DISABLE_OPENGL_4) 151 152 if(SDL_gpu_USE_SYSTEM_GLEW) 153 # If glew is not found here, we’ll use the bundled version 154 find_package(GLEW) 155 endif() 156 157 if(NOT GLEW_FOUND) 158 message(" Using bundled version of GLEW") 159 endif(NOT GLEW_FOUND) 160 161 162 if (NOT SDL_gpu_DISABLE_OPENGL) 163 if(GLEW_FOUND) 164 # Look in the GL subdirectory, too. 165 foreach(GL_DIR ${GLEW_INCLUDE_DIRS}) 166 set(GLEW_GL_DIRS ${GLEW_GL_DIRS} "${GL_DIR}/GL") 167 endforeach(GL_DIR ${GLEW_INCLUDE_DIRS}) 168 169 include_directories(${GLEW_INCLUDE_DIRS} ${GLEW_GL_DIRS}) 170 link_libraries (${GLEW_LIBRARIES}) 171 else(GLEW_FOUND) 172 SET(SDL_gpu_SRCS ${SDL_gpu_SRCS} externals/glew/glew.c) 173 SET(SDL_gpu_HDRS ${SDL_gpu_HDRS} externals/glew/GL/glew.h externals/glew/GL/glxew.h externals/glew/GL/wglew.h) 174 add_definitions("-DGLEW_STATIC") 175 endif(GLEW_FOUND) 176 endif(NOT SDL_gpu_DISABLE_OPENGL) 177 178endif (SDL_gpu_DISABLE_OPENGL) 179 180# Find the package for OpenGLES 181if (SDL_gpu_DISABLE_GLES) 182 add_definitions("-DSDL_GPU_DISABLE_GLES") 183else (SDL_gpu_DISABLE_GLES) 184 185 if(ANDROID) 186 find_library( ANDROID_LOG_LIBRARY log ) 187 find_library( ANDROID_GLES2_LIBRARY GLESv2 ) 188 find_library( ANDROID_GLES1_LIBRARY GLESv1_CM ) 189 link_libraries( 190 ${ANDROID_LOG_LIBRARY} 191 ${ANDROID_GLES2_LIBRARY} 192 ${ANDROID_GLES1_LIBRARY} 193 ) 194 else() 195 find_package(OpenGLES REQUIRED) 196 include_directories(${OPENGLES_INCLUDE_DIR}) 197# link_libraries (${OPENGLES_LIBRARIES}) 198 set(SDL_gpu_GL_LIBRARIES ${OPENGLES_LIBRARIES}) 199 endif() 200 201 if (SDL_gpu_DISABLE_GLES_1) 202 add_definitions("-DSDL_GPU_DISABLE_GLES_1") 203 endif (SDL_gpu_DISABLE_GLES_1) 204 if (SDL_gpu_DISABLE_GLES_2) 205 add_definitions("-DSDL_GPU_DISABLE_GLES_2") 206 endif (SDL_gpu_DISABLE_GLES_2) 207 if (SDL_gpu_DISABLE_GLES_3) 208 add_definitions("-DSDL_GPU_DISABLE_GLES_3") 209 endif (SDL_gpu_DISABLE_GLES_3) 210 211endif (SDL_gpu_DISABLE_GLES) 212 213# If stb-image is not found here, we’ll use the bundled version 214find_package(STBI) 215if(NOT STBI_FOUND) 216 message(" Using bundled version of stb-image") 217endif(NOT STBI_FOUND) 218 219find_package(STBI_write) 220if(NOT STBI_WRITE_FOUND) 221 message(" Using bundled version of stb-image-write") 222endif(NOT STBI_WRITE_FOUND) 223 224if(NOT WIN32) 225 find_library(M_LIB m) 226 link_libraries(${M_LIB}) 227endif (NOT WIN32) 228 229# Make local includes look in the right places 230include_directories(include) 231include_directories(src) 232 233if(NOT GLEW_FOUND) 234 include_directories(src/externals/glew) 235 include_directories(src/externals/glew/GL) 236endif(NOT GLEW_FOUND) 237 238if(NOT STBI_FOUND) 239 include_directories(src/externals/stb_image) 240 add_definitions("-DSTBI_FAILURE_USERMSG") 241endif(NOT STBI_FOUND) 242 243 244add_definitions("-Wall -std=c99 -pedantic") 245 246# Build the SDL_gpu library. 247add_subdirectory(src) 248 249if(SDL_gpu_BUILD_DEMOS OR SDL_gpu_BUILD_TESTS OR SDL_gpu_BUILD_TOOLS) 250 add_library(test-common STATIC ${SDL_gpu_SOURCE_DIR}/common/common.c ${SDL_gpu_SOURCE_DIR}/common/demo-font.c) 251 set(TEST_LIBS test-common SDL_gpu) 252endif(SDL_gpu_BUILD_DEMOS OR SDL_gpu_BUILD_TESTS OR SDL_gpu_BUILD_TOOLS) 253 254# Build the demos 255if(SDL_gpu_BUILD_DEMOS) 256 add_subdirectory(demos) 257endif(SDL_gpu_BUILD_DEMOS) 258 259# Build the tests 260if(SDL_gpu_BUILD_TESTS) 261 if(SDL_gpu_BUILD_VIDEO_TEST) 262 263 find_package(FFMPEG REQUIRED) 264 include_directories(${FFMPEG_INCLUDE_DIR}) 265 link_libraries (${FFMPEG_LIBRARIES}) 266 267 add_definitions("-DSDL_GPU_BUILD_VIDEO_TEST") 268 endif(SDL_gpu_BUILD_VIDEO_TEST) 269 270 add_subdirectory(tests) 271endif(SDL_gpu_BUILD_TESTS) 272 273# Build sample tools 274if(SDL_gpu_BUILD_TOOLS) 275 add_subdirectory(tools) 276endif(SDL_gpu_BUILD_TOOLS)