Skip to content

Instantly share code, notes, and snippets.

@iwer
Last active February 12, 2024 20:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iwer/fc4e34a2a491461d606d826b72664845 to your computer and use it in GitHub Desktop.
Save iwer/fc4e34a2a491461d606d826b72664845 to your computer and use it in GitHub Desktop.
A writeup of how to to get UnrealGDAL based projects up-and-running with Unreal Engine 5

UnrealGDAL based plugin setup

UnrealGDAL utilizes a python based cli tool to build thirdparty libraries with the Unreal toolchain and to include the build artifacts into the Unreal project build process. It is built around the conan C++ package manager.

There are several gotchas on the way to migrating the stack like: UE dependencies changing requiring conan recipe changes, conan upgrading to 2.0, ubuntu phasing out old autotools and so on...

As I understand, the original author of UnrealGDAL and the build-tools is quite busy, so I cloned relevant repositories and try to maintain something that is functioning for me.

However, maybe this can also be usefull to someone else, so here you go:

UE 5.1

Prepare UE

Install from Epic Launcher and clone UE source to separate directory. In the clone:

./Setup.bat
./GenerateProjectFiles.bat

Build 3rd party libs

Get Build tools

1.57 <= conan <= 1.59 (ue4cli is not yet ready for conan2)

pip3 install --upgrade conan==1.59

ue4cli>=0.0.54 ,conan-ue4cli>=0.0.38

pip3 install ue4cli conan-ue4cli

ue4-conan-recipes (with ue5 compatibility)

git clone git@github.com:iwer/ue4-conan-recipes.git
Windows
git switch -c ue5 origin/ue5

Copy directories to ~/AppData/Roaming/conan-ue4cli/recipes

Linux
git switch -c gdal3 origin/gdal3

Build libs

Windows
ue4 setroot <path/to/ue5/source>
ue4 conan generate
ue4 setroot <path/to/ue5/installation>
ue4 conan update
ue4 conan build gdal-ue4==2.4.0 mergetiff-ue4
Linux
ue4 setroot <path/to/ue5/source>
ue4 conan generate
ue4 setroot <path/to/ue5/installation>
ue4 conan update

I could not build gdal 2.4.0 on Ubuntu anymore due to autoconf >= 2.71. So I created conan recipes for gdal 3.5.1. Get conan recipes from https://github.com/iwer/ue4-conan-recipes and copy the recipes to ~/.config/conan-ue4cli/recipes. Then build:

ue4 conan build gdal-ue4==3.5.1 mergetiff-ue4

Get Plugins

Optional: Populate built thirdparty libs (e.g. to store them in VCS)

cd <UnrealProjectDirectory>
ue4 conan precompute host -d .\Plugins\UnrealGDAL\Source\GDAL\
@Bosa17
Copy link

Bosa17 commented Jan 8, 2024

Were there any modifications needed to the GDAL.Build.cs file to migrate it to Unreal 5+
I changed the Tools.DotNETCommon to EpicGames.Core
Are there more changes that you did to build GDAL for 5.0+?

@iwer
Copy link
Author

iwer commented Jan 9, 2024

Yes, have a look at or use the ue5 branch of my fork of UnrealGDAL.

@Bosa17
Copy link

Bosa17 commented Jan 9, 2024

Thanks for the help. I also found that some changes to the header files were needed to build it for UE 5.3.2, particularly from the Core module that should be included in the branch.

However, even after incorporating your changes in the GDAL.Build.cs file, I am still getting errors like:

1>libcurl.lib(version.obj) : error LNK2019: unresolved external symbol nghttp2_version referenced in function curl_version_info

In the commit, you do mention the requirement of linking to Crypto32, but could you please elaborate how that was done?

@Bosa17
Copy link

Bosa17 commented Jan 9, 2024

Are you flagging it as a system_lib and then providing your own libcurl with the required setting? Could you please point to how to achieve this by provisioning my own libcurl with the required setting? I think this is also quite important for all the people who want to migrate to UE5+ and might not know the next step.

@iwer
Copy link
Author

iwer commented Jan 9, 2024

UE5.3 may have introduced changes that i have no adaptations for atm. However libcurl and nghttp2 are in UE5.2 third party libs that should be collected in the ue4 conan generate step. And yes Crypt32 should be collected as system libs. This may give more insight on how the output should look like. Unfortunately I cant give much more support atm as I am on medical leave.

@Bosa17
Copy link

Bosa17 commented Jan 9, 2024

Hey, Firstly, get well soon! Your help means a lot. From the output file, I was able to figure out the additional requirements that I needed to add in the conanfile for GDAL.
self._requireUnreal("OpenSSL/ue4@adamrehn/{}") self._requireUnreal("nghttp2/ue4@adamrehn/{}")
Then, I modified the GDAL.Build.cs to remove the extra lib being added to crypt32.lib when the precomputed data was being added, thereby also solving the issue that has been linked.

image

I have got Unreal GDAL working for 5.3.2, and I would like to thank you for your help. I would also request you to let me add all my changes made to UnrealGDAL to your repo as a branch for 5.3.2

@iwer
Copy link
Author

iwer commented Jan 9, 2024

Very nice! Feel free to prepare a pull request, i'd be more than happy to review it when i'm back.

@iwer
Copy link
Author

iwer commented Feb 12, 2024

I just discovered, that there is an effort to make UnrealGDAL UE5.3 compatible by ssav7912 and then wolfgangp. While I have not yet found the time to test it, it may be a straw, for everyone struggling with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment