0

I'm trying to understand this so I can get a project up and running using CMake.

Let's say I have the following IDL file:

namespace HelloWorld{
  [default_interface]
  runtimeclass HelloWorld
  {
    HelloWorld();
    String SayHello(String name);
  }
}

What are the steps required on the command line to generate a Windows run time component that I can use?

I'm trying to understand this so I can get a project up and running using CMake.

mohamedmoussa
  • 547
  • 4
  • 13
  • 1
    It's involved. See [this Q&A](https://stackoverflow.com/q/56823779/1889329) to get started. – IInspectable Jan 08 '20 at 10:30
  • Thanks for that. I'm quite confused as I'm not sure how `cppwinrt` ties into all of this. The `HelloWorld.h` file generated by `midl` looks nothing like the header files generated using the Visual Studio extension. Did you end up getting CMake to work for your project? – mohamedmoussa Jan 08 '20 at 10:35
  • 1
    MIDL consumes IDL files and produces the raw, ABI-level structures (plus the .winmd, if requested). cppwinrt, on the other hand, consumes .winmd files, and generates the *projected* (and implementation) types, as expressed by C++/WinRT. I never got this to work with CMake. It may be possible, but it's a *lot* harder than simply getting this to compile on the command line. There are too many artifacts generated along the way, that CMake needs to be told about. – IInspectable Jan 08 '20 at 11:35
  • Thank you. Maybe the best option for now is to try remove the CMake requirement. – mohamedmoussa Jan 09 '20 at 04:50
  • 1
    In case you find time to pursue this further, you may find the following helpful: To understand the MSBuild process better, you can try to run [MSBuild Log Viewer](http://msbuildlog.com/). It'll allow you to view the actual build steps that are run. Also, C++/WinRT is hosted on [GitHub](https://github.com/microsoft/cppwinrt). The [cmd_reader](https://github.com/microsoft/cppwinrt/blob/master/cppwinrt/cmd_reader.h) encodes some of the logic to find the SDK and .winmd location. – IInspectable Jan 10 '20 at 17:33

0 Answers0