Skip to content

Commit 1642335

Browse files
committed
Merge pull request #32 from NathanaelAtEGR/fix/install-cmake-archive
* NathanaelAtEGR/fix/install-cmake-archive: [FIX] Perf issues and Windows build [FIX] Missing boost::boost, when configured without python Couldn't include Boost on macOS 13 Add "ARCHIVE DEST..." to CMAKE Install for static libs and Windows DLL Loader
2 parents 2eea425 + bc2f943 commit 1642335

File tree

5 files changed

+39
-22
lines changed

5 files changed

+39
-22
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ if (MSVC)
4040
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline")
4141
endif()
4242
endif()
43+
add_compile_definitions("BOOST_NO_CXX98_FUNCTION_BASE")
4344

4445
option(BUILD_TESTS "Build tests" ON)
4546
option(BUILD_DOCS "Build documentation" ON)
@@ -104,6 +105,11 @@ if(BUILD_PYTHON_BINDINGS)
104105
CACHE INTERNAL "Python library path.")
105106
endif()
106107

108+
# usd::usd target always requres Boost::Boost
109+
if (NOT TARGET Boost::Boost)
110+
find_package(Boost REQUIRED)
111+
endif()
112+
107113
add_subdirectory(src)
108114

109115
if (BUILD_TESTS)

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ endif()
4949
install(
5050
TARGETS unf
5151
EXPORT ${PROJECT_NAME}
52+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
5253
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
5354
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
5455
)

src/unf/broker.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ BrokerPtr Broker::Create(const UsdStageWeakPtr& stage)
4343
return Registry[stage];
4444
}
4545

46+
const UsdStageWeakPtr
47+
Broker::GetStage() const {
48+
return _stage;
49+
}
50+
4651
bool Broker::IsInTransaction() { return _mergers.size() > 0; }
4752

4853
void Broker::BeginTransaction(CapturePredicate predicate)
@@ -170,14 +175,14 @@ void Broker::_NoticeMerger::Merge()
170175
// first notice, and all other can be pruned.
171176
if (notices.size() > 1 && notices[0]->IsMergeable()) {
172177
auto& notice = notices.at(0);
173-
auto it = std::next(notices.begin());
174178

175-
while (it != notices.end()) {
179+
auto it = std::next(notices.begin());
180+
for (; it != notices.end(); ++it) {
176181
// Attempt to merge content of notice with first notice
177182
// if this is possible.
178183
notice->Merge(std::move(**it));
179-
it = notices.erase(it);
180184
}
185+
notices.resize(1);
181186
}
182187
}
183188
}

src/unf/broker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Broker : public PXR_NS::TfRefBase, public PXR_NS::TfWeakBase {
6161
UNF_API Broker& operator=(const Broker&) = delete;
6262

6363
/// Return Usd Stage associated with the broker.
64-
UNF_API const PXR_NS::UsdStageWeakPtr GetStage() const { return _stage; }
64+
UNF_API const PXR_NS::UsdStageWeakPtr GetStage() const;
6565

6666
/// \brief
6767
/// Indicate whether a notice transaction has been started.

src/unf/notice.cpp

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ ObjectsChanged& ObjectsChanged::operator=(const ObjectsChanged& other)
6363

6464
void ObjectsChanged::Merge(ObjectsChanged&& notice)
6565
{
66-
SdfPathSet resyncSet(_resyncChanges.begin(), _resyncChanges.end());
67-
6866
// Update resyncChanges if necessary.
69-
for (const auto& path : notice._resyncChanges) {
70-
if (resyncSet.find(path) == resyncSet.end()) {
71-
resyncSet.insert(path);
72-
_resyncChanges.push_back(std::move(path));
67+
for (auto& path : notice._resyncChanges) {
68+
const auto iter = std::find(_resyncChanges.begin(), _resyncChanges.end(), path);
69+
if (iter == _resyncChanges.end())
70+
{
71+
_resyncChanges.emplace_back(std::move(path));
7372
}
7473
}
7574

@@ -78,31 +77,37 @@ void ObjectsChanged::Merge(ObjectsChanged&& notice)
7877
const SdfPath& primPath = path.GetPrimPath();
7978

8079
// Skip if the path is already in resyncedPaths.
81-
if (resyncSet.find(primPath) != resyncSet.end()) {
82-
continue;
80+
{
81+
const auto it = std::find(
82+
_resyncChanges.begin(), _resyncChanges.end(), primPath);
83+
if (it != _resyncChanges.end())
84+
continue;
8385
}
8486

8587
// Skip if an ancestor of the path is already in resyncedPaths.
8688
bool ancestorResynced = false;
8789
for (const auto& ancestor : primPath.GetPrefixes()) {
88-
if (resyncSet.find(ancestor) != resyncSet.end()) {
89-
ancestorResynced = true;
90-
break;
90+
const auto it = std::find(
91+
_resyncChanges.begin(), _resyncChanges.end(), ancestor);
92+
if (it != _resyncChanges.end()) {
93+
goto continue_ancestorResynced;
9194
}
9295
}
93-
if (ancestorResynced) {
94-
continue;
95-
}
9696

97-
auto it = std::find(_infoChanges.begin(), _infoChanges.end(), path);
98-
if (it == _infoChanges.end()) {
99-
_infoChanges.push_back(std::move(path));
97+
// Add infoChanges, when not already available
98+
{
99+
const auto it = std::find(
100+
_infoChanges.begin(), _infoChanges.end(), path);
101+
if (it == _infoChanges.end()) {
102+
_infoChanges.push_back(std::move(path));
103+
}
100104
}
105+
continue_ancestorResynced:;
101106
}
102107

103108
// Update changeFields.
104109
for (auto const& entry : notice._changedFields) {
105-
auto const path = entry.first;
110+
auto const& path = entry.first;
106111

107112
if (_changedFields.find(path) == _changedFields.end()) {
108113
_changedFields[path] = std::move(notice._changedFields[path]);

0 commit comments

Comments
 (0)