Skip to content

Commit

Permalink
- Initial checkin of YAML serialization
Browse files Browse the repository at this point in the history
- Added ext/yaml-cpp-0.2.5.tar.gz with a patch to build it static
- Added yaml-cpp to the LICENCE file
- CDLTransform should be the only thing depending on tinyxml
- PyOCIO_Config_getXML now returns YAML not XML, this should be fixed soon. Possibly this python method should be removed and we use the config.__str__() instead, this would make it slightly more pythonic
  • Loading branch information
malcolmhumphreys committed Oct 18, 2010
1 parent 8897a98 commit ef6cddf
Show file tree
Hide file tree
Showing 18 changed files with 1,115 additions and 1,231 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Expand Up @@ -56,6 +56,22 @@ endif()
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Weffc++ -Winline ")

###############################################################################
### YAML ###

include(ExternalProject)
ExternalProject_Add(YAML_CPP_LOCAL
DOWNLOAD_DIR ext/download
URL ${CMAKE_SOURCE_DIR}/ext/yaml-cpp-0.2.5.tar.gz
BINARY_DIR ext/build
PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/ext/yaml-cpp-0.2.5.patch
INSTALL_DIR ext/dist
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/ext/dist
)
set(YAML_CPP_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ext/dist/include/yaml-cpp)
set(YAML_CPP_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib)
set(YAML_CPP_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cpp.a)

###############################################################################
### BOOST ###

Expand Down
27 changes: 27 additions & 0 deletions LICENSE
Expand Up @@ -6,6 +6,9 @@ http://code.google.com/p/pystring/
TinyXML
http://sourceforge.net/projects/tinyxml/

yaml-cpp
http://code.google.com/p/yaml-cpp/

PTex (Mutex), courtesy of Brent Burley and Disney
http://ptex.us/

Expand Down Expand Up @@ -100,6 +103,30 @@ distribution.

---------------------------------------------------------------------

yaml-cpp

Copyright (c) 2008 Jesse Beder.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

---------------------------------------------------------------------

PTEX SOFTWARE
Copyright 2009 Disney Enterprises, Inc. All rights reserved

Expand Down
3 changes: 1 addition & 2 deletions export/OpenColorIO/OpenColorIO.h
Expand Up @@ -215,8 +215,7 @@ OCIO_NAMESPACE_ENTER
const char * getDescription() const;
void setDescription(const char * description);

void writeXML(std::ostream& os) const;

void writeToStream(std::ostream& os) const;

// COLORSPACES ////////////////////////////////////////////////////////

Expand Down
12 changes: 12 additions & 0 deletions ext/yaml-cpp-0.2.5.patch
@@ -0,0 +1,12 @@
diff -Naur YAML_CPP_LOCAL.orig/CMakeLists.txt YAML_CPP_LOCAL/CMakeLists.txt
--- YAML_CPP_LOCAL.orig/CMakeLists.txt 2010-10-18 10:11:19.000000000 +1100
+++ YAML_CPP_LOCAL/CMakeLists.txt 2010-10-18 10:11:46.000000000 +1100
@@ -2,7 +2,7 @@

project (YAML_CPP)

-set(LIB_TYPE SHARED)
+set(LIB_TYPE STATIC)

if(IPHONE)
set(CMAKE_OSX_SYSROOT iphoneos2.2.1)
Binary file added ext/yaml-cpp-0.2.5.tar.gz
Binary file not shown.
23 changes: 23 additions & 0 deletions src/core/CDLTransform.cpp
Expand Up @@ -53,6 +53,29 @@ OCIO_NAMESPACE_ENTER
" <Saturation> 1 </Saturation> "
" </SatNode> "
" </ColorCorrection>";

// http://ticpp.googlecode.com/svn/docs/ticpp_8h-source.html#l01670

void SetText( TiXmlElement* element, const char * value)
{
if ( element->NoChildren() )
{
element->LinkEndChild( new TiXmlText( value ) );
}
else
{
if ( 0 == element->GetText() )
{
element->InsertBeforeChild( element->FirstChild(), TiXmlText( value ) );
}
else
{
// There already is text, so change it
element->FirstChild()->SetValue( value );
}
}
}

}

CDLTransformRcPtr CDLTransform::Create()
Expand Down
14 changes: 12 additions & 2 deletions src/core/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@
include_directories(
${CMAKE_SOURCE_DIR}/export/
${CMAKE_BINARY_DIR}/export/
${YAML_CPP_INCLUDE_DIRS}
)

file(GLOB_RECURSE core_src_files "${CMAKE_SOURCE_DIR}/src/core/*.cpp")
Expand All @@ -15,8 +16,17 @@ configure_file(${CMAKE_SOURCE_DIR}/export/OpenColorIO/OpenColorVersion.h.in
${CMAKE_BINARY_DIR}/export/OpenColorVersion.h @ONLY)
list(APPEND core_export_headers ${CMAKE_BINARY_DIR}/export/OpenColorVersion.h)

add_library(OpenColorIO SHARED ${core_src_files})
install(TARGETS OpenColorIO DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
add_library(OpenColorIO SHARED
${core_src_files})

add_dependencies(OpenColorIO
YAML_CPP_LOCAL)

target_link_libraries(OpenColorIO
${YAML_CPP_STATIC_LIBRARIES})

install(TARGETS OpenColorIO DESTINATION
${CMAKE_INSTALL_PREFIX}/lib)

# TODO: RegisterFileFormat() mechanism doesn't seem to work when static linked?
#add_library(OpenColorIOStatic STATIC ${core_src_files})
Expand Down
1 change: 0 additions & 1 deletion src/core/CineonLogToLinTransform.cpp
Expand Up @@ -275,7 +275,6 @@ namespace OCIO = OCIO_NAMESPACE;

#include <iostream>
#include <cmath>
#include "tinyxml/tinyxml.h"

BOOST_AUTO_TEST_SUITE( CineonLogToLinTransform_Unit_Tests )

Expand Down

0 comments on commit ef6cddf

Please sign in to comment.