1

I'm writing a C++ static library using Visual Studio 2008. My static library needs to be loaded by different executables for Windows and Linux (Red Hat)

Now, for the windows build I've got no problems since I'm developing using its environment (as I've already said VS 2008 on Win 8).

My problems occurs when I move the code on Linux. Sincerely I don't know what is the better solution.

So I'm here asking a few questions looking for the right choice:

  • Should I compile my executable on Windows using some tools to make a build for linux? Is this even possible? What tool? I tried Cmake but I hadn't found a way.

  • Should I compile my lib on windows, transfer it on my Linux system and compile in Linux an executable that loads my static library?

  • Is there a tool that merely converts my vcproj into a makefile? So in windows I only generate the makefile, send it to the Linux System and there compile everything?

The real problem is that I'm not that confident with makefiles, the project is really huge and create my own makefile from scratch is my last possible option and I'd like to avoid it since there's a lot of work to do and it could be time consumming

Thank in advance!

fredmaggiowski
  • 2,103
  • 2
  • 23
  • 42
  • 7
    You already have a VS solution, but otherwise I would recommend tools that can generate both solution files and makefiles for you, such as [CMake](http://www.cmake.org/). – Some programmer dude Jan 21 '15 at 08:44
  • Ok, i'll take another look at Cmake! Thanks – fredmaggiowski Jan 21 '15 at 08:51
  • 2
    CMake will facilitate going with your 3rd bullet point. The process would be that you (manually) "convert" your solution to a CMakeList file. From this file, you can generate a Visual Studio solution, or a Makefile, or a Ninja file, or an XCode project, or ... – Angew is no longer proud of SO Jan 21 '15 at 09:03
  • @FredMaggiowski in theory you can compile your library under Linux with mingw, so that it can run in Windows. So you need only one host to make a release for both platforms. See this [blog post](http://www.blogcompiler.com/2010/07/11/compile-for-windows-on-linux/) to get an idea. CMake should be part of this concept. See this [article](http://www.cmake.org/Wiki/CmakeMingw). – yegorich Jan 21 '15 at 10:42
  • already answered here: http://stackoverflow.com/questions/6649606/vcxproj-to-cmake – user3619296 Apr 11 '15 at 05:35
  • Thanks, I wasn't able to find this answer when I make my question. btw I solved using [Make It So](https://code.google.com/p/make-it-so/) – fredmaggiowski Apr 11 '15 at 09:24

1 Answers1

0

At the end of my journey searching for the right choice I've found the solution that best suits my needs.

What I've done was using Make It So that created makefiles for each project inside my solution, then transferred makefile together with source code, after a little customisation of the makefiles to suit my needs I compiled smoothly my code.

Thanks to those who commented, you helped me in my researches!

Cheers!

fredmaggiowski
  • 2,103
  • 2
  • 23
  • 42