Skip to content

Commit 75ee36e

Browse files
committed
Fixed windows build
1 parent edb032f commit 75ee36e

File tree

11 files changed

+104
-44
lines changed

11 files changed

+104
-44
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ set(CESIUM_OMNI_CXX_DEFINES
378378
# Boost is a dependency of USD. It is dynamically linked so we need to set this flag.
379379
set(CESIUM_OMNI_CXX_DEFINES ${CESIUM_OMNI_CXX_DEFINES} BOOST_ALL_DYN_LINK)
380380

381+
# Disable auto-linking
382+
set(CESIUM_OMNI_CXX_DEFINES ${CESIUM_OMNI_CXX_DEFINES} BOOST_ALL_NO_LIB)
383+
381384
# Hide USD build warning
382385
set(CESIUM_OMNI_CXX_DEFINES ${CESIUM_OMNI_CXX_DEFINES} BOOST_BIND_GLOBAL_PLACEHOLDERS)
383386

cmake/AddConanDependencies.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ set(REQUIRES
1111
"zlib/1.2.13@#13c96f538b52e1600c40b88994de240f"
1212
"yaml-cpp/0.7.0@#85b409c274a53d226b71f1bdb9cb4f8b"
1313
"libcurl/8.2.1@#8f62ba7135f5445e5fe6c4bd85143b53"
14-
"nasm/2.15.05@#799d63b1672a337584b09635b0f22fc1")
14+
"nasm/2.15.05@#058c93b2214a49ca1cfe9f8f26205568")
1515

1616
if(WIN32)
17-
set(REQUIRES ${REQUIRES} "strawberryperl/5.32.1.1@#8f83d05a60363a422f9033e52d106b47")
17+
set(REQUIRES ${REQUIRES} "strawberryperl/5.32.1.1@#707032463aa0620fa17ec0d887f5fe41")
1818
endif()
1919

2020
# cmake-format: off

cmake/Macros.cmake

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ function(add_prebuilt_project)
387387
""
388388
""
389389
"RELEASE_INCLUDE_DIR;DEBUG_INCLUDE_DIR;RELEASE_LIBRARY_DIR;RELEASE_DLL_DIR;DEBUG_LIBRARY_DIR;DEBUG_DLL_DIR"
390-
"RELEASE_LIBRARIES;RELEASE_DLL_LIBRARIES;DEBUG_LIBRARIES;DEBUG_DLL_LIBRARIES;TARGET_NAMES"
390+
"RELEASE_LIBRARIES;RELEASE_DLL_LIBRARIES;DEBUG_LIBRARIES;DEBUG_DLL_LIBRARIES;TARGET_NAMES;TARGETS_IN_DLL_DIR"
391391
${ARGN})
392392

393393
if(NOT DEFINED _RELEASE_DLL_LIBRARIES)
@@ -445,8 +445,25 @@ $<$<CONFIG:MinSizeRel>:${_RELEASE_INCLUDE_DIR}>")
445445
PATHS ${_DEBUG_LIBRARY_DIR}
446446
NO_DEFAULT_PATH NO_CACHE)
447447

448-
set(${TARGET_NAME}_LIBRARY_RELEASE "${_RELEASE_DLL_DIR}/${RELEASE_DLL_NAME}.dll")
449-
set(${TARGET_NAME}_LIBRARY_DEBUG "${_DEBUG_DLL_DIR}/${DEBUG_DLL_NAME}.dll")
448+
# Determine which directory to use for DLLs
449+
# If TARGETS_IN_DLL_DIR is empty, default to DLL_DIR for all targets
450+
# Otherwise, only targets in TARGETS_IN_DLL_DIR use DLL_DIR; others use LIBRARY_DIR
451+
if(NOT _TARGETS_IN_DLL_DIR)
452+
# Empty list - default all to DLL_DIR
453+
set(RELEASE_DLL_LOCATION "${_RELEASE_DLL_DIR}")
454+
set(DEBUG_DLL_LOCATION "${_DEBUG_DLL_DIR}")
455+
elseif(TARGET_NAME IN_LIST _TARGETS_IN_DLL_DIR)
456+
# Target is in the DLL_DIR list
457+
set(RELEASE_DLL_LOCATION "${_RELEASE_DLL_DIR}")
458+
set(DEBUG_DLL_LOCATION "${_DEBUG_DLL_DIR}")
459+
else()
460+
# Target is not in the DLL_DIR list - use LIBRARY_DIR
461+
set(RELEASE_DLL_LOCATION "${_RELEASE_LIBRARY_DIR}")
462+
set(DEBUG_DLL_LOCATION "${_DEBUG_LIBRARY_DIR}")
463+
endif()
464+
465+
set(${TARGET_NAME}_LIBRARY_RELEASE "${RELEASE_DLL_LOCATION}/${RELEASE_DLL_NAME}.dll")
466+
set(${TARGET_NAME}_LIBRARY_DEBUG "${DEBUG_DLL_LOCATION}/${DEBUG_DLL_NAME}.dll")
450467
else()
451468
find_library(
452469
${TARGET_NAME}_LIBRARY_RELEASE

extern/CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,20 @@ add_prebuilt_project(
269269
"${NVIDIA_USD_ROOT}/${NVIDIA_DEBUG_FOLDER_NAME}/include"
270270
RELEASE_LIBRARY_DIR
271271
"${NVIDIA_USD_ROOT}/${NVIDIA_RELEASE_FOLDER_NAME}/lib"
272+
RELEASE_DLL_DIR
273+
"${NVIDIA_USD_ROOT}/${NVIDIA_RELEASE_FOLDER_NAME}/bin"
272274
DEBUG_LIBRARY_DIR
273275
"${NVIDIA_USD_ROOT}/${NVIDIA_DEBUG_FOLDER_NAME}/lib"
276+
DEBUG_DLL_DIR
277+
"${NVIDIA_USD_ROOT}/${NVIDIA_DEBUG_FOLDER_NAME}/bin"
274278
RELEASE_LIBRARIES
275279
${NVIDIA_USD_RELEASE_LIBRARIES}
276280
DEBUG_LIBRARIES
277281
${NVIDIA_USD_DEBUG_LIBRARIES}
278282
TARGET_NAMES
279283
${NVIDIA_USD_TARGET_NAMES}
284+
TARGETS_IN_DLL_DIR
285+
tbb
280286
)
281287
# cmake-format: on
282288

@@ -391,20 +397,16 @@ add_prebuilt_project(
391397
# cmake-format: on
392398

393399
if(WIN32)
394-
set(NVIDIA_ADDITIONAL_LIBRARIES "${KIT_IMGUI_ROOT}/bin/imgui.dll" "${KIT_IMGUI_ROOT}/bin/deps/freetype.dll")
400+
set(NVIDIA_ADDITIONAL_LIBRARIES "${KIT_IMGUI_ROOT}/bin/imgui.dll")
395401

396402
set_property(GLOBAL PROPERTY NVIDIA_ADDITIONAL_LIBRARIES_PROPERTY "${NVIDIA_ADDITIONAL_LIBRARIES}")
397403
else()
398404
set(NVIDIA_ADDITIONAL_SEARCH_PATHS
399405
"$<TARGET_FILE_DIR:python311>"
400406
"$<TARGET_FILE_DIR:usd_usd>"
401-
"$<TARGET_FILE_DIR:carb>"
402-
# This is where freetype is located on Linux
403-
"${KIT_IMGUI_ROOT}/bin/deps")
407+
"$<TARGET_FILE_DIR:carb>")
404408

405-
set(NVIDIA_ADDITIONAL_LINK_DIRECTORIES
406-
# This is where freetype is located on Linux. Needed by imgui which doesn't set its rpath properly
407-
"${KIT_IMGUI_ROOT}/bin/deps")
409+
set(NVIDIA_ADDITIONAL_LINK_DIRECTORIES)
408410

409411
set_property(GLOBAL PROPERTY NVIDIA_ADDITIONAL_SEARCH_PATHS_PROPERTY "${NVIDIA_ADDITIONAL_SEARCH_PATHS}")
410412
set_property(GLOBAL PROPERTY NVIDIA_ADDITIONAL_LINK_DIRECTORIES_PROPERTY "${NVIDIA_ADDITIONAL_LINK_DIRECTORIES}")

extern/nvidia/deps/kit-sdk.packman.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
<!--TODO: update these-->
1717
<dependency name="omni-ui" linkPath="../_build/target-deps/omni-ui/">
1818
<package name="omni.ui" version="8cfe2dbd9d3266b6" platforms="linux-x86_64 manylinux_2_35_x86_64"/>
19+
<package name="omni.ui" version="1fbb6da913c9dfa8" platforms="windows-x86_64"/>
1920
</dependency>
2021
<dependency name="omni-kit-renderer-imgui" linkPath="../_build/target-deps/omni-kit-renderer-imgui/">
2122
<package name="omni.kit.renderer.imgui" version="617e1ab163fd09a2" platforms="linux-x86_64 manylinux_2_35_x86_64" />
23+
<package name="omni.kit.renderer.imgui" version="9bfff9ba25aa72c2" platforms="windows-x86_64" />
2224
</dependency>
2325
</project>

src/core/include/cesium/omniverse/UsdTokens.h

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
1111
#endif
1212

1313
// Note: variable names should match the USD token names as closely as possible, with special characters converted to underscores
14+
// Split into multiple sequences to avoid MSVC C1009 "macros nested too deeply" error
1415

15-
#define USD_TOKENS \
16+
#define USD_TOKENS_1 \
1617
(base_color_texture) \
1718
(cesium_base_color_texture_float4) \
1819
(cesium_feature_id_int) \
@@ -63,7 +64,9 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
6364
(cesium_property_int) \
6465
(cesium_property_int2) \
6566
(cesium_property_int3) \
66-
(cesium_property_int4) \
67+
(cesium_property_int4)
68+
69+
#define USD_TOKENS_2 \
6770
(clipping_raster_overlay_resolver) \
6871
(doubleSided) \
6972
(extent) \
@@ -113,7 +116,9 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
113116
((inputs_maximum_value, "inputs:maximum_value")) \
114117
((inputs_metallic_factor, "inputs:metallic_factor")) \
115118
((inputs_no_data, "inputs:no_data")) \
116-
((inputs_null_feature_id, "inputs:null_feature_id")) \
119+
((inputs_null_feature_id, "inputs:null_feature_id"))
120+
121+
#define USD_TOKENS_3 \
117122
((inputs_offset, "inputs:offset")) \
118123
((inputs_primvar_name, "inputs:primvar_name")) \
119124
((inputs_property_id, "inputs:property_id")) \
@@ -159,20 +164,37 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
159164
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
160165
#endif
161166

162-
TF_DECLARE_PUBLIC_TOKENS(UsdTokens, USD_TOKENS);
167+
TF_DECLARE_PUBLIC_TOKENS(UsdTokens1, USD_TOKENS_1);
168+
TF_DECLARE_PUBLIC_TOKENS(UsdTokens2, USD_TOKENS_2);
169+
TF_DECLARE_PUBLIC_TOKENS(UsdTokens3, USD_TOKENS_3);
163170

164171
#ifdef CESIUM_OMNI_CLANG
165172
#pragma clang diagnostic pop
166173
#endif
167174

168-
#define FABRIC_DEFINE_TOKEN_ELEM(elem) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens->elem);
175+
// Macros for defining FabricTokens from each UsdTokens struct
176+
#define FABRIC_DEFINE_TOKEN_ELEM_1(elem) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens1->elem);
177+
#define FABRIC_DEFINE_TOKEN_ELEM_2(elem) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens2->elem);
178+
#define FABRIC_DEFINE_TOKEN_ELEM_3(elem) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens3->elem);
179+
180+
#define FABRIC_DEFINE_TOKEN_1(r, elem) \
181+
TF_PP_TUPLE_ELEM(0, _TF_PP_IFF(TF_PP_IS_TUPLE(elem), \
182+
(FABRIC_DEFINE_TOKEN_ELEM_1(TF_PP_TUPLE_ELEM(0, elem))), \
183+
(FABRIC_DEFINE_TOKEN_ELEM_1(elem))))
184+
185+
#define FABRIC_DEFINE_TOKEN_2(r, elem) \
186+
TF_PP_TUPLE_ELEM(0, _TF_PP_IFF(TF_PP_IS_TUPLE(elem), \
187+
(FABRIC_DEFINE_TOKEN_ELEM_2(TF_PP_TUPLE_ELEM(0, elem))), \
188+
(FABRIC_DEFINE_TOKEN_ELEM_2(elem))))
169189

170-
#define FABRIC_DEFINE_TOKEN(r, elem) \
190+
#define FABRIC_DEFINE_TOKEN_3(r, elem) \
171191
TF_PP_TUPLE_ELEM(0, _TF_PP_IFF(TF_PP_IS_TUPLE(elem), \
172-
(FABRIC_DEFINE_TOKEN_ELEM(TF_PP_TUPLE_ELEM(0, elem))), \
173-
(FABRIC_DEFINE_TOKEN_ELEM(elem))))
192+
(FABRIC_DEFINE_TOKEN_ELEM_3(TF_PP_TUPLE_ELEM(0, elem))), \
193+
(FABRIC_DEFINE_TOKEN_ELEM_3(elem))))
174194

175-
#define FABRIC_DEFINE_TOKENS(seq) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN, ~, seq)
195+
#define FABRIC_DEFINE_TOKENS_1(seq) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN_1, ~, seq)
196+
#define FABRIC_DEFINE_TOKENS_2(seq) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN_2, ~, seq)
197+
#define FABRIC_DEFINE_TOKENS_3(seq) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN_3, ~, seq)
176198

177199
#define FABRIC_DECLARE_TOKEN_ELEM(elem) extern const omni::fabric::TokenC elem;
178200

@@ -190,7 +212,9 @@ __pragma(warning(pop))
190212
PXR_NAMESPACE_CLOSE_SCOPE
191213

192214
namespace cesium::omniverse::FabricTokens {
193-
FABRIC_DECLARE_TOKENS(USD_TOKENS);
215+
FABRIC_DECLARE_TOKENS(USD_TOKENS_1);
216+
FABRIC_DECLARE_TOKENS(USD_TOKENS_2);
217+
FABRIC_DECLARE_TOKENS(USD_TOKENS_3);
194218

195219
const omni::fabric::TokenC feature_id_n(uint64_t index);
196220
const omni::fabric::TokenC raster_overlay_n(uint64_t index);

src/core/src/Broadcast.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#include "cesium/omniverse/Broadcast.h"
22

33
// Suppress deprecation warning for getMessageBusEventStream until Events 2.0 migration is complete
4-
#ifdef __GNUC__
4+
#ifdef _MSC_VER
5+
#pragma warning(push)
6+
#pragma warning(disable : 4996)
7+
#elif defined(__GNUC__)
58
#pragma GCC diagnostic push
69
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
710
#endif
@@ -89,6 +92,8 @@ void sendMessageToBus(const std::string_view& eventKey) {
8992

9093
} // namespace cesium::omniverse::Broadcast
9194

92-
#ifdef __GNUC__
95+
#ifdef _MSC_VER
96+
#pragma warning(pop)
97+
#elif defined(__GNUC__)
9398
#pragma GCC diagnostic pop
9499
#endif

src/core/src/FabricMaterial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ void FabricMaterial::setRasterOverlayAlphaValue(const omni::fabric::Path& path,
18951895
}
18961896

18971897
void FabricMaterial::setFeatureIdIndexValues(const omni::fabric::Path& path, int nullFeatureId) {
1898-
setFeatureIdAttributeValues(path, pxr::UsdTokens->vertexId.GetString(), nullFeatureId);
1898+
setFeatureIdAttributeValues(path, pxr::UsdTokens2->vertexId.GetString(), nullFeatureId);
18991899
}
19001900

19011901
void FabricMaterial::setFeatureIdAttributeValues(

src/core/src/UsdNotificationHandler.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,15 @@ void processCesiumGlobeAnchorChanged(
226226
// clang-format off
227227
for (const auto& property : properties) {
228228
if (detectTransformChanges &&
229-
(property == pxr::UsdTokens->xformOp_translate ||
230-
property == pxr::UsdTokens->xformOp_rotateXYZ ||
231-
property == pxr::UsdTokens->xformOp_rotateXZY ||
232-
property == pxr::UsdTokens->xformOp_rotateYXZ ||
233-
property == pxr::UsdTokens->xformOp_rotateYZX ||
234-
property == pxr::UsdTokens->xformOp_rotateZXY ||
235-
property == pxr::UsdTokens->xformOp_rotateZYX ||
236-
property == pxr::UsdTokens->xformOp_orient ||
237-
property == pxr::UsdTokens->xformOp_scale)) {
229+
(property == pxr::UsdTokens3->xformOp_translate ||
230+
property == pxr::UsdTokens3->xformOp_rotateXYZ ||
231+
property == pxr::UsdTokens3->xformOp_rotateXZY ||
232+
property == pxr::UsdTokens3->xformOp_rotateYXZ ||
233+
property == pxr::UsdTokens3->xformOp_rotateYZX ||
234+
property == pxr::UsdTokens3->xformOp_rotateZXY ||
235+
property == pxr::UsdTokens3->xformOp_rotateZYX ||
236+
property == pxr::UsdTokens3->xformOp_orient ||
237+
property == pxr::UsdTokens3->xformOp_scale)) {
238238
updateByPrimLocalTransform = true;
239239
updateBindings = true;
240240
} else if (property == pxr::CesiumTokens->cesiumAnchorLongitude ||
@@ -309,7 +309,7 @@ void processCesiumTilesetChanged(
309309
property == pxr::CesiumTokens->cesiumRasterOverlayBinding ||
310310
property == pxr::CesiumTokens->cesiumPointSize ||
311311
property == pxr::CesiumTokens->cesiumGeoreferenceBinding ||
312-
property == pxr::UsdTokens->material_binding) {
312+
property == pxr::UsdTokens3->material_binding) {
313313
reload = true;
314314
} else if (
315315
property == pxr::CesiumTokens->cesiumMaximumScreenSpaceError ||
@@ -326,8 +326,8 @@ void processCesiumTilesetChanged(
326326
property == pxr::CesiumTokens->cesiumMainThreadLoadingTimeLimit) {
327327
updateTilesetOptions = true;
328328
} else if (
329-
property == pxr::UsdTokens->primvars_displayColor ||
330-
property == pxr::UsdTokens->primvars_displayOpacity) {
329+
property == pxr::UsdTokens3->primvars_displayColor ||
330+
property == pxr::UsdTokens3->primvars_displayOpacity) {
331331
updateDisplayColorAndOpacity = true;
332332
}
333333
}
@@ -658,7 +658,7 @@ void processCesiumCartographicPolygonChanged(
658658
auto updateBindings = false;
659659

660660
for (const auto& property : properties) {
661-
if (property == pxr::UsdTokens->points) {
661+
if (property == pxr::UsdTokens2->points) {
662662
updateBindings = true;
663663
}
664664
}

src/core/src/UsdTokens.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ __pragma(warning(disable: 4003))
1515
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
1616
#endif
1717

18-
TF_DEFINE_PUBLIC_TOKENS(
19-
UsdTokens,
20-
USD_TOKENS);
18+
TF_DEFINE_PUBLIC_TOKENS(UsdTokens1, USD_TOKENS_1);
19+
TF_DEFINE_PUBLIC_TOKENS(UsdTokens2, USD_TOKENS_2);
20+
TF_DEFINE_PUBLIC_TOKENS(UsdTokens3, USD_TOKENS_3);
2121

2222
#ifdef CESIUM_OMNI_CLANG
2323
#pragma clang diagnostic pop
@@ -31,7 +31,9 @@ PXR_NAMESPACE_CLOSE_SCOPE
3131
// clang-format on
3232

3333
namespace cesium::omniverse::FabricTokens {
34-
FABRIC_DEFINE_TOKENS(USD_TOKENS);
34+
FABRIC_DEFINE_TOKENS_1(USD_TOKENS_1);
35+
FABRIC_DEFINE_TOKENS_2(USD_TOKENS_2);
36+
FABRIC_DEFINE_TOKENS_3(USD_TOKENS_3);
3537

3638
namespace {
3739
std::mutex tokenMutex;

0 commit comments

Comments
 (0)