Merge branch 'development' into cmake/warn_virtual

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Framework/AzCore/AzCore/Memory/HeapSchema.h
#	Code/Framework/AzCore/AzCore/Memory/HphaSchema.h
#	Code/Framework/AzCore/AzCore/Memory/MallocSchema.h
#	Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.h
This commit is contained in:
Esteban Papp
2021-09-14 15:32:35 -07:00
70 changed files with 565 additions and 225 deletions
+8 -2
View File
@@ -20,6 +20,7 @@
// AzCore
#include <AzCore/Casting/numeric_cast.h> // for aznumeric_cast
#include <AzQtComponents/Utilities/PixmapScaleUtilities.h>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_AboutDialog.h>
@@ -46,8 +47,13 @@ CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice,
CAboutDialog > QLabel#link { text-decoration: underline; color: #94D2FF; }");
// Prepare background image
QImage backgroundImage(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
m_backgroundImage = QPixmap::fromImage(backgroundImage.scaled(m_enforcedWidth, m_enforcedHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
m_backgroundImage = AzQtComponents::ScalePixmapForScreenDpi(
QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg")),
screen(),
QSize(m_enforcedWidth, m_enforcedHeight),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation
);
// Draw the Open 3D Engine logo from svg
m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/o3de_logo.svg"));
+9 -8
View File
@@ -9,11 +9,11 @@
// Description : implementation file
#include "EditorDefs.h"
#include "StartupLogoDialog.h"
#include <AzQtComponents/Utilities/PixmapScaleUtilities.h>
// Qt
#include <QPainter>
#include <QThread>
@@ -22,8 +22,6 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_StartupLogoDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
/////////////////////////////////////////////////////////////////////////////
// CStartupLogoDialog dialog
@@ -36,13 +34,16 @@ CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopy
m_ui->setupUi(this);
s_pLogoWindow = this;
m_backgroundImage = QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
setFixedSize(QSize(600, 300));
// Prepare background image
QImage backgroundImage(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg"));
m_backgroundImage = QPixmap::fromImage(backgroundImage.scaled(m_enforcedWidth, m_enforcedHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
m_backgroundImage = AzQtComponents::ScalePixmapForScreenDpi(
QPixmap(QStringLiteral(":/StartupLogoDialog/splashscreen_background_developer_preview.jpg")),
screen(),
QSize(m_enforcedWidth, m_enforcedHeight),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation
);
// Draw the Open 3D Engine logo from svg
m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/o3de_logo.svg"));
@@ -34,6 +34,7 @@
// AzQtComponents
#include <AzQtComponents/Components/Widgets/CheckBox.h>
#include <AzQtComponents/Components/WindowDecorationWrapper.h>
#include <AzQtComponents/Utilities/PixmapScaleUtilities.h>
// Editor
#include "Settings.h"
@@ -79,8 +80,11 @@ WelcomeScreenDialog::WelcomeScreenDialog(QWidget* pParent)
{
projectPreviewPath = ":/WelcomeScreenDialog/DefaultProjectImage.png";
}
ui->activeProjectIcon->setPixmap(
QPixmap(projectPreviewPath).scaled(
AzQtComponents::ScalePixmapForScreenDpi(
QPixmap(projectPreviewPath),
screen(),
ui->activeProjectIcon->size(),
Qt::KeepAspectRatioByExpanding,
Qt::SmoothTransformation
@@ -96,7 +96,7 @@ namespace AZ
const char* get_name() const { return m_name; }
void set_name(const char* name) { m_name = name; }
size_type get_max_size() const { return AZ_CORE_MAX_ALLOCATOR_SIZE; }
constexpr size_type max_size() const { return AZ_CORE_MAX_ALLOCATOR_SIZE; }
size_type get_allocated_size() const { return 0; }
bool is_lock_free() { return false; }
@@ -216,6 +216,11 @@ namespace AZ
return m_source->GetMaxAllocationSize();
}
auto AllocatorOverrideShim::GetMaxContiguousAllocationSize() const -> size_type
{
return m_source->GetMaxContiguousAllocationSize();
}
IAllocatorAllocate* AllocatorOverrideShim::GetSubAllocator()
{
return m_source->GetSubAllocator();
@@ -52,6 +52,7 @@ namespace AZ
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
size_type GetMaxAllocationSize() const override;
size_type GetMaxContiguousAllocationSize() const override;
IAllocatorAllocate* GetSubAllocator() override;
private:
@@ -188,6 +188,11 @@ BestFitExternalMapAllocator::GetMaxAllocationSize() const
return m_schema->GetMaxAllocationSize();
}
auto BestFitExternalMapAllocator::GetMaxContiguousAllocationSize() const -> size_type
{
return m_schema->GetMaxContiguousAllocationSize();
}
//=========================================================================
// GetSubAllocator
// [1/28/2011]
@@ -63,6 +63,7 @@ namespace AZ
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
size_type GetMaxAllocationSize() const override;
size_type GetMaxContiguousAllocationSize() const override;
IAllocatorAllocate* GetSubAllocator() override;
//////////////////////////////////////////////////////////////////////////
@@ -136,6 +136,12 @@ BestFitExternalMapSchema::GetMaxAllocationSize() const
return 0;
}
auto BestFitExternalMapSchema::GetMaxContiguousAllocationSize() const -> size_type
{
// Return the maximum size of any single allocation
return AZ_CORE_MAX_ALLOCATOR_SIZE;
}
//=========================================================================
// GarbageCollect
// [1/28/2011]
@@ -57,6 +57,7 @@ namespace AZ
AZ_FORCE_INLINE size_type NumAllocatedBytes() const { return m_used; }
AZ_FORCE_INLINE size_type Capacity() const { return m_desc.m_memoryBlockByteSize; }
size_type GetMaxAllocationSize() const;
size_type GetMaxContiguousAllocationSize() const;
AZ_FORCE_INLINE IAllocatorAllocate* GetSubAllocator() const { return m_desc.m_mapAllocator; }
/**
@@ -244,6 +244,11 @@ namespace AZ
return maxChunk;
}
auto HeapSchema::GetMaxContiguousAllocationSize() const -> size_type
{
return MAX_REQUEST;
}
AZ_FORCE_INLINE HeapSchema::size_type
HeapSchema::ChunckSize(pointer_type ptr)
{
@@ -57,6 +57,7 @@ namespace AZ
size_type NumAllocatedBytes() const override { return m_used; }
size_type Capacity() const override { return m_capacity; }
size_type GetMaxAllocationSize() const override;
size_type GetMaxContiguousAllocationSize() const override;
IAllocatorAllocate* GetSubAllocator() override { return m_subAllocator; }
void GarbageCollect() override {}
@@ -1069,6 +1069,7 @@ namespace AZ {
/// returns allocation size for the pointer if it belongs to the allocator. result is undefined if the pointer doesn't belong to the allocator.
size_t AllocationSize(void* ptr);
size_t GetMaxAllocationSize() const;
size_t GetMaxContiguousAllocationSize() const;
size_t GetUnAllocatedMemory(bool isPrint) const;
void* SystemAlloc(size_t size, size_t align);
@@ -2301,6 +2302,11 @@ namespace AZ {
return maxSize;
}
size_t HpAllocator::GetMaxContiguousAllocationSize() const
{
return AZ_CORE_MAX_ALLOCATOR_SIZE;
}
//=========================================================================
// GetUnAllocatedMemory
// [9/30/2013]
@@ -2677,6 +2683,11 @@ namespace AZ {
return m_allocator->GetMaxAllocationSize();
}
auto HphaSchema::GetMaxContiguousAllocationSize() const -> size_type
{
return m_allocator->GetMaxContiguousAllocationSize();
}
//=========================================================================
// GetUnAllocatedMemory
// [9/30/2013]
@@ -66,6 +66,7 @@ namespace AZ
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
size_type GetMaxAllocationSize() const override;
size_type GetMaxContiguousAllocationSize() const override;
size_type GetUnAllocatedMemory(bool isPrint = false) const override;
IAllocatorAllocate* GetSubAllocator() override { return m_desc.m_subAllocator; }
@@ -62,6 +62,8 @@ namespace AZ
virtual size_type Capacity() const = 0;
/// Returns max allocation size if possible. If not returned value is 0
virtual size_type GetMaxAllocationSize() const { return 0; }
/// Returns the maximum contiguous allocation size of a single allocation
virtual size_type GetMaxContiguousAllocationSize() const { return 0; }
/**
* Returns memory allocated by the allocator and available to the user for allocations.
* IMPORTANT: this is not the overhead memory this is just the memory that is allocated, but not used. Example: the pool allocators
@@ -144,6 +144,11 @@ AZ::MallocSchema::size_type AZ::MallocSchema::GetMaxAllocationSize() const
return 0xFFFFFFFFull;
}
AZ::MallocSchema::size_type AZ::MallocSchema::GetMaxContiguousAllocationSize() const
{
return AZ_CORE_MAX_ALLOCATOR_SIZE;
}
AZ::IAllocatorAllocate* AZ::MallocSchema::GetSubAllocator()
{
return nullptr;
@@ -50,6 +50,7 @@ namespace AZ
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
size_type GetMaxAllocationSize() const override;
size_type GetMaxContiguousAllocationSize() const override;
IAllocatorAllocate* GetSubAllocator() override;
void GarbageCollect() override;
+8 -3
View File
@@ -839,6 +839,11 @@ namespace AZ
return AZ::AllocatorInstance<Parent>::Get().GetMaxAllocationSize();
}
size_type GetMaxContiguousAllocationSize() const override
{
return AZ::AllocatorInstance<Parent>::Get().GetMaxContiguousAllocationSize();
}
size_type GetUnAllocatedMemory(bool isPrint = false) const override
{
return AZ::AllocatorInstance<Parent>::Get().GetUnAllocatedMemory(isPrint);
@@ -896,7 +901,7 @@ namespace AZ
}
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
size_type get_max_size() const { return AllocatorInstance<Allocator>::Get().GetMaxAllocationSize(); }
size_type max_size() const { return AllocatorInstance<Allocator>::Get().GetMaxContiguousAllocationSize(); }
size_type get_allocated_size() const { return AllocatorInstance<Allocator>::Get().NumAllocatedBytes(); }
AZ_FORCE_INLINE bool is_lock_free() { return AllocatorInstance<Allocator>::Get().is_lock_free(); }
@@ -954,7 +959,7 @@ namespace AZ
}
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
size_type get_max_size() const { return m_allocator->GetMaxAllocationSize(); }
size_type max_size() const { return m_allocator->GetMaxContiguousAllocationSize(); }
size_type get_allocated_size() const { return m_allocator->NumAllocatedBytes(); }
AZ_FORCE_INLINE bool operator==(const AZStdIAllocator& rhs) const { return m_allocator == rhs.m_allocator; }
@@ -1006,7 +1011,7 @@ namespace AZ
}
constexpr const char* get_name() const { return m_name; }
void set_name(const char* name) { m_name = name; }
size_type get_max_size() const { return m_allocatorFunctor().GetMaxAllocationSize(); }
size_type max_size() const { return m_allocatorFunctor().GetMaxContiguousAllocationSize(); }
size_type get_allocated_size() const { return m_allocatorFunctor().NumAllocatedBytes(); }
constexpr bool operator==(const AZStdFunctorAllocator& rhs) const { return m_allocatorFunctor == rhs.m_allocatorFunctor; }
@@ -61,6 +61,7 @@ namespace AZ
size_type NumAllocatedBytes() const override { return m_custom ? m_custom->NumAllocatedBytes() : m_numAllocatedBytes; }
size_type Capacity() const override { return m_custom ? m_custom->Capacity() : AZ_CORE_MAX_ALLOCATOR_SIZE; } // custom size or unlimited
size_type GetMaxAllocationSize() const override { return m_custom ? m_custom->GetMaxAllocationSize() : AZ_CORE_MAX_ALLOCATOR_SIZE; } // custom size or unlimited
size_type GetMaxContiguousAllocationSize() const override { return m_custom ? m_custom->GetMaxContiguousAllocationSize() : AZ_CORE_MAX_ALLOCATOR_SIZE; } // custom size or unlimited
IAllocatorAllocate* GetSubAllocator() override { return m_custom ? m_custom : NULL; }
protected:
@@ -232,6 +232,7 @@ namespace AZ
size_type NumAllocatedBytes() const;
size_type Capacity() const;
size_type GetMaxAllocationSize() const;
size_type GetMaxContiguousAllocationSize() const;
IAllocatorAllocate* GetSubAllocator();
void GarbageCollect();
@@ -674,6 +675,11 @@ AZ::OverrunDetectionSchema::size_type AZ::OverrunDetectionSchemaImpl::GetMaxAllo
return 0;
}
auto AZ::OverrunDetectionSchemaImpl::GetMaxContiguousAllocationSize() const -> size_type
{
return 0;
}
AZ::IAllocatorAllocate* AZ::OverrunDetectionSchemaImpl::GetSubAllocator()
{
return nullptr;
@@ -799,6 +805,11 @@ AZ::OverrunDetectionSchema::size_type AZ::OverrunDetectionSchema::GetMaxAllocati
return m_impl->GetMaxAllocationSize();
}
auto AZ::OverrunDetectionSchema::GetMaxContiguousAllocationSize() const -> size_type
{
return m_impl->GetMaxContiguousAllocationSize();
}
AZ::IAllocatorAllocate* AZ::OverrunDetectionSchema::GetSubAllocator()
{
return m_impl->GetSubAllocator();
@@ -86,6 +86,7 @@ namespace AZ
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
size_type GetMaxAllocationSize() const override;
size_type GetMaxContiguousAllocationSize() const override;
IAllocatorAllocate* GetSubAllocator() override;
void GarbageCollect() override;
@@ -707,6 +707,11 @@ PoolSchema::GarbageCollect()
//m_impl->GarbageCollect();
}
auto PoolSchema::GetMaxContiguousAllocationSize() const -> size_type
{
return m_impl->m_allocator.m_maxAllocationSize;
}
//=========================================================================
// NumAllocatedBytes
// [11/1/2010]
@@ -1052,6 +1057,11 @@ ThreadPoolSchema::GarbageCollect()
m_impl->GarbageCollect();
}
auto ThreadPoolSchema::GetMaxContiguousAllocationSize() const -> size_type
{
return m_impl->m_maxAllocationSize;
}
//=========================================================================
// NumAllocatedBytes
// [11/1/2010]
@@ -70,6 +70,7 @@ namespace AZ
/// Return unused memory to the OS. Don't call this too often because you will force unnecessary allocations.
void GarbageCollect() override;
size_type GetMaxContiguousAllocationSize() const override;
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
IAllocatorAllocate* GetSubAllocator() override;
@@ -115,6 +116,7 @@ namespace AZ
/// Return unused memory to the OS. Don't call this too often because you will force unnecessary allocations.
void GarbageCollect() override;
size_type GetMaxContiguousAllocationSize() const override;
size_type NumAllocatedBytes() const override;
size_type Capacity() const override;
IAllocatorAllocate* GetSubAllocator() override;
@@ -179,6 +179,11 @@ namespace AZ
return m_schema->GetMaxAllocationSize();
}
size_type GetMaxContiguousAllocationSize() const override
{
return m_schema->GetMaxContiguousAllocationSize();
}
size_type GetUnAllocatedMemory(bool isPrint = false) const override
{
return m_schema->GetUnAllocatedMemory(isPrint);
@@ -103,6 +103,7 @@ namespace AZ
size_type Capacity() const override { return m_allocator->Capacity(); }
/// Keep in mind this operation will execute GarbageCollect to make sure it returns, max allocation. This function WILL be slow.
size_type GetMaxAllocationSize() const override { return m_allocator->GetMaxAllocationSize(); }
size_type GetMaxContiguousAllocationSize() const override { return m_allocator->GetMaxContiguousAllocationSize(); }
size_type GetUnAllocatedMemory(bool isPrint = false) const override { return m_allocator->GetUnAllocatedMemory(isPrint); }
IAllocatorAllocate* GetSubAllocator() override { return m_isCustom ? m_allocator : m_allocator->GetSubAllocator(); }
@@ -61,7 +61,7 @@ namespace AZ
const char* get_name() const { return m_name; }
void set_name(const char* name) { m_name = name; }
size_type get_max_size() const { return AZ_CORE_MAX_ALLOCATOR_SIZE; }
constexpr size_type max_size() const { return AZ_CORE_MAX_ALLOCATOR_SIZE; }
size_type get_allocated_size() const { return 0; }
bool is_lock_free() { return false; }
@@ -2306,7 +2306,7 @@ LUA_API const Node* lua_getDummyNode()
else // even references are stored by value as we need to convert from lua native type, i.e. there is not real reference for NativeTypes (numbers, strings, etc.)
{
bool usedBackupAlloc = false;
if (backupAllocator != nullptr && sizeof(T) > tempAllocator.get_max_size())
if (backupAllocator != nullptr && sizeof(T) > AZStd::allocator_traits<decltype(tempAllocator)>::max_size(tempAllocator))
{
value.m_value = backupAllocator->allocate(sizeof(T), AZStd::alignment_of<T>::value, 0);
usedBackupAlloc = true;
@@ -2340,7 +2340,7 @@ LUA_API const Node* lua_getDummyNode()
else // it's a value type
{
bool usedBackupAlloc = false;
if (backupAllocator != nullptr && valueClass->m_size > tempAllocator.get_max_size())
if (backupAllocator != nullptr && valueClass->m_size > AZStd::allocator_traits<decltype(tempAllocator)>::max_size(tempAllocator))
{
value.m_value = backupAllocator->allocate(valueClass->m_size, valueClass->m_alignment, 0);
usedBackupAlloc = true;
@@ -45,7 +45,7 @@ namespace UnitTest
virtual ~AllocatorsBase() = default;
void SetupAllocator()
void SetupAllocator(const AZ::SystemAllocator::Descriptor& allocatorDesc = {})
{
m_drillerManager = AZ::Debug::DrillerManager::Create();
m_drillerManager->Register(aznew AZ::Debug::MemoryDriller);
@@ -54,7 +54,7 @@ namespace UnitTest
// Only create the SystemAllocator if it s not ready
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
{
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
AZ::AllocatorInstance<AZ::SystemAllocator>::Create(allocatorDesc);
m_ownsAllocator = true;
}
}
@@ -85,6 +85,7 @@ namespace UnitTest
{
public:
ScopedAllocatorSetupFixture() { SetupAllocator(); }
explicit ScopedAllocatorSetupFixture(const AZ::SystemAllocator::Descriptor& allocatorDesc) { SetupAllocator(allocatorDesc); }
~ScopedAllocatorSetupFixture() { TeardownAllocator(); }
};
@@ -40,15 +40,11 @@ namespace AZStd
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().Resize(ptr, newSize);
}
//=========================================================================
// get_max_size
// [1/1/2008]
//=========================================================================
allocator::size_type
allocator::get_max_size() const
auto allocator::max_size() const -> size_type
{
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().GetMaxAllocationSize();
return AZ::AllocatorInstance<AZ::SystemAllocator>::Get().GetMaxContiguousAllocationSize();
}
//=========================================================================
// get_allocated_size
// [1/1/2008]
+5 -4
View File
@@ -49,8 +49,8 @@ namespace AZStd
* const char* get_name() const;
* void set_name(const char* name);
*
* // Returns maximum size we can allocate from this allocator.
* size_type get_max_size() const;
* // Returns theoretical maximum size of a single contiguous allocation from this allocator.
* size_type max_size() const;
* <optional> size_type get_allocated_size() const;
* };
*
@@ -100,7 +100,8 @@ namespace AZStd
pointer_type allocate(size_type byteSize, size_type alignment, int flags = 0);
void deallocate(pointer_type ptr, size_type byteSize, size_type alignment);
size_type resize(pointer_type ptr, size_type newSize);
size_type get_max_size() const;
// max_size actually returns the true maximum size of a single allocation
size_type max_size() const;
size_type get_allocated_size() const;
AZ_FORCE_INLINE bool is_lock_free() { return false; }
@@ -157,7 +158,7 @@ namespace AZStd
AZ_FORCE_INLINE const char* get_name() const;
AZ_FORCE_INLINE void set_name(const char* name);
AZ_FORCE_INLINE size_type get_max_size() const;
AZ_FORCE_INLINE size_type max_size() const;
AZ_FORCE_INLINE bool is_lock_free();
AZ_FORCE_INLINE bool is_stale_read_allowed();
@@ -41,7 +41,7 @@ namespace AZStd
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
AZ_FORCE_INLINE size_type get_max_size() const { return m_allocator->get_max_size(); }
constexpr size_type max_size() const { return m_allocator->max_size(); }
AZ_FORCE_INLINE size_type get_allocated_size() const { return m_allocator->get_allocated_size(); }
@@ -59,7 +59,7 @@ namespace AZStd
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
AZ_FORCE_INLINE size_type get_max_size() const { return m_size - (m_freeData - m_data); }
constexpr size_type max_size() const { return m_size; }
AZ_FORCE_INLINE size_type get_allocated_size() const { return m_freeData - m_data; }
pointer_type allocate(size_type byteSize, size_type alignment, int flags = 0)
@@ -63,7 +63,7 @@ namespace AZStd
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
AZ_FORCE_INLINE size_type get_max_size() const { return Size - (m_freeData - reinterpret_cast<const char*>(&m_data)); }
constexpr size_type max_size() const { return Size; }
AZ_FORCE_INLINE size_type get_allocated_size() const { return m_freeData - reinterpret_cast<const char*>(&m_data); }
pointer_type allocate(size_type byteSize, size_type alignment, int flags = 0)
@@ -190,7 +190,7 @@ namespace AZStd
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
AZ_FORCE_INLINE size_type get_max_size() const { return (NumNodes - m_numOfAllocatedNodes) * sizeof(Node); }
constexpr size_type max_size() const { return NumNodes * sizeof(Node); }
AZ_FORCE_INLINE size_type get_allocated_size() const { return m_numOfAllocatedNodes * sizeof(Node); }
inline Node* allocate()
@@ -6,11 +6,10 @@
*
*/
#pragma once
#ifndef AZSTD_DEQUE_H
#define AZSTD_DEQUE_H 1
#include <AzCore/std/allocator.h>
#include <AzCore/std/allocator_traits.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/createdestroy.h>
#include <AzCore/std/typetraits/aligned_storage.h>
@@ -350,7 +349,7 @@ namespace AZStd
}
AZ_FORCE_INLINE size_type size() const { return m_size; }
AZ_FORCE_INLINE size_type max_size() const { return m_allocator.get_max_size() / sizeof(block_node_type); }
AZ_FORCE_INLINE size_type max_size() const { return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(block_node_type); }
AZ_FORCE_INLINE bool empty() const { return m_size == 0; }
AZ_FORCE_INLINE const_reference at(size_type offset) const { return *const_iterator(AZSTD_CHECKED_ITERATOR_2(const_iterator_impl, m_firstOffset + offset, this)); }
@@ -1243,5 +1242,3 @@ namespace AZStd
return removedCount;
}
}
#endif // AZSTD_DEQUE_H
@@ -286,7 +286,7 @@ namespace AZStd
}
AZ_FORCE_INLINE size_type size() const { return m_numElements; }
AZ_FORCE_INLINE size_type max_size() const { return m_allocator.max_size() / sizeof(node_type); }
AZ_FORCE_INLINE size_type max_size() const { return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(node_type); }
AZ_FORCE_INLINE bool empty() const { return (m_numElements == 0); }
AZ_FORCE_INLINE iterator begin() { return iterator(AZSTD_CHECKED_ITERATOR(iterator_impl, m_head.m_next)); }
@@ -5,11 +5,11 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef AZSTD_LIST_H
#define AZSTD_LIST_H 1
#pragma once
#include <AzCore/std/allocator.h>
#include <AzCore/std/allocator_traits.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/createdestroy.h>
#include <AzCore/std/typetraits/alignment_of.h>
@@ -316,7 +316,7 @@ namespace AZStd
}
AZ_FORCE_INLINE size_type size() const { return m_numElements; }
AZ_FORCE_INLINE size_type max_size() const { return m_allocator.max_size() / sizeof(node_type); }
AZ_FORCE_INLINE size_type max_size() const { return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(node_type); }
AZ_FORCE_INLINE bool empty() const { return (m_numElements == 0); }
AZ_FORCE_INLINE iterator begin() { return iterator(AZSTD_CHECKED_ITERATOR(iterator_impl, m_head.m_next)); }
@@ -1346,5 +1346,3 @@ namespace AZStd
return container.remove_if(predicate);
}
}
#endif // AZSTD_LIST_H
@@ -484,7 +484,7 @@ namespace AZStd
AZ_FORCE_INLINE bool empty() const { return m_numElements == 0; }
AZ_FORCE_INLINE size_type size() const { return m_numElements; }
AZ_FORCE_INLINE size_type max_size() const { return m_allocator.max_size() / sizeof(node_type); }
AZ_FORCE_INLINE size_type max_size() const { return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(node_type); }
rbtree(this_type&& rhs)
: m_numElements(0) // it will be set during swap
@@ -5,10 +5,11 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef AZSTD_RINGBUFFER_H
#define AZSTD_RINGBUFFER_H 1
#pragma once
#include <AzCore/std/allocator.h>
#include <AzCore/std/allocator_traits.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/createdestroy.h>
#include <AzCore/std/utils.h>
@@ -416,7 +417,7 @@ namespace AZStd
}
AZ_FORCE_INLINE size_type size() const { return m_size; }
AZ_FORCE_INLINE size_type max_size() const { return m_allocator.max_size() / sizeof(node_type); }
AZ_FORCE_INLINE size_type max_size() const { return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(node_type); }
AZ_FORCE_INLINE bool empty() const { return m_size == 0; }
AZ_FORCE_INLINE bool full() const { return size_type(m_end - m_buff) == m_size; }
AZ_FORCE_INLINE size_type free() const { return size_type(m_end - m_buff) - m_size; }
@@ -1240,6 +1241,3 @@ namespace AZStd
lhs.swap(rhs);
}
}
#endif // AZSTD_RINGBUFFER_H
#pragma once
@@ -9,6 +9,7 @@
#include <AzCore/std/allocator.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/allocator_traits.h>
#include <AzCore/std/createdestroy.h>
#include <AzCore/std/typetraits/alignment_of.h>
#include <AzCore/std/typetraits/is_integral.h>
@@ -431,7 +432,7 @@ namespace AZStd
}
AZ_FORCE_INLINE size_type size() const { return m_last - m_start; }
AZ_FORCE_INLINE size_type max_size() const { return m_allocator.get_max_size() / sizeof(node_type); }
AZ_FORCE_INLINE size_type max_size() const { return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(node_type); }
AZ_FORCE_INLINE bool empty() const { return m_start == m_last; }
void reserve(size_type numElements)
@@ -22,7 +22,7 @@ namespace AZStd
* Internally the buffer is allocated using aligned_storage.
* \note only allocate/deallocate are thread safe.
* reset, leak_before_destroy and comparison operators are not thread safe.
* get_max_size and get_allocated_size are thread safe but the returned value is not perfectly in
* get_allocated_size is thread safe but the returned value is not perfectly in
* sync on the actual number of allocations (the number of allocations is incremented before the
* allocation happens and decremented after the allocation happens, trying to give a conservative
* number)
@@ -71,7 +71,7 @@ namespace AZStd
AZ_FORCE_INLINE const char* get_name() const { return m_name; }
AZ_FORCE_INLINE void set_name(const char* name) { m_name = name; }
AZ_FORCE_INLINE size_type get_max_size() const { return (NumNodes - m_numOfAllocatedNodes.load(AZStd::memory_order_relaxed)) * sizeof(Node); }
constexpr size_type max_size() const { return NumNodes * sizeof(Node); }
AZ_FORCE_INLINE size_type get_allocated_size() const { return m_numOfAllocatedNodes.load(AZStd::memory_order_relaxed) * sizeof(Node); }
inline Node* allocate()
@@ -16,6 +16,7 @@
#include <AzCore/std/base.h>
#include <AzCore/std/iterator.h>
#include <AzCore/std/allocator.h>
#include <AzCore/std/allocator_traits.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/typetraits/alignment_of.h>
#include <AzCore/std/typetraits/is_integral.h>
@@ -862,8 +863,7 @@ namespace AZStd
inline size_type max_size() const
{
// return maximum possible length of sequence
size_type num = m_allocator.get_max_size();
return (num <= 1 ? 1 : num - 1);
return AZStd::allocator_traits<allocator_type>::max_size(m_allocator) / sizeof(value_type);
}
inline void resize(size_type newSize)
@@ -122,8 +122,15 @@ namespace UnitTest
TEST_F(AllocatorDefaultTest, AllocatorTraitsMaxSizeCompilesWithoutErrors)
{
using AZStdAllocatorTraits = AZStd::allocator_traits<AZStd::allocator>;
AZStd::allocator testAllocator("trait allocator");
struct AllocatorWithGetMaxSize
: AZStd::allocator
{
using AZStd::allocator::allocator;
size_t get_max_size() { return max_size(); }
};
using AZStdAllocatorTraits = AZStd::allocator_traits<AllocatorWithGetMaxSize>;
AllocatorWithGetMaxSize testAllocator("trait allocator");
typename AZStdAllocatorTraits::size_type maxSize = AZStdAllocatorTraits::max_size(testAllocator);
EXPECT_EQ(testAllocator.get_max_size(), maxSize);
}
@@ -149,32 +156,32 @@ namespace UnitTest
myalloc.set_name(newName);
AZ_TEST_ASSERT(strcmp(myalloc.get_name(), newName) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() == AZStd::size_t(bufferSize));
EXPECT_EQ(bufferSize, myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
buffer_alloc_type::pointer_type data = myalloc.allocate(100, 1);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100);
EXPECT_EQ(bufferSize - 100, myalloc.max_size() - myalloc.get_allocated_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100);
myalloc.deallocate(data, 100, 1); // we can free the last allocation only
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize);
EXPECT_EQ(bufferSize, myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
data = myalloc.allocate(100, 1);
myalloc.allocate(3, 1);
myalloc.deallocate(data); // can't free allocation which is not the last.
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 103);
EXPECT_EQ(bufferSize - 103, myalloc.max_size() - myalloc.get_allocated_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 103);
myalloc.reset();
AZ_TEST_ASSERT(myalloc.get_max_size() == AZStd::size_t(bufferSize));
EXPECT_EQ(bufferSize, myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
data = myalloc.allocate(50, 64);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50);
EXPECT_LE(myalloc.max_size() - myalloc.get_allocated_size(), bufferSize - 50);
AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50);
buffer_alloc_type myalloc2;
@@ -194,28 +201,28 @@ namespace UnitTest
myalloc.set_name(newName);
AZ_TEST_ASSERT(strcmp(myalloc.get_name(), newName) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() == sizeof(int) * numNodes);
EXPECT_EQ(numNodes * sizeof(int), myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
int* data = reinterpret_cast<int*>(myalloc.allocate(sizeof(int), 1));
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - 1) * sizeof(int));
EXPECT_EQ((numNodes - 1) * sizeof(int), myalloc.max_size() - myalloc.get_allocated_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == sizeof(int));
myalloc.deallocate(data, sizeof(int), 1);
AZ_TEST_ASSERT(myalloc.get_max_size() == sizeof(int) * numNodes);
EXPECT_EQ(numNodes * sizeof(int), myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
for (int i = 0; i < numNodes; ++i)
{
data = reinterpret_cast<int*>(myalloc.allocate(sizeof(int), 1));
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - (i + 1)) * sizeof(int));
EXPECT_EQ((numNodes - (i + 1)) * sizeof(int), myalloc.max_size() - myalloc.get_allocated_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == (i + 1) * sizeof(int));
}
myalloc.reset();
AZ_TEST_ASSERT(myalloc.get_max_size() == numNodes * sizeof(int));
EXPECT_EQ(numNodes * sizeof(int), myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
AZ_TEST_ASSERT(myalloc == myalloc);
@@ -233,7 +240,7 @@ namespace UnitTest
AZ_TEST_ASSERT(aligned_data != nullptr);
AZ_TEST_ASSERT(((AZStd::size_t)aligned_data & (dataAlignment - 1)) == 0);
AZ_TEST_ASSERT(myaligned_pool.get_max_size() == (numNodes - 1) * sizeof(aligned_int_type));
EXPECT_EQ((numNodes - 1) * sizeof(aligned_int_type), myaligned_pool.max_size() - myaligned_pool.get_allocated_size());
AZ_TEST_ASSERT(myaligned_pool.get_allocated_size() == sizeof(aligned_int_type));
myaligned_pool.deallocate(aligned_data, sizeof(aligned_int_type), dataAlignment); // Make sure we free what we have allocated.
@@ -268,32 +275,32 @@ namespace UnitTest
ref_allocator_type::pointer_type data1 = ref_allocator1.allocate(10, 1);
AZ_TEST_ASSERT(data1 != nullptr);
AZ_TEST_ASSERT(ref_allocator1.get_max_size() == bufferSize - 10);
EXPECT_EQ(bufferSize - 10, ref_allocator1.max_size() - ref_allocator1.get_allocated_size());
AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() == 10);
AZ_TEST_ASSERT(shared_allocator.get_max_size() == bufferSize - 10);
EXPECT_EQ(bufferSize - 10, shared_allocator.max_size() - shared_allocator.get_allocated_size());
AZ_TEST_ASSERT(shared_allocator.get_allocated_size() == 10);
ref_allocator_type::pointer_type data2 = ref_allocator2.allocate(10, 1);
AZ_TEST_ASSERT(data2 != nullptr);
AZ_TEST_ASSERT(ref_allocator2.get_max_size() <= bufferSize - 20);
EXPECT_LE(ref_allocator2.max_size() - ref_allocator2.get_allocated_size(), bufferSize - 20);
AZ_TEST_ASSERT(ref_allocator2.get_allocated_size() >= 20);
AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20);
EXPECT_LE(shared_allocator.max_size() - shared_allocator.get_allocated_size(), bufferSize - 20);
AZ_TEST_ASSERT(shared_allocator.get_allocated_size() >= 20);
shared_allocator.reset();
data1 = ref_allocator1.allocate(10, 32);
AZ_TEST_ASSERT(data1 != nullptr);
AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 10);
EXPECT_LE(ref_allocator1.max_size() - ref_allocator1.get_allocated_size(), bufferSize - 10);
AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 10);
AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 10);
EXPECT_LE(shared_allocator.max_size() - shared_allocator.get_allocated_size(), bufferSize - 10);
AZ_TEST_ASSERT(shared_allocator.get_allocated_size() >= 10);
data2 = ref_allocator2.allocate(10, 32);
AZ_TEST_ASSERT(data2 != nullptr);
AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 20);
EXPECT_LE(ref_allocator1.max_size() - ref_allocator1.get_allocated_size(), bufferSize - 20);
AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 20);
AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20);
EXPECT_LE(shared_allocator.max_size() - shared_allocator.get_allocated_size(), bufferSize - 20);
AZ_TEST_ASSERT(shared_allocator.get_allocated_size() >= 20);
AZ_TEST_ASSERT(ref_allocator1 == ref_allocator2);
@@ -312,31 +319,31 @@ namespace UnitTest
myalloc.set_name(newName);
AZ_TEST_ASSERT(strcmp(myalloc.get_name(), newName) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() == AZStd::size_t(bufferSize));
EXPECT_EQ(bufferSize, myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
stack_allocator::pointer_type data = myalloc.allocate(100, 1);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100);
EXPECT_EQ(bufferSize - 100, myalloc.max_size() - myalloc.get_allocated_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100);
myalloc.deallocate(data, 100, 1); // this allocator doesn't free data
AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100);
EXPECT_EQ(bufferSize - 100, myalloc.max_size() - myalloc.get_allocated_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100);
myalloc.reset();
AZ_TEST_ASSERT(myalloc.get_max_size() == AZStd::size_t(bufferSize));
EXPECT_EQ(bufferSize, myalloc.max_size());
AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0);
data = myalloc.allocate(50, 64);
AZ_TEST_ASSERT(data != nullptr);
AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0);
AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50);
EXPECT_LE(myalloc.max_size() - myalloc.get_allocated_size(), bufferSize - 50);
AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50);
AZ_STACK_ALLOCATOR(myalloc2, 200); // test the macro declaration
AZ_TEST_ASSERT(myalloc2.get_max_size() == 200);
EXPECT_EQ(200, myalloc2.max_size() );
AZ_TEST_ASSERT(myalloc == myalloc);
AZ_TEST_ASSERT((myalloc2 != myalloc));
@@ -49,7 +49,7 @@ namespace UnitTest
const char newName[] = "My new test allocator";
myalloc.set_name(newName);
EXPECT_EQ(0, strcmp(myalloc.get_name(), newName));
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * s_allocatorCapacity, myalloc.get_max_size());
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * s_allocatorCapacity, myalloc.max_size());
}
}
@@ -61,10 +61,10 @@ namespace UnitTest
typename TestFixture::allocator_type::pointer_type data = myalloc.allocate();
EXPECT_NE(nullptr, data);
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type), myalloc.get_allocated_size());
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * (s_allocatorCapacity - 1), myalloc.get_max_size());
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * (s_allocatorCapacity - 1), myalloc.max_size() - myalloc.get_allocated_size());
myalloc.deallocate(data);
EXPECT_EQ(0, myalloc.get_allocated_size());
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * s_allocatorCapacity, myalloc.get_max_size());
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * s_allocatorCapacity, myalloc.max_size());
}
TYPED_TEST(ConcurrentAllocatorTestFixture, MultipleAllocateDeallocate)
@@ -84,19 +84,19 @@ namespace UnitTest
EXPECT_EQ(dataSize, dataSet.size());
dataSet.clear();
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * dataSize, myalloc.get_allocated_size());
EXPECT_EQ((s_allocatorCapacity - dataSize) * sizeof(typename TestFixture::allocator_type::value_type), myalloc.get_max_size());
EXPECT_EQ((s_allocatorCapacity - dataSize) * sizeof(typename TestFixture::allocator_type::value_type), myalloc.max_size() - myalloc.get_allocated_size());
for (size_t i = 0; i < dataSize; i += 2)
{
myalloc.deallocate(data[i]);
}
EXPECT_EQ(sizeof(typename TestFixture::allocator_type::value_type) * (dataSize / 2), myalloc.get_allocated_size());
EXPECT_EQ((s_allocatorCapacity - dataSize / 2) * sizeof(typename TestFixture::allocator_type::value_type), myalloc.get_max_size());
EXPECT_EQ((s_allocatorCapacity - dataSize / 2) * sizeof(typename TestFixture::allocator_type::value_type), myalloc.max_size() - myalloc.get_allocated_size());
for (size_t i = 1; i < dataSize; i += 2)
{
myalloc.deallocate(data[i]);
}
EXPECT_EQ(0, myalloc.get_allocated_size());
EXPECT_EQ(s_allocatorCapacity * sizeof(typename TestFixture::allocator_type::value_type), myalloc.get_max_size());
EXPECT_EQ(s_allocatorCapacity * sizeof(typename TestFixture::allocator_type::value_type), myalloc.max_size());
}
TYPED_TEST(ConcurrentAllocatorTestFixture, ConcurrentAllocateoDeallocate)
@@ -159,7 +159,7 @@ namespace UnitTest
EXPECT_NE(nullptr, aligned_data);
EXPECT_EQ(0, ((AZStd::size_t)aligned_data & (dataAlignment - 1)));
EXPECT_EQ((s_allocatorCapacity - 1) * sizeof(aligned_int_type), myaligned_pool.get_max_size());
EXPECT_EQ((s_allocatorCapacity - 1) * sizeof(aligned_int_type), myaligned_pool.max_size() - myaligned_pool.get_allocated_size());
EXPECT_EQ(sizeof(aligned_int_type), myaligned_pool.get_allocated_size());
myaligned_pool.deallocate(aligned_data, sizeof(aligned_int_type), dataAlignment); // Make sure we free what we have allocated.
+2
View File
@@ -1179,6 +1179,8 @@ namespace UnitTest
size_type Capacity() const override { return 1 * 1024 * 1024 * 1024; }
/// Returns max allocation size if possible. If not returned value is 0
size_type GetMaxAllocationSize() const override { return 1 * 1024 * 1024 * 1024; }
/// Returns max allocation size of a single contiguous allocation
size_type GetMaxContiguousAllocationSize() const override { return 1 * 1024 * 1024 * 1024; }
/// Returns a pointer to a sub-allocator or NULL.
IAllocatorAllocate* GetSubAllocator() override { return NULL; }
};
@@ -263,21 +263,29 @@ namespace AzFramework
}
commandAndArgs[commandTokens.size()] = nullptr;
AZStd::vector<AZStd::unique_ptr<char[]>> environmentVariablesManaged;
AZStd::vector<char*> environmentVariablesVector;
char** environmentVariables = nullptr;
int numEnvironmentVars = 0;
if (processLaunchInfo.m_environmentVariables)
{
numEnvironmentVars = processLaunchInfo.m_environmentVariables->size();
// Adding one more as exec expects the array to have a nullptr as the last element
environmentVariables = new char*[numEnvironmentVars + 1];
for (int i = 0; i < numEnvironmentVars; i++)
for (const auto& envVarString : *processLaunchInfo.m_environmentVariables)
{
const AZStd::string& envVarString = processLaunchInfo.m_environmentVariables->at(i);
environmentVariables[i] = new char[envVarString.size() + 1];
environmentVariables[i][0] = '\0';
azstrcat(environmentVariables[i], envVarString.size(), envVarString.c_str());
auto& environmentVariable = environmentVariablesManaged.emplace_back(AZStd::make_unique<char[]>(envVarString.size() + 1));
environmentVariable[0] = '\0';
azstrcat(environmentVariable.get(), envVarString.size() + 1, envVarString.c_str());
environmentVariablesVector.emplace_back(environmentVariable.get());
}
environmentVariables[numEnvironmentVars] = nullptr;
// Adding one more as exec expects the array to have a nullptr as the last element
environmentVariablesVector.emplace_back(nullptr);
environmentVariables = environmentVariablesVector.data();
}
else
{
// If no environment variables were specified, then use the current process's environment variables
// and pass it along for the execute .
extern char **environ; // Defined in unistd.h
environmentVariables = ::environ;
AZ_Assert(environmentVariables, "Environment variables for current process not available\n");
}
pid_t child_pid = fork();
@@ -290,15 +298,6 @@ namespace AzFramework
// Close these handles as they are only to be used by the child process
processData.m_startupInfo.CloseAllHandles();
if (processLaunchInfo.m_environmentVariables)
{
for (int i = 0; i < numEnvironmentVars; i++)
{
delete [] environmentVariables[i];
}
delete [] environmentVariables;
}
for (int i = 0; i < commandTokens.size(); i++)
{
delete [] commandAndArgs[i];
@@ -0,0 +1,31 @@
/*
* 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
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzQtComponents/Utilities/PixmapScaleUtilities.h>
#include <QtGui/private/qhighdpiscaling_p.h>
namespace AzQtComponents
{
QPixmap ScalePixmapForScreenDpi(
QPixmap pixmap, QScreen* screen, QSize size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformationMode)
{
qreal screenDpiFactor = QHighDpiScaling::factor(screen);
pixmap.setDevicePixelRatio(screenDpiFactor);
QPixmap scaledPixmap;
size.setWidth(aznumeric_cast<int>(aznumeric_cast<qreal>(size.width()) * screenDpiFactor));
size.setHeight(aznumeric_cast<int>(aznumeric_cast<qreal>(size.height()) * screenDpiFactor));
scaledPixmap = pixmap.scaled(size, aspectRatioMode, transformationMode);
return scaledPixmap;
}
}
@@ -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
*
*/
#pragma once
#include <AzQtComponents/AzQtComponentsAPI.h>
#include <QPixmap>
#include <QScreen>
namespace AzQtComponents
{
AZ_QT_COMPONENTS_API QPixmap ScalePixmapForScreenDpi(QPixmap pixmap, QScreen* screen, QSize size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformationMode);
}; // namespace AzQtComponents
@@ -276,6 +276,8 @@ set(FILES
Utilities/HandleDpiAwareness.cpp
Utilities/HandleDpiAwareness.h
Utilities/MouseHider.h
Utilities/PixmapScaleUtilities.cpp
Utilities/PixmapScaleUtilities.h
Utilities/QtPluginPaths.cpp
Utilities/QtPluginPaths.h
Utilities/QtWindowUtilities.cpp
@@ -47,9 +47,9 @@ namespace AzToolsFramework
return QString();
}
QPixmap EditorEntityUiHandlerBase::GenerateItemIcon(AZ::EntityId /*entityId*/) const
QIcon EditorEntityUiHandlerBase::GenerateItemIcon(AZ::EntityId /*entityId*/) const
{
return QPixmap();
return QIcon();
}
bool EditorEntityUiHandlerBase::CanToggleLockVisibility(AZ::EntityId /*entityId*/) const
@@ -40,7 +40,7 @@ namespace AzToolsFramework
//! Returns the item tooltip text to display in the Outliner.
virtual QString GenerateItemTooltip(AZ::EntityId entityId) const;
//! Returns the item icon pixmap to display in the Outliner.
virtual QPixmap GenerateItemIcon(AZ::EntityId entityId) const;
virtual QIcon GenerateItemIcon(AZ::EntityId entityId) const;
//! Returns whether the element's lock and visibility state should be accessible in the Outliner
virtual bool CanToggleLockVisibility(AZ::EntityId entityId) const;
//! Returns whether the element's name should be editable
@@ -66,9 +66,9 @@ namespace AzToolsFramework
return result;
}
QPixmap LayerUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
QIcon LayerUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
{
return QPixmap(m_layerIconPath);
return QIcon(m_layerIconPath);
}
void LayerUiHandler::PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
@@ -24,7 +24,7 @@ namespace AzToolsFramework
// EditorEntityUiHandler...
QString GenerateItemInfoString(AZ::EntityId entityId) const override;
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
QIcon GenerateItemIcon(AZ::EntityId entityId) const override;
void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void PaintDescendantBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index,
const QModelIndex& descendantIndex) const override;
@@ -280,17 +280,17 @@ namespace AzToolsFramework
QVariant EntityOutlinerListModel::GetEntityIcon(const AZ::EntityId& id) const
{
auto entityUiHandler = m_editorEntityFrameworkInterface->GetHandler(id);
QPixmap pixmap;
QIcon icon;
// Retrieve the icon from the handler
if (entityUiHandler != nullptr)
{
pixmap = entityUiHandler->GenerateItemIcon(id);
icon = entityUiHandler->GenerateItemIcon(id);
}
if (!pixmap.isNull())
if (!icon.isNull())
{
return QIcon(pixmap);
return icon;
}
// If no icon was returned by the handler, use the default one.
@@ -299,7 +299,7 @@ namespace AzToolsFramework
if (isEditorOnly)
{
return QIcon(QPixmap(QString(":/Icons/Entity_Editor_Only.svg")));
return QIcon(QString(":/Icons/Entity_Editor_Only.svg"));
}
AZ::Entity* entity = nullptr;
@@ -308,10 +308,10 @@ namespace AzToolsFramework
if (!isInitiallyActive)
{
return QIcon(QPixmap(QString(":/Icons/Entity_Not_Active.svg")));
return QIcon(QString(":/Icons/Entity_Not_Active.svg"));
}
return QIcon(QPixmap(QString(":/Icons/Entity.svg")));
return QIcon(QString(":/Icons/Entity.svg"));
}
QVariant EntityOutlinerListModel::GetEntityTooltip(const AZ::EntityId& id) const
@@ -41,9 +41,9 @@ namespace AzToolsFramework
}
}
QPixmap LevelRootUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
QIcon LevelRootUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
{
return QPixmap(m_levelRootIconPath);
return QIcon(m_levelRootIconPath);
}
QString LevelRootUiHandler::GenerateItemInfoString(AZ::EntityId entityId) const
@@ -29,7 +29,7 @@ namespace AzToolsFramework
~LevelRootUiHandler() override = default;
// EditorEntityUiHandler...
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
QIcon GenerateItemIcon(AZ::EntityId entityId) const override;
QString GenerateItemInfoString(AZ::EntityId entityId) const override;
bool CanToggleLockVisibility(AZ::EntityId entityId) const override;
bool CanRename(AZ::EntityId entityId) const override;
@@ -81,14 +81,14 @@ namespace AzToolsFramework
return tooltip;
}
QPixmap PrefabUiHandler::GenerateItemIcon(AZ::EntityId entityId) const
QIcon PrefabUiHandler::GenerateItemIcon(AZ::EntityId entityId) const
{
if (m_prefabEditInterface->IsOwningPrefabBeingEdited(entityId))
{
return QPixmap(m_prefabEditIconPath);
return QIcon(m_prefabEditIconPath);
}
return QPixmap(m_prefabIconPath);
return QIcon(m_prefabIconPath);
}
void PrefabUiHandler::PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
@@ -31,7 +31,7 @@ namespace AzToolsFramework
// EditorEntityUiHandler...
QString GenerateItemInfoString(AZ::EntityId entityId) const override;
QString GenerateItemTooltip(AZ::EntityId entityId) const override;
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
QIcon GenerateItemIcon(AZ::EntityId entityId) const override;
void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void PaintDescendantBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index,
const QModelIndex& descendantIndex) const override;
@@ -39,7 +39,7 @@ namespace MCore
return 0;
}
StaticAllocator::size_type StaticAllocator::get_max_size() const
StaticAllocator::size_type StaticAllocator::max_size() const
{
return 0;
}
@@ -22,7 +22,7 @@ namespace MCore
StaticAllocator::size_type resize(pointer_type ptr, size_type newSize);
StaticAllocator::size_type get_max_size() const;
StaticAllocator::size_type max_size() const;
StaticAllocator::size_type get_allocated_size() const;
};
@@ -89,11 +89,23 @@ namespace Multiplayer
//! @param deltaTime amount of time to integrate the provided inputs over
virtual void ProcessInput(NetworkInput& networkInput, float deltaTime) = 0;
//! Similar to ProcessInput, do not call directly.
//! This only needs to be overridden in components which allow NetworkInput to be processed by script.
//! @param networkInput input structure to process
//! @param deltaTime amount of time to integrate the provided inputs over
virtual void ProcessInputFromScript([[maybe_unused]] NetworkInput& networkInput, [[maybe_unused]] float deltaTime){}
//! Only valid on a client, should never be invoked on the server.
//! @param networkInput input structure to process
//! @param deltaTime amount of time to integrate the provided inputs over
virtual void CreateInput(NetworkInput& networkInput, float deltaTime) = 0;
//! Similar to CreateInput, should never be invoked on the server.
//! This only needs to be overridden in components which allow NetworkInput creation to be handled by scripts.
//! @param networkInput input structure to process
//! @param deltaTime amount of time to integrate the provided inputs over
virtual void CreateInputFromScript([[maybe_unused]]NetworkInput& networkInput, [[maybe_unused]] float deltaTime) {}
template <typename ComponentType>
const ComponentType* FindComponent() const;
@@ -252,7 +252,44 @@ void Signal{{ PropertyName }}({{ ', '.join(paramDefines) }});
{#
#}
{%- macro EmitDerivedClassesComment(dataFileNames, Component, ComponentName, ComponentNameBase, ComponentDerived, ControllerName, ControllerNameBase, ControllerDerived, NetworkInputCount) -%}
{% macro GetNetworkInputCount(Component) -%}
{{ Component.findall('NetworkInput') | len }}
{%- endmacro -%}
{#
#}
{% macro ParseNetworkInputsExposedToScript(Component) -%}
{% set NetworkInputsExposedToScript = namespace(value=0) %}
{% for netInput in Component.findall('NetworkInput') %}
{% if ('ExposeToScript' in netInput.attrib) and (netInput.attrib['ExposeToScript'] |booleanTrue) %}
{{ caller(netInput) -}}
{% endif %}
{% endfor %}
{%- endmacro -%}
{#
#}
{% macro GetNetworkInputsExposedToScriptCount(Component) -%}
{% set NetworkInputsExposedToScript = namespace(value=0) %}
{% call (netInput) ParseNetworkInputsExposedToScript(Component) %}
{% set NetworkInputsExposedToScript.value = NetworkInputsExposedToScript.value + 1 %}
{% endcall %}
{{ NetworkInputsExposedToScript.value }}
{%- endmacro -%}
{#
#}
{% macro GetCommaSeparatedParamListOfScriptableNetworkInputs(Component) -%}
{% set parameters = [] %}
{% call (netInput) ParseNetworkInputsExposedToScript(Component) %}
{% set parameters = parameters.append(netInput.attrib['Type'] + ' ' + LowerFirst(netInput.attrib['Name'])) %}
{% endcall %}
{{ parameters | join(', ') }}
{%- endmacro -%}
{#
#}
{%- macro EmitDerivedClassesComment(dataFileNames, Component, ComponentName, ComponentNameBase, ComponentDerived, ControllerName, ControllerNameBase, ControllerDerived) -%}
{% if ComponentDerived or ControllerDerived %}
/*
/// You may use the classes below as a basis for your new derived classes. Derived classes must be marked in {{ (dataFileNames[0] | basename) }}
@@ -293,7 +330,16 @@ namespace {{ Component.attrib['Namespace'] }}
void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
{% set NetworkInputCount = GetNetworkInputCount(Component) | int %}
{% if NetworkInputCount > 0 %}
//! Common input creation logic for the NetworkInput.
//! Fill out the input struct and the MultiplayerInputDriver will send the input data over the network
//! to ensure it's processed.
//! @param input input structure which to store input data for sending to the authority
//! @param deltaTime amount of time to integrate the provided inputs over
void CreateInput(Multiplayer::NetworkInput& input, float deltaTime) override;
//! Common input processing logic for the NetworkInput.
//! @param input input structure to process
//! @param deltaTime amount of time to integrate the provided inputs over
@@ -366,6 +412,18 @@ namespace {{ Component.attrib['Namespace'] }}
{
}
{% if NetworkInputCount > 0 %}
{% set net_input_parameters_name = [] %}
{% call (netInput) ParseNetworkInputsExposedToScript(Component) %}
{% set net_input_parameters_name = net_input_parameters_name.append(LowerFirst(netInput.attrib['Name'])) %}
{% endcall %}
void {{ ControllerName }}::CreateInput([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime)
{
{% if (GetNetworkInputsExposedToScriptCount(Component) | int) > 0 %}
// Remember the following NetworkInputs have been exposed to script: {{ net_input_parameters_name|join(', ') }}.
// If a script is handling these inputs they will have already be filled out by now.
{% endif %}
}
void {{ ControllerName }}::ProcessInput([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime)
{
@@ -230,7 +230,8 @@ AZStd::fixed_vector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }
{% if ControllerDerived %}
{% set ControllerBaseName = ControllerName + "Base" %}
{% endif %}
{% set NetworkInputCount = Component.findall('NetworkInput') | len %}
{% set NetworkInputCount = AutoComponentMacros.GetNetworkInputCount(Component) | int %}
{% set NetworkInputsExposedToScriptCount = AutoComponentMacros.GetNetworkInputsExposedToScriptCount(Component) | int %}
{% set NetworkPropertyCount = Component.findall('NetworkProperty') | len %}
{% set RpcCount = Component.findall('RemoteProcedure') | len %}
#include "AutoComponentTypes.h"
@@ -250,6 +251,10 @@ AZStd::fixed_vector<{{ Property.attrib['Type'] }}, {{ Property.attrib['Count'] }
{% call(Include) AutoComponentMacros.ParseIncludes(Component) %}
#include <{{ Include.attrib['File'] }}>
{% endcall %}
{% if NetworkInputsExposedToScriptCount > 0 %}
#include <AzCore/RTTI/BehaviorContext.h>
{% endif %}
{% for Service in Component.iter('ComponentRelation') %}
{% if Service.attrib['Constraint'] != 'Incompatible' %}
@@ -263,7 +268,7 @@ namespace {{ Service.attrib['Namespace'] }}
{% endif %}
{% endfor %}
{{ AutoComponentMacros.EmitDerivedClassesComment(dataFileNames, Component, ComponentName, ComponentBaseName, ComponentDerived, ControllerName, ControllerBaseName, ControllerDerived, NetworkInputCount) }}
{{ AutoComponentMacros.EmitDerivedClassesComment(dataFileNames, Component, ComponentName, ComponentBaseName, ComponentDerived, ControllerName, ControllerBaseName, ControllerDerived) }}
namespace {{ Component.attrib['Namespace'] }}
{
//! Forward declarations
@@ -337,6 +342,13 @@ namespace {{ Component.attrib['Namespace'] }}
: public Multiplayer::IMultiplayerComponentInput
{
public:
{% if NetworkInputsExposedToScriptCount > 0 %}
AZ_TYPE_INFO({{ ComponentName }}NetworkInput, "{{ (ComponentName ~ "NetworkInput") | createHashGuid }}")
{{ ComponentName }}NetworkInput() = default;
{{ ComponentName }}NetworkInput({{ AutoComponentMacros.GetCommaSeparatedParamListOfScriptableNetworkInputs(Component) }});
static void Reflect(AZ::ReflectContext* context);
{% endif%}
Multiplayer::NetComponentId GetNetComponentId() const override;
bool Serialize(AzNetworking::ISerializer& serializer) override;
Multiplayer::IMultiplayerComponentInput& operator =(const Multiplayer::IMultiplayerComponentInput& rhs) override;
@@ -348,7 +360,41 @@ namespace {{ Component.attrib['Namespace'] }}
static Multiplayer::NetComponentId s_netComponentId;
friend void RegisterMultiplayerComponents();
};
{% if NetworkInputsExposedToScriptCount > 0 %}
class {{ ComponentName }}Requests
: public AZ::ComponentBus
{
public:
AZ_RTTI({{ ComponentName }}Requests, "{{ (ComponentName ~ "Requests") | createHashGuid }}")
virtual {{ ComponentName }}NetworkInput CreateInput(float deltaTime) = 0;
virtual void ProcessInput({{ ComponentName }}NetworkInput* networkInput, float deltaTime) = 0;
};
using {{ ComponentName }}RequestBus = AZ::EBus<{{ ComponentName }}Requests>;
class {{ ComponentName }}BusHandler final
: public {{ ComponentName }}RequestBus::Handler
, public AZ::BehaviorEBusHandler
{
public:
AZ_EBUS_BEHAVIOR_BINDER({{ ComponentName }}BusHandler, "{{ (ComponentName ~ "BusHandler") | createHashGuid }}", AZ::SystemAllocator, CreateInput, ProcessInput)
{{ ComponentName }}NetworkInput CreateInput(float deltaTime) override
{
{{ ComponentName }}NetworkInput result;
CallResult(result, FN_CreateInput, deltaTime);
return result;
}
void ProcessInput({{ ComponentName }}NetworkInput* networkInput, float deltaTime) override
{
Call(FN_ProcessInput, networkInput, deltaTime);
}
};
{% endif %}
{% endif %}
class {{ ControllerBaseName }}{% if not ControllerDerived %} final{% endif %}{{ "" }}
: public Multiplayer::MultiplayerController
@@ -373,8 +419,14 @@ namespace {{ Component.attrib['Namespace'] }}
//! MultiplayerController interface
//! @{
Multiplayer::MultiplayerController::InputPriorityOrder GetInputOrder() const override { return Multiplayer::MultiplayerController::InputPriorityOrder::Default; }
{% if NetworkInputsExposedToScriptCount > 0 %}
void CreateInputFromScript([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime) final;
void ProcessInputFromScript([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime) final;
{% endif %}
void CreateInput([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime) override {}
void ProcessInput([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime) override {}
//! @}
{{ DeclareNetworkPropertyAccessors(Component, 'Authority', 'Server', false)|indent(8) -}}
@@ -1152,7 +1152,8 @@ m_{{ LowerFirst(Property.attrib['Name']) }} = m_{{ LowerFirst(Property.attrib['N
{% else %}
{% set ControllerBaseName = ControllerName %}
{% endif %}
{% set NetworkInputCount = Component.findall('NetworkInput') | len %}
{% set NetworkInputCount = AutoComponentMacros.GetNetworkInputCount(Component) | int %}
{% set NetworkInputsExposedToScriptCount = AutoComponentMacros.GetNetworkInputsExposedToScriptCount(Component) | int %}
{% set NetworkPropertyCount = Component.findall('NetworkProperty') | len %}
{% set RpcCount = Component.findall('RemoteProcedure') | len %}
#include "{{ includeFile }}"
@@ -1299,6 +1300,56 @@ namespace {{ Component.attrib['Namespace'] }}
}
{% if NetworkInputCount > 0 %}
{% set ScriptableNetworkInputParamNames = [] %}
{% call(netInput) AutoComponentMacros.ParseNetworkInputsExposedToScript(Component) %}
{% set ScriptableNetworkInputParamNames = ScriptableNetworkInputParamNames.append(LowerFirst(netInput.attrib['Name'])) %}
{% endcall %}
{% if NetworkInputsExposedToScriptCount > 0 %}
{{ ComponentName }}NetworkInput Construct{{ ComponentName }}NetworkInput({{ AutoComponentMacros.GetCommaSeparatedParamListOfScriptableNetworkInputs(Component) }})
{
return {{ ComponentName }}NetworkInput({{ ScriptableNetworkInputParamNames|join(', ') }});
}
{{ ComponentName }}NetworkInput::{{ ComponentName }}NetworkInput({{ AutoComponentMacros.GetCommaSeparatedParamListOfScriptableNetworkInputs(Component) }})
: {% for param_name in ScriptableNetworkInputParamNames %}m_{{ LowerFirst(param_name) }}({{ LowerFirst(param_name) }}){% if not loop.last %}, {% endif %}{% endfor -%}{}
void {{ ComponentName }}NetworkInput::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
if (serializeContext)
{
serializeContext->Class<{{ ComponentName }}NetworkInput>()
->Version(1)
;
}
AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context);
if (behaviorContext)
{
behaviorContext->Class<{{ ComponentName }}NetworkInput>("{{ ComponentName }}NetworkInput")
->Attribute(AZ::Script::Attributes::Module, "{{ LowerFirst(Component.attrib['Namespace']) }}")
->Attribute(AZ::Script::Attributes::Category, "{{ UpperFirst(Component.attrib['Namespace']) }}")
{% set ScriptableNetInputNames = [] %}
{% call (netInput) AutoComponentMacros.ParseNetworkInputsExposedToScript(Component) %}
{% set ScriptableNetInputNames = ScriptableNetInputNames.append(netInput.attrib['Name']) %}
{% endcall %}
->Method("CreateFromValues", &Construct{{ ComponentName }}NetworkInput, { { {% for param_name in ScriptableNetInputNames %}{"{{ LowerFirst(param_name) }}"}{% if not loop.last %}, {% endif %}{% endfor -%} } })
{% for param_name in ScriptableNetInputNames %}
->Property("{{ param_name }}", BehaviorValueProperty(&{{ ComponentName }}NetworkInput::m_{{ LowerFirst(param_name) }}))
{% endfor %}
;
behaviorContext->EBus<{{ ComponentName }}RequestBus>("{{ ComponentName }}BusHandler")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "{{ LowerFirst(Component.attrib['Namespace']) }}")
->Attribute(AZ::Script::Attributes::Category, "{{ UpperFirst(Component.attrib['Namespace']) }}")
->Handler<{{ ComponentName }}BusHandler>()
;
}
}
{% endif %}
Multiplayer::NetComponentId {{ ComponentName }}NetworkInput::GetNetComponentId() const
{
return {{ ComponentName }}NetworkInput::s_netComponentId;
@@ -1347,6 +1398,26 @@ namespace {{ Component.attrib['Namespace'] }}
{% endif %}
}
{% if NetworkInputsExposedToScriptCount > 0 %}
void {{ ControllerBaseName }}::CreateInputFromScript([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime)
{
{{ ComponentName }}NetworkInput result;
{{ ComponentName }}RequestBus::EventResult(result, GetEntity()->GetId(), &{{ ComponentName }}RequestBus::Events::CreateInput, deltaTime);
// Inputs for your own component always exist
{{ ComponentName }}NetworkInput* {{ LowerFirst(ComponentName) }}Input = input.FindComponentInput<{{ ComponentName }}NetworkInput>();
{% call(netInput) AutoComponentMacros.ParseNetworkInputsExposedToScript(Component) %}
{{ LowerFirst(ComponentName) }}Input->m_{{ LowerFirst(netInput.attrib['Name']) }} = result.m_{{ LowerFirst(netInput.attrib['Name']) }};
{% endcall %}
}
void {{ ControllerBaseName }}::ProcessInputFromScript([[maybe_unused]] Multiplayer::NetworkInput& input, [[maybe_unused]] float deltaTime)
{
{{ ComponentName }}NetworkInput* {{ LowerFirst(ComponentName) }}Input = input.FindComponentInput<{{ ComponentName }}NetworkInput>();
{{ ComponentName }}RequestBus::Event(GetEntity()->GetId(), &{{ ComponentName }}RequestBus::Events::ProcessInput, {{ LowerFirst(ComponentName) }}Input, deltaTime);
}
{% endif %}
const {{ ComponentName }}& {{ ControllerBaseName }}::GetParent() const
{
return static_cast<const {{ ComponentName }}&>(GetOwner());
@@ -1399,6 +1470,9 @@ namespace {{ Component.attrib['Namespace'] }}
}
ReflectToEditContext(context);
ReflectToBehaviorContext(context);
{% if NetworkInputsExposedToScriptCount > 0 %}
{{ ComponentName }}NetworkInput::Reflect(context);
{% endif %}
}
void {{ ComponentBaseName }}::ReflectToEditContext(AZ::ReflectContext* context)
@@ -1448,8 +1522,8 @@ namespace {{ Component.attrib['Namespace'] }}
{{ DefineNetworkPropertyBehaviorReflection(Component, 'Authority', 'Server', ComponentName) | indent(16) -}}
{{ DefineNetworkPropertyBehaviorReflection(Component, 'Authority', 'Client', ComponentName) | indent(16) -}}
{{ DefineNetworkPropertyBehaviorReflection(Component, 'Authority', 'Autonomous', ComponentName) | indent(16) -}}
{{ DefineNetworkPropertyBehaviorReflection(Component, 'Autonomous', 'Authority', ComponentName) | indent(16) -}}
{{ DefineNetworkPropertyBehaviorReflection(Component, 'Autonomous', 'Authority', ComponentName) | indent(16) }}
// Reflect RPCs
{{ ReflectRpcInvocations(Component, ComponentName, 'Server', 'Authority')|indent(4) -}}
{{ ReflectRpcInvocations(Component, ComponentName, 'Autonomous', 'Authority')|indent(4) -}}
@@ -1459,7 +1533,6 @@ namespace {{ Component.attrib['Namespace'] }}
{{ ReflectRpcEvents(Component, ComponentName, 'Autonomous', 'Authority')|indent(4) -}}
{{ ReflectRpcEvents(Component, ComponentName, 'Authority', 'Autonomous')|indent(4) -}}
{{ ReflectRpcEvents(Component, ComponentName, 'Authority', 'Client')|indent(4) -}}
{{- DefineArchetypePropertyBehaviorReflection(Component, ComponentName) | indent(16) }}
;
}
@@ -1508,7 +1581,6 @@ namespace {{ Component.attrib['Namespace'] }}
}
{{ ComponentBaseName }}::{{ ComponentBaseName }}() = default;
{{ ComponentBaseName }}::~{{ ComponentBaseName }}() = default;
void {{ ComponentBaseName }}::Init()
@@ -278,6 +278,7 @@ namespace Multiplayer
AZ_Assert(IsNetEntityRoleAutonomous(), "Incorrect network role for input creation");
for (MultiplayerComponent* multiplayerComponent : m_multiplayerInputComponentVector)
{
multiplayerComponent->GetController()->CreateInputFromScript(networkInput, deltaTime);
multiplayerComponent->GetController()->CreateInput(networkInput, deltaTime);
}
}
@@ -289,6 +290,7 @@ namespace Multiplayer
AZ_Assert((NetworkRoleHasController(m_netEntityRole)), "Incorrect network role for input processing");
for (MultiplayerComponent* multiplayerComponent : m_multiplayerInputComponentVector)
{
multiplayerComponent->GetController()->ProcessInputFromScript(networkInput, deltaTime);
multiplayerComponent->GetController()->ProcessInput(networkInput, deltaTime);
}
m_isProcessingInput = false;
-45
View File
@@ -1,45 +0,0 @@
#
# 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
#
#
# This file is copied during engine registration. Edits to this file will be lost next
# time a registration happens.
include_guard()
set(LY_EXTERNAL_SUBDIRS "" CACHE STRING "Additional list of subdirectory to recurse into via the cmake `add_subdirectory()` command. \
The subdirectories are included after the restricted platform folders have been visited by a call to `add_subdirectory(restricted/\${restricted_platform})`")
#! read_engine_external_subdirs
# Read the external subdirectories from the engine.json file
# External subdirectories are any folders with CMakeLists.txt in them
# This could be regular subdirectories, Gems(contains an additional gem.json),
# Restricted folders(contains an additional restricted.json), etc...
# \arg:output_external_subdirs name of output variable to store external subdirectories into
function(read_engine_external_subdirs output_external_subdirs)
ly_file_read(${LY_ROOT_FOLDER}/engine.json engine_json_data)
string(JSON external_subdirs_count ERROR_VARIABLE engine_json_error
LENGTH ${engine_json_data} "external_subdirectories")
if(engine_json_error)
message(FATAL_ERROR "Error querying number of elements in JSON array \"external_subdirectories\": ${engine_json_error}")
endif()
if(external_subdirs_count GREATER 0)
math(EXPR external_subdir_range "${external_subdirs_count}-1")
# Convert the paths the relative paths to absolute paths using the engine root
# as the base directory
foreach(external_subdir_index RANGE ${external_subdir_range})
string(JSON external_subdir ERROR_VARIABLE engine_json_error
GET ${engine_json_data} "external_subdirectories" "${external_subdir_index}")
if(engine_json_error)
message(FATAL_ERROR "Error reading field at index ${external_subdir_index} in \"external_subdirectories\" JSON array: ${engine_json_error}")
endif()
file(REAL_PATH ${external_subdir} real_external_subdir BASE_DIRECTORY ${CMAKE_SOURCE_DIR})
list(APPEND external_subdirs ${real_external_subdir})
endforeach()
endif()
set(${output_external_subdirs} ${external_subdirs} PARENT_SCOPE)
endfunction()
+66 -30
View File
@@ -23,12 +23,12 @@ ly_set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Core)
cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory)
cmake_path(RELATIVE_PATH CMAKE_LIBRARY_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE library_output_directory)
# Anywhere CMAKE_INSTALL_PREFIX is used, it has to be escaped so it is baked into the cmake_install.cmake script instead
# of baking the path. This is needed so `cmake --install --prefix <someprefix>` works regardless of the CMAKE_INSTALL_PREFIX
# used to generate the solution.
# CMAKE_INSTALL_PREFIX is still used when building the INSTALL target
set(install_output_folder "\${CMAKE_INSTALL_PREFIX}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>")
if(LY_MONOLITHIC_GAME)
set(LY_BUILD_PERMUTATION Monolithic)
else()
set(LY_BUILD_PERMUTATION Default)
endif()
#! ly_setup_target: Setup the data needed to re-create the cmake target commands for a single target
function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_target_source_dir)
@@ -91,6 +91,10 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
cmake_path(RELATIVE_PATH target_library_output_directory BASE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} OUTPUT_VARIABLE target_library_output_subdirectory)
endif()
cmake_path(APPEND archive_output_directory "${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
cmake_path(APPEND library_output_directory "${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
cmake_path(APPEND runtime_output_directory "${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
if(COMMAND ly_install_target_override)
# Mac needs special handling because of a cmake issue
ly_install_target_override(TARGET ${TARGET_NAME}
@@ -104,18 +108,18 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
install(
TARGETS ${TARGET_NAME}
ARCHIVE
DESTINATION ${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>
DESTINATION ${archive_output_directory}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
LIBRARY
DESTINATION ${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}
DESTINATION ${library_output_directory}/${target_library_output_subdirectory}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
RUNTIME
DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}
DESTINATION ${runtime_output_directory}/${target_runtime_output_subdirectory}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
endif()
# CMakeLists.txt file
# CMakeLists.txt related files
string(REGEX MATCH "(.*)::(.*)$" match ${ALIAS_TARGET_NAME})
if(match)
set(NAMESPACE_PLACEHOLDER "NAMESPACE ${CMAKE_MATCH_1}")
@@ -140,7 +144,7 @@ function(ly_setup_target OUTPUT_CONFIGURED_TARGET ALIAS_TARGET_NAME absolute_tar
if(TARGET_TYPE_PLACEHOLDER IN_LIST GEM_LIBRARY_TYPES)
get_target_property(gem_module ${TARGET_NAME} GEM_MODULE)
if(gem_module)
set(TARGET_TYPE_PLACEHOLDER "GEM_MODULE")
string(PREPEND TARGET_TYPE_PLACEHOLDER "GEM_")
endif()
endif()
@@ -222,32 +226,32 @@ set_target_properties(${RUN_TARGET_NAME} PROPERTIES
)
endif()
# Config file
# Config files
set(target_file_contents "# Generated by O3DE install\n\n")
if(NOT target_type STREQUAL INTERFACE_LIBRARY)
unset(target_location)
set(runtime_types EXECUTABLE APPLICATION)
if(target_type IN_LIST runtime_types)
set(target_location "\${LY_ROOT_FOLDER}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_runtime_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
set(target_location "\${LY_ROOT_FOLDER}/${runtime_output_directory}/${target_runtime_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
elseif(target_type STREQUAL MODULE_LIBRARY)
set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
elseif(target_type STREQUAL SHARED_LIBRARY)
string(APPEND target_file_contents
"set_property(TARGET ${NAME_PLACEHOLDER}
APPEND_STRING PROPERTY IMPORTED_IMPLIB
$<$<CONFIG:$<CONFIG>$<ANGLE-R>:\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"$<ANGLE-R>
$<$<CONFIG:$<CONFIG>$<ANGLE-R>:\"\${LY_ROOT_FOLDER}/${archive_output_directory}/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"$<ANGLE-R>
)
")
string(APPEND target_file_contents
"set_property(TARGET ${NAME_PLACEHOLDER}
PROPERTY IMPORTED_IMPLIB_$<UPPER_CASE:$<CONFIG>>
\"\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"
\"\${LY_ROOT_FOLDER}/${archive_output_directory}/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>\"
)
")
set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
set(target_location "\${LY_ROOT_FOLDER}/${library_output_directory}/${target_library_output_subdirectory}/$<TARGET_FILE_NAME:${TARGET_NAME}>")
else() # STATIC_LIBRARY, OBJECT_LIBRARY, INTERFACE_LIBRARY
set(target_location "\${LY_ROOT_FOLDER}/${archive_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>")
set(target_location "\${LY_ROOT_FOLDER}/${archive_output_directory}/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>")
endif()
if(target_location)
@@ -265,9 +269,9 @@ set_property(TARGET ${NAME_PLACEHOLDER}
endif()
set(target_install_source_dir ${CMAKE_CURRENT_BINARY_DIR}/install/${relative_target_source_dir})
file(GENERATE OUTPUT "${target_install_source_dir}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake" CONTENT "${target_file_contents}")
install(FILES "${target_install_source_dir}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake"
DESTINATION ${relative_target_source_dir}
file(GENERATE OUTPUT "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake" CONTENT "${target_file_contents}")
install(FILES "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/${NAME_PLACEHOLDER}_$<CONFIG>.cmake"
DESTINATION ${relative_target_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
@@ -299,16 +303,44 @@ function(ly_setup_subdirectory absolute_target_source_dir)
string(APPEND all_configured_targets "${configured_target}")
endforeach()
# Initialize the target install source directory to path underneath the current binary directory
set(target_install_source_dir "${CMAKE_CURRENT_BINARY_DIR}/install/${relative_target_source_dir}")
ly_file_read(${LY_ROOT_FOLDER}/cmake/install/Copyright.in cmake_copyright_comment)
# 1. Create the base CMakeLists.txt that will just include a cmake file per platform
file(CONFIGURE OUTPUT "${target_install_source_dir}/CMakeLists.txt" CONTENT [[
@cmake_copyright_comment@
include(Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
]] @ONLY)
install(FILES "${target_install_source_dir}/CMakeLists.txt"
DESTINATION ${relative_target_source_dir}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
# 2. For this platform file, create a Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake file
# that will include different configuration permutations (e.g. monolithic vs non-monolithic)
file(CONFIGURE OUTPUT "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake" CONTENT [[
@cmake_copyright_comment@
if(LY_MONOLITHIC_GAME)
include(Platform/${PAL_PLATFORM_NAME}/Monolithic/permutation.cmake)
else()
include(Platform/${PAL_PLATFORM_NAME}/Default/permutation.cmake)
endif()
]])
install(FILES "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake"
DESTINATION ${relative_target_source_dir}/Platform/${PAL_PLATFORM_NAME}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
# 3. For this configuration permutation, generate a Platform/${PAL_PLATFORM_NAME}/${permutation}/permutation.cmake
# that will declare the target and configure it
ly_setup_subdirectory_create_alias("${absolute_target_source_dir}" CREATE_ALIASES_PLACEHOLDER)
ly_setup_subdirectory_set_gem_variant_to_load("${absolute_target_source_dir}" GEM_VARIANT_TO_LOAD_PLACEHOLDER)
ly_setup_subdirectory_enable_gems("${absolute_target_source_dir}" ENABLE_GEMS_PLACEHOLDER)
ly_file_read(${LY_ROOT_FOLDER}/cmake/install/Copyright.in cmake_copyright_comment)
# Initialize the target install source directory to path underneath the current binary directory
set(target_install_source_dir ${CMAKE_CURRENT_BINARY_DIR}/install/${relative_target_source_dir})
# Write out all the aggregated ly_add_target function calls and the final ly_create_alias() calls to the target CMakeLists.txt
file(WRITE ${target_install_source_dir}/CMakeLists.txt
file(WRITE "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/permutation.cmake"
"${cmake_copyright_comment}"
"${all_configured_targets}"
"\n"
@@ -316,9 +348,8 @@ function(ly_setup_subdirectory absolute_target_source_dir)
"${GEM_VARIANT_TO_LOAD_PLACEHOLDER}"
"${ENABLE_GEMS_PLACEHOLDER}"
)
install(FILES "${target_install_source_dir}/CMakeLists.txt"
DESTINATION ${relative_target_source_dir}
install(FILES "${target_install_source_dir}/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/permutation.cmake"
DESTINATION ${relative_target_source_dir}//Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
@@ -362,10 +393,10 @@ function(ly_setup_cmake_install)
# Inject code that will generate each ConfigurationType_<CONFIG>.cmake file
set(install_configuration_type_template [=[
configure_file(@LY_ROOT_FOLDER@/cmake/install/ConfigurationType_config.cmake.in
${CMAKE_INSTALL_PREFIX}/cmake/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake
${CMAKE_INSTALL_PREFIX}/cmake/Platform/@PAL_PLATFORM_NAME@/@LY_BUILD_PERMUTATION@/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake
@ONLY
)
message(STATUS "Generated ${CMAKE_INSTALL_PREFIX}/cmake/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake")
message(STATUS "Generated ${CMAKE_INSTALL_PREFIX}/cmake/Platform/@PAL_PLATFORM_NAME@/@LY_BUILD_PERMUTATION@/ConfigurationTypes_${CMAKE_INSTALL_CONFIG_NAME}.cmake")
]=])
string(CONFIGURE "${install_configuration_type_template}" install_configuration_type @ONLY)
install(CODE "${install_configuration_type}"
@@ -493,6 +524,11 @@ endfunction()"
endif()
# runtime dependencies that need to be copied to the output
# Anywhere CMAKE_INSTALL_PREFIX is used, it has to be escaped so it is baked into the cmake_install.cmake script instead
# of baking the path. This is needed so `cmake --install --prefix <someprefix>` works regardless of the CMAKE_INSTALL_PREFIX
# used to generate the solution.
# CMAKE_INSTALL_PREFIX is still used when building the INSTALL target
set(install_output_folder "\${CMAKE_INSTALL_PREFIX}/${runtime_output_directory}/${PAL_PLATFORM_NAME}/$<CONFIG>/${LY_BUILD_PERMUTATION}")
set(target_file_dir "${install_output_folder}/${target_runtime_output_subdirectory}")
ly_get_runtime_dependencies(runtime_dependencies ${target})
foreach(runtime_dependency ${runtime_dependencies})
+5 -5
View File
@@ -54,19 +54,19 @@ function(ly_install_target_override)
install(
TARGETS ${ly_platform_install_target_TARGET}
ARCHIVE
DESTINATION ${ly_platform_install_target_ARCHIVE_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>
DESTINATION ${ly_platform_install_target_ARCHIVE_DIR}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
LIBRARY
DESTINATION ${ly_platform_install_target_LIBRARY_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_LIBRARY_SUBDIR}
DESTINATION ${ly_platform_install_target_LIBRARY_DIR}/${ly_platform_install_target_LIBRARY_SUBDIR}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
RUNTIME
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_RUNTIME_SUBDIR}
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${ly_platform_install_target_RUNTIME_SUBDIR}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
BUNDLE
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_RUNTIME_SUBDIR}
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${ly_platform_install_target_RUNTIME_SUBDIR}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
RESOURCE
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${PAL_PLATFORM_NAME}/$<CONFIG>/${ly_platform_install_target_RUNTIME_SUBDIR}/
DESTINATION ${ly_platform_install_target_RUNTIME_DIR}/${ly_platform_install_target_RUNTIME_SUBDIR}
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
+1 -1
View File
@@ -15,7 +15,6 @@ set(FILES
Configurations.cmake
Dependencies.cmake
Deployment.cmake
EngineJson.cmake
FileUtil.cmake
Findo3de.cmake
Gems.cmake
@@ -28,6 +27,7 @@ set(FILES
LYPython.cmake
LYWrappers.cmake
Monolithic.cmake
O3DEJson.cmake
OutputDirectory.cmake
Packaging.cmake
PAL.cmake
+10 -1
View File
@@ -15,7 +15,16 @@ include_guard(GLOBAL)
set(CMAKE_CONFIGURATION_TYPES "" CACHE STRING "" FORCE)
# For the SDK case, we want to only define the confiuguration types that have been added to the SDK
file(GLOB configuration_type_files "cmake/ConfigurationTypes_*.cmake")
# We need to redeclare LY_BUILD_PERMUTATION because Configurations is one of the first things included by the
# root CMakeLists.txt. Even LY_MONOLITHIC_GAME is declared after, but since is a passed cache variable, and
# default is the same as undeclared, we can use it at this point.
if(LY_MONOLITHIC_GAME)
set(LY_BUILD_PERMUTATION Monolithic)
else()
set(LY_BUILD_PERMUTATION Default)
endif()
file(GLOB configuration_type_files "cmake/Platform/${PAL_PLATFORM_NAME}/${LY_BUILD_PERMUTATION}/ConfigurationTypes_*.cmake")
foreach(configuration_type_file ${configuration_type_files})
include(${configuration_type_file})
endforeach()
+1 -1
View File
@@ -23,5 +23,5 @@ ly_add_target(
set(configs @CMAKE_CONFIGURATION_TYPES@)
foreach(config ${configs})
include("@NAME_PLACEHOLDER@_${config}.cmake" OPTIONAL)
include("Platform/@PAL_PLATFORM_NAME@/@LY_BUILD_PERMUTATION@/@NAME_PLACEHOLDER@_${config}.cmake" OPTIONAL)
endforeach()