Cycles: Fix compilation error with OIIO compiled against system PugiXML
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 13 Nov 2017 09:40:19 +0000 (10:40 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 13 Nov 2017 09:42:29 +0000 (10:42 +0100)
build_files/cmake/Modules/FindOpenImageIO.cmake
intern/cycles/CMakeLists.txt
intern/cycles/util/util_xml.h

index d59f9cfcdfc932347939d582d4807fecf5650972..e7527f15755fcf0b120210ab2cdf8d4b354a981d 100644 (file)
@@ -76,6 +76,8 @@ IF(OPENIMAGEIO_FOUND)
   SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
   IF(EXISTS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/pugixml.hpp)
     SET(OPENIMAGEIO_PUGIXML_FOUND TRUE)
+  ELSE()
+    SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
   ENDIF()
 ELSE()
   SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
index 5844c2480d67ec2804e2cea9b9b3337f050b833e..dbf1bcece162537d0c6249753393fcf4b77cc60e 100644 (file)
@@ -209,6 +209,10 @@ if(WITH_CYCLES_DEBUG)
        add_definitions(-DWITH_CYCLES_DEBUG)
 endif()
 
+if(NOT OPENIMAGEIO_PUGIXML_FOUND)
+       add_definitions(-DWITH_SYSTEM_PUGIXML)
+endif()
+
 include_directories(
        SYSTEM
        ${BOOST_INCLUDE_DIR}
index e1a28df94336ccdc8c65caee45ac5b37f2cf9f9f..c9c1ea47e9675082a6345249a79c71a619d3ee11 100644 (file)
 
 CCL_NAMESPACE_BEGIN
 
-using OIIO_NAMESPACE::pugi::xml_node;
-using OIIO_NAMESPACE::pugi::xml_attribute;
+OIIO_NAMESPACE_USING
+
+#ifdef WITH_SYSTEM_PUGIXML
+#  define PUGIXML_NAMESPACE pugi
+#else
+#  define PUGIXML_NAMESPACE OIIO_NAMESPACE::pugi
+#endif
+
+using PUGIXML_NAMESPACE::xml_node;
+using PUGIXML_NAMESPACE::xml_attribute;
 
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_XML_H__ */
-