Browse Source

cmake: fixes to OpenGL and GLUT lib usage

Johannes Ruehle 11 years ago
parent
commit
1fd28dbc1c
3 changed files with 30 additions and 26 deletions
  1. 26 22
      CMakeLists.txt
  2. 3 3
      cmake/NiceModules.cmake
  3. 1 1
      core/CMakeLists.txt

+ 26 - 22
CMakeLists.txt

@@ -153,30 +153,34 @@ if(WITH_OPENGL)
     include_directories( ${OPENGL_INCLUDE_DIRS} )
     ADD_DEFINITIONS( "-DNICE_USELIB_OPENGL")
   endif()
-endif()
 
-if(WIN32)
-	message(STATUS "find GLUT for win32")
-	set(GLUT_INCLUDE_DIR "C:/Libraries/freeglut-MSVC-2.8.0-1.mp/freeglut/include/")# , where to find GL/glut.h, etc.
-	set(GLUT_ROOT_PATH "C:/Libraries/freeglut-MSVC-2.8.0-1.mp/freeglut/") #  GLUT_LIBRARIES
-	set(tmp_OPENGL_LIBRARY_DIR "${OPENGL_LIBRARY_DIR}") #temporarily store opengl_lib path
-	set(OPENGL_LIBRARY_DIR "${GLUT_ROOT_PATH}lib")
-	find_package(GLUT)
-	if(GLUT_FOUND)
-	  message(STATUS "GLUT found")
-	  include_directories( ${GLUT_INCLUDE_DIR} )
-	  ADD_DEFINITIONS( -DNICE_USELIB_GLUT)
-	  #ADD_DEFINITIONS(-DBUILD_VTI -DFREEGLUT_STATIC) with static seems not to work
-	endif()
-	set(OPENGL_LIBRARY_DIR "${tmp_OPENGL_LIBRARY_DIR}") #reset opengl lib path
-else()
-	find_package(GLUT)
-	if(GLUT_FOUND)
-	  message(STATUS "GLUT found")
-	  include_directories( ${GLUT_INCLUDE_DIR} )
-	  ADD_DEFINITIONS(-DNICE_USELIB_GLUT)
-	endif()
+  #try using GLUT
+  if(WIN32)
+  	message(STATUS "find GLUT for win32")
+  	set(GLUT_INCLUDE_DIR "C:/Libraries/freeglut-MSVC-2.8.0-1.mp/freeglut/include/")# , where to find GL/glut.h, etc.
+  	set(GLUT_ROOT_PATH "C:/Libraries/freeglut-MSVC-2.8.0-1.mp/freeglut/") #  GLUT_LIBRARIES
+  	set(tmp_OPENGL_LIBRARY_DIR "${OPENGL_LIBRARY_DIR}") #temporarily store opengl_lib path
+  	set(OPENGL_LIBRARY_DIR "${GLUT_ROOT_PATH}lib")
+  	find_package(GLUT)
+  	if(GLUT_FOUND)
+  	  message(STATUS "GLUT found")
+  	  include_directories( ${GLUT_INCLUDE_DIR} )
+  	  ADD_DEFINITIONS( -DNICE_USELIB_GLUT)
+  	  #ADD_DEFINITIONS(-DBUILD_VTI -DFREEGLUT_STATIC) with static seems not to work
+  	endif()
+  	set(OPENGL_LIBRARY_DIR "${tmp_OPENGL_LIBRARY_DIR}") #reset opengl lib path
+  else()
+  	find_package(GLUT)
+  	if(GLUT_FOUND)
+  	  message(STATUS "GLUT found")
+  	  include_directories( ${GLUT_INCLUDE_DIR} )
+  	  ADD_DEFINITIONS(-DNICE_USELIB_GLUT)
+  	endif()
+  endif()
+
+endif()
 
+if(NOT WIN32)
   #check for available regex stuff
   CHECK_INCLUDE_FILES(regex.h HAVE_REGEX_H)
   if(HAVE_REGEX_H)

+ 3 - 3
cmake/NiceModules.cmake

@@ -75,7 +75,7 @@ macro(nice_get_source_files)
     set(nice_${the_library}_SRC"")
     
 
-    message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
+    #message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
     file(GLOB_RECURSE list_tmp1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.cpp *.tcc *.c)
     #message(STATUS "list_tmp1: ${list_tmp1}")
     foreach( t_SrcFile ${list_tmp1})
@@ -101,8 +101,8 @@ macro(nice_get_source_files)
       list( REMOVE_ITEM nice_${the_library}_TESTFILES_SRC ${list_exclude_from_build_SRC} )  
     endif()      
 
-    message(STATUS "globallyrecusive_tests: ${nice_${the_library}_TESTFILES_SRC}")
-    message(STATUS "globallyrecusive_progs: ${nice_${the_library}_PROGFILES_SRC}")
+    #message(STATUS "globallyrecusive_tests: ${nice_${the_library}_TESTFILES_SRC}")
+    #message(STATUS "globallyrecusive_progs: ${nice_${the_library}_PROGFILES_SRC}")
 
     ### Get all header files recursively
     file(GLOB_RECURSE nice_${the_library}_HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)

+ 1 - 1
core/CMakeLists.txt

@@ -5,7 +5,7 @@
 set(the_library "core")
 
 #add linkage dependencies to other libraries here
-set("nice_${the_library}_LINKING_DEPENDENCIES"  ${Boost_LIBRARIES} ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${QT_LIBRARIES} ${IPP_LIBRARIES} ${ImageMagick_LIBRARIES})
+set("nice_${the_library}_LINKING_DEPENDENCIES"  ${Boost_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${QT_LIBRARIES} ${IPP_LIBRARIES} ${ImageMagick_LIBRARIES})
 if(MATIO_FOUND)
   list(APPEND nice_${the_library}_LINKING_DEPENDENCIES ${MATIO_LIBRARIES})
 endif(MATIO_FOUND)