From 445e3f8a473db9b1e0d1301e6ce4bf74c270f376 Mon Sep 17 00:00:00 2001 From: Paul Molodowitch Date: Tue, 2 Nov 2021 17:44:21 -0700 Subject: [PATCH] collection of fixes for building without pre-compiled headers ie, if -DPXR_ENABLE_PRECOMPILED_HEADERS=OFF wanted to build without precompiled headers to help with debugging a strange build issue (ie, create more transparent + atomic build steps) also, turning off PCH usage allows stashed.io (a caching compiler wrapper for MSVC) to operate when using PDB (see: https://github.com/playscale/stashed.io/wiki/PDB-and-PCH-generation) most fixes are pretty self-explanatory - adding some missing headers to individual source / header files in stackTrace.cpp, the include of Winsock2.h must happen before windows.h, which is brought in via fileSystem.h See: https://github.com/PixarAnimationStudios/USD/pull/1672 --- pxr/base/arch/stackTrace.cpp | 6 +++++- pxr/base/trace/dataBuffer.cpp | 2 ++ pxr/imaging/hd/extComputationContextInternal.h | 2 ++ pxr/imaging/hdx/fullscreenShader.h | 1 + pxr/imaging/hgiGL/scopedStateHolder.h | 1 + pxr/imaging/hgiGL/shaderGenerator.h | 2 ++ pxr/imaging/plugin/hdEmbree/config.cpp | 1 + pxr/imaging/plugin/hdEmbree/meshSamplers.h | 2 ++ pxr/usd/ndr/registry.h | 1 + pxr/usd/plugin/usdMtlx/discovery.cpp | 1 + pxr/usd/sdf/fileIO.h | 1 + 11 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pxr/base/arch/stackTrace.cpp b/pxr/base/arch/stackTrace.cpp index 54f11a4128..beb9c0a4ff 100644 --- a/pxr/base/arch/stackTrace.cpp +++ b/pxr/base/arch/stackTrace.cpp @@ -32,6 +32,11 @@ #include "pxr/base/arch/error.h" #include "pxr/base/arch/errno.h" #include "pxr/base/arch/export.h" +#if defined(ARCH_OS_WINDOWS) +// Need to include Winsock2.h BEFORE windows.h - which is included in +// fileSystem.h +#include +#endif #include "pxr/base/arch/fileSystem.h" #include "pxr/base/arch/inttypes.h" #include "pxr/base/arch/symbols.h" @@ -39,7 +44,6 @@ #if defined(ARCH_OS_WINDOWS) #include #include -#include #include #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 diff --git a/pxr/base/trace/dataBuffer.cpp b/pxr/base/trace/dataBuffer.cpp index 7cdef004f6..e08edb17fe 100644 --- a/pxr/base/trace/dataBuffer.cpp +++ b/pxr/base/trace/dataBuffer.cpp @@ -26,6 +26,8 @@ #include "pxr/pxr.h" +#include + PXR_NAMESPACE_OPEN_SCOPE constexpr size_t _GetMaxAlign() { diff --git a/pxr/imaging/hd/extComputationContextInternal.h b/pxr/imaging/hd/extComputationContextInternal.h index bb68e3014f..f4d03f5e68 100644 --- a/pxr/imaging/hd/extComputationContextInternal.h +++ b/pxr/imaging/hd/extComputationContextInternal.h @@ -28,6 +28,8 @@ #include "pxr/imaging/hd/extComputationContext.h" +#include + PXR_NAMESPACE_OPEN_SCOPE /// diff --git a/pxr/imaging/hdx/fullscreenShader.h b/pxr/imaging/hdx/fullscreenShader.h index dc80f5bf5f..03d5a81598 100644 --- a/pxr/imaging/hdx/fullscreenShader.h +++ b/pxr/imaging/hdx/fullscreenShader.h @@ -35,6 +35,7 @@ #include "pxr/imaging/hgi/shaderProgram.h" #include "pxr/imaging/hgi/texture.h" +#include #include PXR_NAMESPACE_OPEN_SCOPE diff --git a/pxr/imaging/hgiGL/scopedStateHolder.h b/pxr/imaging/hgiGL/scopedStateHolder.h index 229edbdcb8..40d027fad3 100644 --- a/pxr/imaging/hgiGL/scopedStateHolder.h +++ b/pxr/imaging/hgiGL/scopedStateHolder.h @@ -27,6 +27,7 @@ #include "pxr/pxr.h" #include "pxr/imaging/hgiGL/api.h" +#include PXR_NAMESPACE_OPEN_SCOPE diff --git a/pxr/imaging/hgiGL/shaderGenerator.h b/pxr/imaging/hgiGL/shaderGenerator.h index 6dbf16f97a..8794014e1d 100644 --- a/pxr/imaging/hgiGL/shaderGenerator.h +++ b/pxr/imaging/hgiGL/shaderGenerator.h @@ -29,6 +29,8 @@ #include "pxr/imaging/hgiGL/shaderSection.h" #include "pxr/imaging/hgiGL/api.h" +#include + PXR_NAMESPACE_OPEN_SCOPE using HgiGLShaderSectionUniquePtrVector = diff --git a/pxr/imaging/plugin/hdEmbree/config.cpp b/pxr/imaging/plugin/hdEmbree/config.cpp index faddced8c4..5aadd92c26 100644 --- a/pxr/imaging/plugin/hdEmbree/config.cpp +++ b/pxr/imaging/plugin/hdEmbree/config.cpp @@ -26,6 +26,7 @@ #include "pxr/base/tf/envSetting.h" #include "pxr/base/tf/instantiateSingleton.h" +#include #include PXR_NAMESPACE_OPEN_SCOPE diff --git a/pxr/imaging/plugin/hdEmbree/meshSamplers.h b/pxr/imaging/plugin/hdEmbree/meshSamplers.h index b2a68f1900..bef6f65959 100644 --- a/pxr/imaging/plugin/hdEmbree/meshSamplers.h +++ b/pxr/imaging/plugin/hdEmbree/meshSamplers.h @@ -32,6 +32,8 @@ #include #include +#include + PXR_NAMESPACE_OPEN_SCOPE /// \class HdEmbreeRTCBufferAllocator diff --git a/pxr/usd/ndr/registry.h b/pxr/usd/ndr/registry.h index 677af8aaba..a9511c0c2b 100644 --- a/pxr/usd/ndr/registry.h +++ b/pxr/usd/ndr/registry.h @@ -36,6 +36,7 @@ #include "pxr/usd/ndr/nodeDiscoveryResult.h" #include "pxr/usd/ndr/parserPlugin.h" #include "pxr/usd/sdf/assetPath.h" +#include #include PXR_NAMESPACE_OPEN_SCOPE diff --git a/pxr/usd/plugin/usdMtlx/discovery.cpp b/pxr/usd/plugin/usdMtlx/discovery.cpp index ab018249b1..fa2a5b0299 100644 --- a/pxr/usd/plugin/usdMtlx/discovery.cpp +++ b/pxr/usd/plugin/usdMtlx/discovery.cpp @@ -31,6 +31,7 @@ #include "pxr/base/tf/stringUtils.h" #include #include +#include namespace mx = MaterialX; diff --git a/pxr/usd/sdf/fileIO.h b/pxr/usd/sdf/fileIO.h index 2166f13019..f334e886fb 100644 --- a/pxr/usd/sdf/fileIO.h +++ b/pxr/usd/sdf/fileIO.h @@ -35,6 +35,7 @@ #include "pxr/usd/ar/writableAsset.h" #include "pxr/base/tf/diagnosticLite.h" +#include #include #include #include