Page 1 of 1

Compiling GTK/SDL wtih CMake & MinGW on Windows

Posted: Mon Oct 20, 2008 9:35 am
by spacy51

I am getting into CMake and trying to compile the SDL/GTK build on Windoze Vista.

 

 

I think I found a bug in the CMakeLists.txt file, can anyone confirm this is a bug for Linux as well?

[code]Index: CMakeLists.txt

--- CMakeLists.txt (revision 770)
+++ CMakeLists.txt (working copy)
@@ -233,6 +233,7 @@

INCLUDE_DIRECTORIES(
${ZLIB_INCLUDE_DIR}

  • ${PNG_INCLUDE_DIR}
    ${SDL_INCLUDE_DIR}
    )

[/code]

Without it, I get problems in Util.cpp at #include .

 

 

 

Here's something else:

[code]Index: Patch.cpp

--- Patch.cpp (revision 770)
+++ Patch.cpp (working copy)
@@ -30,11 +30,12 @@
// #include "RTC.h"
// #include "Port.h"

-#ifndef _MSC_VER
-#define _stricmp strcasecmp
-#endif // ! _MSC_VER
+#ifdef __MINGW32_VERSION
+typedef off64_t __off64_t;
+#endif

#ifdef _MSC_VER
+#define _stricmp strcasecmp
#define fseeko64 _fseeki64
#define ftello64 _ftelli64
typedef __int64 __off64_t;
[/code]

 

MinGW does not know "__off64_t", but I found "off64_t" in the header files. Can anyone test if this issue also aplies to building on Linux? I would have to change the "#ifdef __MINGW32_VERSION" to "#ifdef GNUC" in that case.

 

 

After these to fixes, I get a "libvbamcore.a", but nothing else is built. I probably have to modify the "CMakeLists.txt" a little in order to detect GTK or something like that.

 

 

EDIT:

OK, I got the SDL build compiling&working without any further modifications. CMake is great.

 

EDIT2:

Hm, CMake only offers "FindGTK...", but nothing for GTKmm. The "CMakeLists.txt" uses pkg-config, but I read that it is poorly supported on Windows, and it will probably be a pain to set up.


Compiling GTK/SDL wtih CMake & MinGW on Windows

Posted: Mon Oct 20, 2008 12:24 pm
by bgK

Your first patch (PNG include) is ok to commit, it is a genuine bug. It is not triggered on Linux because the PNG headers are in the same folder as some other includes.

 

The second patch fails because you mixed the contents of a ifdef and a ifndef :

Code: Select all

«_stricmp» was not declared in this scope

 

Otherwise :

Code: Select all

#ifdef __GNUC__
typedef    off64_t __off64_t;
#endif

Works ok on GCC 4.2.3

 

I managed to make pkg-config work with GTKmm on MinGW (+MSYS), but using a custom GTKmm detection script is probably simpler (I know Inkscape has a nice script to do so).


Compiling GTK/SDL wtih CMake & MinGW on Windows

Posted: Mon Oct 20, 2008 12:36 pm
by spacy51

The second patch fails because you mixed the contents of a ifdef and a ifndef

 

Oh, you're right, my bad -_-"

 

 

Otherwise :

Code: Select all

#ifdef __GNUC__
typedef    off64_t __off64_t;
#endif

<div>

Works ok on GCC 4.2.3

</div>

 

I just committed this and the other patch. Did it work on GCC without that fix?

 

 

I managed to make pkg-config work with GTKmm on MinGW (+MSYS), but using a custom GTKmm detection script is probably simpler (I know Inkscape has a nice script to do so).

 

OK, thanks for the info.


Compiling GTK/SDL wtih CMake & MinGW on Windows

Posted: Mon Oct 20, 2008 12:38 pm
by bgK

<blockquote data-ipsquote="" class="ipsQuote" data-ipsquote-contentapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentid="236" data-ipsquote-contentclass="forums_Topic"><div>

Otherwise :

Code: Select all

#ifdef __GNUC__
typedef    off64_t __off64_t;
#endif

<div>

Works ok on GCC 4.2.3

</div>

 

I just committed this and the other patch. Did it work on GCC without that fix?

</div></blockquote>
 

Yup


Compiling GTK/SDL wtih CMake & MinGW on Windows

Posted: Mon Oct 20, 2008 1:00 pm
by spacy51

OK, then I hope both types have the same meaning. Why does UPS require large file support anyway? The patches are usually tiny, and the ROMs (at least GB/GBA) only several MB.