Cmake/juceaide Windows issue on direct2d branch

Has something changed in the direct2d branch in either juceaide or juce cmake?
When building with that branch I get the following errors:

-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
CMake Error at Z://modules/juce/extras/Build/CMake/JUCEUtils.cmake:540 (message):
  Running juceaide failed:

  command:
  Z:/<path>/waveform/waveform12/build_win/juce/tools/extras/Build/juceaide/juceaide_artefacts/Debug/juceaide.exe
  winicon;Z:/<path>/waveform/waveform12/build_win/Waveform12_artefacts/JuceLibraryCode/icon.ico;Z:/<path>/waveform/waveform12/../common/binarydata/icon_w12.png


  output:
Call Stack (most recent call first):
  Z:/<path>/modules/juce/extras/Build/CMake/JUCEUtils.cmake:596 (_juce_execute_juceaide)
  Z:/<path>/modules/juce/extras/Build/CMake/JUCEUtils.cmake:648 (_juce_generate_icon)
  Z:/<path>/modules/juce/extras/Build/CMake/JUCEUtils.cmake:2008 (_juce_configure_bundle)
  Z:/<path>/waveform/common/cmake/build.cmake:170 (juce_add_gui_app)
  CMakeLists.txt:7 (include)


-- Configuring incomplete, errors occurred!

<path> has no spaces in it (replace for readability) and the exact same command works if I switch to the develop juce branch.

I should also note that this is on a Mac M2 machine using a Windows VM so the VM is ARM64.
Invoked with cmake -B build_win -A x64
Visual Studio 17 2022

CMake version 3.28.1

Any ideas?

1 Like

Are you using Parallels?

If so, Parallels only supports up to DirectX 11.1; the JUCE Direct2D renderer requires DirectX 11.2.

So that may be the issue - but, of course, you should still be able to build. I’ll have to give that some thought.

Matt

I am using parallels so that’s a shame but yes I thought I should be able to build still.

From the cmake output it looks like juceaide.exe fails with the winicon command but it doesn’t look like there are any differences between the branches. I’ll keep digging as well.

Does it make a difference if you install the Direct2D Debug Layer?

I suspect this is something going wrong with creating the images required to produce icon files, which will default to D2D on the direct2d branch. Using an explicit software image type in juceaide will probably fix things, but falling back gracefully would be much better.

I was able to build and run the DemoRunner on Parallels on my M1 Mac, but I had to install the Direct2D debug layer first.

I’ll try the cmake build tomorrow.

Matt

@t0m yes that does seem to the be the issue.
@matt installing the Direct2D debug layer did also fix the problem though and I can build again now.

Thanks!

1 Like

OK, good.

Normally, I would not expect the debug layer to be required, but it obviously is in this case.

Right now the debug layer is enabled for debug builds, which can be useful but is also slower:

D2D1_FACTORY_OPTIONS options;
#if JUCE_DEBUG
    options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;
#else
    options.debugLevel = D2D1_DEBUG_LEVEL_NONE;
#endif
D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, 
    __uuidof (ID2D1Factory1), 
    &options,
    (void**)d2dSharedFactory.resetAndGetPointerAddress());

I’ll push a change that will disable the debug layer by default.

Matt

You can add a juce module option for it.

That’s a good idea.