Tutorial :Windows Build System: How to build a project (from its source code) which doesn't have *.sln or Visual C++ proj file (*.vcproj)



Question:

I'm facing this problem. So, I need to build the support libraries (zlib, libtiff, libpng, libxml2, libiconv) with "Multithreaded DLL" (/MD) & "Multithreaded DLL Debug" (/MDd) run-time options. But the problem is there is no direct way . I mean there is no *.sln / *.vcproj file which I can open in Visual C++ and build it.

I'm aware with the GNU build system:

$./configure --with-all-sorts-of-required-switches  $./make  $./make install  

During my search I've encountered with something called CMake which generates *.vcproj & *.sln file but for that CMakeLists.txt is required. Not all projects provide CMakeLists.txt.

I've never compiled anything from Visual C++ Command Line.

  • Generally most projects provide makefile. Now how do I generate *.vcproj / *.sln from this?

  • Can I compile with mingw-make of MinGW?

  • If I can, how do I set different options ("Multi-Threaded"(/MT), "Multi-Threaded Debug"(/MTd), "Multi-Threaded DLL"(/MD), "Multi-Threaded DLL Debug"(/MDd)) for run-time libraries?

  • I don't know what other ways are available. Please throw some light on this.


Solution:1

I believe all those projects include a .vcproj file (open/build in VC) and/or VC makefile (build with nmake).


Solution:2

You can just create a new project in Visual Studio and add the existing .cpp files to it.

Note that for several of the GNU libraries you've mentioned, you might have difficulty getting them to build on Microsoft Visual Studio's compiler, because as far as I know they are not shy about using GCC extensions in such programs.


Solution:3

Most projects work, when you create an empty Win32 project and drag all files into that.

Then change the output paths and maybe click throught several options.


Solution:4

You can create wrapper scripts for the compiler+linker to call the VC compiler and give them to configure by ./configure CC=my-visual-c-script CXX=my-visual-c++-script. I hacked the compile script distributed with automake to do this thing. Note that automake calls the compiler also to link, so the wrapper must decide if it must call the compiler or the linker.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »