Is it possible to create WinRT project with cmake? - c++

To create WINRT project we need to have CMake >= 2.8.10 and:
Set project type to be Windows Store App(CMAKE: SET_TARGET_PROPERTIES(target PROPERTIES VS_WINRT_EXTENSIONS TRUE)
Add compiler flag /ZW for WinRT compilation(CMAKE: ADD_DEFINITIONS(-ZW))
Add App.xaml.h, App.xaml.cpp
Add App.xaml so VS will generate some additional files from it(CMAKE: HOW?)
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.

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

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.

Related

Installing a library in Visual Studio 2019 C++

I am trying to install this library in Visual Studio 2019
https://github.com/alex-87/HyperGraphLib
The instructions only show how to do so for linux/unix I was curious how I would do this for windows. I can download the .zip but where would I extract this and how do I get Visual Studio to install the library.
Visual Studio can directly open a CMake project (CMakelists.txt indicates that).
That said, very often projects are in theory "cross platform" but in practise they don't work in Windows because no one has bothered to test them there (mostly because an alternative would already exist or the actual developers do not care much). Projects that have better chances to work with Windows usually come also with a .vcxproj/.sln.
click on project, properties, link editors , input and add the dependencies (with keyboards only )

Adding dependencies to a setup project Win32 application Visual Studio

Hi I am looking to create a setup project for my Win32 application developed using Visual Studio 2013. I have created the setup.exe using InstallShield However now i also need to add dependencies which should be installed along with the required application when setup.exe is run.
The dependencies are simply Visual C++ Redistributable for Visual Studio 2015.
I went through this article for creating the setup.exe for my application. But I did not find any documentation which directs me how to add dependencies to this installer.
I found this document which describes a walkthrough for adding dependencies but that is no more possible in Visual Studio 2013 as much as I am aware. Now we 'NEED' to use Install Shield. Correct me if I am wrong.
Please direct me to some documentation which will guide me to add dependencies to my setup project.
UPDATE
I found in the InstallShield Project Assistant an option to check for installation requirements. But it requires you to specify the directory to search the particular file. As far as I know the Visual C++ Redistributable package is not installed in any particular location but the only way to detect its presence is to check if the registry key is set to 1.
So instead of checking I'd rather always have the setup file to install the Visual C++ Redistributable package no matter it is present or no.
But even for that how do I go about it?
There might be other reasons you need to use InstallShield that I'm not aware of, but in the simple case of a C++ app that needs the runtime as a prerequisite, I'd use Visual Studio 2015 (Community Edition will do) and add the Installer project extension. The project properties lets you build a prerequisite installer (a setup.exe) and among the choices are the VC++ runtimes. That's just an exe that does its checks and installs if required.
I'm not sure how you got a VC 2015 C++ requirement while developing with VS 2013. Again, VS 2013 also has a community edition and an installer project extension that will install the VS 2013 C++ prerequisites.
The redistributable installers have their own checks to see if they need installing. I wouldn't expect InstallShield to require you to know the detection rules of a C++ runtime. that's a bit odd. There may be another setting where you just say C++ runtime required.

Integrating separate Qt and Visual studio 2008 projects together

I have a Qt project(.pro) which essentially uses Qt libraries and OpenGL and i need to integrate this project with an existing VS2008 project(.vcproj) which uses a 3rd party API on another system.
The VS project interfaces with a hardware(along with many other functions) through a serial port and i intend to use its event handler to trigger the actions in Qt( since a serial port cannot be opened by two programs simultaneously? )
I use Qt v4.8.1 with mingw complier. i did come across a VS plugin for Qt. but i'm not sure as to how the above task of integration can be done.
I'll be thankful if you can kindly shed some light on this.
My advice would be to completely integrate the source of the Qt project into the VS project. It's possible to compile Qt code in visual studio. Of course, this requires to configure your VS project to make it "qt-ready". In detail:
Integrate the source code of the qt project into the VS solution. This means, the header files, the cpp files and the ui files you might have.
You still need the Qt libraries on your system in order to compile QT source with visual studio. I recommend to install "qt-win-opensource-4.8.1-vs2008.exe". These are the special Qt 4.8.1 libaries for VS 2008 (pre-compiled). Can be found here: http://download.qt-project.org/archive/qt/4.8/4.8.1/
You have to tell visual studio how to "pre-compile" the Qt source with the installed Qt binaries. This can be down in two ways:
I. You can configure the project properties of your VS project. Unfortunatelly I have never used this way, so I don't know exactly how to do this.
II. You can use CMake to setup your VS project. CMake allows the simple integration of Qt libaries and compilers. Using CMake means to write a CMakeLists.txt, which generates the VS project for you. Here you can find a sample, explaining how to write a CMakeLists.txt with Qt support: http://www.cmake.org/Wiki/CMake/Tutorials/Qt
Also, the Qt plugin for visual studio you mentioned is optional. You do not need it to build a Qt project with visual studio, but it makes some issues easier, e.g. debugging or calling the Qt designer from visual studio.
Hope this helps,
Michael

Visual Studio 2013 msvcr120 to msvcr100

Is it possible to change the restrib file to msvcr100 so other computers can run the program without having problems with the .dll file? If so how do i get that?
I do compile the program and other people can't use it because of the missing msvcr120.dll file. So it would be great if i could change that somehow.
Is it possible to install the Plattformtoolset without a older Visualstudio version?
You have a few choices:
Install VS2010 on the machine, and set the Platform Toolset option to v100.
Install the Windows SDK v7.0A from here, which SHOULD / CAN add a new option to your Platform Toolset menu in VS2013. Getting this to work can be quite fiddly though. (It's rarely worked for me right out of the box). Note if you use MFC in your application, this option isn't any good for you - MFC libraries are not included with this SDK.
Get your users to install the Microsoft VS 2013 C++ Redistributable Package from here, and carry on regardless.
Statically link to the VS2013 runtimes, instead of using dynamic linking to the runtime DLLs. You can set this in the IDE through project settings under C/C++ > Code Generation > RunTime Library > Multi-threaded (/MT) or (/MTd). All the needed code will be compiled into your app, which will make the files bigger, but will avoid the issues you mention.
In Project > Properties > General, there is a setting called Platform toolset. You can use that to change the version of the build toolchain used.
One thing to consider in regards to changing the platform toolset: it changes the compiler, so C++ features newer than Visual Studio 2010 will not compile. It also requires the other version to be installed.
The best way to handle this would be to give them the Visual C++ Redistributable for Visual Studio 2013.
You could either have them do it themselves, or make an installer.

How do I configure Qt to work with Visual Studio 2010?

I downloaded open-source version of Qt from the site and have compiled it with nmake, but I'm having trouble using it in my projects. It seems that Visual Studio can't find the Qt headers, even though I added the paths to my PATH, INCLUDE, and LIB variables. I tried installing the Qt Visual Studio add-in but it only supports Visual Studio 2008.
Has anyone gotten Qt to work with Visual Studio 2010? Or do I have to wait until Qt 4.7 is officially released for Visual Studio 2010 support?
Either download the pre-built vs2008 package or build it using cmake's vs2008 profile and then open the resulting .sln file in vs2010 and let it do the conversion.
edit - annoying feature so far is that the vs plugin doesn't support vs2010 which makes it essentially impossible to use for desktop app development.
Traditionally VS support was part of the paid licences, with the OS package you only get mingw support. Things are changing, but might have some rough edges for a while.
OTOH, mingw has a HUGE advantage: deployment. You don't have to chase around the vcredist_x86 files and all the associated voodoo. Just be sure to include all the .DLLs you use and that's it.
Also, there's QtCreator. It's not as featureful or omniscient as VS; but it does feel a lot nicer and easier to use. It takes off all the tedious work of nmake, and embeds the UI editors. And it's cross platform!
honestly, for me VS can drop dead this minute and i won't miss it.
Qt V4.8.0 contains prebuilt binaries for Visual Studio 2010 so you don't need to build manually anymore:
http://qt.nokia.com/downloads/windows-cpp-vs2010