Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 548392
Collapse All | Expand All

(-)a/CMakeLists.txt (-7 / +36 lines)
Lines 202-216 if(USE_EXTERNAL_YAML) Link Here
202
    # Set minimum yaml version for non-patched sources.
202
    # Set minimum yaml version for non-patched sources.
203
    set(YAML_VERSION_MIN "0.3.0")
203
    set(YAML_VERSION_MIN "0.3.0")
204
    include(FindPkgConfig)
204
    include(FindPkgConfig)
205
    pkg_check_modules(YAML_CPP yaml-cpp)
205
    pkg_check_modules(PC_YAML_CPP REQUIRED QUIET yaml-cpp)
206
    find_path(YAML_CPP_INCLUDE_DIR yaml-cpp/yaml.h
207
        HINTS  ${PC_YAML_CPP_INCLUDEDIR} ${PC_YAML_CPP_INCLUDE_DIRS} )
208
    find_library(YAML_CPP_LIBRARY LIBRARY_NAMES yaml-cpp libyaml-cpp
209
        HINTS ${PC_YAML_CPP_LIBRARY_DIRS} )
210
    set(YAML_CPP_LIBRARIES ${YAML_CPP_LIBRARY})
211
    set(YAML_CPP_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})
212
    set(YAML_CPP_VERSION ${PC_YAML_CPP_VERSION})
213
214
    if(YAML_CPP_VERSION VERSION_LESS ${YAML_VERSION_MIN})
215
        message(FATAL_ERROR "ERROR: yaml-cpp ${YAML_VERSION_MIN} or greater is required.")
216
    endif()
217
218
    find_package_handle_standard_args(yaml-cpp
219
                                      REQUIRED_VARS YAML_CPP_LIBRARIES YAML_CPP_INCLUDE_DIRS )
220
    set(YAML_CPP_FOUND ${YAML-CPP_FOUND})
221
    mark_as_advanced(YAML_CPP_INCLUDE_DIR YAML_CPP_LIBRARY YAML-CPP_FOUND)
222
206
    if(YAML_CPP_FOUND)
223
    if(YAML_CPP_FOUND)
207
        if(YAML_CPP_VERSION VERSION_EQUAL ${YAML_VERSION_MIN} OR
224
        if(YAML_CPP_VERSION VERSION_GREATER "0.5.0")
208
           YAML_CPP_VERSION VERSION_GREATER ${YAML_VERSION_MIN})
225
            # Need to also get the boost headers here, as yaml-cpp 0.5.0+ requires them.
209
            message(STATUS "System yaml-cpp library will be used.")
226
            # Don't bother doing this step if we are already including the boost headers for shared_ptr
210
            include_directories(BEFORE ${YAML_CPP_INCLUDE_DIRS})
227
            if(NOT OCIO_USE_BOOST_PTR)
211
        else()
228
                set(Boost_ADDITIONAL_VERSIONS "1.49" "1.45" "1.44" "1.43" "1.43.0" "1.42"
212
            message(FATAL_ERROR "ERROR: yaml-cpp ${YAML_VERSION_MIN} or greater is required.")
229
                                              "1.42.0" "1.41" "1.41.0" "1.40"
230
                                              "1.40.0" "1.39" "1.39.0" "1.38"
231
                                              "1.38.0" "1.37" "1.37.0" "1.34.1"
232
                                              "1_34_1")
233
                set(Boost_USE_MULTITHREADED ON)
234
                find_package(Boost 1.34)
235
                if(NOT Boost_FOUND)
236
                    message(FATAL_ERROR "Error: Detected system yaml-cpp version ${YAML_CPP_VERSION} is greater than 0.5.0, and therefore requires boost, but a boost installation could not be found.")
237
                endif()
238
239
                set(EXTERNAL_INCLUDE_DIRS ${EXTERNAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
240
            endif()
213
        endif()
241
        endif()
242
        set(EXTERNAL_INCLUDE_DIRS ${EXTERNAL_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIRS})
214
    else(YAML_CPP_FOUND)
243
    else(YAML_CPP_FOUND)
215
        message(FATAL_ERROR "ERROR: System yaml-cpp library was not found. Make sure the library is installed and the pkg-config file exists.")
244
        message(FATAL_ERROR "ERROR: System yaml-cpp library was not found. Make sure the library is installed and the pkg-config file exists.")
216
    endif(YAML_CPP_FOUND)
245
    endif(YAML_CPP_FOUND)
(-)a/src/core/OCIOYaml.cpp (-8 / +18 lines)
Lines 88-113 OCIO_NAMESPACE_ENTER Link Here
88
#else
88
#else
89
        typedef YAML::const_iterator Iterator;
89
        typedef YAML::const_iterator Iterator;
90
#endif
90
#endif
91
        
91
92
        // Iterator access
92
        // Iterator access
93
        
93
        // Note: The ownership semantics have changed between yaml-cpp 0.3.x and 0.5.x .
94
        inline const YAML::Node& get_first(const Iterator it)
94
        // Returning a const reference to a yaml node screws with the internal yaml-cpp smart ptr 
95
        {
95
        // implementation in the newer version. Luckily, the compiler does not care if we maintain
96
        // const YAML::Node & = get_first(iter) syntax at the call site even when returning an actual object
97
        // (instead of the reference as expected).
96
#ifdef OLDYAML
98
#ifdef OLDYAML
99
        inline const YAML::Node& get_first(const Iterator &it)
100
        {
97
            return it.first();
101
            return it.first();
102
        }
98
#else
103
#else
104
        inline YAML::Node get_first(const Iterator &it)
105
        {
99
            return it->first;
106
            return it->first;
100
#endif
101
        }
107
        }
108
#endif
102
        
109
        
103
        inline const YAML::Node& get_second(const Iterator it)
104
        {
105
#ifdef OLDYAML
110
#ifdef OLDYAML
111
        inline const YAML::Node& get_second(const Iterator &it)
112
        {
106
            return it.second();
113
            return it.second();
114
        }
107
#else
115
#else
116
        inline YAML::Node get_second(const Iterator &it)
117
        {
108
            return it->second;
118
            return it->second;
109
#endif
110
        }
119
        }
120
#endif
111
        
121
        
112
        // Basic types
122
        // Basic types
113
        
123
        

Return to bug 548392