How to produce platform independent source files (which can generate project files for anyone using cmake) from a visual studio solution? - c++

I know cmake is a tool which can produce visual studio solution files from source files. I see many of c++ projects are stored in the github in that way. My problem is how create that source. Is there anyway to generate it on visual studio or anyother way.? I have created a project by using visual studio . So I have the solution file. I want to upload it in to github as a portable source which can produce project files later using cmake for anyone.

Related

make visual studio add all necessary when building release

So I am working on an example project that displays video from a network stream.
The project is in C++.
After building the project in release, and trying to run the project on a different computer, I get errors on missing DLL files.
These DLL files are located within the installation location of Visual studio.
one example is msvcp140d.dll.
After copying all the missing files, I get a generic error with no specific file.
So:
Is there a way to tell visual studio to add all relevant files when building the project?

External C++ source files in android studio?

Here is the drill. I have a cross-platform project written mostly in C++ (more on this later) that runs on windows, android and ios.
Is there any way in which android studio can be configured to have a custom directory that contains all the native C++ code ? By custom, I mean external to the main folder in which the android studio project resides in.
I'm guessing you can see where I'm getting at... I have a cross-platform project that can be opened from 3 different IDE's... visual studio, android studio and xcode and I want to be able to write / edit / compile the code from all of them.
Let's say I have the following main hierarchy:
projectDir
src (C++ source files .cpp)
include (C++ headers .h)
_visualStudio (visual studio project)
_xcode (xcode project)
_androidStudio (android studio project)
assets (resources .png etc)
others...
This is what I want to achieve, but I am unable to figure out how can I configure an android studio project to be able to accept external source files, but most importantly to be able to see and edit them from the android studio IDE. Basically I want to tell android studio... "Look, this is the path for the native files, treat them as if they belong to the project".
I know this is possible from visual studio and from xcode because I already did that, but up until now I used my own build system for android and I had no need for android studio. Is there any way to achieve this ? Perhaps some kind of symbolic folder links ?
The thing is I want to keep only a single copy of my shared resources (src, include and assets should only be in one place, but should be available for android studio as well).
So far the only solution is to keep them inside android studio project directory, and change visual studio paths to look for them there, but I find this very nonprofessional.
EDIT:
Is there any addFileToProject (as in visual studio) in android studio in which the file can be outside the project ?
After a bit of more digging I found that it is actually possible.
You just have to create a directory junction like this (inside app/src/main/cpp where the files would normally be).
mklink \J linkName linkDestination(can be outside the project)
Android studio will be able to see the containing folder as it's own (it sees it as a link, but you can double click it to expand the contents). You can also edit source files inside it with the only mention that you have to add these files within CMakeLists.txt or whatever build file you are using in order to have intellisense (you get a sync warning from android studio if the files aren't referenced anywhere in the build files).
Later edit... if you are using junctions for Java / Kotlin files in an android studio project, make sure to set the source sets through the junctions as well... in order to avoid visual errors like 'duplicated class'.

How to move some files under version control from one project to another in Visual Studio 2015?

I use c++, mercurial as VCS and IDE - Visual Studio 2015. Sometimes I need to extract some files from project to separate project (in the same solution). Now for that I have to:
create new project in the same solution
use mercurial "rename" for all files I need to move
remove files from source project manually via Visual Studio
add files to destination project manually via Visual Studio
fix includes in these files
maybe something else (change namespace, etc.)
It would be nice making items 2, 3 and 4 at once (and somehow automatically). I Can't find anything suitable so I will be very grateful for any advice about it (maybe some tools, scripts, Visual Studio extensions or something else).

Run C++ analysis with VS solution file

I want to analyse a more complex C++-Project with SonarQube (v4.4) and the Cxx-Plugin v0.9.1 (Community C++).
It includes many sub-projects in different directories.
I got a VS2005 solution file (*.sln) which referes to the relevent *.vcproj files or alternativ mwc + mpc files.
I was now wondering, what the best way to do this analysis is.
Sure, I could write a sonar-project.properties file manually with all directories.
But isn't there a possibilty to run the analysis using the given workspace / project files I got? I could think of e.g. Sonar-Runner readout information from that files to create modules with given direcotry (and maybe automatically includes the defined addionaly includes).
I found Plug-Ins like "Analysis Bootstrapper for Visual Studio Projects Plugin" or the .Net-Plug-In, but obviously they don't support vcproj files.
Thanks for any help and best regards
Visual Studio comes with C++ static code analysis, but for 2005/2008 you need the team edition. 2010/2012 it is available in the premium edition. It is now available in the 2013 professional edition.
Otherwise I would look here

Build C++ Projects with Makefile using Visual Studio 2008

I downloaded cpptest from internet, and I want to build it using Visual Studio 2008.
The problem is that instead of .sln and vcproj file, Makefile.am is distributed, and I believe that all the all the necessary included file is included in the Makefile.am.
How to use Makefile.am to generate VS project files? I tried to use Cmake, but there is no CMakeList in the distribution.
Edit: Thanks to all the answers! There is a sln file distributed after all. But I am still interested to know the answer to my original question.
the visual studio project files for cpptest are in the win directory, not in the src directory where the makefile is..
edit
makefiles are meant to be used with GNU make. If you want that on windows, you can look at Mingw, GnuWin32 or Cygwin. But they also require gcc for compiling, so you won't really be using VS.
However, for most projects that do not have external dependencies it's no big deal if you do not have the VS project file: after all a makefile is just a list of the source files and some compilation options. To successfully build projects like cpptest, you could just create an emtpy VS project, add all source files to it, set output type to executable, build it and you're done. Eventually you can tune optimization options, but for the rest the default options will just do fine.
Go to win\VisualStudio.NET and you will find a VS solution file.
I just downloaded the archive and found the .sln file. It is under: /win/VisualStudio.NET. You can open that with VS2008 and update it, it should work.