Page 1 of 4

Help with setting up CMAke please

Posted: Fri Nov 22, 2013 1:34 pm
by Enjay
I'm starting with GZDoom but what I learn (I hope) will be applied to ZDoom too.

Here's where I have got to:

Downloaded CMake and installed it.
Pointed it at the location of the GZDoom git checkout on my HD.
Told it where to put an output.
Clicked configure.
Got the following.

Image
Spoiler:
So, how many of those red entries do I need to address? I can easily tell CMake where to find nasm but I've never even had yasm on my machine. Som of those entries just look like information rather than something for me to necessarily configure. Is that correct?

Basically, I don't know CMake well enough to know what I need to do next so some pointers would be great. Thanks.

Re: Help with setting up CMAke please

Posted: Fri Nov 22, 2013 2:15 pm
by Blzut3
You did it right. Just hitting generate now will work, but I would recommend putting the path to nasm in so the assembly code is used. The red just means those are new options.

Re: Help with setting up CMAke please

Posted: Fri Nov 22, 2013 3:55 pm
by Enjay
OK, well the path to nasm is in and when I hit "generate" it seems to do stuff but I don't get an exe or any PK3 files generated.

Here's my output folder:
Image

There are certainly some "could not find" messages in the CMake output text:
Spoiler:
I'm probably missing something obvious but I don't know what it is.

Re: Help with setting up CMAke please

Posted: Fri Nov 22, 2013 9:07 pm
by Blzut3
Did you open the project file in visual studio and compile? You should end up with a Debug or Release directory (depending on the build type selected in Visual Studio) which will contain the exe and pk3.

If you don't know what the not founds are, you probably don't care about them. ;) If something's required CMake won't complete.

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 1:05 am
by Enjay
Blzut3 wrote:Did you open the project file in visual studio and compile? You should end up with a Debug or Release directory (depending on the build type selected in Visual Studio) which will contain the exe and pk3.
:lol: OK. so I said that I was missing something obvious. I didn't realise that I still had to open something in Visual studio. I thought it was all supposed to happen automatically.

I am guessing that the project file I need is ALL_BUILD.vcproj? When I open it and try a release build in VC2008Express, I get linking errors relating to FMODEx.
Spoiler:
Any ideas on that one?

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 3:03 am
by Graf Zahl
Open the .sln file, just as you would do with the prebuild VC project.

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 3:19 am
by Nash
I don't understand any of the new-fangled stuff. So basically, as per discussion in the other thread; the gzdoom.sln file or whatever shouldn't be used, and instead we now have to generate it everytime with CMake? Am I getting this right? Or... ?

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 3:21 am
by Enjay
Well, I deleted the output directory to ensure a clean start and tried again. Opening the sln file in VC2008 Express and building gives me the same result.
Spoiler:

I've done a bit of digging and this seems relevant:

http://msdn.microsoft.com/en-us/library/2b054ds4.aspx

I tried forcing CMake to point to all of the different versions of link.exe I found on my HD by doing a search (i.e. I tried the different exes in turn, not at the same time). None of them made a difference.

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\link.exe
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\link.exe
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\win64\link.exe
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\win64\x86\AMD64\link.exe


[edit]And just by way of stumbling around in the dark blind research, opening every copy of delayimp.lib and link.exe that I could find and searching for __delayLoadHelper2 using a hex editor returned positive results in all files.[/edit]

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 5:46 am
by Enjay
Would this be something to do with me still using fmodex 4.26.36? I don't see why it would because using the original sln files doesn't throw up this error and it is my understanding that ZDoom doesn't work properly with fmodex after 4.26 either but... well, I'm just asking really.

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 6:55 am
by Graf Zahl
@Enjay:

Have you read what the page says? The problem seems to be that you link to an incorrect delayimp.lib. I never had such problems. For me it always worked with all compilers from 2005-2013.
If you can't resolve this you may just disable delayed loading of fmodex.dll.

UNfortunately this is hardcoded in the CMake file, so search for

/DELAYLOAD:\"fmodex${X64}.dll\"

and remove all occurences of it. This option should be user settable but I need to do a bit of research to do it right.


@Nash:

Once you created a project it will self-update if the CMakeLists.txt files change. Of course, if you have your child port you should add your new files to the project in the CMakeLists.txt file, not your working project because those will get overwritten when the CMake file changes.

As for abandoning the .sln files, blame Microsoft and their incompatible project files between compilers.
I dumped VC 2005 due to annoying stability problems and 2008 because it's a bug ridden mess. I currently use VC 2013 so it's impossible for me to maintain the old projects any longer - and I do not want to make GZDoom depend on the most recent version of VC. I also work only with the CMake generated project now (which is machine bound and non-transferrable) so whatever happens, there's just no way to keep a working VC solution in the repo.

CMake is still better than what some Linux-based developers do. They stubbornly stick to Unix tools and make it completely impossible to fork their code on Windows.

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 7:43 am
by Enjay
Graf Zahl wrote:Have you read what the page says? The problem seems to be that you link to an incorrect delayimp.lib.
Yes, I read that. That's the reason that I was searching for link.exe because the page says:
make sure the linker matches delayimp.lib. If there is a mismatch, you will get a linker error reporting either ___delayLoadHelper2@8 or ___delayLoadHelper@8 as an unresolved external symbol. The former implies a new linker with an old delayimp.lib, and the latter implies an old linker with a new delayimp.lib.
That looked to me like it was indicating a mismatch between delayimp.lib and the linker. So, I tried to resolve the issue from two sides: specifically pointing CMake at various link.exe files (which I assume is the linker) and I also tried messing around with the delayimp.lib files that I could find (eg moving old ones so that they were no longer in the search paths etc), though I was less clear on how I could do much with those files.

Interestingly, I did also try pointing CMake at fmodexp_vc.lib instead of fmodex_vc.lib just to see if that would make any difference. The error messages went away and I did get an exe. I didn't bother testing it though.
Graf Zahl wrote:If you can't resolve this you may just disable delayed loading of fmodex.dll.

UNfortunately this is hardcoded in the CMake file, so search for

/DELAYLOAD:\"fmodex${X64}.dll\"

and remove all occurences of it. This option should be user settable but I need to do a bit of research to do it right.
Interesting, I don't have that in any of the files in my CMake output directory (searched inside the files using TextPad). The closest I have is:

AdditionalOptions=" /machine:X86 /debug /DELAYLOAD:fmodex.dll"
AdditionalOptions=" /machine:X86 /opt:ref /opt:icf /nodefaultlib:msvcrt /TSAWARE /DELAYLOAD:fmodex.dll"
AdditionalOptions=" /machine:X86 /opt:ref /opt:icf /nodefaultlib:msvcrt /TSAWARE /DELAYLOAD:fmodex.dll"
AdditionalOptions=" /machine:X86 /debug /opt:ref /opt:icf /nodefaultlib:msvcrt /TSAWARE /DELAYLOAD:fmodex.dll"

in zdoom.vcproj

Commenting out those lines makes loading the project fail. However, just removing the "/DELAYLOAD:fmodex.dll" does give me an exe. So that seems like it might be progress.


However, I'd still like to be compiling things without this work around if possible. I wonder if uninstalling VC2005, VC2008 and then installing the latest version (Which I guess is Visual Studio Express 2013 for Windows [edit]Nope, that requires Win8[/edit]) might be the way to go?

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 8:39 am
by Graf Zahl
I meant you should change it in CMakeLists.txt, not the output directory. If you change CMake's output you'll lose the changes whenever something changes about the project settings. The project CMake generates is configured to re-run CMake automatically whenever the CMake project files are edited.

About the error, no, uninstalling compilers won't help. Somewhere you got a bogus delayimp.lib but it's hard to tell where that may have come from.

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 10:10 am
by Enjay
Graf Zahl wrote:I meant you should change it in CMakeLists.txt, not the output directory. If you change CMake's output you'll lose the changes whenever something changes about the project settings. The project CMake generates is configured to re-run CMake automatically whenever the CMake project files are edited.
Ah, right, understood. I wondered if that might be the case but I was trying to avoid editing files in the source directory in case I upload any of my builds to DRD. I like to make things as unaltered as possible for that. Still, if I need to, I guess I need to.
Graf Zahl wrote:About the error, no, uninstalling compilers won't help. Somewhere you got a bogus delayimp.lib but it's hard to tell where that may have come from.
That's the thing, I've searched and re-searched my HD, uninstalled a few things and I have only found 2 files called delayimp.lib. One, dated 29 July 2008 was installed with Microsoft Visual Studio 9.0/2008, the other, dated 18 March 2010 was installed today when I installed Microsoft Visual Studio 10.0/2010. However, I still get the error when compiling with with VS2008.

VS2010 does not give me the error and I get an exe that runs but there are some other errors and warnings when I compile it.

I uninstalled VS 2005 before I read your post but I guessed that, sooner or later, it was going to be redundant anyway.

This error in 2008 is really bugging me though.

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 10:57 am
by Enjay
For what it's worth, these are the errors that I get when using 2010. I don't know how serious any of them are but I do get what appears to be a functioning exe.
Spoiler:
Spoiler:
Spoiler:
Spoiler:
Are any of those important?

Re: Help with setting up CMAke please

Posted: Sat Nov 23, 2013 12:15 pm
by Graf Zahl
The last one is a problem which needs to be fixed in the repo.

The others are irrelevant. Some of the external code is not 100% standard compliant and throws warnings as a result.