Skip to content

Commit

Permalink
Merge branch 'master' into fix-plugin-install
Browse files Browse the repository at this point in the history
  • Loading branch information
plevy authored Feb 5, 2025
2 parents f087f06 + 1bc68de commit 1057f71
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cmake/install-package-config-files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 5 additions & 6 deletions cmake/osgearth-macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand All @@ -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}
Expand All @@ -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")
Expand All @@ -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)
Expand Down
60 changes: 36 additions & 24 deletions src/osgEarth/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,42 +248,54 @@ namespace
std::map< std::string, std::vector<Config> > 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<std::string,std::vector<Config> >::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<double>(0.0);
auto& c = i.second[0];
if (c.isSimple())
{
if (c.isNumber())
value[i.first] = c.valueAs<double>(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<Config>::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<Config>::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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarth/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1057f71

Please sign in to comment.