New makefile (faster compilation, profiling and more)

I'm trying a new setup with Visual Studio 2012
Does anyone else using it? Should I stick with VS 2010 or 2008?
 
The included project file is for 2010, but it will automatically upgrade if opened by a newer version. The only issue in this regard is that it will not downgrade, meaning if I go ahead and add some brand new version, everybody would have to install the newest. Back when I picked 2010, it was because it was like 10% of the size of the new one. However Microsoft has since removed the MSVC++ only download for 2010 (well 2010 entirely) and the new argument is I can't be bothered to upgrade :p

I would highly recommend reading this thread when starting a new mod: http://forums.civfanatics.com/showthread.php?t=564062
It's a small easy change when starting, but painful later on and it could save a whole lot of time and problems.
 
The included project file is for 2010, but it will automatically upgrade if opened by a newer version. The only issue in this regard is that it will not downgrade, meaning if I go ahead and add some brand new version, everybody would have to install the newest. Back when I picked 2010, it was because it was like 10% of the size of the new one. However Microsoft has since removed the MSVC++ only download for 2010 (well 2010 entirely) and the new argument is I can't be bothered to upgrade :p

:cool:

I would highly recommend reading this thread when starting a new mod: http://forums.civfanatics.com/showthread.php?t=564062
It's a small easy change when starting, but painful later on and it could save a whole lot of time and problems.

Yeah, I'm following that thread, it's a great initiative :goodjob:
I hope it will reach as many modders as possible
However I'm not starting a new mod, it's just for good ol' RFCE :)
Still keeping it in mind, so no worries
 
I'm having troubles with compilling under Visual Studio 2012
Your project file updated without any problems, but the compiling adds 100+ errors even with vanilla BtS c++ files
Is it possible that it's because VS 2012 got incompatible with the old toolkit or old sdk?
That would be my first guess, as I still tried to use the ones linked in Asaf's thread
 
I'm having troubles with compilling under Visual Studio 2012
Your project file updated without any problems, but the compiling adds 100+ errors even with vanilla BtS c++ files
When something like that happens, copy paste the errors into the forum inside a spoiler. At least do it with the first errors as they are usually the key to what went wrong.

Is it possible that it's because VS 2012 got incompatible with the old toolkit or old sdk?
That's unlikely because it works for other people. Also VS 201x is used to make it easier for humans to see what goes on. What happens while compiling is that it actually generates command line code, which calls VS 2003. It has to be that one because if exe and dll are compiled with different versions of the compiler, odd stuff can happen.

That would be my first guess, as I still tried to use the ones linked in Asaf's thread
You need to install VC 2003. I'm not 100% sure about the SDK because in theory you need it, but I tried having problems installing it and I just ignored it and it worked anyway :crazyeye:

You need to go through step 1 on this page:
http://modiki.civfanatics.com/index.php?title=How_to_Install_the_SDK
Naturally you should skip the makefile, but you can't do without the rest.
 
Tested it with a couple SDKs

The old one (the one in Asaf's thread) definitely has some big compatibility issues
I can upload the errors if you want, but I doubt it's useful

I'm running windows 8.1, there are 4 windows sdk folders for me under program files:
v6.0A, v7.0A, v8.0, and v8.0A
(In your makefile the default SDK setting is v7.0A)
Using that SDK results in only 2 errors, the main being:
error U1077: '"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe' : return code '0x1'
file: CvGameCoreDLL\NMAKE
There is no rc.exe in that folder, although there is one in the v6.0A folder
Did I make a mistake when setting up the compiler?

There are also a larger number of pragma warnings (900+), but I think they are harmless
All with the same message, connected to different files in the Windows Kits:
warning C4068: unknown pragma
file: C:\Program Files (x86)\Windows Kits\8.0\Include\um\joystickapi.h
All are pointed at #pragma region Desktop Family, #pragma region Application Family, or #pragma endregion
 
You need to install VC 2003. I'm not 100% sure about the SDK because in theory you need it, but I tried having problems installing it and I just ignored it and it worked anyway :crazyeye:

You need to go through step 1 on this page:
http://modiki.civfanatics.com/index.php?title=How_to_Install_the_SDK
Naturally you should skip the makefile, but you can't do without the rest.

Ohh, I have a working compiling setup for Visual Studio 2008, with an older makefile obviously.
Just wanted to give your new one a try, the new compiling options are appealing :)
Anyway, I have VC2003 installed, and know the (very) basics of the procedure, so the makefile setup should be ok.
 
Try removing the old project files, particularly CvGameCoreDLL.rc. It is a known cause of problems.

In fact what I usually do is to make a project files folder. Here I use Makefile.project to set
Code:
SOURCE_DIR = ..\CvGameCoreDLL
This keeps source code and project files apart and if you only add the files from Makefile 2.5, then it should be clean of relics like the .rc file. The source dir could then only contain .cpp .h and .inl. If it complains about the CvText... whateever, remove that file. It's pointless to leave the file it can't compile anyway.
 
Try removing the old project files, particularly CvGameCoreDLL.rc. It is a known cause of problems.

In fact what I usually do is to make a project files folder. Here I use Makefile.project to set
Code:
SOURCE_DIR = ..\CvGameCoreDLL
This keeps source code and project files apart and if you only add the files from Makefile 2.5, then it should be clean of relics like the .rc file. The source dir could then only contain .cpp .h and .inl. If it complains about the CvText... whateever, remove that file. It's pointless to leave the file it can't compile anyway.

Yeah, I wanted to report that your makefile somehow didn't blacklist the CvTextScreens file.
Simply deleted it, but might be wise to investigate it further for users who don't know that that file is there by mistake.

There is no CvGameCoreDLL.rc, and I use a clean folder.
Might be good to fully separate the folders though, thanks.
 
Alright, managed to sort it out with VS2012 too.
Still getting the pragma warnings though.
Can you confirm they are harmless?

Anyway, thanks for the efforts of building the makefile :)
Do you want the logs with the old SDK?
 
Here are the logs if you are curios, both the successful with the pragma errors, and the one with old sdk
 

Attachments

  • CvGameCoreDLL_logs.7z
    5.9 KB · Views: 249
Alright, managed to sort it out with VS2012 too.
Still getting the pragma warnings though.
Can you confirm they are harmless?
I can't really tell without knowing which warnings you get. All I get is one warning when I link. That one happened in vanilla as well. Anything else would be new.

Anyway, thanks for the efforts of building the makefile :)
I wrote the makefile to cover my own needs. Since it is much better than 1.0, I decided on making this thread. I didn't change anything in the makefile to make it distributable or anything like that. To be honest I still think the makefile sucks, but that is due to limitations in nmake and MSVC. If I had known what I know now, I would have started on a new makefile using GNU make (the one linux use) as it is far superior and would have saved a lot of frustrations. However right now it's like if it ain't broke, don't fix it.

Do you want the logs with the old SDK?
If it's the one with the warnings, then sure.

EDIT:
I left the browser open for a while and you posted the log in the meantime. Lucky me, no wait time :)

Code:
CFLAGS = /wdC4068
Add that line to Makefile.settings and the warnings should go away. I think it's due to the old compiler not knowing the "future" pragmas in 8.0. I would ignore it unless the game turns out to be unstable. If it is, then you need to use the SDK.
 
Try removing the old project files, particularly CvGameCoreDLL.rc. It is a known cause of problems.

In fact what I usually do is to make a project files folder. Here I use Makefile.project to set
Code:
SOURCE_DIR = ..\CvGameCoreDLL
This keeps source code and project files apart and if you only add the files from Makefile 2.5, then it should be clean of relics like the .rc file. The source dir could then only contain .cpp .h and .inl. If it complains about the CvText... whateever, remove that file. It's pointless to leave the file it can't compile anyway.

One additional thing to this:
If I set the Makefile.project to that folder, VS won't find the project files for displaying them
Still looking for them in the main directory.
 
One additional thing to this:
If I set the Makefile.project to that folder, VS won't find the project files for displaying them
Still looking for them in the main directory.
You select "add existing item" and then select all the files in the source directory just like you would do when adding files from the same directory. Granted if you already added the files to the project and then moved the project files, it will be a problem and you have to remove the files from the project and then add them again.
 
You select "add existing item" and then select all the files in the source directory just like you would do when adding files from the same directory. Granted if you already added the files to the project and then moved the project files, it will be a problem and you have to remove the files from the project and then add them again.

Ahh, silly me :)
I indeed forgot that I did it that way before :crazyeye:
 
Nightinggale, thanks so much for all your support here ...

I have what I imagine is a stupid user mistake, but I can't figure it out.

When I compile from VC2008, I receive this error:
Unable to start program 'c:\[directory structure]\Mods\[MyMod]\Assets\CvGameCoreDLL\CvGameCoreDLL.dll"

I realize that a .dll is not an executable, but I don't know what I'm doing wrong. Any help?

Thanks so much in advance!
 
I realize that a .dll is not an executable
In that case you know more than MSVC does. It just tries to execute the compiled file even if it is a dll file.

What you need to do is to execute the exe itself. You can do that the same way as any player would do, which is to double click the shortcut to the mod or just open the exe and load the mod.

If you want to open the mod from the project, then you place this perl script next to the project files and executes it while the project is closed. It's designed for MSVC 2010, but it may work for 2008 as well.
https://sourceforge.net/p/civ4-modcomps-by-nightinggale/code/ci/master/tree/Project%20Files/SetupPaths.pl

It handles the setup in most cases, but not all. The official way to set up the project to start the exe is to open some window and write:
Code:
C:\....\Civ4BeyondSword.exe mod=\"mymod"
In other words it's the same as what you put in the shortcut to open the mod directly from a shortcut.

The main problem with setting up the start line from the project itself is that I have forgotten where you do that. It wasn't easy to find and since I wrote the perl script, I haven't had the need to do it again.

If the project is set up correctly, it can run the mod directly and it is possible to start debug DLLs with the debugger attached from the start. This can be very useful, particularly if you need to debug xml loading or even something earlier than that, the code being executed when the DLL gets attached to the exe.
 
Ha! Thanks, Nightinggale ... I'm not sure if that's funny or tragic. ;)

Maybe this is the nut of it: where does the compiler save MY new CvGameCoreDLL.dll to? I've looked through all of the directory structures (below my mod directory) and can't seem to locate it. As an aside, the console does say the build was successful, buuuut "then where'd you out my friggin file, VC?!? Where?" ;)

Thanks again!
 
Top Bottom