haxeui / hxWidgets

Haxe externs (and wrappers) for wxWidgets
MIT License
77 stars 22 forks source link

Discussion: Compilation with MinGW #51

Closed R3D9477 closed 6 years ago

R3D9477 commented 6 years ago

Hi. I tried to compile a simple application on Windows with MinGW. Also I have already installed wxWidgets library (by default path C:\wxWidgets-3.1.0).

my build.hxml:

-main Main
-cp Source
-cpp Bin

-lib hscript
-lib hxWidgets
-lib haxeui-core
-lib haxeui-hxwidgets

-D ABI=-MD
-D WXSTATIC

-D HXCPP_MINGW
-D MINGW_ROOT=C:\Program Files (x86)\mingw-w64\i686-7.2.0-posix-dwarf-rt_v5-rev1\mingw32

exception:

...
 - src/wx/widgets/styles/WindowStyle.cpp
Error: In file included from ./src/wx/widgets/styles/WindowStyle.cpp:5:0:
include/wx/widgets/styles/WindowStyle.h:11:10: fatal error: wx/window.h: No such file or directory
 #include <wx/window.h>
          ^~~~~~~~~~~~~
compilation terminated.
Error: Build failed

I think that I must manually to define path to wxWidgets *.h files, right? But how to do it most correctly? Thanks.

ianharrigan commented 6 years ago

On the main README there should be instructions, this one in particular:

If i remember rightly i didnt end up with that env var and had to manually create it. Let me know if the any of those instructions need updating too

Cheers

R3D9477 commented 6 years ago

@ianharrigan sorry, my bad but something wrong with path separator (Windows 10):

WINWX = C:\wxWidgets-3.1.0

Error: In file included from C:\wxWidgets-3.1.0\include/wx/defs.h:20:0,
                 from C:\wxWidgets-3.1.0\include/wx/event.h:14,
                 from C:\wxWidgets-3.1.0\include/wx/window.h:18,
                 from include/wx/widgets/styles/WindowStyle.h:11,
                 from ./src/wx/widgets/styles/WindowStyle.cpp:5:
C:\wxWidgets-3.1.0\include/wx/platform.h:136:10: fatal error: wx/setup.h: No such file or directory
 #include "wx/setup.h"
          ^~~~~~~~~~~~
compilation terminated.
Error: Build failed

WINWX = C:/wxWidgets-3.1.0

Error: In file included from C:/wxWidgets-3.1.0\include/wx/defs.h:20:0,
                 from C:/wxWidgets-3.1.0\include/wx/event.h:14,
                 from C:/wxWidgets-3.1.0\include/wx/window.h:18,
                 from include/wx/widgets/styles/WindowStyle.h:11,
                 from ./src/wx/widgets/styles/WindowStyle.cpp:5:
C:/wxWidgets-3.1.0\include/wx/platform.h:136:10: fatal error: wx/setup.h: No such file or directory
 #include "wx/setup.h"
          ^~~~~~~~~~~~
compilation terminated.
Error: Build failed
ianharrigan commented 6 years ago

i think the env var should be WXWIN not WINWX (wrong way round).... also, to be safe, use windows forward slashes...

image

That work?

EDIT: Although, it does look like its found the the path, the error is from platform.h - never tried to compile using mingw - would be interested to see if this can be resolved.

R3D9477 commented 6 years ago

@ianharrigan sure, this is just an typo in my issue.

yep, it works fine:

C:\Users\user>echo %WXWIN%
C:\wxWidgets-3.1.0

i think that trouble in with path, because it contains both types of path separator (first windows-type, and second unix-type): C:\wxWidgets-3.1.0\include/wx/platform.h so, I see line with hardcoded path separator

I think, when haxe tried to concaterate C:\wxWidgets-3.1.0 with wx/platform.h (or C:/wxWidgets-3.1.0 with wx/platform.h), it uses OS-specific path separator (symbol \ for windows). But as result I haxe C:\wxWidgets-3.1.0\wx/platform.h or C:/wxWidgets-3.1.0\wx/platform.h. Both path isn't valid I think.

Are you use msvc compiler? What the path to wxWidgets are you have as result?

R3D9477 commented 6 years ago

@ianharrigan ok, I've changed WXWIN from C:\wxWidgets-3.1.0 to C:\\wxWidgets-3.1.0 and now path looks more valid, but compilation failed:

Error: In file included from C:/wxWidgets-3.1.0/include/wx/defs.h:20:0,
                 from C:/wxWidgets-3.1.0/include/wx/event.h:14,
                 from C:/wxWidgets-3.1.0/include/wx/window.h:18,
                 from include/wx/widgets/styles/WindowStyle.h:11,
                 from ./src/wx/widgets/styles/WindowStyle.cpp:5:
C:/wxWidgets-3.1.0/include/wx/platform.h:136:10: fatal error: wx/setup.h: No such file or directory
 #include "wx/setup.h"
          ^~~~~~~~~~~~
compilation terminated.
Error: Build failed

hmm, directory wxWidgets-3.1.0/include don't contain file setup.h needed additional configuration for wxwidgets (wx-config)

Think it's not issue for hxWidgets

ianharrigan commented 6 years ago

I think you need to build wx also... there are probably precompiled versions you can get too, but iirc i just compiled the .dlls / libs with a make file - not sure how easy that is with mingw though (i used MSVC)

R3D9477 commented 6 years ago

@ianharrigan thank you for help! I'll paste results of compilation with MinGW here (when I will get success)

R3D9477 commented 6 years ago

@ianharrigan so, I copied setup.h from C:\wxWidgets-3.1.0\include\wx\msw to C:\wxWidgets-3.1.0\include\wx and wxWidgets was successfully compiled with MinGW (static and shared versions).

but when I tried to compile hxWidgets I've now another exception:

...
 - src/hx/widgets/GraphicsObject.cpp
 - src/hx/widgets/Gauge.cpp
Error: In file included from ./src/hx/widgets/GraphicsContext.cpp:59:0:
include/hx/widgets/GraphicsContext.h:84:16: error: 'wxAntialiasMode' was not declared in this scope
    cpp::Struct<wxAntialiasMode, cpp::EnumHandler> antialiasMode;
...

but this enum already defined at C:\wxWidgets-3.1.0\include\wx\graphics.h

do you have any ideas? gmm, I'll try previous version of wxWidgets