Cafu visual studio solution?

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
User avatar
BRabbit
Posts:28
Joined:2010-08-16, 19:26
Location:Moscow, Russia
Cafu visual studio solution?

Post by BRabbit » 2010-08-17, 04:44

Hi, I've just downloaded the Cafu source and built it, everything was ok; but where are the VC++ .vcproj and .sln files? Or is there a way to use SCons to generate them? Apart from using the VC++ (2008) compiler I would like to use the IDE too, and the debugger (even more important). Thanks for your support.
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu visual studio solution?

Post by Carsten » 2010-08-17, 14:53

Hi BRabbit,
welcome to the Cafu forums! :welcome:
BRabbit wrote:Hi, I've just downloaded the Cafu source and built it, everything was ok; but where are the VC++ .vcproj and .sln files? Or is there a way to use SCons to generate them?
Unfortunately I don't know of a way to create .vcproj and .sln files from SCons (although that would certainly be very helpful).

The big advantage of SCons is that it allows us to build Cafu on all supported platforms with all supported compilers, without us having to address all those (very many, very different, and sometimes very weird) platform-specific build tools.

I've been considering switching to other build tools though in order to make building Cafu even simpler, such as Waf, Premake, CMake, etc., but so far I've never found the time to dig into them.
Apart from using the VC++ (2008) compiler I would like to use the IDE too, and the debugger (even more important).
I think you can do all that even without the .vcproj and .sln files - just open the related files in the IDE.

Especially the debugger can be used stand-alone with just the executable files; when it breaks, it will automatically show you the proper place in the code.

If you use the Express Edition of VC++, you may want to install WinDbg as a port-mortem (or "just-in-time") debugger, please see http://www.cafu.de/forum/viewtopic.php?p=3765#p3765 for more details.
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu visual studio solution?

Post by Carsten » 2010-08-19, 17:01

Just for completeness to the above post, and for future references:

Another build system candidate is gyp (and, less so, bakefile and qmake).

The most attractive ones seem to be waf, cmake and gyp, and there is a very insteresting thread about them at https://lists.webkit.org/pipermail/webk ... .html#8881

In essence, I think we should look into these and just try them out.
Best regards,
Carsten
User avatar
BRabbit
Posts:28
Joined:2010-08-16, 19:26
Location:Moscow, Russia

Re: Cafu visual studio solution?

Post by BRabbit » 2010-11-07, 17:57

Well, i know it's against cross-platform code, but I managed to make a VC++ solution with all the Cafu code, and it was pretty straight, tough. I have built all the code with no problems, but when it comes to the linking...mm..well, i found the library dependencies looking at the SConscript file, which says -in a rather complicated manner- what libraries are used by each of Cafu program (let's say, CaWE, the Cafu executable itself, the DLLs). So i compiled, linked and ran CaWE using my Visual Studio solution.
Anyway, there are some parts, specifically right now the OpenGL12 Renderer library that I couldn't link and I receive those 'unresolved externals' and 'conflicts with other libraries' nasty errors. I know that it must be some missing libraries, but i'm pretty sure I'm using all the libraries at least defined in the SConscript file.
So, Carsten, I would like to know:
-Are every program and library in Cafu Unicode? (Maybe this is a problem with the character set)
-Could you post what are the libraries needed?

I'm gonna put here a zipped complete solution (with no source code, so you can add the lastest code from the tracker), because i know some people including me are really conformed with MSW-only builds and used to some VC (the IDE part) features, like find and replace, debugging breakpoints (you are right when you say I can debug my program by waiting for the error to appear, but sometimes that's not the case), etc.
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu visual studio solution?

Post by Carsten » 2010-11-07, 20:39

BRabbit wrote:Well, i know it's against cross-platform code, but I managed to make a VC++ solution with all the Cafu code, and it was pretty straight, tough.
That's great to hear.
I've been investigating the above mentioned SCons alternatives, especially CMake, Premake and waf, but the big problem with all of them is that I have not yet found a way to make them build wxWidgets (as a part of the Cafu build process).

Nonetheless, if you'd manage to create e.g. a Premake4 (or CMake) script for Cafu, I'd be very interested in hearing about it!
Anyway, there are some parts, specifically right now the OpenGL12 Renderer library that I couldn't link and I receive those 'unresolved externals' and 'conflicts with other libraries' nasty errors. I know that it must be some missing libraries, but i'm pretty sure I'm using all the libraries at least defined in the SConscript file.
Note that neither Cafu nor CaWE directly link to the Renderer or Sound DLLs. These DLLs are linked dynamically at run-time: there is no need to account for them at link time.

You essentially need the libraries mentioned at
http://trac.cafu.de/browser/cafu/trunk/ ... ev=174#L87

and for Cafu:
http://trac.cafu.de/browser/cafu/trunk/ ... v=174#L100
http://trac.cafu.de/browser/cafu/trunk/ ... v=174#L101

and for CaWE:
http://trac.cafu.de/browser/cafu/trunk/ ... v=174#L158
http://trac.cafu.de/browser/cafu/trunk/ ... v=174#L162
So, Carsten, I would like to know:
-Are every program and library in Cafu Unicode? (Maybe this is a problem with the character set)
The source code files only use the lower 128 ASCII values, so they should be encoding agnostic. Cafu and CaWE both use some Unicode features, but that should not be a problem (especially not at the linking stage).
-Could you post what are the libraries needed?
Well, you're on the right track, and the most complete and accurate description is in the two files that you already considered:
http://trac.cafu.de/browser/cafu/trunk/SConstruct
http://trac.cafu.de/browser/cafu/trunk/SConscript
(also mind the code beginning at http://trac.cafu.de/browser/cafu/trunk/ ... v=174#L305)
I'm gonna put here a zipped complete solution (with no source code, so you can add the lastest code from the tracker),
Yes, I'd be happy about that! :-) (but a PreMake or CMake file would be even better ;-) ).
Best regards,
Carsten
User avatar
BRabbit
Posts:28
Joined:2010-08-16, 19:26
Location:Moscow, Russia

Re: Cafu visual studio solution?

Post by BRabbit » 2010-11-07, 22:30

Carsten wrote: Note that neither Cafu nor CaWE directly link to the Renderer or Sound DLLs. These DLLs are linked dynamically at run-time: there is no need to account for them at link time.
Yes, that's true. The thing is that i was actually linking the DLL itself. :P
Carsten wrote:
Yes, I'd be happy about that! :-) (but a PreMake or CMake file would be even better ;-) ).
OMG!! :shock: :shock:
By Wikipedia:
"CMake takes script files named "CMakeLists.txt" as input. It can generate makefiles and projects for many platforms and IDEs including Unix, Windows, Mac OS X, MSVC, Cygwin, MinGW and XCode. The platform's native build tools are used for the actual building."
This is what we need! A cross-platform build system but using the platform's ide (Visual Studio, XCode).
So you are right, I better make the CMakeList than a VC solution. Posting it soon!
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu visual studio solution?

Post by Carsten » 2010-11-08, 22:16

BRabbit wrote:This is what we need! A cross-platform build system but using the platform's ide (Visual Studio, XCode).
:cheesy:
Note that there is also Premake: http://industriousone.com/premake

My preliminary and certainly incomplete check left me with the impression that CMake is more mature, has more features, larger user base, and probably is able to deal also with corner cases.
However, it is also poorly documented (I got the book!), and the custom macro language is somewhat unfortunate as well.

Premake4, in contrast, uses (just like Cafu) the very elegant Lua programming language for its input description, and the documentation is straightforward. I'm not sure though if it can examine the target system in Autotools-style, which seems to be required for building wxWidgets.

Probably the only definitive way to learn which one is better (for our purposes) is to try them both. I've not yet had the time to do so, but if you made a start, it would certainly be a huge help.

(And note that initially, it would be enough to build the applications, e.g. CaWE and Cafu. This would still depend on having the libs build in a prior step (using SCons), but it would be a good beginning nevertheless.)
Best regards,
Carsten
User avatar
BRabbit
Posts:28
Joined:2010-08-16, 19:26
Location:Moscow, Russia

Re: Cafu visual studio solution?

Post by BRabbit » 2010-11-09, 16:26

Premake seems to be even easier than CMake. Here's information about building wxWidgets with premake: http://wiki.wxwidgets.org/Premake4
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu visual studio solution?

Post by Carsten » 2010-11-10, 12:41

BRabbit wrote:Here's information about building wxWidgets with premake: http://wiki.wxwidgets.org/Premake4
Unfortunately, this is a Premake example for building an application that uses wxWidgets.
It does not deal with building wxWidgets itself.
(The example is a good start, but ideally and eventually, we must be able to build wxWidgets itself with CMake or Premake as well. ;-) )
Best regards,
Carsten
Master Kira
Posts:1
Joined:2011-02-01, 14:53

Re: Cafu visual studio solution?

Post by Master Kira » 2011-02-01, 15:19

I'm a little new to this engine, and appear to be right for my purpose =).

I searched in forum and found this topic perfect for my question...

In a solution are needed: entry point (main, winmain, and so on...), files cpp and h (#include), libraries (link).
If i build a myself solution (with a standard entry point where attach all next, libraries and inclusions), where can i found all these needed?

Have BRabbit make that solution for Visual Studio? I hope XD

(I'm not so advanced in C++ programming XD)
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: Cafu visual studio solution?

Post by Carsten » 2011-02-01, 19:21

Hi Master Kira,
welcome to the Cafu forums! :welcome:
Master Kira wrote:In a solution are needed: entry point (main, winmain, and so on...), files cpp and h (#include), libraries (link).
If i build a myself solution (with a standard entry point where attach all next, libraries and inclusions), where can i found all these needed?
The problem is that Cafu consists of many libraries (just look in subdirectories Libs/ and ExtLibs/), and many executables -- making a VS proj or sln file had to cover them all.

As outlined above, I'm still open to it, but is there any problem with using SCons?
I know it feels foreign at first, but it's simple and convenient, and solves the problem well (you can still use the VS IDE for editing the files etc.; optionally also see this post: http://www.cafu.de/forum/viewtopic.php?p=4271#p4271)
Have BRabbit make that solution for Visual Studio? I hope XD
(I'm not so advanced in C++ programming XD)
Sorry, I don't know how far he got.
Best regards,
Carsten
ACB
Posts:1
Joined:2011-05-20, 20:49

Re: Cafu visual studio solution?

Post by ACB » 2011-05-21, 00:41

I created an Visual Studio Soloution for myself now.
It still uses scons to build but atleast it enables you to use Intellisense and you can use the Debugger more comfortably and ofc you can build directly from VC ;)

I made it for win32 and VC9 (2008) so if you use a different version you need to update the debug paths for all projects and build options (Project->Settings->Configuration->Debugging->Command).

The archive needs to be unpacked to your Cafu root folder!

If you want you can add it to the SVN repository.
Attachments
Cafu Engine VC9.rar
(12.08KiB)Downloaded 418 times
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests