DannyDaemonic
Chieftain
- Joined
- Jun 6, 2010
- Messages
- 25
Current version: 1.0
Today's my birthday, but I have a gift for you.
The makefile everyone has been using is bad. It looks like it started as a codeblocks makefile, but it's not how makefile are suppose to be. You aren't suppose to have a separate target for each source file. I've written a better one. It uses rules instead of listing each cpp file. It also uses nmake preprocessing to build a list of cpp files so you don't have to be editing the makefile.
I added a BLACKLIST macro so that it won't try to compile CvTextScreens. If you are compiling for older versions of civ4 you might want to comment the BLACKLIST line out.
This makefile should work with ALL versions of Civ4 CvGameCoreDLL. It works with vanilla, warlords, and bts. It should also work with BULL, ACO, Better Bts AI, etc.
CvGameCoreDll is set up to use precompiled headers, but the old makefile doesn't take advantage of this. This is a huge speed up, especially when STL is involved.
Here are the two timings Visual Studio building stock Civ4 BTS CvGameCoreDLL:
Time Elapsed 00:07:10.55
Time Elapsed 00:02:04.90
The old makefile takes 344.7% longer! On larger projects it will be more significant, even 400%+.
The other improvement I've added is `fastdep` support. `fastdep` is only optional, and is not enabled unless you uncomment the line for it in the makefile (or use the makefile I've included with it). This allows us to mimic the built-in dependency support Visual Studio normally has. For those not in the know, this lets us recompile the source files affected when we make a change, especially a change to a header file. With the old makefile, if you change a header you have to clean and rebuild everything, otherwise things could crash unexpectedly, or simply not link. This saves you time with that step.
Why use this makefile?
Attachments
I've attached 3 7z and 3 zip archives. The first is just the makefile. The second is the makefile and fastdep. (Just put fastdep.exe in a bin directory in your project folder.) And the 3rd, as required by GPL, is the modified fastdep source code. (I had to fix a couple bugs for it to work with Civ4). I've added a 4th attachment of each type: Visual Studio 2010 project files.
Today's my birthday, but I have a gift for you.
The makefile everyone has been using is bad. It looks like it started as a codeblocks makefile, but it's not how makefile are suppose to be. You aren't suppose to have a separate target for each source file. I've written a better one. It uses rules instead of listing each cpp file. It also uses nmake preprocessing to build a list of cpp files so you don't have to be editing the makefile.
I added a BLACKLIST macro so that it won't try to compile CvTextScreens. If you are compiling for older versions of civ4 you might want to comment the BLACKLIST line out.
This makefile should work with ALL versions of Civ4 CvGameCoreDLL. It works with vanilla, warlords, and bts. It should also work with BULL, ACO, Better Bts AI, etc.
CvGameCoreDll is set up to use precompiled headers, but the old makefile doesn't take advantage of this. This is a huge speed up, especially when STL is involved.
Here are the two timings Visual Studio building stock Civ4 BTS CvGameCoreDLL:
Time Elapsed 00:07:10.55
Time Elapsed 00:02:04.90
The old makefile takes 344.7% longer! On larger projects it will be more significant, even 400%+.
The other improvement I've added is `fastdep` support. `fastdep` is only optional, and is not enabled unless you uncomment the line for it in the makefile (or use the makefile I've included with it). This allows us to mimic the built-in dependency support Visual Studio normally has. For those not in the know, this lets us recompile the source files affected when we make a change, especially a change to a header file. With the old makefile, if you change a header you have to clean and rebuild everything, otherwise things could crash unexpectedly, or simply not link. This saves you time with that step.
Why use this makefile?
- You don't have to change the makefile once it's setup. You don't have to edit it to add new files or remove those you no longer use.
- Did I mention it's 300-400% faster? CvGameCoreDLL was designed to be used with PCH.
- It handles dependencies automatically. `fastdep` is an amazingly fast dependency generator. Runs in under 0.1 seconds!
- No knowledge is needed for a simple build user and only basic knowledge of make for a real developer.
- Generates dependencies in a separate file. You can include this file for people who don't have or want to use fastdep.
- Now uses /Zi instead of /ZI (faster/smaller debugging executable).
- Statically linked fastdep.
- Added another include path to support different versions of Windows Platform SDK.
- No longer tries to build a resource file if CvGameCoreDLL.rc is missing.
- Clearer error message when fastdep is missing but enabled.
- Modified Makefile to be compatible with all versions of Windows.
- Added zip archives.
Attachments
I've attached 3 7z and 3 zip archives. The first is just the makefile. The second is the makefile and fastdep. (Just put fastdep.exe in a bin directory in your project folder.) And the 3rd, as required by GPL, is the modified fastdep source code. (I had to fix a couple bugs for it to work with Civ4). I've added a 4th attachment of each type: Visual Studio 2010 project files.