Added build options: NO_GLFW NO_GLFW_X11

This commit is contained in:
David G Yu 2017-07-27 19:18:34 -07:00
parent c6a527b02c
commit 3e640239f7
2 changed files with 40 additions and 25 deletions

View File

@ -306,6 +306,8 @@ option(NO_METAL "Disable Metal support" OFF)
option(NO_DX "Disable DirectX support")
option(NO_TESTS "Disable all tests")
option(NO_GLTESTS "Disable GL tests")
option(NO_GLFW "Disable components depending on GLFW" OFF)
option(NO_GLFW_X11 "Disable GLFW components depending on X11" OFF)
option(OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES "Enable true derivative evaluation for Gregory basis patches" OFF)
@ -335,7 +337,7 @@ endif()
if(NOT NO_CUDA)
find_package(CUDA 4.0)
endif()
if(NOT NO_OPENGL AND NOT ANDROID AND NOT IOS)
if(NOT NO_GLFW AND NOT NO_OPENGL AND NOT ANDROID AND NOT IOS)
find_package(GLFW 3.0.0)
endif()
if(NOT NO_PTEX)

View File

@ -30,6 +30,19 @@
# GLFW_LIBRARIES
#
if(NOT NO_GLFW_X11)
set(GLFW_X11_INCLUDE_DIRS
"/usr/X11R6/include"
"/usr/include/X11"
)
set(GLFW_X11_LIB_DIRS
"/usr/X11R6/lib"
)
else()
set(GLFW_X11_INCLUDE_DIRS "")
set(GLFW_X11_LIB_DIRS "")
endif()
find_path( GLFW_INCLUDE_DIR
NAMES
GLFW/glfw3.h
@ -41,8 +54,7 @@ find_path( GLFW_INCLUDE_DIR
"${OPENGL_INCLUDE_DIR}"
/usr/openwin/share/include
/usr/openwin/include
/usr/X11R6/include
/usr/include/X11
"${GLFW_X11_INCLUDE_DIRS}"
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglfw
/usr/local/include
@ -66,8 +78,7 @@ find_path( GLFW_INCLUDE_DIR
"${OPENGL_INCLUDE_DIR}"
/usr/openwin/share/include
/usr/openwin/include
/usr/X11R6/include
/usr/include/X11
"${GLFW_X11_INCLUDE_DIRS}"
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglfw
/usr/local/include
@ -91,7 +102,7 @@ if (WIN32)
/usr/lib
/usr/lib/w32api
/usr/local/lib
/usr/X11R6/lib
"${GLFW_X11_LIB_DIRS}"
DOC
"The GLFW library"
)
@ -140,29 +151,31 @@ else ()
find_package(Threads REQUIRED)
find_package(X11 REQUIRED)
if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "Xrandr library not found - required for GLFW")
endif()
if(NOT NO_GLFW_X11)
find_package(X11 REQUIRED)
if(NOT X11_xf86vmode_FOUND)
message(FATAL_ERROR "xf86vmode library not found - required for GLFW")
endif()
if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "Xrandr library not found - required for GLFW")
endif()
if(NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "Xcursor library not found - required for GLFW")
endif()
if(NOT X11_xf86vmode_FOUND)
message(FATAL_ERROR "xf86vmode library not found - required for GLFW")
endif()
if(NOT X11_Xinerama_FOUND)
message(FATAL_ERROR "Xinerama library not found - required for GLFW")
endif()
if(NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "Xcursor library not found - required for GLFW")
endif()
if(NOT X11_Xi_FOUND)
message(FATAL_ERROR "Xi library not found - required for GLFW")
endif()
if(NOT X11_Xinerama_FOUND)
message(FATAL_ERROR "Xinerama library not found - required for GLFW")
endif()
list(APPEND GLFW_x11_LIBRARY "${X11_Xrandr_LIB}" "${X11_Xxf86vm_LIB}" "${X11_Xcursor_LIB}" "${X11_Xinerama_LIB}" "${X11_Xi_LIB}" "${X11_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}" -lrt -ldl)
if(NOT X11_Xi_FOUND)
message(FATAL_ERROR "Xi library not found - required for GLFW")
endif()
list(APPEND GLFW_x11_LIBRARY "${X11_Xrandr_LIB}" "${X11_Xxf86vm_LIB}" "${X11_Xcursor_LIB}" "${X11_Xinerama_LIB}" "${X11_Xi_LIB}" "${X11_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}" -lrt -ldl)
endif (NOT NO_GLFW_X11)
find_library( GLFW_glfw_LIBRARY
NAMES
@ -181,7 +194,7 @@ else ()
/usr/local/lib
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/openwin/lib
/usr/X11R6/lib
"${GLFW_X11_LIB_DIRS}"
DOC
"The GLFW library"
)