@Roy Li Can we use clang-cl being shipped with VS. So basically can the below be achieved?
WinUI project using MSBuild build system (i.e Visual Studio Generator) and for compiler/linker as clang-cl compiler shipped with Visual Studio.
So this is how I am trying.
- installed clang-cl vis VS load
- Generated CMake cache using CMake like below cmake -G "Visual Studio 17 2022" -T ClangCl D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master>cmake -S . -G "Visual Studio 17 2022" -T ClangCL -- Building for: Visual Studio 17 2022 -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621. -- The C compiler identification is Clang 15.0.1 with MSVC-like command-line -- The CXX compiler identification is Clang 15.0.1 with MSVC-like command-line And this automatically picks clang-cl shipped with
- But when I build like below, it fails. D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master>cmake --build . It fails with below error
D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src/App.xaml.h(4,10): fatal error : 'App.xaml.g.h' file not found [D:\Wi nUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\DemoApp.vcxproj] D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\MainWindow.xaml.cpp(9,3): error : use of undeclared identifier 'Initi alizeComponent' [D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\DemoApp.vcxproj] D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\MainWindow.xaml.cpp(15,12): error : function 'IsSettingsInvoked' with deduced return type cannot be used before it is defined [D:\WinUI\cmake-cpp-winrt-winui3-master_LLVMclang-cl\cmake-cpp-winrt-winui3-master\src\DemoApp.vcx proj]
It seems MSBuild did not generate App.xaml.g.h/App.xaml.g.xpp (and many more files that gets generated if we use VS cl compiler) which means that MSBuild did not run the xamlCompiler task.
Is there anything specific need to be done to resolve this issue ?
Regards,
Mohsin Siddiqui