Horde3D
http://horde3d.org/forums/

mingw32, cross compiling, build system
http://horde3d.org/forums/viewtopic.php?f=8&t=321
Page 1 of 4

Author:  Codepoet [ 30.04.2008, 16:09 ]
Post subject:  mingw32, cross compiling, build system

As I wrote in my Python thread I got Horde3D to compile using a cross compiler under Linux: mingw32.

To get this working I had to do the following:
Linker error, related to confusion between pow and powf:
Code:
diff --git a/Horde3D/Source/Horde3D Engine/egRenderer.cpp b/Horde3D/Source/Horde3D Engine/egRenderer.cpp
index d3a8823..6fc911f 100644
--- a/Horde3D/Source/Horde3D Engine/egRenderer.cpp
+++ b/Horde3D/Source/Horde3D Engine/egRenderer.cpp
@@ -729,7 +729,7 @@ void Renderer::updateShadowMap()
        for( uint32 i = 1; i < numMaps; i++ )
        {
                float f = i / (float)numMaps;
+               float log = nearDist * pow( farDist / nearDist, f );
-               float log = nearDist * powf( farDist / nearDist, f );^M
                float uni = nearDist + (farDist - nearDist) * f;

                _splitPlanes[i] = t * log + (1 - t) * uni;


wgl seems to be unsupported by mingw32:
Code:
diff --git a/Horde3D/Source/Horde3D Utils/main.cpp b/Horde3D/Source/Horde3D Utils/main.cpp
index be73011..b84a44a 100644
--- a/Horde3D/Source/Horde3D Utils/main.cpp
+++ b/Horde3D/Source/Horde3D Utils/main.cpp
@@ -22,7 +22,6 @@
 //
 // *************************************************************************************************

-
 #include "Horde3D.h"
 #include "utPlatform.h"
 #include "utMath.h"
@@ -39,10 +38,6 @@
 using namespace std;


+#ifdef __MINGW32__
+#undef PLATFORM_WIN
+#endif
+
 namespace Horde3DUtils
 {
        ofstream                        outf;


case matters on Linux:


Code:
diff --git a/Horde3D/Source/Shared/utXMLParser.cpp b/Horde3D/Source/Shared/utXMLParser.cpp
index 235ade0..e0e498f 100644
--- a/Horde3D/Source/Shared/utXMLParser.cpp
+++ b/Horde3D/Source/Shared/utXMLParser.cpp
@@ -82,7 +82,7 @@
 //#include <crtdbg.h>
 //#endif
 #define WIN32_LEAN_AND_MEAN
+#include <windows.h> // to have IsTextUnicode, MultiByteToWideChar, WideCharToMultiByte to handle unicode files
-#include <Windows.h> // to have IsTextUnicode, MultiByteToWideChar, WideCharToMultiByte to handle unicode files^M
                      // to have "MessageBoxA" to display error messages for openFilHelper
 #endif


utImage.cpp produces many warnings regarding conversion from "const char *" to "char *", but it works.


All other changes are related to makefiles. Simply replacing g++ with i586-mingw32msvc-g++, changing names of library files etc.


And here's my problem: It's not that easy to integrate the changes to the makefiles into the existing build system. Other problems like being unable to specify the compiler on Linux with the usual CC or CXX environment variables is not possible. Parallel compilation with -jN is not really supported....
I'm interested in moving away from the makefile approach to a platform independent build system.

Author:  Volker [ 30.04.2008, 17:38 ]
Post subject:  Re: mingw32, cross compiling, build system

I also thought about using CMake. But currently I don't have time to realize that. Any volunteers? :wink:

Author:  Codepoet [ 30.04.2008, 18:21 ]
Post subject:  Re: mingw32, cross compiling, build system

Sure, I'll do it. It will help me a lot under Linux when I can produce windows executables. :)

I prefer to use waf (was: bksys, fork of scons). Worked so far very good for me in some of my projects. Disadvantage for Visual Studio users is that, there will be no native build file for them. But I believe Visual Studio can execute any command to build a project and that would be enough to get the build button to work.

The only dependency of waf is Python, that should be no problem.

Author:  Volker [ 30.04.2008, 19:49 ]
Post subject:  Re: mingw32, cross compiling, build system

Never heard of it, but if you think it is easy to configure and maintain we can use it. I never used the makefile project under visual studio, but if that's the only problem, we can maintain visual studio project files separately.
Anyway, a big thanks for managing this.

Author:  DDd [ 30.04.2008, 19:54 ]
Post subject:  Re: mingw32, cross compiling, build system

+1 for cmake, it just works.

I had problems with scons in the past. If waf is a scons fork then i would prefer to have a cmake build system.

Author:  Volker [ 30.04.2008, 20:03 ]
Post subject:  Re: mingw32, cross compiling, build system

In principle I would also prefer CMake since I know that is widely used. But I don't have much experience with those build systems. Most of the time I used Visual Studio.

[edit] I added a vote to the topic :-)

Author:  Codepoet [ 30.04.2008, 20:07 ]
Post subject:  Re: mingw32, cross compiling, build system

waf has not much to do with scons today. It's really simple:

Building the libHorde3D.so (or Horde3D.dll):
Code:
def build(bld):
        obj = bld.create_obj('cpp', 'shlib')
        obj.source = '''../Shared/utXMLParser.cpp
        egAnimatables.cpp
        egAnimation.cpp
        egCamera.cpp
        egCom.cpp
        egExtensions.cpp
        egGeometry.cpp
        egLight.cpp
        egMain.cpp
        egMaterial.cpp
        egModel.cpp
        egModules.cpp
        egParticle.cpp
        egPipeline.cpp
        egPrimitives.cpp
        egRendererBase.cpp
        egRenderer.cpp
        egResource.cpp
        egScene.cpp
        egSceneGraphRes.cpp
        egShader.cpp
        egTextures.cpp
        utImage.cpp
        utOpenGL.cpp
        '''
        obj.includes = '. ../Shared ../../Extensions'
        obj.uselib = 'GL'
        obj.target = 'Horde3D'
        obj.want_libtool = False

Really simple ;) The files for the samples and Horde3DUtils are similarly simple.

Building:
Code:
./waf configure
./waf


I don't like cmake that much: If you are doing something wrong you never know if cmake is the problem or the created makefile / projectfile.

Author:  Volker [ 30.04.2008, 20:10 ]
Post subject:  Re: mingw32, cross compiling, build system

I think we can start with waf as long as noone makes CMake files. If that's the case we can think about it again.

Author:  DDd [ 30.04.2008, 20:18 ]
Post subject:  Re: mingw32, cross compiling, build system

Personally i will always use VS C++ compiler to build horde3d and not mingw32, i use multiple versions of gcc for different projects, including ARM programming, so i don't really like to mess with my configurations for Symbian compilation.

This doesn't really help me in any way, i will continue to use the visual studio solution files. But it may be useful for others :)

Author:  swiftcoder [ 30.04.2008, 20:38 ]
Post subject:  Re: mingw32, cross compiling, build system

Volker wrote:
I think we can start with waf as long as noone makes CMake files. If that's the case we can think about it again.
Waf is pretty much useless on the Mac (it would require rewriting major parts of waf itself), whereas CMake works flawlessly both with the Mac and with Visual Studio. Unfortunately I don't have the time to produce CMake files in the near future.

Author:  Volker [ 30.04.2008, 20:58 ]
Post subject:  Re: mingw32, cross compiling, build system

So I think the long term goal should be CMake,... maybe I will find some time after next week to take a look at CMake.

Author:  Codepoet [ 30.04.2008, 21:28 ]
Post subject:  Re: mingw32, cross compiling, build system

DDd: Something better than the existing makefiles would be really usefull for me.

swiftcoder: I didn't know that. Is it really that bad? xmms2 uses waf and builds on OS X AFAIK. Could you test that?

Volker: If waf is really missing mac support I'll take a look at cmake.

Author:  swiftcoder [ 01.05.2008, 00:09 ]
Post subject:  Re: mingw32, cross compiling, build system

Codepoet wrote:
swiftcoder: I didn't know that. Is it really that bad? xmms2 uses waf and builds on OS X AFAIK. Could you test that?
It isn't so much that it doesn't work, more that it doesn't understand any differences between Mac and linux (or Windows for that matter).

CMake can output XCode project files (as well as Visual Studio project files) directly from the basic build system, which eases integration a lot. If we go with Waf, we will still have to maintain Visual Studio and XCode projects for those who need them.

Author:  Meltra [ 01.05.2008, 02:16 ]
Post subject:  Re: mingw32, cross compiling, build system

I'm not a big fan of CMake, the whole scripting is just to/so ...
Lets just keep it at some people like cmake others don't.

I always liked the approach premake has, it uses the lua language to as scripting interface and it will generate the build files for the target system.
It's clean, easy to use and works on mac, linux, windows, ...

CMake is more mature and has more features, but with some time and a couple of good lua scripts premake could be far better then cmake ever will be.

As for Xcode :: gnu make files work on mac, lua scripting has the *if(mac)* option but no xcode project files atm. XCode project files have been on the todo list for some while, they might even be in the svn version. (allot of that stuff has been on hold for the 4.0 remake of premake ...)

http://premake.sourceforge.net/what_is_premake
http://industriousone.com/post/subversion-shuffling

Author:  DDd [ 01.05.2008, 07:35 ]
Post subject:  Re: mingw32, cross compiling, build system

premake 4 appears to be interesting, easier than cmake, but not as powerful and will have features similar to cmake, but i don't think it would be very good policy to start using premake 3.5 something that is not going to be compatible with 4.0.

Page 1 of 4 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/