Re: MGui "v2" news

255 : there is object->deleteMe()
object can be a button, image etc
and is really deleted by MWindow's update so it's thread safe.

27

Re: MGui "v2" news

Oh, didn't notice! Perfect.

Re: MGui "v2" news

Hey Anaël,

Finally got it to work! big_smile

Concerning the premake4.lua script, some links are not required on linux:

    -- MEngine
    project "mengine"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MEngine/**" }
        defines { "MENGINE_STATIC" }
--        links { "mcore" }
    

    -- MGui
    project "mgui"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MGui/**" }
        defines { "MGUI_STATIC" }
--        links { "mengine", "mcore" }
    

    -- MCommon
    project "mcommon"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "Common/Contexts/GL/**" }
        files { sourcesDir .. "Common/Loaders/FreeImage/**" }
        files { sourcesDir .. "Common/Loaders/Freetype/**" }
        files { sourcesDir .. "Common/Renderers/**" }
        files { sourcesDir .. "Common/GUI/**" }
--        links { "mgui", "mengine", "mcore", "glfw", "glee", "freeimage", "freetype", "tinycthread" }

Can you please check if they are required for building on Mac.

Last edited by com3D (2013-10-13 17:53:38)

Re: MGui "v2" news

zester wrote:

Static linking is only for special cases on Linux and in many cases won't work correctly.

In fact it seems that all errors are due to the fact that with GCC, the linker searches and processes libraries and object files in the order they are specified. So if the order is incorrect, "undefined reference" errors pop up, even though everything else is set correctly.

For example, if library B depends on library A, linking them with -lA -lB will cause an error.

Re: MGui "v2" news

Here are the errors that I get when buiding with vs2010:

Freeimage:
c:\...\branches\experimental\3rdparty\freeimage\source\zlib\zconf.h(447): fatal error C1083: Impossible d'ouvrir le fichier include : 'unistd.h' : No such file or directory

Test
main.cpp(161): error C3861: 'Sleep' : identificateur introuvable

Last edited by com3D (2013-10-16 18:36:40)

31

Re: MGui "v2" news

In Visual Studio 2010 MGui compiles fine, I just did it myself. A lot of errors can be avoided by compiling with the lower warning level, which is (/W0) on Configuration->C/C++.
You may want to try that.

Are you trying to compile the stand-alone version? This one:
https://code.google.com/p/maratis/sourc … 2FIncludes

Last edited by 255 (2013-10-10 19:03:49)

Re: MGui "v2" news

Thanks for your help 255.

Yes, we are talking of the experimental branch.

I'm totally noob with visual studio and I changed nothing to "factory" settings.
I'm doing "Generate solution" in release32 mode on Windows XP. Is it OK ?
I'll try to alter the settings as you recommended.

By the way, did you upgrade to latest revision ?

Last edited by com3D (2013-10-11 11:39:51)

33

Re: MGui "v2" news

Yes, 219.

Re: MGui "v2" news

Tried with minGW:

glfw:
For building GLFW we need to upgrade to latest version (3.0.3).

freeimage:
no error

mcommon:
..\..\Sources\Common\Loaders\FreeImage\MFreeImageLoader.cpp(81): error C2440: '=' : impossible de convertir de 'unsigned int (__cdecl *)(void *,unsigned int,unsigned int,fi_handle)' en 'FI_ReadProc'
          Cette conversion requiert reinterpret_cast, un cast de style C ou un cast de style fonction

Test:
I have to include <windows.h> to resolve sleep issue

Last edited by com3D (2013-10-13 08:47:26)

35

Re: MGui "v2" news

When you get this kind of errors you should just try to edit the line and do some casting as the error message says itself.
I'm not able to give you a solution for this specific error, but in general it's something like this:

Line of code: pointerOfTypeX = pointerOfTypeY;
Error: cannot convert TypeY* to TypeX*, casting problems, etc.
Solution: pointerOfTypeX = (TypeX*)pointerOfTypeY

I'm pretty sure that MinGW also have that "warning level" thing so you may also want to change that in your configuration, and these kind of errors may disappear.

Last edited by 255 (2013-10-13 08:51:26)

Re: MGui "v2" news

Many thanks 255, big_smile

Passing '-fpermissive' to minGW "resolves" the casting errors.
Didn't noticed it but this fix was suggested by minGW at the end of each error report. This is a very cool feature.

Can we pass warnings settings to vs2010 projects so that we can fix the premake template for visual studio ?

Last edited by com3D (2013-10-13 11:43:32)

37

Re: MGui "v2" news

I don't know Premake.
The VS option is this one though: http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
And here the compiler command-line syntax: http://msdn.microsoft.com/en-us/library/610ecb4h.aspx

BTW I don't think that disable warnings for the entire project (from which you may want to base your game) is a good idea, maybe anael could fix these casting problems in the source itself. He may not get these warnings in his IDE, but he could fix them anyway if we point out the lines.

Last edited by 255 (2013-10-13 12:10:20)

Re: MGui "v2" news

Thanks for references.

The casting issues are only relevant to Windows, they don't occur with POSIX.
Waiting for Anaël directives.

Last edited by com3D (2013-10-13 18:57:07)

Re: MGui "v2" news

Hi,

I added a cast for the freeimage loader error in case : https://code.google.com/p/maratis/sourc … Loader.cpp

it's better to keep the warning level high during experimental development, casting warning are usually useless but they can sometime reveal an error or give a clue for a bug.

tell me if the fix removed the error

Re: MGui "v2" news

Perfect ! All casting errors have been blasted. big_smile

NB: tested with minGW.

Re: MGui "v2" news

Anaël,

Scons is passing 'sse2' to the compiler for all platforms.
Should we incorporate this either in the premake template?

Last edited by com3D (2013-10-14 07:45:21)

Re: MGui "v2" news

hi, yes, we can make the assumption that sse2 is now on a majority.
thanks,

Re: MGui "v2" news

With visual studio, these errors remain:

freeimage:
c:\...\branches\experimental\3rdparty\freeimage\source\zlib\zconf.h(447): fatal error C1083: Impossible d'ouvrir le fichier include : 'unistd.h' : No such file or directory

Windows complains not finding a POSIX header!
MinGW has its own version of this header, that's why I didn't get this error previously.

mcommon:
..\..\Sources\Common\Loaders\FreeImage\MFreeImageLoader.cpp(81): error C2440: '=' : impossible de convertir de 'unsigned int (__cdecl *)(void *,unsigned int,unsigned int,fi_handle)' en 'FI_ReadProc'
          Cette conversion requiert reinterpret_cast, un cast de style C ou un cast de style fonction

Test:
I have to include <windows.h> to resolve sleep issue

Last edited by com3D (2013-10-14 20:10:22)

Re: MGui "v2" news

Are you uploading your premake scripts some-wheres? I want to look at adding network(enet?) support tonight.  And see about getting Maratis in Qt4 QGLWidget.

Last edited by zester (2013-10-14 21:23:59)

Re: MGui "v2" news

Yes Zester,

I've pushed a linux fix to the premake template for experimental branch in the issue tracker.
See issue #20 here, you can download the file. big_smile

Re: MGui "v2" news

And here is the latest version (I'll submit it in the tracker soon as Windows test will be complete):

-----------------------------------------------------------------------------------------------------------------------------
-- Test premake build
-----------------------------------------------------------------------------------------------------------------------------

rootDir = "../../"
sourcesDir = rootDir .. "Sources/"
thirdPartyDir = rootDir .. "3rdparty/"

-- Get arguments passed to the command line
for i=1, #_ARGS do
    if _ARGS[i] == "cygwin" then cygwin = true print("*****  BUILD USING CYGWIN  *****") end
    if _ARGS[i] == "minGW" then minGW = true print("*****  BUILD USING MINGW  *****") end
end


solution "Test"

    configurations { "Debug", "Release" }
    platforms { "x32", "x64" }

    if os.is("windows") then
        defines { "_WIN32", "WIN32" }
        if minGW then defines { "__MINGW32__" } end
        if cygwin then defines { "__CYGWIN__" } end
    elseif os.is("macosx") then defines { "__APPLE__", "MACOSX" }
    elseif os.is("linux") then defines { "LINUX", "linux" }
    end

-- INCLUDES
    includedirs { 
        thirdPartyDir .. "tinycthread/source",
        thirdPartyDir .. "glee",
        thirdPartyDir .. "glfw/include",
        thirdPartyDir .. "freeimage/Source",
        thirdPartyDir .. "freetype/include",
        thirdPartyDir .. "tinyutf8",
        sourcesDir .. "MSDK/MCore/Includes",
        sourcesDir .. "MSDK/MEngine/Includes",
        sourcesDir .. "MSDK/MGui/Includes",
        sourcesDir .. "Common"
    }

    if os.is("windows") then
        includedirs { thirdPartyDir .. "windirent/include" }
    end

    configuration "Debug"
        defines { "DEBUG" }
        flags { "Symbols" }

    configuration "Release"
        defines { "NDEBUG" }
        flags { "Optimize" }


    -- freeimage
    include ( rootDir .. "Projects/3rdparty/freeimage" )

    -- freetype
    include ( rootDir .. "Projects/3rdparty/freetype" )

    -- tinycthread
    project "tinycthread"
        kind "StaticLib"
        language "C++"
        files { thirdPartyDir .. "tinycthread/**.h", 
                thirdPartyDir .. "tinycthread/**.c" }

    -- Glee
    project "glee"
        kind "StaticLib"
        language "C++"
        files { thirdPartyDir .. "glee/**.h", 
                thirdPartyDir .. "glee/**.c" }
                
    -- glfw
    include ( rootDir .. "Projects/3rdparty/glfw" )

    -- MCore
    project "mcore"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MCore/**" }
        defines { "MCORE_STATIC" }


    -- MEngine
    project "mengine"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MEngine/**" }
        defines { "MENGINE_STATIC" }
    --    links { "mcore" } -- for SharedLib only


    -- MGui
    project "mgui"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MGui/**" }
        defines { "MGUI_STATIC" }
    --    links { "mengine", "mcore" } -- for SharedLib only


    -- MCommon
    project "mcommon"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "Common/Contexts/GL/**" }
        files { sourcesDir .. "Common/Loaders/FreeImage/**" }
        files { sourcesDir .. "Common/Loaders/Freetype/**" }
        files { sourcesDir .. "Common/Renderers/**" }
        files { sourcesDir .. "Common/GUI/**" }
        --links { "mgui", "mengine", "mcore", "glfw", "glee", "freeimage", "freetype", "tinycthread" } -- for SharedLib only


    -- Test
    project "Test"
        kind "ConsoleApp"
        language "C++"

        files { "*.cpp" }
        links {
            "mcommon", "mgui", "mengine", "mcore", 
            "glfw", "glee", "freeimage", "freetype", "tinycthread"
        }

        if os.is("macosx") then
            links {
                "Cocoa.framework", "OpenGL.framework", "CoreServices.framework",
                "Foundation.framework", "IOKit.framework"
            }

        elseif os.is("windows") then
            links { "Opengl32", "Winmm" }

        elseif os.is("linux") then
            links { "X11", "Xxf86vm", "Xrandr", "Xi", "GL", "dl", "pthread", "rt" }
            linkoptions { "-Wl,-rpath=." }
        end

Last edited by com3D (2013-10-23 20:16:14)

Re: MGui "v2" news

A few tests:

LINUX
- build using make & GCC 4.6.3 tongue
- build using Code::Blocks 12.11 & GCC 4.6.3 tongue

- binaries on Ubuntu Precise: tongue
- binaries on Slackware 14: tongue

WINDOWS
- build using vs2010 : cf above sad
- build using minGW : cf above sad

Last edited by com3D (2013-10-16 18:37:34)

Re: MGui "v2" news

Very nice com3D and thank you for taking on premake and getting it to build Maratis for us. I tried for awhile but the thirdparty libs gave me alot of trouble, not use to that as a linux user.

Re: MGui "v2" news

We are all learning a lot in this community ! big_smile

Re: MGui "v2" news

com3D wrote:

And here is the latest version (I'll submit it in the tracker soon as Windows test will be complete):

I am going to have to wait to test, looks like there are some additional premake4.lua scripts needed (freeimage, and a couple of others I take it.).