Re: mingw and gnucap-2013-04-23

beranger <[email protected]> Fri, 10 Oct 2014 14:17:26 +0200
Newsgroups gmane.comp.gnu.gnucap.general
Message-ID <[email protected]>
On Sunday 01 September 2013, Le Coupanec Jacques wrote:
>/  I've been trying to cross-compile a XP version with default/
>/  plugins for  a few days.../
>/  It's the first time I use mingw and I hope that someone/
>/  achieved that  and could help me./



Hello,
If you want i just finish a windows executable for gnucap-2013-04-23 
with few change on the code.
I test it, should work fine on wine and windows7.

You could find the source on this link  :
-https://drive.google.com/file/d/0B-mpEqwyLyrnbkNCOFV5eGMxcFE/view?usp=sharing
and the executable:
-https://drive.google.com/file/d/0B-mpEqwyLyrnY1V0YzY4SVl2VW8/v 
ew?usp=sharing

Here's the procedure, i follow , to cross-compile on fedora for windows:

0. _Install mingw_

1. _I had to include md.h to readline, for compiling on  linux and 
windows__:_
Files                            modification
lib\configure                l31 : add -I../include  to compilation flags
apps\configure            l31 : add -I../include  to compilation flags
lib\test_readline.cc        l2 : add #include <md.h>  to header
apps\test_readline.cc    l2 : add #include <md.h>   to header
modelgen\make2           l2: add -ldl toCCCFLAGS

2._I compile normally modelgen with gcc without mingw , because i used 
it only on linux__:_
Files                                modification
modelgen\makefile       l58 : replace make2.mingw par Make2


3._For lib\make2.mingw and apps\make2.mingw , i compile only the binary 
and not creating the library(.dll or .so) :_


VPATH*=* .:..

# Standard base for g++.

CCC*=* i686-w64-mingw32-g++

DLLTOOL*=* i686-w64-mingw32-dlltool

CCFLAGS*=* \

\

-O3 -march*=*native -msse4.2 -msse4.1-DNDEBUG -I. -I../../include

LIBS*=*

LDFLAGS*=* -shared

.SUFFIXES*:*

.SUFFIXES*:*.o .cc

.cc.o*:*; $(CCC)$(CCFLAGS)-c $<

#------------------------------------------------------------------------

$(TARGET)*:*$(TARGET_DEPENDS)

_4.__I call the library on main.cc only for linux system :_

#if defined(__MINGW32__)

#define ismingw 1

#else

#define ismingw 0

#endif

et ligne 67 , on conditionne l'appel aux librairies à la compilation 
type linux

if(ismingw == 0 ){

CMD::command(std::string("load " DEFAULT_PLUGINS), &CARD_LIST::card_list);

}



_5._ _I statically link the binary of apps and lib_ to the main :
Files                            modification
main\make2.mingw l35 : LDFLAGS = ../../apps/MSW/*.o../../lib/MSW/*.o 
-static-libgcc -static-libstdc++

I know it's not the most beautiful solution, but it seem to work.
Regards,
beranger Six