views:

75

answers:

2

Hey folks,

I'm currently porting a POSIX C++ application to run on Windows without Cygwin or anything. No problem so far. Now, the application (ZNC, an IRC bouncer, in case you're interested) supports loading modules from .so shared library files on Linux/BSD etc.

I ported the main executable without much of a problem, all wrapped into a VS 2008 project file and stuff. Now, said modules are all separate .cpp files which can't be linked into the executable as they all export symbols like GetVersion(). And it isn't feasible anyway.

So, to cut a long story short, I want to (have to) compile all the modules (over 20) into separate DLL files. I don't want to create a single VS project for each however. Which means I'll probably have to create a makefile? Or something the like? I've never done that before on Windows, so that's my question. What is the best approach to compile a bunch of .cpps into separate DLL files (with the same settings, all stored conveniently in one place/file)?

Thanks in Advance! I.R.

+1  A: 

As far as I know there is no built in way to do this. So here is what I would do:

  1. Convert one of the modules into a DLL, make sure it works and everything is kosher.

  2. Write a script to generate the other 20 vcproj's from the one reference vcproj that works. I don't know the details of your module system so i'm not sure how strait forward that will be.

  3. Add them into the solution.

Hopefully that works.

Jon Clegg
+1  A: 

cmake works pretty well with MSVC, and is cross-platform. You can list all your libraries in one (or, at your option, one per dll) CMakeList.txt file and it will generate a solution with all the project files. On unix, it generates makefiles.

Oh, and in Windows, make is called nmake, if I'm not mistaken.

mmh I didn't realize cmake works on Windows, too, so I'm going to play with that :) thanks everyone so far!
KiNgMaR
+1 for suggesting CMake, it would simplify builds of this kind of projects pretty much
mloskot