diff --git a/cmake/install-package-config-files.cmake b/cmake/install-package-config-files.cmake index 7fe282b8b5..a2fcb43c74 100644 --- a/cmake/install-package-config-files.cmake +++ b/cmake/install-package-config-files.cmake @@ -6,7 +6,7 @@ function(osgearth_package_install_config_files) include(CMakePackageConfigHelpers) # main target include dir - set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/osgearth") + set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") configure_package_config_file( "${PROJECT_SOURCE_DIR}/cmake/osgearth-config.cmake.in" diff --git a/cmake/osgearth-macros.cmake b/cmake/osgearth-macros.cmake index dcabe0704e..287fe3e8d8 100644 --- a/cmake/osgearth-macros.cmake +++ b/cmake/osgearth-macros.cmake @@ -170,7 +170,7 @@ macro(add_osgearth_library) cmake_parse_arguments(MY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(INSTALL_INCLUDE_FOLDER ${CMAKE_INSTALL_INCLUDEDIR}/${MY_TARGET}) - + set(ALL_HEADERS ${MY_HEADERS} ${MY_IMGUI_HEADERS} ${MY_PUBLIC_HEADERS}) include_directories(${MY_INCLUDE_DIRECTORIES}) @@ -179,11 +179,11 @@ macro(add_osgearth_library) source_group("Headers" FILES ${ALL_HEADERS}) source_group("Shaders" FILES ${MY_SHADERS} ) source_group("Templates" FILES ${MY_TEMPLATES} ) - + if(NOT MY_STATIC) set(MY_STATIC ${OSGEARTH_DYNAMIC_OR_STATIC}) endif() - + # create the library. add_library( ${MY_TARGET} @@ -192,8 +192,6 @@ macro(add_osgearth_library) ${MY_SOURCES} ${MY_SHADERS} ${MY_TEMPLATES} ) - - include_directories(${MY_INCLUDE_DIRECTORIES}) # Link: if(NOT "${MY_TARGET}" STREQUAL "osgEarth") @@ -218,7 +216,8 @@ macro(add_osgearth_library) # library install and target exports for the cmake config packaging. install( TARGETS ${MY_TARGET} - EXPORT ${MY_TARGET}Targets) + EXPORT ${MY_TARGET}Targets + INCLUDES DESTINATION include) # deploy the shaders for this library, if requested. if(OSGEARTH_INSTALL_SHADERS) diff --git a/src/osgEarth/Config.cpp b/src/osgEarth/Config.cpp index 4f2b0ea081..8d3e87a121 100644 --- a/src/osgEarth/Config.cpp +++ b/src/osgEarth/Config.cpp @@ -248,42 +248,54 @@ namespace std::map< std::string, std::vector > sets; // sorted // sort into bins by name: - for( ConfigSet::const_iterator c = conf.children().begin(); c != conf.children().end(); ++c ) + for(auto& child : conf.children()) { - sets[c->key()].push_back( *c ); + sets[child.key()].push_back(child); } - for( std::map >::iterator i = sets.begin(); i != sets.end(); ++i ) + if (sets.size() == 1 && sets.begin()->second.size() > 1) + { + // if there's only one set, and it has more than one member, it's a JSON array. + auto& only_set = *sets.begin(); + auto& members = only_set.second; + Json::Value array_value(Json::arrayValue); + for (auto& member : members) + { + array_value.append(conf2json(member, nicer, depth + 1)); + } + value = array_value; + } + + else { - if ( i->second.size() == 1 ) + for (auto i : sets) { - Config& c = i->second[0]; - if ( c.isSimple() ) + if (i.second.size() == 1) { - if (c.isNumber()) - value[i->first] = c.valueAs(0.0); + auto& c = i.second[0]; + if (c.isSimple()) + { + if (c.isNumber()) + value[i.first] = c.valueAs(0.0); + else + value[i.first] = c.value(); + } else - value[i->first] = c.value(); + { + value[i.first] = conf2json(c, nicer, depth + 1); + } } else { - Json::Value child = conf2json(c, nicer, depth+1); - if (child.isObject()) + std::string array_key = Stringify() << i.first << "__array__"; + Json::Value array_value(Json::arrayValue); + for (std::vector::iterator j = i.second.begin(); j != i.second.end(); ++j) { - value[i->first] = child; - } - } - } - else - { - std::string array_key = Stringify() << i->first << "__array__"; - Json::Value array_value( Json::arrayValue ); - for( std::vector::iterator j = i->second.begin(); j != i->second.end(); ++j ) - { - array_value.append( conf2json(*j, nicer, depth+1) ); + array_value.append(conf2json(*j, nicer, depth + 1)); + } + value[array_key] = array_value; + //value = array_value; } - value[array_key] = array_value; - //value = array_value; } } } diff --git a/src/osgEarth/Geometry.cpp b/src/osgEarth/Geometry.cpp index d9343b0536..4d33c17c57 100644 --- a/src/osgEarth/Geometry.cpp +++ b/src/osgEarth/Geometry.cpp @@ -758,7 +758,7 @@ void Geometry::removeDuplicates() osg::Vec3d v = front(); for (Geometry::iterator itr = begin(); itr != end(); ) { - if (itr != begin() && equivalent(v.x(), itr->x()) && equivalent(v.y(), itr->y())) + if (itr != begin() && v == *itr) { itr = erase(itr); }