caseymcc / UE4_FastNoise2

Example for importing FastNoise2 into UE4
MIT License
12 stars 0 forks source link

Where to put FastNoise? #1

Closed sfla closed 2 years ago

sfla commented 2 years ago

FastNoise isn't actually added anywhere here? I tried adding it to my source/Game-folder, but it started to complain about missing imports for IMGUI etc, so I instead moved it outside the Source-folder, just put it in my root folder. When building now, it looks for FastNoise2 in a place where it has never been.

CMake Error at CMakeLists.txt:128 (add_subdirectory): 0> add_subdirectory given source "C:/Game Projects/MyGame/Source/MyGame/../FastNoise2" which is not an 0> existing directory.

And it's right, it's not an existing directory. I don't understand why it looks for it in top-level Source. Is that hard coded? Do I have to add it there?

caseymcc commented 2 years ago

This is mainly an example on how to use UE4CMake and there is some more information there to help, however for this example it is expecting FastNoise2 to be at Source/Deps/FastNoise2 based on the directory provided in FastNoise2Example.Build.cs

I will add it as a submodule for future and update the readme.

caseymcc commented 2 years ago

Upon checking it is already a submodule, when you checked out the repo did you run

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
sfla commented 2 years ago

Oh right. I never actually cloned the repo, I just looked through the content of the repo, and there was no Deps-folder in Source. But I can see in .gitmodules that it specifies the path there.

My issue remain. My build succeeds, but it outputs a "CMake Error". I have my FastNoise2-folder in Source now (same as you, but not inside "Deps". My Build.cs has this:

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

But I got errors. I thought maybe the path was wrong, so I tried entering a false path to see if it yielded the same error:

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

(Changing from FastNoise2 to FastNoise3). It gave me errors (I can't remember now if they were the same errors, even though that was the point). However: I have changed it back to what I presume is the correct path (With /FastNoise2), but I'm seeing some weird output still referencing the dummy FastNoise3-path.. First:

CMakeTarget load target: FastNoise loc: Game\Source\Game\..\FastNoise2
m_cmakeTargetPath: Game/Plugins/CMakeTarget/Source
0>m_modulePath: Game\Source\Game
0>Running: cmake.exe --build "Game\Source\Game\../ThirdParty\generated\FastNoise\build" --config Debug

The first line above here has the correct path. The last line above generates to generated/FastNoise/..., I assume because the CMakeTarget.add(..) adds with targetName:"FastNoise". Then it seems to know that it has to build, because some earlier generated file is outdated:

CMake is re-running because Game/Source/ThirdParty/generated/FastNoise/build/CMakeFiles/generate.stamp is out-of-date.
the file 'Game/Source/ThirdParty/generated/FastNoise/CMakeLists.txt' is newer than 'Game/Source/ThirdParty/generated/FastNoise/build/CMakeFiles/generate.stamp.depend'
result='-1'

but then it looks in FastNoise3: ????

CMake Error at CMakeLists.txt:128 (add_subdirectory):
add_subdirectory given source "Game/Source/Rover/../FastNoise3" which is not an existing directory.
Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043.
0>-- Configuring incomplete, errors occurred!

Why is it still looking for FastNoise3? That code has been removed, and project has been cleaned and built several times since.

sfla commented 2 years ago

Ok, I just deleted the entire "Source/ThirdParty"-folder and built again, and nothing happened, but then I added a "Console.WriteLine("Hello world"); in my .Build.cs, and then everything worked.

caseymcc commented 2 years ago

Likely when you ran it the first time the information was incorrect and when it generated the build files it generated them with the wrong information. I think it checks to see if the build files exists and skips the generation and therefore would never rebuild the build files even after you made changes. You have to remove the ThirdParty folder to fix it like you did. I had seen this myself but I do not have an easy way of checking if the cmaketarget info is changed, I will think on it and at the least add that info to the readme.