Merge branch 'update-cmake-glew-test'

Fixes issue 6548
This commit is contained in:
Glenn Rice 2013-09-07 12:46:44 -05:00
commit 508888c935
2 changed files with 35 additions and 3 deletions

View File

@ -646,13 +646,13 @@ if(WIN32)
else() else()
if(NOT ANDROID) if(NOT ANDROID)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
check_lib(GLEW GLEW GL/glew.h) include(FindGLEW)
endif() endif()
if(NOT GLEW_FOUND) if(NOT GLEW_FOUND OR NOT GLEW_HAS_1_9_METHODS)
message("Using static GLEW from Externals") message("Using static GLEW from Externals")
add_subdirectory(Externals/GLew) add_subdirectory(Externals/GLew)
include_directories(Externals/GLew/include) include_directories(Externals/GLew/include)
endif(NOT GLEW_FOUND) endif()
endif() endif()
endif() endif()

32
CMakeTests/FindGLEW.cmake Normal file
View File

@ -0,0 +1,32 @@
include(FindPkgConfig OPTIONAL)
# This is a hack to deal with Ubuntu's mess.
# Ubuntu's version of glew is 1.8, but they have patched in most of glew 1.9.
# So Ubuntu's version works for dolphin.
macro(test_glew)
set(CMAKE_REQUIRED_INCLUDES ${GLEW_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES GLEW)
check_cxx_source_runs("
#include <GL/glew.h>
int main()
{
#ifdef GLEW_ARB_shader_image_load_store
return 0;
#else
return 1;
#endif
}"
GLEW_HAS_1_9_METHODS)
endmacro()
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
pkg_search_module(GLEW REQUIRED glew>=1.8)
endif()
if(GLEW_FOUND)
test_glew()
if (GLEW_HAS_1_9_METHODS)
include_directories(${GLEW_INCLUDE_DIRS})
message("GLEW found")
endif()
endif()