Improved CvGameCoreDLL Makefile! AND ~71% faster compilation

Yes, that's what I went for the moment I read that with this you could simply load the project file and instantly compile the standard BTS dll. That solution sounded a lot simpler than the whole install this toolkit, and that Platform sdk, etc,etc.
And as long as I don't try /MTd, it works as expected. I guess I could try the /MTd plus "/NODEFAULTLIB:msvcprtd.lib" combination since I don't remember if I already did that.

The settings that work for me:
Spoiler :
Final_Release:
Compiler:
/O2 /G7 /I "Boost-1.32.0\include" /I "Python24\include" /I "CxImage\general" /I "CxImage\jpeg" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "FINAL_RELEASE" /D "LOG_AI" /D "_MOD_FRACTRADE" /D "_MOD_SENTRY" /D "_MOD_GOVWORKERS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MD /GR /Fo"Final Release/" /Fd"Final Release/vc70.pdb" /W3 /nologo /c /Zd /Gd
Linker:
/OUT:"Assets/CvGameCoreDLL.dll" /INCREMENTAL:NO /NOLOGO /LIBPATH:"Python24\libs" /LIBPATH:"boost-1.32.0\libs\\" /DLL /DEBUG /PDB:"Final Release/CvGameCoreDLL.pdb" /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE /OPT:REF /OPT:ICF /IMPLIB:"Final Release/CvGameCoreDLL.lib" /MACHINE:X86 boost_python-vc71-mt-1_32.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Boost-1.32.0\libs\boost_python-vc71-mt-1_32.lib"

and Final_Debug
Compiler:
/Od /G7 /I "Boost-1.32.0\include" /I "Python24\include" /I "CxImage\general" /I "CxImage\jpeg" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "LOG_AI" /D "_MOD_FRACTRADE" /D "_MOD_SENTRY" /D "_MOD_GOVWORKERS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /RTC1 /MD /Gy /GR /Fo"Final Debug/" /Fd"Final Debug/vc70.pdb" /W3 /nologo /c /Zd /Gd

Linker:
/OUT:"Assets/debug/CvGameCoreDLL.dll" /INCREMENTAL /NOLOGO /LIBPATH:"Python24\libs" /LIBPATH:"boost-1.32.0\libs\\" /DLL /NODEFAULTLIB:"msvcprtd.lib" /DEBUG /PDB:"Final Debug/CvGameCoreDLL_DEBUG.pdb" /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE /IMPLIB:"Final Debug/CvGameCoreDLL.lib" /MACHINE:X86 boost_python-vc71-mt-1_32.lib winmm.lib msvcprt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Boost-1.32.0\libs\boost_python-vc71-mt-1_32.lib"
 
/MT and /MTd are for a multithreaded DLL which I doubt Civ4 can use. Most games don't even have a separate UI thread, let alone real multithreading in the AI or game logic. Try /MDd with /NODEFAULTLIB:msvcprtd.lib for the debug build.

I guess since you have /MD working for that it isn't necessary. I probably switched it to /MDd and then found I had to add the /NODEFAULTLIB:msvcprtd.lib to get that to work. I just Googled each problem until I got it working, and then tweaked the things that didn't seem right based on the compiler option descriptions on MSDN. I've never done any Windows development, but at least I can understand what the options say, if not always precisely what they mean. ;)
 
Of course I meant /MDd - we are compiling a dll after all. An exe would need /MTd
/MD is multi-threaded dll, /MDd is multi-threaded debug dll - and everyone uses those for CvGameCoreDLL. So we could make civ4 multi-threaded - or at least everything that's exposed in the SDK (as you said, AI) and maybe reduce turn times; it's a lot of work and it requires great care and more skills, so I doubt anyone will do it but that doesn't mean it's not possible.

I did try googling the error that crashes my /MDd dlls, but never found out anything..
 
If I use the /MD switch, how do I make a block of code execute on another thread?
 
No, not me. The only idea I had was use simultanious turns in single player, for AI players. I believe this should at least not require any long investigations about what stuff can even run in parallel without screwing up randomly but I honestly don't think I could pull that off that easily. Remember I took a whole month for simple single-threaded civic AI and it's still not committed yet ..
 
Not to rain on anybody's parade, but I highly doubt that a modder could make anything useful happen for multi-threading. There is a whole concept of "thread-safe" programming using semaphores, and none of the base civ code uses this. If several AI's are running at the same time, one thread may make a change to a data structure used by another thread, while the other thread is in the middle of examining it.

If the entire code base were built from scratch around thread-safeness, this would be neat, but I highly doubt it could be retrofitted.
 
You aren't raining anywhere, I actually thought what you said was obvious. I never said it would be an easy, or even a sane thing to attempt it. I wouldn't have stopped anyone who'd like to try though.
My whole point was: it's not impossible: language, compiler and the used settings would support it. In theory ;)
 
That's what happens when I read compiler option switches at 6am. :rollseyes: Okay, so what did you change to make it work?
 
I wish I knew. Well in the case of /MDd I believe it was your NODEFAULTLIB hint that made it possible, it's what made me try change Final_Debug to /MDd instead of working off Debug, as I did before.
Why /Zi works again, not a clue. It's been almost half a month since my first first dlls and I set it to /Zd after my first attempts all failed because of it and never looked back. Until today.
 
Just posting thanks - finally got around to installing it and there were no problems at all with a RFC-based mod. Full rebuild went down to less than 5 mins from the usual 20, and the DLL is pretty much same size as before (5.60 vs 5.59 MB...) :goodjob:
 
hello,

i cant seem to get a compile to work,

i put the faststep in a bin folder inside the project folder,

but all i get is this:
Code:
Performing Makefile project actions
Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.
'Final_Release' is up-to-date
Build log was saved at "file://c:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\CvGameCoreDLL\Final_Release\BuildLog.htm"
CvGameCoreDLL - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


any chance of getting a bit of help?

im compiling revdcm dll.
 
If you're using Danny's makefile, you need to change the target in Visual Studio to "Release" instead of "Final_Release" unless you or RevDCM changed that makefile. VS defaults to "Release" but the makefile from Refar used "Final_Release". Danny left it as "Release" to make it easier to set up new projects in VS, but that means you have to modify old projects.
 
Double-check the makefile. If you see Release but not Final_Release, yes that's what you need to do.
 
ok,

Double-check the makefile.

humm 0 do i need to change the final release in the make file as well?

from what i can see theres only 3 places - for one instance:
Code:
Final_Release_GLOBAL_CFLAGS= /D_MOD_SENTRY /D_MOD_FRACTRADE /D_MOD_GOVWORKERS  /D_MOD_GWARM /D_MOD_SHAM_SPOILER
there too?

thanks.
 
No, what I'm saying is this:

  1. Your error message says there's no target named Final_Release.
  2. Danny's makefile uses Release instead of Final_Release.
  3. That makes me think you're using Danny's makefile.
If that logic is correct, fix your VS project. If not, that's not the problem. But if you're using Refar's makefile, changing it will mess it up further. I have never compiled RevDCM nor looked at its makefile, so the above is total conjecture based on your error message.
 
Top Bottom