From 80bdd4e17b615c910b488ab75c441985c85262dd Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Wed, 7 Jul 2021 14:34:45 -0700 Subject: [PATCH] Clang compile fixes (#1876) * Fix compile error from -Wwritable-strings Signed-off-by: Chris Burel * Fix flags used to build MaskedOcclusionCulling with clang Signed-off-by: Chris Burel * Fix class that has a final destructor, but the class itself was not final Signed-off-by: Chris Burel --- .../IO/Streamer/StorageDriveTests_Windows.cpp | 2 +- Gems/Atom/RPI/Code/CMakeLists.txt | 2 ++ .../Common/Clang/atom_rpi_public_clang.cmake | 18 ++++++++++++++++++ .../Common/MSVC/atom_rpi_public_msvc.cmake | 19 +++++++++++++++++++ .../Source/Platform/Windows/PAL_windows.cmake | 13 ------------- .../SceneAPIExt/Rules/MotionMetaDataRule.h | 4 ++-- 6 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 Gems/Atom/RPI/Code/Source/Platform/Common/Clang/atom_rpi_public_clang.cmake create mode 100644 Gems/Atom/RPI/Code/Source/Platform/Common/MSVC/atom_rpi_public_msvc.cmake diff --git a/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp b/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp index e654ef4aa3..b505bba5dd 100644 --- a/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp +++ b/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp @@ -1155,7 +1155,7 @@ namespace Benchmark class StorageDriveWindowsFixture : public benchmark::Fixture { public: - constexpr static char* TestFileName = "StreamerBenchmark.bin"; + constexpr static const char* TestFileName = "StreamerBenchmark.bin"; constexpr static size_t FileSize = 64_mib; void SetupStreamer(bool enableFileSharing) diff --git a/Gems/Atom/RPI/Code/CMakeLists.txt b/Gems/Atom/RPI/Code/CMakeLists.txt index 71e5d82e48..d806b8c687 100644 --- a/Gems/Atom/RPI/Code/CMakeLists.txt +++ b/Gems/Atom/RPI/Code/CMakeLists.txt @@ -25,6 +25,8 @@ ly_add_target( ../Assets/atom_rpi_asset_files.cmake ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake ${MASKED_OCCLUSION_CULLING_FILES} + PLATFORM_INCLUDE_FILES + ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/Common/${PAL_TRAIT_COMPILER_ID}/atom_rpi_public_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PRIVATE Source diff --git a/Gems/Atom/RPI/Code/Source/Platform/Common/Clang/atom_rpi_public_clang.cmake b/Gems/Atom/RPI/Code/Source/Platform/Common/Clang/atom_rpi_public_clang.cmake new file mode 100644 index 0000000000..88309e590c --- /dev/null +++ b/Gems/Atom/RPI/Code/Source/Platform/Common/Clang/atom_rpi_public_clang.cmake @@ -0,0 +1,18 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_add_source_properties( + SOURCES External/MaskedOcclusionCulling/MaskedOcclusionCullingAVX2.cpp + PROPERTY COMPILE_OPTIONS + VALUES -mavx2 -mfma -msse4.1 +) + +ly_add_source_properties( + SOURCES External/MaskedOcclusionCulling/MaskedOcclusionCulling.cpp + PROPERTY COMPILE_OPTIONS + VALUES -mno-avx +) diff --git a/Gems/Atom/RPI/Code/Source/Platform/Common/MSVC/atom_rpi_public_msvc.cmake b/Gems/Atom/RPI/Code/Source/Platform/Common/MSVC/atom_rpi_public_msvc.cmake new file mode 100644 index 0000000000..50cfc8a179 --- /dev/null +++ b/Gems/Atom/RPI/Code/Source/Platform/Common/MSVC/atom_rpi_public_msvc.cmake @@ -0,0 +1,19 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_add_source_properties( + SOURCES External/MaskedOcclusionCulling/MaskedOcclusionCullingAVX2.cpp + PROPERTY COMPILE_OPTIONS + VALUES /arch:AVX2 /W3 +) +ly_add_source_properties( + SOURCES + External/MaskedOcclusionCulling/MaskedOcclusionCullingAVX512.cpp + External/MaskedOcclusionCulling/MaskedOcclusionCulling.cpp + PROPERTY COMPILE_OPTIONS + VALUES /W3 +) diff --git a/Gems/Atom/RPI/Code/Source/Platform/Windows/PAL_windows.cmake b/Gems/Atom/RPI/Code/Source/Platform/Windows/PAL_windows.cmake index 896f505d05..a9e3cf10f9 100644 --- a/Gems/Atom/RPI/Code/Source/Platform/Windows/PAL_windows.cmake +++ b/Gems/Atom/RPI/Code/Source/Platform/Windows/PAL_windows.cmake @@ -7,16 +7,3 @@ set (PAL_TRAIT_BUILD_ATOM_RPI_ASSETS_SUPPORTED TRUE) set (PAL_TRAIT_BUILD_ATOM_RPI_MASKED_OCCLUSION_CULLING_SUPPORTED TRUE) - -ly_add_source_properties( - SOURCES External/MaskedOcclusionCulling/MaskedOcclusionCullingAVX2.cpp - PROPERTY COMPILE_OPTIONS - VALUES /arch:AVX2 /W3 -) -ly_add_source_properties( - SOURCES - External/MaskedOcclusionCulling/MaskedOcclusionCullingAVX512.cpp - External/MaskedOcclusionCulling/MaskedOcclusionCulling.cpp - PROPERTY COMPILE_OPTIONS - VALUES /W3 -) \ No newline at end of file diff --git a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionMetaDataRule.h b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionMetaDataRule.h index 873dccef72..e2f530a887 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionMetaDataRule.h +++ b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionMetaDataRule.h @@ -37,7 +37,7 @@ namespace EMotionFX::Pipeline::Rule AZStd::unique_ptr m_motionEventTable; }; - class MotionMetaDataRule + class MotionMetaDataRule final : public ExternalToolRule> { public: @@ -46,7 +46,7 @@ namespace EMotionFX::Pipeline::Rule MotionMetaDataRule(); MotionMetaDataRule(const AZStd::shared_ptr& data); - ~MotionMetaDataRule() final = default; + ~MotionMetaDataRule() = default; const AZStd::shared_ptr& GetData() const override { return m_data; } void SetData(const AZStd::shared_ptr& data) override { m_data = data; }