gerkey avatar gerkey committed b75715f

Added query for OGRE's plugindir variable, which is defined in its .pc file. This allows us to remove the Ubuntu-specific hacks regarding finding OGRE and its library/plugin directories. As far as I can tell, OGRE.pc should always have the right values for libdir and plugindir.

Comments (0)

Files changed (7)

cmake/SearchForStuff.cmake

     set(ogre_cflags ${ogre_cflags} ${OGRE-Terrain_CFLAGS})
   endif()
 
-  # There is a major problem with OGRE and Ubuntu. Ubuntu has instituted
-  # a multi-arch install policy (https://wiki.ubuntu.com/MultiarchSpec).
-  # But OGRE and cmake do not handle it very well. The FindOGRE.cmake file
-  # is not installed in a default search path, even if we forcibly find the 
-  # FindOGRE.cmake file does not return correct paths. So, we are forced to
-  # use find_path to find where OGRE and its plugins are installed.
-  find_path(HACK_OGRE_LIBRARY_PATH libOgreMain.so /usr/lib /usr/local/lib
-            /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu
-            ${ogre_library_dirs})
-  if (NOT HACK_OGRE_LIBRARY_PATH)
-    find_path(HACK_OGRE_LIBRARY_PATH libOgreMain_d.so /usr/lib /usr/local/lib
-              /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu
-              ${ogre_library_dirs})
+  # Also find OGRE's plugin directory, which is provided in its .pc file as the
+  # `plugindir` variable.  We have to call pkg-config manually to get it.
+  execute_process(COMMAND pkg-config --variable=plugindir OGRE
+                  OUTPUT_VARIABLE _pkgconfig_invoke_result
+                  RESULT_VARIABLE _pkgconfig_failed)
+  if(_pkgconfig_failed)
+    BUILD_WARNING ("Failed to find OGRE's plugin directory.  The build will succeed, but gazebo will likely fail to run.")
+  else()
+    # This variable will be substituted into cmake/setup.sh.in
+    set (OGRE_PLUGINDIR ${_pkgconfig_invoke_result})
   endif()
 
-
   ########################################
   # Find OpenAL
   # pkg_check_modules(OAL openal)

cmake/setup.sh.in

 export GAZEBO_RESOURCE_PATH=@CMAKE_INSTALL_PREFIX@/share/gazebo-@GAZEBO_VERSION@:@CMAKE_INSTALL_PREFIX@/share/gazebo_models
 export GAZEBO_PLUGIN_PATH=@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@/gazebo-@GAZEBO_VERSION@/plugins
 export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@/gazebo-@GAZEBO_VERSION@/plugins:${LD_LIBRARY_PATH}
-export OGRE_RESOURCE_PATH=@HACK_OGRE_LIBRARY_PATH@/OGRE-@OGRE_VERSION@:@HACK_OGRE_LIBRARY_PATH@/OGRE:
+export OGRE_RESOURCE_PATH=@OGRE_PLUGINDIR@

gazebo/CMakeLists.txt

 )
 
 link_directories(  
-  ${HACK_OGRE_LIBRARY_PATH}
+  ${ogre_library_dirs}
   ${Boost_LIBRARY_DIRS} 
 )
 

gazebo/rendering/CMakeLists.txt

                 ${CMAKE_CURRENT_BINARY_DIR}/rendering.hh)
 
 link_directories(  
-  ${HACK_OGRE_LIBRARY_PATH}
+  ${ogre_library_dirs}
 )
 
 gz_add_library(gazebo_rendering ${sources})

gazebo/rendering/deferred_shading/CMakeLists.txt

 )
 
 link_directories(  
-  ${HACK_OGRE_LIBRARY_PATH}
+  ${ogre_library_dirs}
 )
 
 gz_add_library(gazebo_rendering_deferred ${sources})

test/CMakeLists.txt

 )
 
 link_directories(  
-  ${HACK_OGRE_LIBRARY_PATH}
+  ${ogre_library_dirs}
   ${Boost_LIBRARY_DIRS} 
   ${ODE_LIBRARY_DIRS}
 )

test/regression/CMakeLists.txt

 )
 
 link_directories(  
-  ${HACK_OGRE_LIBRARY_PATH}
+  ${ogre_library_dirs}
   ${Boost_LIBRARY_DIRS} 
   ${ODE_LIBRARY_DIRS}
 )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.