From 31885753cbcd2ba79a724ba2626d6f4873849ea0 Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Mon, 3 May 2021 22:46:28 -0700 Subject: [PATCH] Fixes for compile failures with Clang on Windows (#532) * Fix compile errors when building with Clang. * Fix for clang-based unity builds --- .../AzCore/RTTI/AzStdOnDemandReflection.inl | 2 +- .../AzFramework/ProjectManager/ProjectManager.cpp | 2 +- .../PerforcePlugin/PerforceSourceControl.h | 2 +- .../Code/Source/Framework/MultipartFormData.cpp | 2 +- Gems/Atom/RHI/Code/Tests/Buffer.h | 2 ++ Gems/Atom/RHI/Code/Tests/Query.h | 1 - .../Source/RHI/FrameGraphExecuteGroupBase.cpp | 2 +- Gems/Metastream/Code/CMakeLists.txt | 2 ++ .../Platform/Android/metastream_android.cmake | 10 ++++++++++ .../Platform/Common/MSVC/metastream_msvc.cmake | 4 ---- .../Source/Platform/Linux/metastream_linux.cmake | 10 ++++++++++ .../Code/Source/Platform/Mac/metastream_mac.cmake | 10 ++++++++++ .../Platform/Windows/metastream_windows.cmake | 15 +++++++++++++++ .../Code/Source/Platform/iOS/metastream_ios.cmake | 10 ++++++++++ 14 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 Gems/Metastream/Code/Source/Platform/Android/metastream_android.cmake create mode 100644 Gems/Metastream/Code/Source/Platform/Linux/metastream_linux.cmake create mode 100644 Gems/Metastream/Code/Source/Platform/Mac/metastream_mac.cmake create mode 100644 Gems/Metastream/Code/Source/Platform/Windows/metastream_windows.cmake create mode 100644 Gems/Metastream/Code/Source/Platform/iOS/metastream_ios.cmake diff --git a/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl b/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl index ab92604266..079c70c878 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl +++ b/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl @@ -816,7 +816,7 @@ namespace AZ template static void ReflectUnpackMethodFold(BehaviorContext::ClassBuilder& builder) { - AZStd::string methodName = AZStd::string::format("Get%ld", Index); + const AZStd::string methodName = AZStd::string::format("Get%zu", Index); builder->Method(methodName.data(), [](ContainerType& value) { return AZStd::get(value); }) ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Attribute(AZ::ScriptCanvasAttributes::TupleGetFunctionIndex, Index) diff --git a/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp b/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp index ea8fd75cfd..985bc4665d 100644 --- a/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp +++ b/Code/Framework/AzFramework/AzFramework/ProjectManager/ProjectManager.cpp @@ -137,7 +137,7 @@ namespace AzFramework::ProjectManager } AZ::IO::FixedMaxPath pythonPath = engineRootPath / "python"; pythonPath /= AZ_TRAIT_AZFRAMEWORK_PYTHON_SHELL; - auto cmdPath = AZ::IO::FixedMaxPathString::format("%s %s%s --executable_path=%s --parent_pid=%" PRId64, pythonPath.Native().c_str(), + auto cmdPath = AZ::IO::FixedMaxPathString::format("%s %s%s --executable_path=%s --parent_pid=%" PRIu32, pythonPath.Native().c_str(), debugOption.c_str(), (projectManagerPath / projectsScript).c_str(), executablePath.c_str(), AZ::Platform::GetCurrentProcessId()); AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo; diff --git a/Code/Sandbox/Plugins/PerforcePlugin/PerforceSourceControl.h b/Code/Sandbox/Plugins/PerforcePlugin/PerforceSourceControl.h index 16489d99fc..1efbbc912c 100644 --- a/Code/Sandbox/Plugins/PerforcePlugin/PerforceSourceControl.h +++ b/Code/Sandbox/Plugins/PerforcePlugin/PerforceSourceControl.h @@ -26,7 +26,7 @@ class CPerforceSourceControl public: // constructor CPerforceSourceControl() = default; - ~CPerforceSourceControl() = default; + virtual ~CPerforceSourceControl() = default; void Init(); diff --git a/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp b/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp index fdd5fa3c92..bec352bf35 100644 --- a/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp +++ b/Gems/AWSCore/Code/Source/Framework/MultipartFormData.cpp @@ -117,7 +117,7 @@ namespace AWSCore result.m_content.append(AZStd::string::format(Detail::FOOTER_FMT, m_boundary.c_str())); // Populate the metadata - result.m_contentLength = AZStd::string::format("%lu", result.m_content.length()); + result.m_contentLength = AZStd::string::format("%zu", result.m_content.length()); result.m_contentType = AZStd::string::format("multipart/form-data; boundary=%s", m_boundary.c_str()); return result; diff --git a/Gems/Atom/RHI/Code/Tests/Buffer.h b/Gems/Atom/RHI/Code/Tests/Buffer.h index cfa216293f..a5538b0071 100644 --- a/Gems/Atom/RHI/Code/Tests/Buffer.h +++ b/Gems/Atom/RHI/Code/Tests/Buffer.h @@ -30,6 +30,8 @@ namespace UnitTest void ShutdownInternal() override; }; + class BufferPool; + class Buffer : public AZ::RHI::Buffer { diff --git a/Gems/Atom/RHI/Code/Tests/Query.h b/Gems/Atom/RHI/Code/Tests/Query.h index 6220ae5f55..80b47f3e42 100644 --- a/Gems/Atom/RHI/Code/Tests/Query.h +++ b/Gems/Atom/RHI/Code/Tests/Query.h @@ -21,7 +21,6 @@ namespace UnitTest class Query : public AZ::RHI::Query { - friend class QueryPool; public: AZ_CLASS_ALLOCATOR(Query, AZ::SystemAllocator, 0); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphExecuteGroupBase.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphExecuteGroupBase.cpp index 809790a7d5..6251eca7dc 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphExecuteGroupBase.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphExecuteGroupBase.cpp @@ -32,7 +32,7 @@ namespace AZ AZ_Assert(commandList && commandList->IsRecording() == false, "Command list not valid."); } } -#endif() +#endif return AZStd::move(m_workRequest); } diff --git a/Gems/Metastream/Code/CMakeLists.txt b/Gems/Metastream/Code/CMakeLists.txt index 47b6f6f9c5..326c21c5a9 100644 --- a/Gems/Metastream/Code/CMakeLists.txt +++ b/Gems/Metastream/Code/CMakeLists.txt @@ -36,6 +36,7 @@ ly_add_target( metastream_shared_files.cmake ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake PLATFORM_INCLUDE_FILES + ${pal_source_dir}/metastream_${PAL_PLATFORM_NAME_LOWERCASE}.cmake ${common_source_dir}/${PAL_TRAIT_COMPILER_ID}/metastream_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PRIVATE @@ -62,6 +63,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) metastream_shared_files.cmake ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake PLATFORM_INCLUDE_FILES + ${pal_source_dir}/metastream_${PAL_PLATFORM_NAME_LOWERCASE}.cmake ${common_source_dir}/${PAL_TRAIT_COMPILER_ID}/metastream_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PRIVATE diff --git a/Gems/Metastream/Code/Source/Platform/Android/metastream_android.cmake b/Gems/Metastream/Code/Source/Platform/Android/metastream_android.cmake new file mode 100644 index 0000000000..4d5680a30d --- /dev/null +++ b/Gems/Metastream/Code/Source/Platform/Android/metastream_android.cmake @@ -0,0 +1,10 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# diff --git a/Gems/Metastream/Code/Source/Platform/Common/MSVC/metastream_msvc.cmake b/Gems/Metastream/Code/Source/Platform/Common/MSVC/metastream_msvc.cmake index 2a42a01b08..5cebdbd198 100644 --- a/Gems/Metastream/Code/Source/Platform/Common/MSVC/metastream_msvc.cmake +++ b/Gems/Metastream/Code/Source/Platform/Common/MSVC/metastream_msvc.cmake @@ -11,7 +11,3 @@ # CivetHttpServer.cpp uses a try catch block set(LY_COMPILE_OPTIONS PRIVATE /EHsc) -set(LY_BUILD_DEPENDENCIES - PRIVATE - 3rdParty::civetweb -) \ No newline at end of file diff --git a/Gems/Metastream/Code/Source/Platform/Linux/metastream_linux.cmake b/Gems/Metastream/Code/Source/Platform/Linux/metastream_linux.cmake new file mode 100644 index 0000000000..4d5680a30d --- /dev/null +++ b/Gems/Metastream/Code/Source/Platform/Linux/metastream_linux.cmake @@ -0,0 +1,10 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# diff --git a/Gems/Metastream/Code/Source/Platform/Mac/metastream_mac.cmake b/Gems/Metastream/Code/Source/Platform/Mac/metastream_mac.cmake new file mode 100644 index 0000000000..4d5680a30d --- /dev/null +++ b/Gems/Metastream/Code/Source/Platform/Mac/metastream_mac.cmake @@ -0,0 +1,10 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# diff --git a/Gems/Metastream/Code/Source/Platform/Windows/metastream_windows.cmake b/Gems/Metastream/Code/Source/Platform/Windows/metastream_windows.cmake new file mode 100644 index 0000000000..3705f7d6fc --- /dev/null +++ b/Gems/Metastream/Code/Source/Platform/Windows/metastream_windows.cmake @@ -0,0 +1,15 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# + +set(LY_BUILD_DEPENDENCIES + PRIVATE + 3rdParty::civetweb +) diff --git a/Gems/Metastream/Code/Source/Platform/iOS/metastream_ios.cmake b/Gems/Metastream/Code/Source/Platform/iOS/metastream_ios.cmake new file mode 100644 index 0000000000..4d5680a30d --- /dev/null +++ b/Gems/Metastream/Code/Source/Platform/iOS/metastream_ios.cmake @@ -0,0 +1,10 @@ +# +# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +# its licensors. +# +# For complete copyright and license terms please see the LICENSE at the root of this +# distribution (the "License"). All use of this software is governed by the License, +# or, if provided, by the license below or the license accompanying this file. Do not +# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#