From 75d9896c0ec72b91a25204bf3dcd886830c51123 Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Mon, 7 Jul 2025 18:16:45 +0200 Subject: [PATCH] re-add Source/ThirdParty/**/*.Build.cs to get tracked under git rather than lfs --- .../SGBleThirdPartyLibs.Build.cs | 149 +++++++++++++++ .../SGConnectThirdPartyHeaders.Build.cs | 53 ++++++ .../SGConnectThirdPartyLibs.Build.cs | 171 ++++++++++++++++++ .../SGCoreThirdPartyLibs.Build.cs | 171 ++++++++++++++++++ .../SGSerialThirdPartyLibs.Build.cs | 171 ++++++++++++++++++ 5 files changed, 715 insertions(+) create mode 100644 Source/ThirdParty/SGBleThirdPartyLibs/SGBleThirdPartyLibs.Build.cs create mode 100644 Source/ThirdParty/SGConnectThirdPartyHeaders/SGConnectThirdPartyHeaders.Build.cs create mode 100644 Source/ThirdParty/SGConnectThirdPartyLibs/SGConnectThirdPartyLibs.Build.cs create mode 100644 Source/ThirdParty/SGCoreThirdPartyLibs/SGCoreThirdPartyLibs.Build.cs create mode 100644 Source/ThirdParty/SGSerialThirdPartyLibs/SGSerialThirdPartyLibs.Build.cs diff --git a/Source/ThirdParty/SGBleThirdPartyLibs/SGBleThirdPartyLibs.Build.cs b/Source/ThirdParty/SGBleThirdPartyLibs/SGBleThirdPartyLibs.Build.cs new file mode 100644 index 00000000..b1b9ef49 --- /dev/null +++ b/Source/ThirdParty/SGBleThirdPartyLibs/SGBleThirdPartyLibs.Build.cs @@ -0,0 +1,149 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2025 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using UnrealBuildTool; + +public class SGBleThirdPartyLibs : ModuleRules +{ + public SGBleThirdPartyLibs(ReadOnlyTargetRules Target) : base(Target) + { + Type = ModuleType.External; + + string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); + string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib")); + string LibraryPathAnroidArm64 = ""; + string LibraryPathAnroidx64 = ""; + string LibraryName = "sgble"; + + bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android); + bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux; + bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64; + bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) && + Target.WindowsPlatform.Architecture == UnrealArch.X64; + bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug); + + if (bIsAndroid) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b")); + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64")); + + LibraryName = string.Format("lib{0}.a", LibraryName); + } + else if (bIsLinux) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64")); + + LibraryName = string.Format("lib{0}.a", LibraryName); + } + else if (bIsLinuxArm64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64")); + + LibraryName = string.Format("lib{0}.a", LibraryName); + } + else if (bIsWin64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc")); + + LibraryName = string.Format("{0}.lib", LibraryName); + } + else + { + Debug.Assert(false, "Unsupported platform!"); + } + + string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include")); + PrivateIncludePaths.Add(IncludePath); + + if (bIsAndroid) + { + if (bIsDebugBuild) + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug")); + } + else + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release")); + } + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName)); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName)); + + PublicAdditionalLibraries.Add(LibraryPathAnroidArm64); + PublicAdditionalLibraries.Add(LibraryPathAnroidx64); + } + else + { + if (bIsDebugBuild) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug")); + } + else + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release")); + } + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName)); + PublicAdditionalLibraries.Add(LibraryPath); + } + + if (bIsWin64) + { + PublicAdditionalLibraries.AddRange(new string[] + { + "bcrypt.lib", + "ntdll.lib", + "propsys.lib", + "runtimeobject.lib", + "userenv.lib", + "ws2_32.lib" + }); + } + } +} \ No newline at end of file diff --git a/Source/ThirdParty/SGConnectThirdPartyHeaders/SGConnectThirdPartyHeaders.Build.cs b/Source/ThirdParty/SGConnectThirdPartyHeaders/SGConnectThirdPartyHeaders.Build.cs new file mode 100644 index 00000000..12e68c78 --- /dev/null +++ b/Source/ThirdParty/SGConnectThirdPartyHeaders/SGConnectThirdPartyHeaders.Build.cs @@ -0,0 +1,53 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2025 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using UnrealBuildTool; + +public class SGConnectThirdPartyHeaders : ModuleRules +{ + public SGConnectThirdPartyHeaders(ReadOnlyTargetRules Target) : base(Target) + { + Type = ModuleType.External; + + string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); + string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include")); + + PublicIncludePaths.Add(IncludePath); + } +} \ No newline at end of file diff --git a/Source/ThirdParty/SGConnectThirdPartyLibs/SGConnectThirdPartyLibs.Build.cs b/Source/ThirdParty/SGConnectThirdPartyLibs/SGConnectThirdPartyLibs.Build.cs new file mode 100644 index 00000000..73bfa2d4 --- /dev/null +++ b/Source/ThirdParty/SGConnectThirdPartyLibs/SGConnectThirdPartyLibs.Build.cs @@ -0,0 +1,171 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2025 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using UnrealBuildTool; + +public class SGConnectThirdPartyLibs : ModuleRules +{ + public SGConnectThirdPartyLibs(ReadOnlyTargetRules Target) : base(Target) + { + Type = ModuleType.External; + + string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); + string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib")); + string LibraryPathAnroidArm64 = ""; + string LibraryPathAnroidx64 = ""; + string LibraryName = "sgconnect"; + + bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android); + bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux; + bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64; + bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) && + Target.WindowsPlatform.Architecture == UnrealArch.X64; + bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug); + + if (bIsAndroid) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b")); + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64")); + + LibraryName = string.Format("lib{0}.a", LibraryName); + } + else if (bIsLinux) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryName = string.Format("lib{0}.a", LibraryName); + +#if UE_5_6_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25")); +#elif UE_5_5_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23")); +#elif UE_5_3_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22")); +#elif UE_5_2_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21")); +#else + Debug.Assert(false, "Unsupported engine version or compiler!"); +#endif + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64")); + } + else if (bIsLinuxArm64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryName = string.Format("lib{0}.a", LibraryName); + +#if UE_5_6_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25")); +#elif UE_5_5_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23")); +#elif UE_5_3_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22")); +#elif UE_5_2_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21")); +#else + Debug.Assert(false, "Unsupported engine version or compiler!"); +#endif + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64")); + } + else if (bIsWin64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64")); + switch (Target.WindowsPlatform.Compiler) + { + case WindowsCompiler.VisualStudio2022: + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc143")); + break; +#if ! UE_5_4_OR_LATER + case WindowsCompiler.VisualStudio2019: + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc142")); + break; +#endif + default: + Debug.Assert(false, "Unsupported engine version or compiler!"); + break; + } + + LibraryName = string.Format("{0}.lib", LibraryName); + } + else + { + Debug.Assert(false, "Unsupported platform!"); + } + + string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include")); + PrivateIncludePaths.Add(IncludePath); + + if (bIsAndroid) + { + if (bIsDebugBuild) + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug")); + } + else + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release")); + } + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName)); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName)); + + PublicAdditionalLibraries.Add(LibraryPathAnroidArm64); + PublicAdditionalLibraries.Add(LibraryPathAnroidx64); + } + else + { + if (bIsDebugBuild) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug")); + } + else + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release")); + } + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName)); + PublicAdditionalLibraries.Add(LibraryPath); + } + } +} \ No newline at end of file diff --git a/Source/ThirdParty/SGCoreThirdPartyLibs/SGCoreThirdPartyLibs.Build.cs b/Source/ThirdParty/SGCoreThirdPartyLibs/SGCoreThirdPartyLibs.Build.cs new file mode 100644 index 00000000..a96ece83 --- /dev/null +++ b/Source/ThirdParty/SGCoreThirdPartyLibs/SGCoreThirdPartyLibs.Build.cs @@ -0,0 +1,171 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2025 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using UnrealBuildTool; + +public class SGCoreThirdPartyLibs : ModuleRules +{ + public SGCoreThirdPartyLibs(ReadOnlyTargetRules Target) : base(Target) + { + Type = ModuleType.External; + + string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); + string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib")); + string LibraryPathAnroidArm64 = ""; + string LibraryPathAnroidx64 = ""; + string LibraryName = "sgcore"; + + bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android); + bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux; + bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64; + bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) && + Target.WindowsPlatform.Architecture == UnrealArch.X64; + bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug); + + if (bIsAndroid) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b")); + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64")); + + LibraryName = string.Format("lib{0}.a", LibraryName); + } + else if (bIsLinux) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryName = string.Format("lib{0}.a", LibraryName); + +#if UE_5_6_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25")); +#elif UE_5_5_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23")); +#elif UE_5_3_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22")); +#elif UE_5_2_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21")); +#else + Debug.Assert(false, "Unsupported engine version or compiler!"); +#endif + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64")); + } + else if (bIsLinuxArm64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryName = string.Format("lib{0}.a", LibraryName); + +#if UE_5_6_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25")); +#elif UE_5_5_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23")); +#elif UE_5_3_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22")); +#elif UE_5_2_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21")); +#else + Debug.Assert(false, "Unsupported engine version or compiler!"); +#endif + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64")); + } + else if (bIsWin64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64")); + switch (Target.WindowsPlatform.Compiler) + { + case WindowsCompiler.VisualStudio2022: + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc143")); + break; +#if ! UE_5_4_OR_LATER + case WindowsCompiler.VisualStudio2019: + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc142")); + break; +#endif + default: + Debug.Assert(false, "Unsupported engine version or compiler!"); + break; + } + + LibraryName = string.Format("{0}.lib", LibraryName); + } + else + { + Debug.Assert(false, "Unsupported platform!"); + } + + string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include")); + PrivateIncludePaths.Add(IncludePath); + + if (bIsAndroid) + { + if (bIsDebugBuild) + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug")); + } + else + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release")); + } + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName)); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName)); + + PublicAdditionalLibraries.Add(LibraryPathAnroidArm64); + PublicAdditionalLibraries.Add(LibraryPathAnroidx64); + } + else + { + if (bIsDebugBuild) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug")); + } + else + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release")); + } + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName)); + PublicAdditionalLibraries.Add(LibraryPath); + } + } +} \ No newline at end of file diff --git a/Source/ThirdParty/SGSerialThirdPartyLibs/SGSerialThirdPartyLibs.Build.cs b/Source/ThirdParty/SGSerialThirdPartyLibs/SGSerialThirdPartyLibs.Build.cs new file mode 100644 index 00000000..2444504f --- /dev/null +++ b/Source/ThirdParty/SGSerialThirdPartyLibs/SGSerialThirdPartyLibs.Build.cs @@ -0,0 +1,171 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2025 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using UnrealBuildTool; + +public class SGSerialThirdPartyLibs : ModuleRules +{ + public SGSerialThirdPartyLibs(ReadOnlyTargetRules Target) : base(Target) + { + Type = ModuleType.External; + + string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); + string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib")); + string LibraryPathAnroidArm64 = ""; + string LibraryPathAnroidx64 = ""; + string LibraryName = "serial"; + + bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android); + bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux; + bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64; + bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) && + Target.WindowsPlatform.Architecture == UnrealArch.X64; + bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug); + + if (bIsAndroid) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android")); + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b")); + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64")); + + LibraryName = string.Format("lib{0}.a", LibraryName); + } + else if (bIsLinux) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryName = string.Format("lib{0}.a", LibraryName); + +#if UE_5_6_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25")); +#elif UE_5_5_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23")); +#elif UE_5_3_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22")); +#elif UE_5_2_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21")); +#else + Debug.Assert(false, "Unsupported engine version or compiler!"); +#endif + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64")); + } + else if (bIsLinuxArm64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); + LibraryName = string.Format("lib{0}.a", LibraryName); + +#if UE_5_6_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25")); +#elif UE_5_5_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23")); +#elif UE_5_3_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22")); +#elif UE_5_2_OR_LATER + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21")); +#else + Debug.Assert(false, "Unsupported engine version or compiler!"); +#endif + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64")); + } + else if (bIsWin64) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64")); + switch (Target.WindowsPlatform.Compiler) + { + case WindowsCompiler.VisualStudio2022: + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc143")); + break; +#if ! UE_5_4_OR_LATER + case WindowsCompiler.VisualStudio2019: + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc142")); + break; +#endif + default: + Debug.Assert(false, "Unsupported engine version or compiler!"); + break; + } + + LibraryName = string.Format("{0}.lib", LibraryName); + } + else + { + Debug.Assert(false, "Unsupported platform!"); + } + + string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include")); + PrivateIncludePaths.Add(IncludePath); + + if (bIsAndroid) + { + if (bIsDebugBuild) + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug")); + } + else + { + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release")); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release")); + } + + LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName)); + LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName)); + + PublicAdditionalLibraries.Add(LibraryPathAnroidArm64); + PublicAdditionalLibraries.Add(LibraryPathAnroidx64); + } + else + { + if (bIsDebugBuild) + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug")); + } + else + { + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release")); + } + + LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName)); + PublicAdditionalLibraries.Add(LibraryPath); + } + } +} \ No newline at end of file