adamrehn / conan-ue4cli

Integrate third-party libraries into the Unreal Engine with Conan
https://docs.adamrehn.com/conan-ue4cli/
MIT License
87 stars 20 forks source link

The boilerplate module creates a folder named (literally) "$(ProjectDir)/Binaries/...." in the UE4 Source folder #16

Open Daan-xyz opened 2 years ago

Daan-xyz commented 2 years ago

This is probably due to the boilerplate code snippet:

        //Ensure our staging directory exists prior to copying any dependency data files into it
        string stagingDir = Path.Combine("$(ProjectDir)", "Binaries", "Data", "${MODULE}");
        if (!Directory.Exists(stagingDir)) {
            Directory.CreateDirectory(stagingDir);
        }

Possibly $(ProjectDir) should be ${ProjectDir} but I'm not (yet) familiar enough to know for sure.

BTW respecting how you are stong-arming all this build system/library chaos together :)

wl2776 commented 1 year ago

I also have this issue. Odd enough.

These variables are described in the UE manuals: https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/ThirdPartyLibraries/

It seems this feature doesn't work for some reason.

Or, if we notice that these character sequences ($, then (, then P, ...) appear only in calls to the RuntimeDependencies.Add method, it might be the case that these sequences are specially handled by that method and are consumed literally in other places.

wl2776 commented 1 year ago

I've studied sources of UE build tools. For example, in file C:\Program Files\Epic Games\UE_4.26\Engine\Source\Programs\UnrealBuildTool\Configuration\TargetRules.cs we can see the following

        /// <summary>
        /// Specifies a list of steps which should be executed before this target is built, in the context of the host platform's shell.
        /// The following variables will be expanded before execution:
        /// $(EngineDir), $(ProjectDir), $(TargetName), $(TargetPlatform), $(TargetConfiguration), $(TargetType), $(ProjectFile).
        /// </summary>
        public List<string> PreBuildSteps = new List<string>();

File C:\Program Files\Epic Games\UE_4.26\Engine\Source\Programs\UnrealBuildTool\Configuration\ModuleRules.cs

        public class RuntimeDependency
        {
            /// <summary>
            /// The file that should be staged. Should use $(EngineDir) and $(ProjectDir) variables as a root, so that the target can be relocated to different machines.
            /// </summary>
            public string Path;

variables will be expanded

This means that UBT stores these paths in its properties and changes them on the fly.