Cycles: Fix compilation error when OIIO is compiled with external PugiXML parser
Basic idea is to check whether OIIO is compiled with embedded PugiXML parser and if so use PugiXML from OIIO, otherwise find a standalone PugiXML library.
This commit is contained in:
@@ -963,6 +963,12 @@ if(UNIX AND NOT APPLE)
|
|||||||
|
|
||||||
if(WITH_OPENIMAGEIO)
|
if(WITH_OPENIMAGEIO)
|
||||||
find_package_wrapper(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_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
|
||||||
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
||||||
|
73
build_files/cmake/Modules/FindPugiXML.cmake
Normal file
73
build_files/cmake/Modules/FindPugiXML.cmake
Normal file
@@ -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
|
||||||
|
)
|
@@ -161,6 +161,7 @@ include_directories(
|
|||||||
${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO
|
${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO
|
||||||
${OPENEXR_INCLUDE_DIR}
|
${OPENEXR_INCLUDE_DIR}
|
||||||
${OPENEXR_INCLUDE_DIRS}
|
${OPENEXR_INCLUDE_DIRS}
|
||||||
|
${PUGIXML_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(sergey): Adjust so standalone repository is also happy.
|
# TODO(sergey): Adjust so standalone repository is also happy.
|
||||||
|
@@ -32,6 +32,10 @@ set(LIBRARIES
|
|||||||
extern_cuew
|
extern_cuew
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT PUGIXML_LIBRARIES STREQUAL "")
|
||||||
|
list(APPEND LIBRARIES ${PUGIXML_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT CYCLES_STANDALONE_REPOSITORY)
|
if(NOT CYCLES_STANDALONE_REPOSITORY)
|
||||||
list(APPEND LIBRARIES bf_intern_glew_mx)
|
list(APPEND LIBRARIES bf_intern_glew_mx)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -66,6 +66,12 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
|||||||
####
|
####
|
||||||
# OpenImageIO
|
# OpenImageIO
|
||||||
find_package(OpenImageIO REQUIRED)
|
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
|
# OIIO usually depends on OpenEXR, so find this library
|
||||||
# but don't make it required.
|
# but don't make it required.
|
||||||
@@ -75,10 +81,12 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
|||||||
# Boost
|
# Boost
|
||||||
set(__boost_packages filesystem regex system thread date_time)
|
set(__boost_packages filesystem regex system thread date_time)
|
||||||
if(WITH_CYCLES_NETWORK)
|
if(WITH_CYCLES_NETWORK)
|
||||||
list(APPEND __boost_packages serialization)
|
list(APPEND __boost_packages serialization)
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CYCLES_OSL AND APPLE)
|
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()
|
endif()
|
||||||
find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
|
find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
|
||||||
if(NOT Boost_FOUND)
|
if(NOT Boost_FOUND)
|
||||||
|
@@ -17,9 +17,9 @@
|
|||||||
#ifndef __UTIL_XML_H__
|
#ifndef __UTIL_XML_H__
|
||||||
#define __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
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user