Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maybe use wx-config when gcc is found in wxCompile.nim #12

Open
retsyo opened this issue Aug 21, 2018 · 5 comments
Open

maybe use wx-config when gcc is found in wxCompile.nim #12

retsyo opened this issue Aug 21, 2018 · 5 comments

Comments

@retsyo
Copy link

retsyo commented Aug 21, 2018

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...)

@PMunch
Copy link
Owner

PMunch commented Aug 21, 2018

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.

@PMunch
Copy link
Owner

PMunch commented Sep 1, 2018

Any status on this?

@retsyo
Copy link
Author

retsyo commented Jan 22, 2019

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

@retsyo
Copy link
Author

retsyo commented Jan 22, 2019

first font.nim should be edited as #13

@retsyo
Copy link
Author

retsyo commented Jan 29, 2019

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

  1. first, get the latest wxWidgets source, decompress it into, for example, E:\msys64\home\USER\wxWidgets\

  2. 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
  1. 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__
  1. 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__  ".}
  1. modify richtext.nim

then you can compile all the 4 demos with nim cpp xx.nim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants