I've been cobbling this little bash script together for issues I've had with Unreal Engine 4 using KDevelop5 on Linux.
This script should set everything up (KDevelop project files, semantic highlighting and autocompletion) so you can simply code, build and run.
Tested with Unreal Engine 4.26.2 on KDE Neon 20.04
Also check out the .gitignore
file in this repo for a good base for your own Projects.
You must have already compiled Unreal Engine and created a project.
A single dependency is required for parsing the Unreal project file.
- jq
You may want to add
FixKDev5.sh
and*/.kdev_include_paths
to your projects.gitignore
file.
Copy FixKDev5.sh
to the root directory of your project then run it like so:
./FixKDev5.sh [-s|--skip-generate]
The -s
or --skip-generate
argument can be passed to save a little time if you are sure the project has been generated since you last added any files.
The script will try to find your copy of UnrealEngine 4 by searching in ~/.local/share/applications
for a file called com.epicgames.UnrealEngineEditor.desktop
.
If this file can not be found then the script will fallback to searching in these directories:
~/UnrealEngine
~/Epic/UnrealEngine/
~/EpicGames/UnrealEngine/
~/Epic Games/UnrealEngine
If the script fails to find your build, you can specify it by setting the environment variable UE4DIR
.
As an example, if I had compiled UE4 under another folder ~/UE4
and the script couldn't find it:
UE4DIR=~/UE4/UnrealEngine ./FixKDev5.sh -s
To load projects a lot faster disable entire project parsing:
Whenever the editor re-generates a project (i.e. every time you create a new C++ class) it generates a lot of useless data for other IDE's. These extra steps can take a while and make the whole process feel a lot more sluggish, but you can configure the UnrealBuildTool to skip all the project types you don't care about.
To do this you can modify .config/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
so that it contains the following <ProjectFileGenerator>
section:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<ProjectFileGenerator>
<Format>KDevelop</Format>
</ProjectFileGenerator>
</Configuration>
To do this for an unmodified BuildConfiguration.xml
run this command:
sed -i 's,<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">,<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">\n\t<ProjectFileGenerator>\n\t\t<Format>KDevelop</Format>\n\t</ProjectFileGenerator>,' ~/.config/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml
If you have to use UE4DIR=...
every time you run the script, append this line to your ~/.bashrc
:
export UE4DIR=/path/to/UnrealEngine
This can be done with this command:
echo "export UE4DIR=/path/to/UnrealEngine" >> ~/.bashrc
Once this is set either log out and back in or run . ~/.bashrc
.
Now you can run the script from any project by running:
./FixKDev5.sh [-s]