maybe use wx-config when gcc is found in wxCompile.nim
retsyo opened this issue · comments
on my sys2+mingw, the make file runs exactly
$ make -f makefile.unx
g++ -c `wx-config --cxxflags` -o bombs.o bombs.cpp
g++ -c `wx-config --cxxflags` -o game.o game.cpp
g++ -c `wx-config --cxxflags` -o bombs1.o bombs1.cpp
g++ -o bombs bombs.o game.o bombs1.o `wx-config --libs`
to build binary files. The wx-config can handle all kinds of compile/link situation while considering real wxwidget's installation (for example, shared/static lib, monolithic build, libtiff...)
The wxCompile
file already uses wx-config if you don't pass it a path explicitly. At least on Linux. If you have a way to run it on Windows as well than I'd be happy to merge a PR which implements that. I have never run the Windows part of the script. That was developed by someone else.
Any status on this?
long time passed
$ nim
Nim Compiler Version 0.19.9 [Windows: amd64]
Compiled at 2018-12-13
Copyright (c) 2006-2018 by Andreas Rumpf
firstly
$ nim c --define:"wxWidgetsPath:/e/msys64/home/USER/wxWidgets" controlgallery.nim
R:\wxnim-0.8.0\examples\genuimacro\command line(1, 2) Error: invalid command line option: '--wxWidgetsPath;E:\msys64\home\USER\wxWidgets'
then
$ nim c --define:"wxWidgetsPath:e:\msys64\home\USER\wxWidgets" controlgallery.nim
...
CC: wxnim_controlgallery
CC: stdlib_helpers2
CC: wxnim_wx
CC: stdlib_ospaths
Error: execution of an external compiler program 'gcc.exe -c -w -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN `wx-config --cppflags` -IE:\msys64\home\USER\_nim\nim\lib -o C:\Users\USER\nimcache\controlgallery_d\wxnim_controlgallery.c.o C:\Users\USER\nimcache\controlgallery_d\wxnim_controlgallery.c' failed with exit code: 1
gcc.exe: error: `wx-config: No such file or directory
gcc.exe: error: unrecognized command line option '--cppflags`'
so the passC
and passL
in wxCompile.nim
is read wrongly because the ``` symbol is treat bad
finally I get it work on my Windows, but this is not a good way.
Here is the instruction to build in MSYS2 + MingW64 on windows 64 bits
-
first, get the latest wxWidgets source, decompress it into, for example, E:\msys64\home\USER\wxWidgets\
-
in E:\msys64\home\USER\wxWidgets\
mkdir msw_build
cd msw_build
../configure --disable-shared --disable-debug --enable-threads --enable-monolithic --enable-unicode --enable-compat28 --enable-graphics_ctx --prefix=/opt/windows_64
make -j8
- now run and copy the output
$ /opt/windows_64/bin/wx-config --libs all
-L/opt/windows_64/lib -Wl,--subsystem,windows -mwindows /opt/windows_64/lib/libwx_mswu-3.1.a -lpng -lz -ljpeg -ltiff -llzma -lwxregexu-3.1 -lwxscintilla-3.1 -lz -lexpat -lpng -lz -ljpeg -ltiff -llzma -lz -lrpcrt4 -loleaut32 -lole32 -luuid -llzma -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc
$ /opt/windows_64/bin/wx-config --cflags
-I/opt/windows_64/lib/wx/include/msw-unicode-static-3.1 -I/opt/windows_64/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -D__WXMSW__
- modify wxCompile.nim according to what you get in step 3. But you must expand
/opt
to the expression of harddisk driver, and use/
to replace\
in the directory
{.passL: " -LE:/msys64/mingw64/lib -Wl,--subsystem,windows -mwindows E:/msys64/mingw64/lib/libwx_mswu-3.1.a -lpng -lz -ljpeg -ltiff -llzma -lwxregexu-3.1 -lwxscintilla-3.1 -lz -lexpat -lpng -lz -ljpeg -ltiff -llzma -lz -lrpcrt4 -loleaut32 -lole32 -luuid -llzma -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc ".}
{.passC: " -static-libstdc++ -IE:/msys64/mingw64/lib/wx/include/msw-unicode-static-3.1 -IE:/msys64/mingw64/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -D__WXMSW__ ".}
then you can compile all the 4 demos with nim cpp xx.nim