diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | build_files/cmake/Modules/FindPugiXML.cmake | 73 | ||||
-rw-r--r-- | intern/cycles/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/app/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/cycles/cmake/external_libs.cmake | 12 | ||||
-rw-r--r-- | intern/cycles/util/util_xml.h | 4 |
6 files changed, 96 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 126755303dd..2e7745d393a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -963,6 +963,12 @@ if(UNIX AND NOT APPLE) if(WITH_OPENIMAGEIO) find_package_wrapper(OpenImageIO) + if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE) + find_package_wrapper(PugiXML) + else() + set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}") + set(PUGIXML_LIBRARIES "") + endif() set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES}) set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere diff --git a/build_files/cmake/Modules/FindPugiXML.cmake b/build_files/cmake/Modules/FindPugiXML.cmake new file mode 100644 index 00000000000..b1ed45fd257 --- /dev/null +++ b/build_files/cmake/Modules/FindPugiXML.cmake @@ -0,0 +1,73 @@ +# - Find PugiXML library +# Find the native PugiXML includes and library +# This module defines +# PUGIXML_INCLUDE_DIRS, where to find pugixml.h, Set when +# PugiXML is found. +# PUGIXML_LIBRARIES, libraries to link against to use PugiiXML. +# PUGIXML_ROOT_DIR, The base directory to search for PugiXML. +# This can also be an environment variable. +# PUGIXML_FOUND, If false, do not try to use PugiXML. +# +# also defined, but not for general use are +# PUGIXML_LIBRARY, where to find the PugiXML library. + +#============================================================================= +# Copyright 2014 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If PUGIXML_ROOT_DIR was defined in the environment, use it. +IF(NOT PUGIXML_ROOT_DIR AND NOT $ENV{PUGIXML_ROOT_DIR} STREQUAL "") + SET(PUGIXML_ROOT_DIR $ENV{PUGIXML_ROOT_DIR}) +ENDIF() + +SET(_pugixml_SEARCH_DIRS + ${PUGIXML_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt/lib/oiio +) + +FIND_PATH(PUGIXML_INCLUDE_DIR + NAMES + pugixml.h + HINTS + ${_pugixml_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(PUGIXML_LIBRARY + NAMES + pugixml + HINTS + ${_pugixml_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG + PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR) + +IF(PUGIXML_FOUND) + SET(PUGIXML_LIBRARIES ${PUGIXML_LIBRARY}) + SET(PUGIXML_INCLUDE_DIRS ${PUGIXML_INCLUDE_DIR}) +ELSE() + SET(PUGIXML_PUGIXML_FOUND FALSE) +ENDIF() + +MARK_AS_ADVANCED( + PUGIXML_INCLUDE_DIR + PUGIXML_LIBRARY +) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 01912019d80..56deb8d0ea0 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -161,6 +161,7 @@ include_directories( ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO ${OPENEXR_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIRS} + ${PUGIXML_INCLUDE_DIR} ) # TODO(sergey): Adjust so standalone repository is also happy. diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt index 3af72ac4431..0694be0321a 100644 --- a/intern/cycles/app/CMakeLists.txt +++ b/intern/cycles/app/CMakeLists.txt @@ -32,6 +32,10 @@ set(LIBRARIES extern_cuew ) +if(NOT PUGIXML_LIBRARIES STREQUAL "") + list(APPEND LIBRARIES ${PUGIXML_LIBRARIES}) +endif() + if(NOT CYCLES_STANDALONE_REPOSITORY) list(APPEND LIBRARIES bf_intern_glew_mx) endif() diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 7f9a9e07487..537de2e7bc9 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -66,6 +66,12 @@ if(CYCLES_STANDALONE_REPOSITORY) #### # OpenImageIO find_package(OpenImageIO REQUIRED) + if(OPENIMAGEIO_PUGIXML_FOUND) + set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}") + set(PUGIXML_LIBRARIES "") + else() + find_package(PugiXML REQUIRED) + endif() # OIIO usually depends on OpenEXR, so find this library # but don't make it required. @@ -75,10 +81,12 @@ if(CYCLES_STANDALONE_REPOSITORY) # Boost set(__boost_packages filesystem regex system thread date_time) if(WITH_CYCLES_NETWORK) - list(APPEND __boost_packages serialization) + list(APPEND __boost_packages serialization) endif() if(WITH_CYCLES_OSL AND APPLE) - list(APPEND __boost_packages wave) + # TODO(sergey): This is because of the way how our precompiled + # libraries works, could be different for someone's else libs.. + list(APPEND __boost_packages wave) endif() find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED) if(NOT Boost_FOUND) diff --git a/intern/cycles/util/util_xml.h b/intern/cycles/util/util_xml.h index d1b4ee1f2d3..cfd0afc95f7 100644 --- a/intern/cycles/util/util_xml.h +++ b/intern/cycles/util/util_xml.h @@ -17,9 +17,9 @@ #ifndef __UTIL_XML_H__ #define __UTIL_XML_H__ -/* PugiXML from OpenImageIO is used for XML parsing. */ +/* PugiXML is used for XML parsing. */ -#include <OpenImageIO/pugixml.hpp> +#include <pugixml.hpp> CCL_NAMESPACE_BEGIN |