ubisoft / Sharpmake

Sharpmake is an open-source C#-based solution for generating project definition files, such as Visual Studio projects and solutions, GNU makefiles, Xcode projects, etc.
Apache License 2.0
927 stars 171 forks source link

Same source filenames leads to obj outputs overwritten #264

Closed ChemistAion closed 1 year ago

ChemistAion commented 1 year ago

I am playing with such a project lately: https://github.com/GPUOpen-LibrariesAndSDKs/RenderPipelineShaders/tree/main/src/runtime/common

There is a case with two rps_rpsl_host sources expressed as a c and cpp with the same filename stem (within the same directory), respetivielly:

In the project CMake is used, which automatically detects such a combo and generates, full name-scope for these two files:

It is done by pointing out ObjectFileName property to the full filename in vcxproj, only for these two files, i.e.: <ClCompile Include="D:\___rps\src\runtime\common\rps_rpsl_host.c"> <ObjectFileName>$(IntDir)/runtime/common/rps_rpsl_host.c.obj</ObjectFileName> </ClCompile>

Is there a way to point out ObjectFileName per source-file in Sharpmake?

belkiss commented 1 year ago

You can use conf.ObjectFileName to remap the object file name for those duplicates.

Read the comment carefully, as it can slow down the compile time :)

https://github.com/ubisoft/Sharpmake/blob/bb553aa35c2a99d107897b7663fbfda482123c20/Sharpmake/Project.Configuration.cs#L1737