Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Atom_RPI.Public and Atom_RPI.Edit to shared libraries #18427

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move explicit template instantiations to new shared AzCore library
Signed-off-by: Markus Prettner <[email protected]>
  • Loading branch information
mprettner-huawei committed Dec 3, 2024
commit d77a4ad50646ce494cbcd5c1bc24ca085f6ed20b
2 changes: 0 additions & 2 deletions Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <AzCore/std/parallel/lock.h>
#include <AzCore/std/string/conversions.h>

DECLARE_EBUS_INSTANTIATION(Data::AssetEvents);

namespace AZ::Data
{
AssetFilterInfo::AssetFilterInfo(const AssetId& id, const AssetType& assetType, AssetLoadBehavior loadBehavior)
Expand Down
2 changes: 1 addition & 1 deletion Code/Framework/AzCore/AzCore/Asset/AssetCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1266,4 +1266,4 @@ namespace AZStd
};
}

DECLARE_EBUS_EXTERN(Data::AssetEvents);
DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS(Data::AssetEvents);
6 changes: 3 additions & 3 deletions Code/Framework/AzCore/AzCore/Asset/AssetManagerBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ namespace AZ
} // namespace Data
} // namespace AZ

DECLARE_EBUS_EXTERN(Data::AssetManagerNotifications);
DECLARE_EBUS_EXTERN(Data::AssetCatalogRequests);
DECLARE_EBUS_EXTERN(Data::AssetManagerEvents);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(Data::AssetManagerNotifications);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(Data::AssetCatalogRequests);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(Data::AssetManagerEvents);

#endif // AZCORE_ASSET_DATABASE_BUS_H
#pragma once
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
#include <AzCore/Slice/SliceComponent.h>
#include <AzCore/Math/Crc.h>

DECLARE_EBUS_INSTANTIATION(Data::AssetManagerNotifications);
DECLARE_EBUS_INSTANTIATION(Data::AssetCatalogRequests);
DECLARE_EBUS_INSTANTIATION(Data::AssetManagerEvents);

namespace AZ
{
namespace Data
Expand Down
2 changes: 1 addition & 1 deletion Code/Framework/AzCore/AzCore/Asset/AssetTypeInfoBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ namespace AZ
using AssetTypeInfoBus = AZ::EBus<AssetTypeInfo>;
} // namespace AZ

DECLARE_EBUS_EXTERN(AssetTypeInfo);
DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS(AssetTypeInfo);
3 changes: 0 additions & 3 deletions Code/Framework/AzCore/AzCore/Component/Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include <AzCore/Math/Sfmt.h>
#include <AzCore/Math/Crc.h>


DECLARE_EBUS_INSTANTIATION_WITH_TRAITS(ComponentDescriptor, ComponentDescriptorBusTraits);

namespace AZ
{
// Add definition for type info and runtime type information to component
Expand Down
2 changes: 1 addition & 1 deletion Code/Framework/AzCore/AzCore/Component/Component.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,4 +826,4 @@ namespace AZ
};
}

DECLARE_EBUS_EXTERN_WITH_TRAITS(ComponentDescriptor, ComponentDescriptorBusTraits);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS_WITH_TRAITS(ComponentDescriptor, ComponentDescriptorBusTraits);
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@

#include <AzCore/Outcome/Outcome.h> // for unexpect_t

DECLARE_EBUS_INSTANTIATION_WITH_TRAITS(ComponentApplicationRequests, ComponentApplicationRequestsEBusTraits);
DECLARE_EBUS_INSTANTIATION(TickEvents);
DECLARE_EBUS_INSTANTIATION(SystemTickEvents);
DECLARE_EBUS_INSTANTIATION(TickRequests);

namespace AZ::Metrics
{
const EventLoggerId CoreEventLoggerId{ static_cast<AZ::u32>(AZStd::hash<AZStd::string_view>{}("Core")) };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ namespace AZ
using ComponentApplicationBus = AZ::EBus<ComponentApplicationRequests, ComponentApplicationRequestsEBusTraits>;
}

DECLARE_EBUS_EXTERN_WITH_TRAITS(ComponentApplicationRequests, ComponentApplicationRequestsEBusTraits);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS_WITH_TRAITS(ComponentApplicationRequests, ComponentApplicationRequestsEBusTraits);
5 changes: 0 additions & 5 deletions Code/Framework/AzCore/AzCore/Component/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@

#include <AzCore/Debug/Profiler.h>

DECLARE_EBUS_INSTANTIATION(EntityEvents);
DECLARE_EBUS_INSTANTIATION(TransformInterface);
DECLARE_EBUS_INSTANTIATION(TransformNotification);
DECLARE_EBUS_INSTANTIATION(TransformHierarchyInformation);

namespace AZ
{
class SerializeEntityFactory
Expand Down
2 changes: 1 addition & 1 deletion Code/Framework/AzCore/AzCore/Component/EntityBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ namespace AZ
#endif // AZCORE_ENTITY_BUS_H
#pragma once

DECLARE_EBUS_EXTERN(EntityEvents);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(EntityEvents);
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Math/Vector3.h>

DECLARE_EBUS_INSTANTIATION(NonUniformScaleRequests);

namespace AZ
{
void NonUniformScaleRequests::Reflect(ReflectContext* context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ namespace AZ
using NonUniformScaleRequestBus = AZ::EBus<NonUniformScaleRequests>;
} // namespace AZ

DECLARE_EBUS_EXTERN(NonUniformScaleRequests);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(NonUniformScaleRequests);
6 changes: 3 additions & 3 deletions Code/Framework/AzCore/AzCore/Component/TickBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ namespace AZ
using SystemTickBus = AZ::EBus<SystemTickEvents>;
}

DECLARE_EBUS_EXTERN(TickEvents);
DECLARE_EBUS_EXTERN(SystemTickEvents);
DECLARE_EBUS_EXTERN(TickRequests);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(TickEvents);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(SystemTickEvents);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(TickRequests);

#endif // AZCORE_COMPONENT_TICK_BUS_H
#pragma once
6 changes: 3 additions & 3 deletions Code/Framework/AzCore/AzCore/Component/TransformBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,6 @@ namespace AZ
/// @endcond
}

DECLARE_EBUS_EXTERN(TransformInterface);
DECLARE_EBUS_EXTERN(TransformNotification);
DECLARE_EBUS_EXTERN(TransformHierarchyInformation);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(TransformInterface);
DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(TransformNotification);
DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS(TransformHierarchyInformation);
2 changes: 2 additions & 0 deletions Code/Framework/AzCore/AzCore/Debug/TraceMessageBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ namespace AZ
typedef AZ::EBus<TraceMessageEvents> TraceMessageBus;
} // namespace Debug
} // namespace AZ

DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(Debug::TraceMessageEvents);
106 changes: 105 additions & 1 deletion Code/Framework/AzCore/AzCore/EBus/EBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -2244,11 +2244,115 @@ namespace AZ \
{ \
template class EBus<a, b>; \
}

//! Instantiates an EBus class template using only the interface argument
//! for both the EBus Interface and BusTraits template parameters

#define DECLARE_EBUS_INSTANTIATION(a) \
namespace AZ \
{ \
template class EBus<a, a>; \
}

//! Declares an EBus class template, which uses EBusAddressPolicy::Single and is instantiated in a shared library, as extern using only the
//! interface argument for both the EBus Interface and BusTraits template parameters
#define DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS(a) \
namespace AZ \
{ \
extern template class EBus<a, a>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING \
extern template class Internal::NonIdHandler<a, a, EBus<a, a>::BusesContainer>; \
extern template struct Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, a>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Explicitly instantiates an EBus which was declared with the function directly above
#define DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(a) \
namespace AZ \
{ \
template class AZ_DLL_EXPORT EBus<a, a>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
template class AZ_DLL_EXPORT Internal::NonIdHandler<a, a, EBus<a, a>::BusesContainer>; \
template struct AZ_DLL_EXPORT Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, a>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Declares an EBus class template, which uses an address policy different from EBusAddressPolicy::Single and is instantiated in a shared
//! library, as extern using only the interface argument for both the EBus Interface and BusTraits template parameters
#define DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS(a) \
namespace AZ \
{ \
extern template class EBus<a, a>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING \
extern template class Internal::IdHandler<a, a, EBus<a, a>::BusesContainer>; \
extern template class Internal::MultiHandler<a, a, EBus<a, a>::BusesContainer>; \
extern template struct Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, a>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Explicitly instantiates an EBus which was declared with the function directly above
#define DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS(a) \
namespace AZ \
{ \
template class AZ_DLL_EXPORT EBus<a, a>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
template class AZ_DLL_EXPORT Internal::IdHandler<a, a, EBus<a, a>::BusesContainer>; \
template class AZ_DLL_EXPORT Internal::MultiHandler<a, a, EBus<a, a>::BusesContainer>; \
template struct AZ_DLL_EXPORT Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, a>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Declares an EBus class template, which uses EBusAddressPolicy::Single and is instantiated in a shared library, as extern with both the
//! interface and bus traits arguments
#define DECLARE_EBUS_EXTERN_DLL_SINGLE_ADDRESS_WITH_TRAITS(a, b) \
namespace AZ \
{ \
extern template class EBus<a, b>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING \
extern template class Internal::NonIdHandler<a, b, EBus<a, b>::BusesContainer>; \
extern template struct Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, b>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Explicitly instantiates an EBus which was declared with the function directly above
#define DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS_WITH_TRAITS(a, b) \
namespace AZ \
{ \
template class AZ_DLL_EXPORT EBus<a, b>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
template class AZ_DLL_EXPORT Internal::NonIdHandler<a, b, EBus<a, b>::BusesContainer>; \
template struct AZ_DLL_EXPORT Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, b>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Declares an EBus class template, which uses an address policy different from EBusAddressPolicy::Single and is instantiated in a shared
//! library, as extern with both the interface and bus traits arguments
#define DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS_WITH_TRAITS(a, b) \
namespace AZ \
{ \
extern template class EBus<a, b>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING \
extern template class Internal::IdHandler<a, b, EBus<a, b>::BusesContainer>; \
extern template class Internal::MultiHandler<a, b, EBus<a, b>::BusesContainer>; \
extern template struct Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, b>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}

//! Explicitly instantiates an EBus which was declared with the function directly above
#define DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS_WITH_TRAITS(a, b) \
namespace AZ \
{ \
template class AZ_DLL_EXPORT EBus<a, b>; \
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
template class AZ_DLL_EXPORT Internal::IdHandler<a, b, EBus<a, b>::BusesContainer>; \
template class AZ_DLL_EXPORT Internal::MultiHandler<a, b, EBus<a, b>::BusesContainer>; \
template struct AZ_DLL_EXPORT Internal::EBusCallstackStorage<Internal::CallstackEntryBase<a, b>, true>; \
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING \
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
*
*/

#include <AzCore/Asset/AssetTypeInfoBus.h>
#include <AzCore/PlatformDef.h>
#include <AzCore/std/smart_ptr/intrusive_base.h>

DECLARE_EBUS_INSTANTIATION(AssetTypeInfo);
namespace AZStd
{
template class AZ_DLL_EXPORT intrusive_refcount<atomic_uint>;
}
45 changes: 45 additions & 0 deletions Code/Framework/AzCore/AzCore/Module/EBusInstantiations.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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/EBus/EBus.h>

#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Asset/AssetManagerBus.h>
#include <AzCore/Asset/AssetTypeInfoBus.h>
#include <AzCore/Component/EntityBus.h>
#include <AzCore/Component/NonUniformScaleBus.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Debug/TraceMessageBus.h>
#include <AzCore/RTTI/BehaviorContext.h>

// Asset buses
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(Data::AssetManagerNotifications);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(Data::AssetCatalogRequests);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(Data::AssetManagerEvents);
DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS(AssetTypeInfo);
DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS(Data::AssetEvents);

// Component buses
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(TickEvents);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(TickRequests);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(SystemTickEvents);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(EntityEvents);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(TransformInterface);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(TransformNotification);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(NonUniformScaleRequests);
DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS(TransformHierarchyInformation);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS_WITH_TRAITS(ComponentApplicationRequests, ComponentApplicationRequestsEBusTraits);
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS_WITH_TRAITS(ComponentDescriptor, ComponentDescriptorBusTraits);

// Debug buses
DECLARE_EBUS_INSTANTIATION_DLL_SINGLE_ADDRESS(Debug::TraceMessageEvents);

// RTTI buses
DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS(BehaviorContextEvents);
DECLARE_EBUS_INSTANTIATION_DLL_MULTI_ADDRESS(BehaviorObjectSignalsInterface);
2 changes: 0 additions & 2 deletions Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <AzCore/RTTI/AttributeReader.h>
#include <AzCore/Component/EntityBus.h>

DECLARE_EBUS_INSTANTIATION(BehaviorContextEvents);

namespace AZ
{
// Definitions for TypeInfo and RTTI functions
Expand Down
2 changes: 1 addition & 1 deletion Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -2931,4 +2931,4 @@ namespace AZ
#include <AzCore/RTTI/AzStdOnDemandPrettyName.inl>
#include <AzCore/RTTI/AzStdOnDemandReflection.inl>

DECLARE_EBUS_EXTERN(BehaviorContextEvents);
DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS(BehaviorContextEvents);
11 changes: 0 additions & 11 deletions Code/Framework/AzCore/AzCore/RTTI/BehaviorObjectSignals.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ namespace AZ
using BehaviorObjectSignals = AZ::EBus<BehaviorObjectSignalsInterface>;
}

DECLARE_EBUS_EXTERN(BehaviorObjectSignalsInterface);
DECLARE_EBUS_EXTERN_DLL_MULTI_ADDRESS(BehaviorObjectSignalsInterface);
2 changes: 0 additions & 2 deletions Code/Framework/AzCore/AzCore/azcore_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ set(FILES
Asset/AssetSerializer.cpp
Asset/AssetSerializer.h
Asset/AssetTypeInfoBus.h
Asset/AssetTypeInfoBus.cpp
Asset/AssetInternal/WeakAsset.h
base.h
Casting/lossy_cast.h
Expand Down Expand Up @@ -504,7 +503,6 @@ set(FILES
RTTI/BehaviorMethodImpl.cpp
RTTI/BehaviorMethodImpl.inl
RTTI/BehaviorObjectSignals.h
RTTI/BehaviorObjectSignals.cpp
RTTI/ChronoReflection.cpp
RTTI/ChronoReflection.h
RTTI/ReflectContext.h
Expand Down
12 changes: 12 additions & 0 deletions Code/Framework/AzCore/AzCore/azcoreshared_files.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# 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
#
#

set(FILES
Module/EBusInstantiations.cpp
Module/AZStdInstantiations.cpp
)
3 changes: 3 additions & 0 deletions Code/Framework/AzCore/AzCore/std/smart_ptr/intrusive_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ namespace AZStd
*/
using intrusive_base = intrusive_refcount<atomic_uint>;

AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
extern template class intrusive_refcount<atomic_uint>;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
} // namespace AZStd
Loading