Skip to content

Commit

Permalink
fix centos7 GL and X libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoopes committed Jan 28, 2019
1 parent a05a017 commit 8a7722d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 25 deletions.
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ find_package(VTK)
if(BUILD_GUIS)

# -------- openGL --------
if(EXISTS /usr/lib64/nvidia/libGL.so)
# on some martinos centos7 machines, linking to the default libGL.so fails due to missing symbols
# in the nvidia drivers, so as a temporary fix, link directly to the nvidia GL library
list(APPEND CMAKE_PREFIX_PATH "/usr/lib64/nvidia")
endif()
find_package(OpenGL)
if(OPENGL_FOUND)
add_definitions(-DHAVE_OPENGL)
Expand All @@ -178,10 +183,6 @@ if(BUILD_GUIS)
# only used by mris_decimate_gui
find_package(WXWidgets)

# -------- xt --------
# used by freeview
find_package(Xt)

endif()

# --------------------------------------------------
Expand Down Expand Up @@ -238,12 +239,6 @@ if(NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map,ld_map.txt -Wl,--no-demangle")
endif()

if(EXISTS "/etc/redhat-release" AND EXISTS "/lib64/libGLdispatch.so")
# temporary centos7 fix: use native libGLdispatch.so as nvidia version is missing symbols
set(CMAKE_EXE_LINKER_FLAGS "-lGLdispatch ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "Using the native libGLdispatch.so")
endif()

# check for clock_gettime on mac
if(APPLE)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
Expand Down
4 changes: 1 addition & 3 deletions cmake/FindWXWidgets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ if(WXWidgets_FOUND)
# of this when we link (but we'll use our own jpeg, tiff, and expat libraries)
set(SED_CMD "| sed 's/[^ ]*jpeg[^ ]*//g' | sed 's/[^ ]*tiff[^ ]*//g' | sed 's/[^ ]*expat[^ ]*//g'")
execute_process(COMMAND bash -c "${WXWidgets_DIR}/bin/wx-config --libs ${SED_CMD}" OUTPUT_VARIABLE WXCONFIG_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND bash -c "${WXWidgets_DIR}/bin/wx-config --libs gl ${SED_CMD}" OUTPUT_VARIABLE WXCONFIG_LIBSGL OUTPUT_STRIP_TRAILING_WHITESPACE)
separate_arguments(WXCONFIG_LIBS)
separate_arguments(WXCONFIG_LIBSGL)
set(WXWidgets_LIBRARIES ${WXCONFIG_LIBS} ${WXCONFIG_LIBSGL} ${WXLIB})
set(WXWidgets_LIBRARIES ${WXCONFIG_LIBS} ${WXLIB})

# get wx flags
execute_process(COMMAND bash -c "${WXWidgets_DIR}/bin/wx-config --cxxflags" OUTPUT_VARIABLE WX_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down
7 changes: 3 additions & 4 deletions cmake/FindX11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
find_path(X11_INCLUDE_DIR HINTS /usr/X11 NAMES GL/gl.h PATH_SUFFIXES include)
find_library(X11_LIBRARY HINTS /usr/X11 NAMES X11 PATH_SUFFIXES lib)
find_library(XMU_LIBRARY HINTS /usr/X11 NAMES Xmu PATH_SUFFIXES lib)
find_library(GL_LIBRARY HINTS /usr/X11 NAMES GL PATH_SUFFIXES lib)
find_library(GLU_LIBRARY HINTS /usr/X11 NAMES GLU PATH_SUFFIXES lib)
find_package_handle_standard_args(X11 DEFAULT_MSG X11_INCLUDE_DIR X11_LIBRARY XMU_LIBRARY GL_LIBRARY GLU_LIBRARY)
set(X11_LIBRARIES ${X11_LIBRARY} ${XMU_LIBRARY} ${GL_LIBRARY} ${GLU_LIBRARY})
find_library(XT_LIBRARY HINTS /usr/X11 NAMES Xt PATH_SUFFIXES lib)
find_package_handle_standard_args(X11 DEFAULT_MSG X11_INCLUDE_DIR X11_LIBRARY XMU_LIBRARY XT_LIBRARY)
set(X11_LIBRARIES ${X11_LIBRARY} ${XMU_LIBRARY} ${XT_LIBRARY})
6 changes: 0 additions & 6 deletions cmake/FindXt.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion freeview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ if(BUILD_GUIS AND VTK_FOUND AND PETSC_FOUND AND TARGET vtkutils)
)

if(NOT APPLE)
target_link_libraries(freeview glut ${Xt_LIBRARIES} ${X11_LIBRARIES})
target_link_libraries(freeview glut ${X11_LIBRARIES})
endif()

if(APPLE)
Expand Down
1 change: 0 additions & 1 deletion mris_decimate_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ if(BUILD_GUIS AND GTS_FOUND AND VTK_FOUND AND WXWidgets_FOUND)
${WXWidgets_LIBRARIES}
${GTS_LIBRARIES}
${OPENGL_LIBRARIES}
${Xt_LIBRARIES}
${X11_LIBRARIES}
)

Expand Down

0 comments on commit 8a7722d

Please sign in to comment.