Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create WinRT project with cmake?

To create WINRT project we need to have CMake >= 2.8.10 and:

  1. Set project type to be Windows Store App(CMAKE: SET_TARGET_PROPERTIES(target PROPERTIES VS_WINRT_EXTENSIONS TRUE)
  2. Add compiler flag /ZW for WinRT compilation(CMAKE: ADD_DEFINITIONS(-ZW))
  3. Add App.xaml.h, App.xaml.cpp
  4. Add App.xaml so VS will generate some additional files from it(CMAKE: HOW?)
  5. Add Package.appxmanifest with description so VS will use it(CMAKE: HOW?)

Thank you.

UPDATE: CMake bug report referring to this question is here 0013749: Cannot target Windows 8 RT from CMake without workarounds.

like image 420
ixSci Avatar asked Nov 05 '12 09:11

ixSci


People also ask

Is CMake better than Visual Studio?

CMake is a better build system than Visual Studio projects and solutions. It is compact and much more easier to maintain even for Windows only projects. See CMake for Visual Studio Developers for some reasons.

Does UWP use WinRT?

WinRT applications are applications that use Windows Runtime framework. More specifically, these are Windows Store and Universal Windows Platform (UWP) applications.


2 Answers

CMake guys are working on it: Bug report at cmake.org

like image 66
borx Avatar answered Oct 23 '22 06:10

borx


This is perfectly doable. Things have considerably changed since this question was initially asked. The most significant changes are:

  • Visual Studio natively supports CMake since Visual Studio 2017 (see CMake support in Visual Studio). It's not longer required to separately download CMake, and have it generate .sln and .vcxproj files. CMake is part of the Visual Studio installation, and can be parsed by Visual Studio's project management infrastructure and build system.
  • C++/CX is no longer the only way to produce and consume Windows Runtime components. C++/WinRT provides a standard C++ language projection of the Windows Runtime API surface, with the ability to consume and produce Windows Runtime components.

With these changes you can use CMake to create a C++ project that builds a Windows Runtime application. C++/WinRT is standard C++, and Visual Studio 2017 provides built-in CMake support.

like image 40
IInspectable Avatar answered Oct 23 '22 04:10

IInspectable