mirror of https://github.com/vitalif/openscad
Merge pull request #256 from openscad/glewfix
fix bugs and rewrite GLEW finding code to be more clear.felipesanches-svg
commit
81264c1d26
|
@ -294,8 +294,7 @@ if (NOT $ENV{GLEWDIR} STREQUAL "")
|
|||
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
|
||||
set(GLEW_DIR "$ENV{OPENSCAD_LIBRARIES}")
|
||||
endif()
|
||||
if (NOT GLEW_INCLUDE_DIR)
|
||||
message(STATUS "OPENCSG_DIR: " ${OPENCSG_DIR})
|
||||
if (GLEW_DIR)
|
||||
find_path(GLEW_INCLUDE_DIR
|
||||
GL/glew.h
|
||||
HINTS ${GLEW_DIR}/include
|
||||
|
@ -304,15 +303,17 @@ if (NOT GLEW_INCLUDE_DIR)
|
|||
NAMES GLEW glew
|
||||
HINTS ${GLEW_DIR}/lib ${GLEW_DIR}/lib64
|
||||
NO_DEFAULT_PATH)
|
||||
if (NOT GLEW_LIBRARY)
|
||||
if (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
|
||||
set(GLEW_FOUND 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT GLEW_FOUND)
|
||||
find_package(GLEW REQUIRED)
|
||||
if (NOT GLEW_LIBRARY)
|
||||
message(FATAL_ERROR "GLEW not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "GLEW include: " ${GLEW_INCLUDE_DIR})
|
||||
message(STATUS "GLEW library: " ${GLEW_LIBRARY})
|
||||
endif()
|
||||
|
||||
inclusion(GLEW_DIR GLEW_INCLUDE_DIR)
|
||||
|
||||
|
|
|
@ -10,17 +10,6 @@
|
|||
# a few lines of this file are based on the LGPL code found at
|
||||
# http://openlibraries.org/browser/trunk/FindGLEW.cmake?rev=1383
|
||||
|
||||
include(FindPkgConfig)
|
||||
|
||||
if (PKG_CONFIG_FOUND)
|
||||
message("Doing pkg config glew check...")
|
||||
pkg_check_modules(GLEW glew>=1.6)
|
||||
endif()
|
||||
|
||||
if (GLEW_LIBRARIES)
|
||||
set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_DIRS}")
|
||||
set(GLEW_LIBRARY ${GLEW_LDFLAGS})
|
||||
else()
|
||||
if (WIN32 AND MSVC)
|
||||
if (WIN32_STATIC_BUILD) # passed from caller
|
||||
set(GLEW_LIB_SEARCH_NAME glew32s.lib) # static, non-debug (Release)
|
||||
|
@ -43,23 +32,36 @@ else()
|
|||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
|
||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
|
||||
DOC "The GLEW library")
|
||||
else (WIN32)
|
||||
else()
|
||||
find_path(GLEW_INCLUDE_DIR GL/glew.h
|
||||
PATHS /usr/include /usr/local/include /usr/pkg/include
|
||||
NO_DEFAULT_PATH
|
||||
DOC "The directory where GL/glew.h resides")
|
||||
find_library(GLEW_LIBRARY
|
||||
NAMES GLEW glew
|
||||
PATHS /usr/lib /usr/local/lib /usr/pkg/lib
|
||||
PATHS /usr/lib /usr/local/lib /usr/pkg/lib /lib /lib64 /usr/lib64
|
||||
NO_DEFAULT_PATH
|
||||
DOC "The GLEW library")
|
||||
endif (WIN32)
|
||||
endif()
|
||||
|
||||
if (GLEW_INCLUDE_DIR)
|
||||
if (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
|
||||
set(GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
||||
message(STATUS "GLEW include found in " ${GLEW_INCLUDE_DIR} )
|
||||
message(STATUS "GLEW library found in " ${GLEW_LIBRARY} )
|
||||
else()
|
||||
set(GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
||||
endif()
|
||||
|
||||
if (NOT GLEW_FOUND)
|
||||
include(FindPkgConfig.cmake)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
message(STATUS "Doing pkg config glew check...")
|
||||
pkg_search_module(GLEW glew)
|
||||
if (GLEW_FOUND)
|
||||
set(GLEW_INCLUDE_DIR "${GLEW_INCLUDEDIR}")
|
||||
set(GLEW_LIBRARY "-L${GLEW_LIBRARY_DIRS} -l${GLEW_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT GLEW_FOUND)
|
||||
message(FATAL_ERROR "GLEW not found")
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue