Sharpmake icon indicating copy to clipboard operation
Sharpmake copied to clipboard

AdditionalSourceRootPaths is not supported in default generator

Open AlexandreJubert opened this issue 5 years ago • 4 comments

Hello,

I tried to use AdditionalSourceRootPaths to provide additional root folders: my projects usually have this kind of layout: / src/ src/main.cpp src/lib.cpp include/ include/lib.h bin/ bin/shaders/triangle.hlsl third-party/

Currently AdditionalSourceRootPaths is not used (only when using fastbuild and xcode it seems ?) to generate a non-blob project.

Is this something that's planned to be supported or you're looking for a PR to address this ?

Thanks for your time !

AlexandreJubert avatar Sep 16 '20 00:09 AlexandreJubert

Heya!

It should work for other generators, especially vcxproj. Could you send the code of the constructor of your project where you call the AdditionalSourceRootPaths?

belkiss avatar Sep 16 '20 07:09 belkiss

Hello,

Here is the code I'm using in the constructor. I'll attach a minimal repro code archive later today. I forgot to add previously, the .cs scripts are located inside a sharpmake folder at root, and everything is generated inside a solutions folder. The complete layout is the following: src/main.cpp src/lib.cpp include/lib.h sharpmake/main.sharpmake.cs generated/ bin/shaders/

    public SnowEngine()
        : base(typeof(HAL.Target))
    {
        Name = "SnowEngine";
        SourceRootPath = @"../src";
        AdditionalSourceRootPaths.Add(@"../include");
        AdditionalSourceRootPaths.Add(@"../bin/shaders");


        AddTargets(
            new HAL.Target
            {
                DevEnv = DevEnv.vs2017,
                Platform = Platform.win64,
                Optimization = Optimization.Debug | Optimization.Release | Optimization.Retail,
                GraphicAPI = HAL.GraphicAPI.Vulkan
            }
        );
    }

AlexandreJubert avatar Sep 16 '20 18:09 AlexandreJubert

Hum the setup looks correct, to me it looks like a resolving bug with the paths, we pretty much always give full paths to those properties so the relative paths as you use are not tested much :(

Could you try this:

SourceRootPath = @"[project.SharpmakeCsPath]/../src";
AdditionalSourceRootPaths.Add(@"[project.SharpmakeCsPath]/../include");
AdditionalSourceRootPaths.Add(@"[project.SharpmakeCsPath]/../bin/shaders");

belkiss avatar Sep 18 '20 07:09 belkiss

Hello @belkiss , I've tried this and I still have the same issue.

I've searched the repo for references to AdditionalSourceRootPaths ( https://github.com/ubisoft/Sharpmake/search?q=AdditionalSourceRootPaths&unscoped_q=AdditionalSourceRootPaths )

And it seems that it's references in the fastbuilt generator and the xcode one, but not in the visual studio ones, that may explain why it seems to be ignored ?

Again thanks a lot for your help !

AlexandreJubert avatar Sep 20 '20 22:09 AlexandreJubert