caseymcc / UE4CMake

Provides a simple way to add a cmake lib to any Unreal Engine 4 (UE4) or 5 (UE5) project.
MIT License
78 stars 14 forks source link

Cannot configure cmake project. Exited with code: 1 #1

Closed pinecone69 closed 2 years ago

pinecone69 commented 3 years ago

When generating my project files, ue4-cmake says it can't configure the cmake project.

I have CMakeTarget.add(Target, this, "libname", Path.Combine(ModuleDirectory, "../ThirdParty/libname"))

where "../ThirdPary/libname" is the directory to the cmake library's source.

The source is pulled from FastNoise2 with submodules included

I have added the CMakeLists.txt to the same directory as my project's build.cs

P.S. I'm not sure how credible I am when I say I get this error because I am particularly new cmake

caseymcc commented 3 years ago

I will try and see if I can get a sample project working with FastNoise2 (built this for another lib so haven't tested with FastNoise2 yet). What version of UE are you using (haven't test with latest or 5 yet)?

caseymcc commented 3 years ago

There was an issue with FastNoise2, the NoiseTool needs to be turned off as it requires a few libs that have to be manually installed (no support in Hunter). Luckily I had already worked on adding cmake args to build script so just had to update the project here with those changes (see latest push https://github.com/caseymcc/UE4CMake/commit/2647ac41a8b28beffba01649088f6accc5438781). Also added https://github.com/caseymcc/UE4_FastNoise2 as an example.

Let me know if that works out for you.

pinecone69 commented 3 years ago

So I updated the code in build.cs (added new CMakeTarget code and added cmake args) and updated the CMakeLists.txt file in the same directory where my build.cs is. I still get the error where it says cannot configure cmake project. Exited with code: 1. I tried this on both UE 4.26.2 and UE 4.25.4.

My visual studio version is VS 2017 15.9.23 if that helps

I'm also wondering what is in "../Deps/FastNoise2" in the FastNoise2 Example project because I'm not exactly sure if the library source I'm putting there is correct (as I mentioned I had cloned FastNoise2 with submodules included).

caseymcc commented 3 years ago

The example uses FastNoise2 as a git submodule, meaning that when you git it you should use

git clone --recurse-submodules https://github.com/caseymcc/UE4_FastNoise2.git

or

git clone https://github.com/caseymcc/UE4_FastNoise2.git
git submodule update --init --recursive

you do not need to copy the files into it.

I tested it with UE 4.25.4 using VS2019 (although the VS version I would not think matters).

pinecone69 commented 3 years ago

Git does not seem to be creating the submodules for me when I use either command, so there is some issue on my side it seems - and manually adding FastNoise2 does not resolve it. I've been trying to look into it.

caseymcc commented 3 years ago

Just tried it myself, looks like something is wrong with the repo. Will check it out later today.

caseymcc commented 3 years ago

Sorry been a while since I messed with this but recently started working with UE4 again so I had to make some changes to get this working better. I was able to get it working as a plugin now, seems a little hacky so some things may break just let me know if you hit something and when I get time I will look into it.

I updated the FastNoise2 example (https://github.com/caseymcc/UE4_FastNoise2) and it should work fine now.

pinecone69 commented 2 years ago

Thanks for continuing to work on it!

I want to make sure I'm doing this right: I added the CMakeTarget plugin to my project, update my .uproject file to enable the CMakeTarget plugin.

In my project's build.cs, I added the following:

CMakeTarget.add(Target, this, "FastNoise2", Path.Combine(this.ModuleDirectory, "../Dependencies/FastNoise2"), "-DFASTNOISE2_NOISETOOL=OFF");

where Dependecies/FastNoise2 is the repo I pulled from https://github.com/Auburn/FastNoise2 with submodules included.

So when I try to run my project, I get the error: "The source directory C:/Users/rgnie/Documents/Unreal Projects/voxel/Source/voxel/Projects/voxel/Source/ThirdParty/generated/FastNoise2/toolchain.cmake does not exist."

I believe the correct directory would be: C:/Users/rgnie/Documents/Unreal Projects/voxel/Source/ThirdParty/generated/FastNoise2/toolchain.cmake

So if this error is not a result of me following instructions incorrectly it can be inferred that there is an error in UE4CMake where it can't locate the ThirdParty folder correctly.

caseymcc commented 2 years ago

The directory you are reporting for sure looks wrong, something is getting duplicated. In the output there should have been a line like this

m_modulePath: {some path}

curious what that says. It maybe that you typed the add command wrong once and it wrote the files incorrectly the first time. It may not be updating the build files after that (will need to look into that) if that is the case you just need to delete the ThirdParty/generated directory and modify you project's .Build.cs (add some spaces or blank lines) to force the rebuild.

caseymcc commented 2 years ago

also I am generally on discord when I am on my machine. setup a channel for this project so you might catch me live there https://discord.gg/4AYSjfEByn. I will add it to the readme as well.

caseymcc commented 2 years ago

Fixed, discussion on discord. Issue was caused by a space in the project path. Several of the cmake calls had to have "'s added to fix it.