Add automatic profile switching #1
10 changed files with 84 additions and 44 deletions
|
@ -21,7 +21,6 @@ public class HarmonyLink : ModuleRules
|
|||
PrivateIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add other private include paths required here ...
|
||||
"ThirdParty/HarmonyLinkLib/include"
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -40,34 +39,10 @@ public class HarmonyLink : ModuleRules
|
|||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
// ... add private dependencies that you statically link with here ...
|
||||
// ... add private dependencies that you statically link with here ...
|
||||
"HarmonyLinkLib",
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
// ... add any modules that your module loads dynamically here ...
|
||||
}
|
||||
);
|
||||
|
||||
// Platform-specific settings for static libraries
|
||||
if (Target.Platform == UnrealTargetPlatform.Win64)
|
||||
{
|
||||
PublicAdditionalLibraries.Add(Path.Combine(PluginDirectory, "Source/ThirdParty/HarmonyLinkLib/lib/Win64/HarmonyLinkLibStatic.lib"));
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_STATIC=1");
|
||||
}
|
||||
else if (Target.Platform == UnrealTargetPlatform.Linux)
|
||||
{
|
||||
PublicAdditionalLibraries.Add(Path.Combine(PluginDirectory, "Source/ThirdParty/HarmonyLinkLib/lib/Linux/libHarmonyLinkLibStatic.a"));
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_STATIC=1");
|
||||
}
|
||||
// I shall include this if anyone wishes to provide Mac binaries of HarmonyLink but these are not included by default as I don't own one.
|
||||
else if (Target.Platform == UnrealTargetPlatform.Mac)
|
||||
{
|
||||
PublicAdditionalLibraries.Add(Path.Combine(PluginDirectory, "Source/ThirdParty/HarmonyLinkLib/lib/Mac/libHarmonyLinkLibStatic.a"));
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_STATIC=1");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "HarmonyLinkLibrary.h"
|
||||
|
||||
#include <HarmonyLinkLib.h>
|
||||
#include "HarmonyLinkLib.h"
|
||||
|
||||
bool UHarmonyLinkLibrary::IsWine()
|
||||
{
|
||||
|
|
|
@ -11,11 +11,6 @@ FCPUInfo::FCPUInfo(HarmonyLinkLib::FCPUInfo* cpu_info)
|
|||
PhysicalCores = cpu_info->Physical_Cores;
|
||||
LogicalCores = cpu_info->Logical_Cores;
|
||||
|
||||
for (const HarmonyLinkLib::FString& Flag : cpu_info->Flags)
|
||||
{
|
||||
Flags.Add(Flag.c_str());
|
||||
}
|
||||
|
||||
cpu_info->free();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -33,10 +33,6 @@ struct FCPUInfo
|
|||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
int32 LogicalCores = 0;
|
||||
|
||||
// A set of flags representing various features or capabilities of the CPU.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="HarmonyLink")
|
||||
TSet<FString> Flags;
|
||||
|
||||
// Constructor that initializes the struct with information from an external CPU info source.
|
||||
// @param cpu_info Pointer to an external FCPUInfo structure to copy data from.
|
||||
FCPUInfo(HarmonyLinkLib::FCPUInfo* cpu_info);
|
||||
|
|
60
Source/ThirdParty/HarmonyLinkLib/HarmonyLinkLib.Build.cs
vendored
Normal file
60
Source/ThirdParty/HarmonyLinkLib/HarmonyLinkLib.Build.cs
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Copyright (C) 2024 Jordon Brooks
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.IO;
|
||||
using Internal;
|
||||
|
||||
public class HarmonyLinkLib : ModuleRules
|
||||
{
|
||||
public HarmonyLinkLib(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
Console.WriteLine("Building HarmonyLinkLib");
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
Type = ModuleType.External;
|
||||
|
||||
// Add the standard library
|
||||
bUseRTTI = true;
|
||||
bEnableExceptions = true;
|
||||
|
||||
// Optionally, if you need C++17 features
|
||||
CppStandard = CppStandardVersion.Cpp17;
|
||||
|
||||
string includePath = Path.Combine(ModuleDirectory, "include");
|
||||
Console.WriteLine("Include Path: " + includePath);
|
||||
PublicIncludePaths.Add(includePath);
|
||||
|
||||
PublicDefinitions.Add("HARMONYLINKLIB_STATIC=1");
|
||||
|
||||
string platformString = Target.Platform.ToString();
|
||||
if (Target.Platform == UnrealTargetPlatform.Win64)
|
||||
{
|
||||
PublicDefinitions.Add("BUILD_WINDOWS=1");
|
||||
string dllPath = Path.Combine(ModuleDirectory, "lib", platformString, "HarmonyLinkLibStatic.lib");
|
||||
Console.WriteLine("DLL Path: " + dllPath);
|
||||
PublicAdditionalLibraries.Add(dllPath);
|
||||
//RuntimeDependencies.Add(dllPath);
|
||||
}
|
||||
else if (Target.Platform == UnrealTargetPlatform.Linux)
|
||||
{
|
||||
Console.WriteLine("Building Linux");
|
||||
PublicDefinitions.Add("BUILD_LINUX=1");
|
||||
string libPath = Path.Combine(ModuleDirectory, "bin", platformString, "libHarmonyLinkLibShared.so");
|
||||
Console.WriteLine("Library Path: " + libPath);
|
||||
PublicAdditionalLibraries.Add(libPath);
|
||||
|
||||
// Add the C++ standard library explicitly
|
||||
//string toolchainLibPath = "E:/UnrealToolChains/v22_clang-16.0.6-centos7/x86_64-unknown-linux-gnu/lib";
|
||||
//PublicSystemLibraryPaths.Add(toolchainLibPath);
|
||||
RuntimeDependencies.Add(libPath);
|
||||
}
|
||||
// I shall include this if anyone wishes to provide Mac binaries of HarmonyLink but these are not included by default as I don't own one.
|
||||
else if (Target.Platform == UnrealTargetPlatform.Mac)
|
||||
{
|
||||
PublicDefinitions.Add("BUILD_MACOS=1");
|
||||
string dynlibPath = Path.Combine(ModuleDirectory, "lib", platformString, "libHarmonyLinkLibStatic.a");
|
||||
Console.WriteLine("Dynamic Library Path: " + dynlibPath);
|
||||
RuntimeDependencies.Add(dynlibPath);
|
||||
}
|
||||
}
|
||||
}
|
BIN
Source/ThirdParty/HarmonyLinkLib/bin/Linux/libHarmonyLinkLibShared.so
(Stored with Git LFS)
vendored
Normal file
BIN
Source/ThirdParty/HarmonyLinkLib/bin/Linux/libHarmonyLinkLibShared.so
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
Source/ThirdParty/HarmonyLinkLib/bin/Win64/HarmonyLinkLibShared.dll
(Stored with Git LFS)
vendored
Normal file
BIN
Source/ThirdParty/HarmonyLinkLib/bin/Win64/HarmonyLinkLibShared.dll
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
12
Source/ThirdParty/HarmonyLinkLib/include/Core.h
vendored
12
Source/ThirdParty/HarmonyLinkLib/include/Core.h
vendored
|
@ -15,7 +15,7 @@
|
|||
#pragma once
|
||||
|
||||
// Use a preprocessor definition to switch between export and import declarations
|
||||
#ifdef _WIN32
|
||||
#ifdef BUILD_WINDOWS
|
||||
#ifdef HARMONYLINKLIB_STATIC
|
||||
#define HARMONYLINKLIB_API
|
||||
#else
|
||||
|
@ -26,5 +26,13 @@
|
|||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define HARMONYLINKLIB_API
|
||||
#ifdef HARMONYLINKLIB_SHARED
|
||||
#ifdef __clang__
|
||||
#define HARMONYLINKLIB_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define HARMONYLINKLIB_API
|
||||
#endif
|
||||
#else
|
||||
#define HARMONYLINKLIB_API
|
||||
#endif
|
||||
#endif
|
||||
|
|
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Linux/libHarmonyLinkLibStatic.a
(Stored with Git LFS)
vendored
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Linux/libHarmonyLinkLibStatic.a
(Stored with Git LFS)
vendored
Binary file not shown.
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Win64/HarmonyLinkLibStatic.lib
(Stored with Git LFS)
vendored
BIN
Source/ThirdParty/HarmonyLinkLib/lib/Win64/HarmonyLinkLibStatic.lib
(Stored with Git LFS)
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue