Successful compile, untested

This commit is contained in:
Jordon Brooks 2024-05-27 19:43:19 +01:00
parent 15a2622991
commit 47008fcefe
Signed by: jordon
GPG key ID: DBD9758CD53E786A
10 changed files with 84 additions and 44 deletions

View file

@ -21,7 +21,6 @@ public class HarmonyLink : ModuleRules
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
"ThirdParty/HarmonyLinkLib/include"
}
);
@ -41,33 +40,9 @@ public class HarmonyLink : ModuleRules
new string[]
{
// ... 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");
}
}
}

View file

@ -2,7 +2,7 @@
#include "HarmonyLinkLibrary.h"
#include <HarmonyLinkLib.h>
#include "HarmonyLinkLib.h"
bool UHarmonyLinkLibrary::IsWine()
{

View file

@ -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

View file

@ -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);

View 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

Binary file not shown.

BIN
Source/ThirdParty/HarmonyLinkLib/bin/Win64/HarmonyLinkLibShared.dll (Stored with Git LFS) vendored Normal file

Binary file not shown.

View file

@ -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

Binary file not shown.

Binary file not shown.