The latest Cesium For Unreal plug-in compilation and development environment construction

The Cesium For Unreal plug-in can directly import Cesium 3D scene data into Unreal and take advantage of Unreal's powerful rendering capabilities. As of now, the latest version 1.22.0 has been officially released. Compared with the original Cesium For Unreal plug-in compilation and development environment construction, it has been simplified a lot. But despite this, because the IT development knowledge points involved are relatively comprehensive, there is still a certain threshold. The following will introduce to you the complete process of compiling version 1.22.0 of the CesiumFor Unreal plug-in and setting up the development environment.

The first step is to prepare the following tools and environment:

(1) Compilation tool CMake 3.15 or above (Website: https://cmake.org/install/)

(2) Development tool Visual Studio 2017 v15.6+ or Visual Studio2019 v16.5+.

(3) Unreal Engine 4.26 or above https://www.unrealengine.com/en-US/download

(4) Scientific Internet environment

The second step is to download the source code.

(1) Find a shallower save path, such as creating a folder in the root directory of the disk. The folder name should be as short as possible. Because the path is too long, various inexplicable problems will occur under the Windows operating system. Assume that the project code downloaded from git is placed in the "D:\CFU" folder.

(2) Execute the following commands in sequence:

git clone https://github.com/CesiumGS/cesium-unreal-samples.git
cd cesium-unreal-samples
mkdir Plugins
cd Plugins
git clone --recursive https://github.com/CesiumGS/cesium-unreal.git

The last sentence is to obtain the basic library that the plug-in depends on.

Note: The last sentence is very critical to obtain the dependent library. This can only be obtained recursively using git. This part of the content is not available when downloading the Zip code package directly from github.

If during the compilation process, it is prompted that some dependencies are missing, it is likely that the dependent library is incomplete. You can cd to the "Plugins\cesium-unreal" directory and use the following command:

gitsubmodule update --init --recursive

The third step is to build and compile the cesium-native library

Personally, I think it is more convenient to use CMakeGUI here, so I take CMake GUI as an example.

Select the path, use Visual Studio 2019 as the compilation tool, x64 bit, and click the "configure" button on the CMake GUI to generate the compilation configuration. Some warning messages will appear in the middle, which can be ignored. Then click the "Generate" button to generate the sln file of the project, and then click "Open Project" to open the project using Visual Studio 2019.

During the compilation process using Visual Studio 2019, an error will occur. The cause of the error is the strict compilation requirement setting, and the warning is regarded as an error. You can select the project properties and change "Treat warnings as errors" as shown below to "No".

After compilation is completed. Find the INSTALL project, right-click and select "Generate" or "Regenerate", and copy the dependent libraries just compiled (mainly static dependent libraries to the plug-in project, which are needed for plug-in compilation.)

The fourth step is to compile the CesiumFor Unreal plug-in

Open the project directory, copy the Source folder under "Project Save Directory\Plugins\cesium-unreal\Documentation" to "Project Save Directory", right-click the "CesiumForUnrealSamples.uproject" file, and select "GenerateVisual Studio project files", The sln file of the plug-in project will be generated. Double-click the sln file and open the project to perform plug-in compilation. During the compilation project, an error that the dependent library cannot be found will appear. This is because the compiled cesium-native version and plug-in compilation The versions are inconsistent. For example, cesium-native is the debug version and the plug-in is the release version, so the dependent lib file will not be found. You can select the correct version in Visual Studio 2019. As shown in the figure below.

Select the Debug Editor version and you can compile successfully. After compilation is completed, UnrealEngine4 can be opened in debugging state, and breakpoints can be set at any source code file in the project for debugging.

Next, you can edit your own scene in the Unreal Engine Editor!

Guess you like

Origin blog.csdn.net/ismartcube/article/details/129245241