Sharpmake: Files with identical names in different subdirectories don't build in Xcode projects.

Hey,

When trying to build spirv-tools I wrote a sharpmake script which included everything under the ‘source’ subdirectory, which works fine when generating a visual studio project. However it doesn’t in Xcode, looking closer at the generated project it seems like the second occurrence of a file that has an identical name isn’t configured to build (in this case different ‘basic_block.cpp’ files exist under the two folders ‘opt’ and ‘val’).

The folder structure looks something like this:

  • source
    • val
      • basic_block.cpp
    • opt
      • basic_block.cpp

In the generated Xcode project file the PBXSourcesBuildPhase section only has a single ‘basic_block.cpp’ entry, if I manually associate the second ‘basic_block.cpp’ with the spirv-tools target then a second one is added, so it does seem to be an issue with the generation of the file.

The sharpmake project itself, which works with visual studio on windows, doesn’t do anything particularly suspicious:

Name = "SpirvTools";
SourceRootPath = Path.Combine("[project.SharpmakeCsPath]", "vendor/spirv-tools");
SourceFilesExcludeRegex.Add(Sharpmake.Util.RegexPathCombine("spirv-tools", "source", "link"));
SourceFilesExcludeRegex.Add(Sharpmake.Util.RegexPathCombine("spirv-tools", "source", "lint"));
SourceFilesExcludeRegex.Add(Sharpmake.Util.RegexPathCombine("spirv-tools", "source", "diff"));

// Custom registration for ObjectFileName redirects across all configurations
AddObjFileRedirect(Path.Combine("source", "val", "basic_block.cpp"), "basic_block_val.obj");
AddObjFileRedirect(Path.Combine("source", "val", "function.cpp"), "function_val.obj");
AddObjFileRedirect(Path.Combine("source", "val", "instruction.cpp"), "instruction_val.obj");

This is happening on the latest release, Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 15

Most upvoted comments

he reproduced the problem and has a fix. this should be merged pretty soon