Commits

Ian Chen committed 465eb78 Merge

Merge from default

  • Participants
  • Parent commits 3bcee19, 4095d19
  • Branches issue_502

Comments (0)

Files changed (5)

cmake/CheckDRIDisplay.cmake

 # FindDRI support
 # Check for existance of glxinfo application
 # Check for existance of support for pyopengl
-MESSAGE(STATUS "Looking for a valid DRI display")
+MESSAGE(STATUS "Looking for display capabilities")
+SET (VALID_DISPLAY FALSE)
 SET (VALID_DRI_DISPLAY FALSE)
 
-# Try to run glxinfo. If not found, variable will be empty
-FIND_PROGRAM(GLXINFO glxinfo)
+IF(DEFINED ENV{DISPLAY})
+  MESSAGE(STATUS " + found a display available ($DISPLAY is set)")
+  SET (VALID_DISPLAY TRUE)
 
-# If not display found, it will throw an error
-# Another grep pattern: "direct rendering:[[:space:]]*Yes[[:space:]]*"
-IF (GLXINFO)
-  EXECUTE_PROCESS(
-    COMMAND glxinfo
-    COMMAND grep GL_EXT_framebuffer_object
-    ERROR_QUIET
-    OUTPUT_VARIABLE GLX)
+  # Continue check for DRI support in the display
+  # Try to run glxinfo. If not found, variable will be empty
+  FIND_PROGRAM(GLXINFO glxinfo)
 
-  IF (GLX)
-    MESSAGE(STATUS " + found a valid dri display (glxinfo)")
-    SET (VALID_DRI_DISPLAY TRUE)
-  ENDIF ()
-ELSE ()
-  EXECUTE_PROCESS(
+  # If not display found, it will throw an error
+  # Another grep pattern: "direct rendering:[[:space:]]*Yes[[:space:]]*"
+  IF (GLXINFO)
+    EXECUTE_PROCESS(
+      COMMAND glxinfo
+      COMMAND grep GL_EXT_framebuffer_object
+      ERROR_QUIET
+      OUTPUT_VARIABLE GLX)
+
+    IF (GLX)
+      MESSAGE(STATUS " + found a valid dri display (glxinfo)")
+      SET (VALID_DRI_DISPLAY TRUE)
+    ENDIF ()
+  ELSE ()
+    EXECUTE_PROCESS(
       # RESULT_VARIABLE is store in a FAIL variable since the command
       # returns 0 if ok and 1 if error (inverse than cmake IF)
       COMMAND ${PROJECT_SOURCE_DIR}/tools/gl-test.py
       ERROR_QUIET
       OUTPUT_QUIET)
 
-  IF (NOT GL_FAIL_RESULT)
-    MESSAGE(STATUS " + found a valid dri display (pyopengl)")
-    SET (VALID_DRI_DISPLAY TRUE)
+    IF (NOT GL_FAIL_RESULT)
+      MESSAGE(STATUS " + found a valid dri display (pyopengl)")
+      SET (VALID_DRI_DISPLAY TRUE)
+    ENDIF ()
   ENDIF ()
 ENDIF ()
 
+IF (NOT VALID_DISPLAY)
+  MESSAGE(STATUS " ! valid display not found")
+ENDIF ()
+
 IF (NOT VALID_DRI_DISPLAY)
   MESSAGE(STATUS " ! valid dri display not found")
 ENDIF ()

cmake/GazeboUtils.cmake

 endmacro()
 
 #################################################
-macro (gz_build_qt_tests)
-
+# INTERNAL function: do not call directly use gz_build_display_tests or gz_build_dri_tests
+macro (_gz_build_qt_tests)
   # Build all the tests
   foreach(QTEST_SOURCE_file ${ARGN})
     string(REGEX REPLACE ".cc" "" BINARY_NAME ${QTEST_SOURCE_file})
     add_test(check_${BINARY_NAME} ${PROJECT_SOURCE_DIR}/tools/check_test_ran.py
              ${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
   endforeach()
+endmacro()
 
+# Define GUI testing macros as empty and redefine them if support is found
+macro (gz_build_display_tests)
 endmacro()
+macro (gz_build_dri_tests)
+endmacro()
+
+if (VALID_DRI_DISPLAY)
+  macro (gz_build_dri_tests)
+    _gz_build_qt_tests(${ARGV})
+  endmacro()
+endif()
+
+if (VALID_DISPLAY)
+  macro (gz_build_display_tests)
+    _gz_build_qt_tests(${ARGV})
+  endmacro()
+endif()
+
+

gazebo/common/SystemPaths.cc

 }
 
 /////////////////////////////////////////////////
+void SystemPaths::ClearModelPaths()
+{
+  this->modelPaths.clear();
+}
+
+/////////////////////////////////////////////////
 void SystemPaths::AddGazeboPaths(const std::string &_path)
 {
   std::string delim(":");
 }
 
 /////////////////////////////////////////////////
+void SystemPaths::AddModelPaths(const std::string &_path)
+{
+  std::string delim(":");
+  size_t pos1 = 0;
+  size_t pos2 = _path.find(delim);
+  while (pos2 != std::string::npos)
+  {
+    this->InsertUnique(_path.substr(pos1, pos2-pos1), this->modelPaths);
+    pos1 = pos2+1;
+    pos2 = _path.find(delim, pos2+1);
+  }
+  this->InsertUnique(_path.substr(pos1, _path.size()-pos1), this->modelPaths);
+}
+
+/////////////////////////////////////////////////
 void SystemPaths::InsertUnique(const std::string &_path,
                                std::list<std::string> &_list)
 {

gazebo/common/SystemPaths.hh

       /// \param[in] _path the directory to add
       public: void AddGazeboPaths(const std::string &_path);
 
+      /// \brief Add colon delimited paths to modelPaths
+      /// \param[in] _path the directory to add
+      public: void AddModelPaths(const std::string &_path);
+
       /// \brief Add colon delimited paths to ogre install
       /// \param[in] _path the directory to add
       public: void AddOgrePaths(const std::string &_path);
 
       /// \brief clear out SystemPaths#gazeboPaths
       public: void ClearGazeboPaths();
+      /// \brief clear out SystemPaths#modelPaths
+      public: void ClearModelPaths();
       /// \brief clear out SystemPaths#ogrePaths
       public: void ClearOgrePaths();
       /// \brief clear out SystemPaths#pluginPaths

gazebo/gui/CMakeLists.txt

   viewers/ViewFactory.hh
 )
 
-set (tests 
+set (display_tests 
   TimePanel_TEST.cc
   )
 
-gz_build_qt_tests(${tests})
+gz_build_display_tests(${display_tests})
 
 set (resources resources.qrc)