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

1.fix compile error on ue5.4 #693

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions Plugins/UnLua/Source/ThirdParty/Lua/Lua.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,11 @@ private string GetBuildSystem()
return "Ninja";
if (Target.Platform.IsInGroup(UnrealPlatformGroup.Windows))
{
#if !UE_5_4_OR_LATER
if (Target.WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2019)
return "Visual Studio 16 2019";
#endif

#if UE_4_27_OR_LATER
if (Target.WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2022)
return "Visual Studio 17 2022";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace UnLua

FEnumRegistry::~FEnumRegistry()
{
for (const auto Pair : Name2Enums)
for (const auto& Pair : Name2Enums)
delete Pair.Value;
}

Expand Down
17 changes: 9 additions & 8 deletions Plugins/UnLua/Source/UnLua/Public/UnLuaEx.inl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and limitations under the License.

#include "UnLuaDebugBase.h"
#include "type_traits"

namespace UnLua
{
Expand Down Expand Up @@ -94,7 +95,7 @@ namespace UnLua
{
static void Generate(FString &Buffer, int32 Index)
{
FString TypeName = TTypeIntelliSense<typename TChooseClass<TIsPointer<T1>::Value, typename TDecay<typename TRemovePointer<T1>::Type>::Type*, typename TDecay<T1>::Type>::Result>::GetName();
FString TypeName = TTypeIntelliSense<typename std::conditional<TIsPointer<T1>::Value, typename TDecay<typename TRemovePointer<T1>::Type>::Type*, typename TDecay<T1>::Type>::type>::GetName();
Buffer += FString::Printf(TEXT("---@param P%d %s %s\r\n"), Index, *TypeName, *TArgumentComment<T1>::Get());
TArgumentIntelliSense<T2...>::Generate(Buffer, Index + 1);
}
Expand Down Expand Up @@ -123,7 +124,7 @@ namespace UnLua
}

// return
FString ReturnTypeName = TTypeIntelliSense<typename TChooseClass<TIsPointer<RetType>::Value, typename TDecay<typename TRemovePointer<RetType>::Type>::Type*, typename TDecay<RetType>::Type>::Result>::GetName();
FString ReturnTypeName = TTypeIntelliSense<typename std::conditional<TIsPointer<RetType>::Value, typename TDecay<typename TRemovePointer<RetType>::Type>::Type*, typename TDecay<RetType>::Type>::type>::GetName();
if (ReturnTypeName.Len() > 0)
{
Buffer += FString::Printf(TEXT("---@return %s\r\n"), *ReturnTypeName);
Expand Down Expand Up @@ -880,7 +881,7 @@ namespace UnLua
template <bool bIsReflected>
void TExportedClassBase<bIsReflected>::GenerateIntelliSense(FString &Buffer) const
{
GenerateIntelliSenseInternal(Buffer, typename TChooseClass<bIsReflected, FTrue, FFalse>::Result());
GenerateIntelliSenseInternal(Buffer, typename std::conditional<bIsReflected, FTrue, FFalse>::type());
}

template <bool bIsReflected>
Expand Down Expand Up @@ -951,7 +952,7 @@ namespace UnLua
TExportedClass<bIsReflected, ClassType, CtorArgType...>::TExportedClass(const char *InName, const char *InSuperClassName)
: FExportedClassBase(InName, InSuperClassName)
{
AddDefaultFunctions(typename TChooseClass<bIsReflected, FTrue, FFalse>::Result());
AddDefaultFunctions(typename std::conditional<bIsReflected, FTrue, FFalse>::type());
}

template <bool bIsReflected, typename ClassType, typename... CtorArgType>
Expand Down Expand Up @@ -1029,14 +1030,14 @@ namespace UnLua
template <bool bIsReflected, typename ClassType, typename... CtorArgType>
void TExportedClass<bIsReflected, ClassType, CtorArgType...>::AddDefaultFunctions(FFalse NotReflected)
{
AddConstructor(typename TChooseClass<TIsConstructible<ClassType, CtorArgType...>::Value, FTrue, FFalse>::Result());
AddDestructor(typename TChooseClass<TAnd<TIsDestructible<ClassType>, TNot<TIsTriviallyDestructible<ClassType>>>::Value, FFalse, FTrue>::Result());
AddConstructor(typename std::conditional<TIsConstructible<ClassType, CtorArgType...>::Value, FTrue, FFalse>::type());
AddDestructor(typename std::conditional<TAnd<TIsDestructible<ClassType>, TNot<TIsTriviallyDestructible<ClassType>>>::Value, FFalse, FTrue>::type());
}

template <bool bIsReflected, typename ClassType, typename... CtorArgType>
void TExportedClass<bIsReflected, ClassType, CtorArgType...>::AddDefaultFunctions(FTrue Reflected)
{
AddDefaultFunctions_Reflected(typename TChooseClass<TPointerIsConvertibleFromTo<ClassType, UObject>::Value, FTrue, FFalse>::Result());
AddDefaultFunctions_Reflected(typename std::conditional<TPointerIsConvertibleFromTo<ClassType, UObject>::Value, FTrue, FFalse>::type());
}

template <bool bIsReflected, typename ClassType, typename... CtorArgType>
Expand All @@ -1045,7 +1046,7 @@ namespace UnLua
int32 NumArgs = sizeof...(CtorArgType);
if (NumArgs > 0)
{
AddConstructor(typename TChooseClass<TIsConstructible<ClassType, CtorArgType...>::Value, FTrue, FFalse>::Result());
AddConstructor(typename std::conditional<TIsConstructible<ClassType, CtorArgType...>::Value, FTrue, FFalse>::type());
}
}

Expand Down
8 changes: 4 additions & 4 deletions Plugins/UnLua/Source/UnLua/Public/UnLuaLegacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -853,18 +853,18 @@ namespace UnLua
virtual void Destruct(void* Dest) const override
{
static_assert(TIsDestructible<T>::Value, "type must be destructible!");
DestructInternal((T*)Dest, typename TChooseClass<TIsTriviallyDestructible<T>::Value, FTrue, FFalse>::Result());
DestructInternal((T*)Dest, typename std::conditional<TIsTriviallyDestructible<T>::Value, FTrue, FFalse>::type());
}

virtual void Copy(void* Dest, const void* Src) const override
{
static_assert(TIsCopyConstructible<T>::Value, "type must be copy constructible!");
CopyInternal((T*)Dest, (const T*)Src, typename TChooseClass<TIsTriviallyCopyConstructible<T>::Value, FTrue, FFalse>::Result());
CopyInternal((T*)Dest, (const T*)Src, typename std::conditional<TIsTriviallyCopyConstructible<T>::Value, FTrue, FFalse>::type());
}

virtual bool Identical(const void* A, const void* B) const override
{
return IdenticalInternal((const T*)A, (const T*)B, typename TChooseClass<THasEqualityOperator<T>::Value, FTrue, FFalse>::Result());
return IdenticalInternal((const T*)A, (const T*)B, typename std::conditional<THasEqualityOperator<T>::Value, FTrue, FFalse>::type());
}

virtual FString GetName() const override { return FString(TType<typename TDecay<T>::Type>::GetName()); }
Expand All @@ -890,7 +890,7 @@ namespace UnLua
{
static_assert(TIsCopyConstructible<T>::Value, "type must be copy constructible!");
T V = UnLua::Get(L, IndexInStack, TType<T>());
CopyInternal((T*)ValuePtr, &V, typename TChooseClass<TIsTriviallyCopyConstructible<T>::Value, FTrue, FFalse>::Result());
CopyInternal((T*)ValuePtr, &V, typename std::conditional<TIsTriviallyCopyConstructible<T>::Value, FTrue, FFalse>::type());
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion Plugins/UnLua/Source/UnLua/Public/UnLuaTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace UnLua
template <typename T> struct TArgTypeTraits
{
typedef typename TDecay<T>::Type RT;
typedef typename TChooseClass<TIsPrimitiveTypeOrPointer<RT>::Value, RT, typename std::remove_cv<T>::type>::Result Type;
typedef typename std::conditional<TIsPrimitiveTypeOrPointer<RT>::Value, RT, typename std::remove_cv<T>::type>::type Type;
};


Expand Down
11 changes: 10 additions & 1 deletion Source/TPSProject.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@
using System.Collections.Generic;

public class TPSProjectTarget : TargetRules{ public TPSProjectTarget(TargetInfo Target) : base(Target) { Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2;
DefaultBuildSettings = BuildSettingsVersion.V2;

#if UE_5_4_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V4;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#endif

ExtraModuleNames.AddRange( new string[] {



"TPSProject"
} ); }}
Expand Down
22 changes: 18 additions & 4 deletions Source/TPSProjectEditor.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@
using UnrealBuildTool;
using System.Collections.Generic;

public class TPSProjectEditorTarget : TargetRules{ public TPSProjectEditorTarget(TargetInfo Target) : base(Target) { Type = TargetType.Editor;
public class TPSProjectEditorTarget : TargetRules
{
public TPSProjectEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] {

#if UE_5_4_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V4;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#endif

ExtraModuleNames.AddRange(
new string[]
{
"TPSProject"
} );
}}
}
);
}
}
6 changes: 6 additions & 0 deletions Source/TPSProjectServer.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public TPSProjectServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V2;

#if UE_5_4_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V4;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#endif

ExtraModuleNames.Add("TPSProject");
}
}