-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1b8f6d
commit b3aa6ca
Showing
12 changed files
with
207 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Binaries/* | ||
Intermediate/* | ||
Source/ThirdParty/VTK/Public/* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.IO; | ||
using UnrealBuildTool; | ||
|
||
public class VTK : ModuleRules | ||
{ | ||
public VTK(ReadOnlyTargetRules target) : base(target) | ||
{ | ||
Type = ModuleType.External; | ||
|
||
PublicIncludePaths.Add(Path.Combine(PluginDirectory, "Source", "ThirdParty", "VTK", "Public")); | ||
|
||
if (target.Platform == UnrealTargetPlatform.Win64) | ||
{ | ||
foreach (var value in Directory.EnumerateFiles(Path.Combine(PluginDirectory, "Intermediate", "ThirdParty", "VTK", "Win64"), "*.lib" , SearchOption.AllDirectories)) | ||
{ | ||
PublicAdditionalLibraries.Add(value); | ||
} | ||
foreach (var value in Directory.EnumerateFiles(Path.Combine(PluginDirectory, "Binaries" , "ThirdParty", "VTK", "Win64"), "*.dll" , SearchOption.AllDirectories)) | ||
{ | ||
PublicDelayLoadDLLs .Add(value); | ||
RuntimeDependencies .Add(value); | ||
} | ||
} | ||
else if (target.Platform == UnrealTargetPlatform.Mac ) | ||
{ | ||
foreach (var value in Directory.EnumerateFiles(Path.Combine(PluginDirectory, "Intermediate", "ThirdParty", "VTK", "Mac" ), "*.dylib", SearchOption.AllDirectories)) | ||
{ | ||
PublicDelayLoadDLLs .Add(value); | ||
RuntimeDependencies .Add(value); | ||
} | ||
} | ||
else if (target.Platform == UnrealTargetPlatform.Linux) | ||
{ | ||
foreach (var value in Directory.EnumerateFiles(Path.Combine(PluginDirectory, "Intermediate", "ThirdParty", "VTK", "Linux"), "*.so" , SearchOption.AllDirectories)) | ||
{ | ||
PublicAdditionalLibraries.Add(value); | ||
PublicDelayLoadDLLs .Add(value); | ||
RuntimeDependencies .Add(value); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "VTKPlugin.h" | ||
#include "Core.h" | ||
#include "Modules/ModuleManager.h" | ||
#include "Interfaces/IPluginManager.h" | ||
|
||
#include "vtkPolyData.h" | ||
|
||
#define LOCTEXT_NAMESPACE "FVTKPluginModule" | ||
|
||
void FVTKPluginModule::StartupModule () | ||
{ | ||
#if PLATFORM_WINDOWS | ||
const FString BaseDir = IPluginManager::Get().FindPlugin("VTKPlugin")->GetBaseDir(); | ||
const FString AbsoluteBaseDir = IFileManager ::Get().ConvertToAbsolutePathForExternalAppForRead(*BaseDir); | ||
const FString VTKDir = FPaths::Combine(*AbsoluteBaseDir, TEXT("/Binaries/ThirdParty/VTK/Win64/")); | ||
const FString Filter = FPaths::Combine(VTKDir, TEXT("*.dll")); | ||
|
||
TArray<FString> Files; | ||
IFileManager::Get().FindFiles(Files, *Filter, true, false); | ||
while (Files.Num() != DynamicLinkLibraries.Num()) // Since the order of DLLs are unknown, try repeatedly until all are loaded. | ||
{ | ||
for (auto& File : Files) | ||
{ | ||
const FString Path = FPaths::Combine(VTKDir, File); | ||
auto Dll = FPlatformProcess::GetDllHandle(*Path); | ||
if (Dll && !DynamicLinkLibraries.Contains(Dll)) | ||
DynamicLinkLibraries.Add(Dll); | ||
} | ||
} | ||
#endif | ||
} | ||
void FVTKPluginModule::ShutdownModule() | ||
{ | ||
for (const auto& Library : DynamicLinkLibraries) | ||
FPlatformProcess::FreeDllHandle(Library); | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE | ||
|
||
IMPLEMENT_MODULE(FVTKPluginModule, VTKPlugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include "Modules/ModuleManager.h" | ||
#include "Runtime/Core/Public/Containers/Array.h" | ||
|
||
class FVTKPluginModule : public IModuleInterface | ||
{ | ||
public: | ||
virtual void StartupModule () override; | ||
virtual void ShutdownModule() override; | ||
|
||
private: | ||
TArray<void*> DynamicLinkLibraries; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnrealBuildTool; | ||
|
||
public class VTKPlugin : ModuleRules | ||
{ | ||
public VTKPlugin(ReadOnlyTargetRules target) : base(target) | ||
{ | ||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; | ||
|
||
PublicDependencyModuleNames.AddRange(new[] {"Core", "Projects", "VTK"}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"FileVersion" : 3, | ||
"Version" : 1, | ||
"VersionName" : "1.0", | ||
"FriendlyName" : "VTKPlugin", | ||
"Description" : "A plugin that downloads, builds, installs and links VTK to UE.", | ||
"Category" : "Other", | ||
"CreatedBy" : "acdemiralp", | ||
"CreatedByURL" : "", | ||
"DocsURL" : "", | ||
"MarketplaceURL" : "", | ||
"SupportURL" : "", | ||
"CanContainContent" : true , | ||
"IsBetaVersion" : false, | ||
"IsExperimentalVersion": false, | ||
"Installed" : false, | ||
"Modules": | ||
[ | ||
{ | ||
"Name" : "VTKPlugin", | ||
"Type" : "Runtime" , | ||
"LoadingPhase": "Default" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@echo off | ||
setlocal enabledelayedexpansion | ||
|
||
set INITIAL_DIR=%CD% | ||
cd /d "%~dp0" | ||
|
||
mkdir Temporary | ||
cd Temporary | ||
|
||
curl -L "https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-windows-x86_64.zip" -o download.zip | ||
tar -xf download.zip | ||
del download.zip | ||
move cmake-3.22.1-windows-x86_64 CMake | ||
|
||
curl -L "https://github.com/Kitware/VTK/archive/refs/tags/v9.1.0.zip" -o download.zip | ||
tar -xf download.zip | ||
del download.zip | ||
move VTK-9.1.0 VTK | ||
|
||
cd VTK | ||
mkdir Build | ||
mkdir Install | ||
cd Build | ||
..\..\CMake\bin\cmake .. -DVTK_GROUP_ENABLE_Rendering=NO | ||
..\..\CMake\bin\cmake --build . --config Release --parallel 32 | ||
..\..\CMake\bin\cmake --install . --prefix ..\Install | ||
|
||
cd .. | ||
xcopy /s Install\include\vtk-9.1 ..\..\Source\ThirdParty\VTK\Public\ | ||
xcopy /s Install\lib ..\..\Intermediate\ThirdParty\VTK\Win64\ | ||
xcopy /s Install\bin ..\..\Binaries\ThirdParty\VTK\Win64\ | ||
|
||
cd ..\.. | ||
rmdir /s /q Temporary | ||
|
||
cd /d %INITIAL_DIR% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
|
||
INITIAL_DIR=$PWD | ||
cd "${0%/*}" | ||
|
||
mkdir Temporary | ||
cd Temporary | ||
|
||
wget -O download.tar.gz "https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-x86_64.tar.gz" | ||
tar -xf download.tar.gz | ||
rm download.tar.gz | ||
mv cmake-3.22.1-linux-x86_64 CMake | ||
|
||
wget -O download.tar.gz "https://github.com/Kitware/VTK/archive/refs/tags/v9.1.0.tar.gz" | ||
tar -xf download.tar.gz | ||
rm download.tar.gz | ||
mv VTK-9.1.0 VTK | ||
|
||
cd VTK | ||
mkdir Build | ||
mkdir Install | ||
cd Build | ||
../../CMake/bin/cmake .. -DVTK_GROUP_ENABLE_Rendering=NO | ||
../../CMake/bin/cmake --build . --config Release --parallel 32 | ||
../../CMake/bin/cmake --install . --prefix ../Install | ||
|
||
cd .. | ||
mkdir -p ../../Source/ThirdParty/VTK/Public && cp -a ./Install/include/vtk-9.1/. "$_" | ||
mkdir -p ../../Intermediate/ThirdParty/VTK/Linux && cp -a ./Install/lib/. "$_" | ||
mkdir -p ../../Binaries/ThirdParty/VTK/Linux && cp -a ./Install/bin/. "$_" | ||
|
||
cd ../.. | ||
rm -rf Temporary | ||
|
||
cd %INITIAL_DIR% |
File renamed without changes.