rock-simulation / configmaps

Formerly included in MARS, config maps recreate Python-like dictionary structures in C++.
GNU Lesser General Public License v3.0
3 stars 6 forks source link

Make this package compatible to yaml-cpp 0.5 #1

Open goldhoorn opened 9 years ago

goldhoorn commented 9 years ago

To increase the compatibility to different systems it would be gread that this package support yaml-cpp 0.5 and yaml-cpp 0.3.

To make this possible follow this steps: Rework this lines:

https://github.com/rock-simulation/configmaps/blob/master/CMakeLists.txt#L9-L14

to somethig like (untested):

pkg_check_modules(YAML REQUIRED
        yaml-cpp
)
include_directories(${YAML_INCLUDE_DIRS})
link_directories(${YAML_LIBRARY_DIRS})
add_definitions(${YAML_CFLAGS_OTHER})  #flags excluding the ones with -I

STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" $YAML_MAJOR_VERSION ${YAML_VERSION}") 
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" $YAML_MINOR_VERSION ${YAML_VERSION}") 
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" $YAML_PATCH_VERSION ${YAML_VERSION}") 
add_definitions("-DYAML_MINOR_VERSION=${YAML_MINOR_VERSION})
add_definitions("-DYAML_MAJOR_VERSION=${YAML_MAJOR_VERSION})
add_definitions("-DYAML_PATCH_VERSION=${YAML_PATCH_VERSION})

add_definitions(${PKGCONFIG_CFLAGS_OTHER})  #flags excluding the ones with -I

In the c++ code you can then identify the version by:

#if YAML_MAJOR_VERSION == 0
  #if YAML_MINOR_VERSION == 3
//Put here the old-code
  #endif
#endif
//Put here the new-code and hope they keep the API backward compatible
goldhoorn commented 9 years ago

@jmachowinski Added you because you are related to this yaml-cpp-0.5 stuff

malter commented 9 years ago

There is now a yaml-0-5 branch for this package, but it is not merged into the master because of other packages depending on yaml-cpp 0.3.

goldhoorn commented 9 years ago

This is the reason why i recomment this backward compatible change. With this you can support yaml-cpp 0.5 without loosing backward compatibility.

The problem here is that rock will not change at once so we need migration time and backward compatibility