Improved CvGameCoreDLL Makefile! AND ~71% faster compilation

Im getting new errors at the end of compiling.
Code:
1> "C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin/rc.exe" /FoRelease\CvGameCoreDLL.res /IBoost-1.32.0/include /IPython24/include /I"C:/Program Files/Microsoft Visual C++ Toolkit 2003/include" /I"C:/Program Files/Microsoft SDKs/Windows/v7.0A/Include" /I"C:/Program Files/Microsoft SDKs/Windows/v7.0A/Include/mfc" CvGameCoreDLL.rc
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>CvGameCoreDLL.rc(20) : error RC2144 : PRIMARY LANGUAGE ID not a number
1>CvGameCoreDLL.rc(55) : error RC2135 : file not found: VS_VERSION_INFO
1>CvGameCoreDLL.rc(56) : error RC2135 : file not found: 3
1>CvGameCoreDLL.rc(57) : error RC2135 : file not found: 3
1>CvGameCoreDLL.rc(58) : error RC2135 : file not found: 0x17L
1>CvGameCoreDLL.rc(64) : error RC2135 : file not found: FILEOS
1>CvGameCoreDLL.rc(65) : error RC2135 : file not found: 0x2L
1>CvGameCoreDLL.rc(68) : error RC2164 : unexpected value in RCDATA
1>CvGameCoreDLL.rc(70) : error RC2135 : file not found: BLOCK
1>CvGameCoreDLL.rc(72) : error RC2135 : file not found: VALUE
1>NMAKE : fatal error U1077: '"C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin/rc.exe"' : return code '0xb'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
I stuck the rc file into the project directory, and i cant make heads or tails of these messages.
 
Yeah, sorry. I just didn't see the point in calling it all Final_Release. Maybe I should make a compatibility Makefile for people who would like a drop in replacement. I'll have to think about it.

Works for me now. Tyvm. :)
 
Im getting new errors at the end of compiling.
Code:
1> "C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin/rc.exe" /FoRelease\CvGameCoreDLL.res /IBoost-1.32.0/include /IPython24/include /I"C:/Program Files/Microsoft Visual C++ Toolkit 2003/include" /I"C:/Program Files/Microsoft SDKs/Windows/v7.0A/Include" /I"C:/Program Files/Microsoft SDKs/Windows/v7.0A/Include/mfc" CvGameCoreDLL.rc
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>CvGameCoreDLL.rc(20) : error RC2144 : PRIMARY LANGUAGE ID not a number
1>CvGameCoreDLL.rc(55) : error RC2135 : file not found: VS_VERSION_INFO
1>CvGameCoreDLL.rc(56) : error RC2135 : file not found: 3
1>CvGameCoreDLL.rc(57) : error RC2135 : file not found: 3
1>CvGameCoreDLL.rc(58) : error RC2135 : file not found: 0x17L
1>CvGameCoreDLL.rc(64) : error RC2135 : file not found: FILEOS
1>CvGameCoreDLL.rc(65) : error RC2135 : file not found: 0x2L
1>CvGameCoreDLL.rc(68) : error RC2164 : unexpected value in RCDATA
1>CvGameCoreDLL.rc(70) : error RC2135 : file not found: BLOCK
1>CvGameCoreDLL.rc(72) : error RC2135 : file not found: VALUE
1>NMAKE : fatal error U1077: '"C:/Program Files/Microsoft SDKs/Windows/v7.0A/bin/rc.exe"' : return code '0xb'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
I stuck the rc file into the project directory, and i cant make heads or tails of these messages.
Well I'm stumped with this one. You seem to be using the same toolkit and SDK as I am. A Google search didn't give any definitive answers either.

Could you check if C:/Program Files/Microsoft SDKs/Windows/v7.0A/Include/mfc/afxres.h is 0 bytes?

Add this line to the top of CvGameCoreDLL.rc and let me know if it gets further:
Code:
#include <windows.h>

Are you using this makefile from within Visual Studio? If so, what version of VS is it?


Works for me now. Tyvm. :)
You're welcome.
 
Code:
1>CvGameCoreDLL - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

:)

Adding that windows header file it what seems to have done it.
Thanks for your help
btw, im using VS 2008 express
 
I got it from the BTS CvGameCore folder in the main program, ill copy it below:
Spoiler :
Code:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include <windows.h>

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 3,1,7,0
 PRODUCTVERSION 3,1,7,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "Use the SDK to override the default game rules"
            VALUE "CompanyName", "Firaxis Games"
            VALUE "FileDescription", "Game core DLL for Sid Meier's Civilization 4 : Beyond The Sword"
            VALUE "FileVersion", "3, 1, 7, 0"
            VALUE "InternalName", "Sid Meier's Civilization 4 : Beyond The Sword Game Core DLL"
            VALUE "LegalCopyright", "Copyright (C) Firaxis Games.  All Rights Reserved."
            VALUE "OriginalFilename", "CvGameCoreDLL.dll"
            VALUE "ProductName", "Sid Meier's Civilization 4 : Beyond The Sword"
            VALUE "ProductVersion", "3, 1, 7, 0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED
I also had to copy that afxres.h file into my project directory, it wouldnt find it wherever it was looking.
 
Fantastic work. Much faster. And a cool energy saver!!!!!!!!!! :goodjob:

But the SDKs are very, very different! I needed this modification:

PHP:
#### Paths ####
TOOLKIT=C:/Program Files/Microsoft Visual C++ Toolkit 2003
PSDK=C:/Program Files/Microsoft SDKs/Windows/v6.0A
PSDK2=C:/Program Files/Microsoft Platform SDK

and

PHP:
#### INCLUDES ####
GLOBAL_INCS=/I"$(TOOLKIT)/include" /I"$(PSDK)/Include" /I"$(PSDK2)/Include/mfc"
 
I got it from the BTS CvGameCore folder in the main program
...
I also had to copy that afxres.h file into my project directory, it wouldnt find it wherever it was looking.

From your description of the error, it seemed like afxres wasn't defining anything needed. My intuition is that you could have just replaced "#include <afxres.h>" with "#include <windows.h>". Any chance you could test that? Just comment out the afxres.h include.

Fantastic work. Much faster. And a cool energy saver!!!!!!!!!! :goodjob:

But the SDKs are very, very different! I needed this modification:

Thanks! And I'm glad you were able to get it working. That change seems strange to me though because that change includes the directory "C:/Program Files/Microsoft Platform SDK/Include/mfc" rather than the expected "C:/Program Files/Microsoft Platform SDK/Windows/VERSION_NUMBER/Include/mfc". For example, mine looks like this:
Code:
Microsoft Platform SDK/Microsoft Sync Framework
Microsoft Platform SDK/Microsoft Sync Framework/v1.0
Microsoft Platform SDK/Silverlight
Microsoft Platform SDK/Silverlight/v3.0
Microsoft Platform SDK/Windows
Microsoft Platform SDK/Windows/v6.1
Microsoft Platform SDK/Windows/v7.0A
(what? I didn't install a Silverlight SDK!)

So it looks like the SDK was installed wrong? I wish there was less variance between all of these SDK installations. There is a free resource compiler called GoRC that I could include with the makefile and fastdep, but it seems to cause more problems than it fixes.
 
Very fast indeed... well done, DannyDaemonic!

I've found a minor oddity using Visual Studio 2010 (a problem related to VS 2010, not your makefile, but I thought I'd mention it regardless)- if I rename the "Final_Release" back to "Release" in the configuration menu, I lose the Nmake option under Configuration Properties and gain a lot more options. However, it's not a problem, because if I just change the commands (so Final_Release uses nmake Release and nmake Release_clean) it works fine.

Also, some people use the Microsoft Platform SDK provided on the Modiki rather than the one that comes with Windows. That's probably why the install paths are different.
 
Very fast indeed... well done, DannyDaemonic!

Thank you. I'm glad it's working.

TC01 said:
I've found a minor oddity using Visual Studio 2010 (a problem related to VS 2010, not your makefile, but I thought I'd mention it regardless)- if I rename the "Final_Release" back to "Release" in the configuration menu, I lose the Nmake option under Configuration Properties and gain a lot more options. However, it's not a problem, because if I just change the commands (so Final_Release uses nmake Release and nmake Release_clean) it works fine.
There are several 2010 bugs, for one, it's tricky to "clean" a build because it doesn't put nmake in the path. I found a simple work around for it, but yikes, 2010 has a ton of bugs.

TC01 said:
Also, some people use the Microsoft Platform SDK provided on the Modiki rather than the one that comes with Windows. That's probably why the install paths are different.
That SDK installer installs to platform's Windows/6.0 folder. Of course people can choose where to install it. It also doesn't help that non-free versions of Visual Studio often install their own versions of the SDK.

I wonder if I should edit that wiki...
 
Wow, this is so much faster. I had to make some changes, since I have three build options instead of your two (Debug, Release and Final_Release), but it was worth it!

The only hiccup I had was that my CyCityInterface1.cpp exceeded the module size, and I had to move about 200 def entries to the CyCityInterface2.cpp file for it to compile, so your changes are a bit pickier, but it wasn't a huge deal...

My compile time went from 12 minutes to 3! That's more than 70%, try 400%! ;)
 
Wow, this is so much faster. I had to make some changes, since I have three build options instead of your two (Debug, Release and Final_Release), but it was worth it!
My Release uses FINAL_RELEASE flags. I didn't see the point in just a regular Release, there is a Debug after all. So why the extra build?

Afforess said:
The only hiccup I had was that my CyCityInterface1.cpp exceeded the module size, and I had to move about 200 def entries to the CyCityInterface2.cpp file for it to compile, so your changes are a bit pickier, but it wasn't a huge deal...
I'm surprised the makefile affects this. What project were you building that hit this limit? Firaxis obviously hit this limitation with the stock source code, that's why they split it up in the first place. Perhaps this limitation only occurs when you are using the pre-compiled header.

Afforess said:
My compile time went from 12 minutes to 3! That's more than 70%, try 400%! ;)
Awsome, I'll have to update the title. Up to 400%!
 
One little thing, I can't seem to get fastdep to work. I probably broke it with my makefile changes. If you can fix it, great, if not, well, it recompiles so fast it hardly matters anyway.

View attachment Makefile.7z
 
My Release uses FINAL_RELEASE flags. I didn't see the point in just a regular Release, there is a Debug after all. So why the extra build?

I use the final release for ... wait for it... final releases; debugs for debugging crashes, and release for speed profiling. The debug build can speed profile too, but it slows the game down so much that it skews the data, whereas the release is only ~5% slower than the final release; but users shouldn't see the profile info. I also have a few various extra data logging enabled with release that isn't with final_releases.
 
Probably- you can replace the link to the outdated makefile with this one!
Many steps in the tutorial probably need to be changed as well. Such changes need to be made with care, though - I'd like to get all the bugs worked out here first. And it seems like everyone needs to be configured slightly differently.
I agree with deanej. I want to make sure there are no more bugs before doing this. However, I would like to point out that there are currently steps for editing the makefile in the wiki.
modiki.civfanatics.com said:
# Open the Makefile in your code editing program. You can use the freshly installed Visual Studio IDE, or something else if you prefer. Windows notepad does not work well here.
# At the very top, change the line that begins with TOOLKIT to the path of your Visual C++ Toolkit 2003 directory.
# Change the line that begins with PSDK to the path of your Microsoft Platform SDK.
# Save the Makefile and exit.
Of course we shouldn't need more editing than that. Some people have enough experience with Visual Studio and the like to figure out how to set up the SDK without using the Wiki.

The extra editing needed by Thomas SG earlier was simply because he had followed his own path in setting up the SDK. He didn't do anything wrong, but in such cases more editing will be needed. I think such people generally have the smarts to do the editing on their own (which Thomas SG was able to do).

If you follow the steps in the wiki one by one, there should be no special editing of the makefile. I'll just have to use a virtual machine with no developer stuff installed and follow the steps one by one, and make sure the makefile works in that setup.

Also, as a bonus, there are some steps we can simply remove because I simplified the Final_Release stuff by using the default target, Release.
 
One little thing, I can't seem to get fastdep to work. I probably broke it with my makefile changes. If you can fix it, great, if not, well, it recompiles so fast it hardly matters anyway.

View attachment 257628

Just by looking over the makefile I see you missed the fastdep final_release stuff. Change:
Code:
!ELSEIF [$(FD) --objectextension=obj -q -O Debug $(SOURCES) > depends] == 0 && \
        [$(FD) --objectextension=obj -q -O Release $(SOURCES) >> depends] == 0
To:
Code:
!ELSEIF [$(FD) --objectextension=obj -q -O Debug $(SOURCES) > depends] == 0 && \
        [$(FD) --objectextension=obj -q -O Release $(SOURCES) > depends] == 0 && \
        [$(FD) --objectextension=obj -q -O Final_Release $(SOURCES) >> depends] == 0
If something is still wrong you could save me a lot of time by sending me the output (use a SPOILER tag or PM).

I use the final release for ... wait for it... final releases; debugs for debugging crashes, and release for speed profiling. The debug build can speed profile too, but it slows the game down so much that it skews the data, whereas the release is only ~5% slower than the final release; but users shouldn't see the profile info. I also have a few various extra data logging enabled with release that isn't with final_releases.

If you're going to be using profiling to set function order or any of that, you're going to want to use Final_Release anyway, especially if you're logging stuff in Release that you aren't in Final_Release. I didn't think the DLL was slow enough to warrant using a Release vs a Final_Release, but I have worked on a projects where this was the case, so I certainly understand it. To my defense, the previous makefile didn't have a non-final release either.
 
If you're going to be using profiling to set function order or any of that, you're going to want to use Final_Release anyway, especially if you're logging stuff in Release that you aren't in Final_Release. I didn't think the DLL was slow enough to warrant using a Release vs a Final_Release, but I have worked on a projects where this was the case, so I certainly understand it. To my defense, the previous makefile didn't have a non-final release either.

When your Final Release DLL is 6.20mb... the game gets slow. I just try to minimize the damage. ;)

I updated the makefile with your extra line, but I'm still not seeing fastdep. Perhaps I'm doing something wrong. I tried to test it by adding an empty function in CvPlayer.cpp and CvPlayer.h, and using the Build command, but it just gives me the function not declared error. Is there something special I should be doing?
 
I updated the makefile with your extra line, but I'm still not seeing fastdep. Perhaps I'm doing something wrong. I tried to test it by adding an empty function in CvPlayer.cpp and CvPlayer.h, and using the Build command, but it just gives me the function not declared error. Is there something special I should be doing?

Hey a bug! It appeared after I edited the makefile to have a more friendly fastdep-not-found message. The fix you need is at the bottom of the makefile, there's also been a version bumb if you feel like editing it into your copy.

When it's working, there should be a file generated named depends that lists all files and their dependencies.
 
Top Bottom