2012/11/2 Yves Perron <yves.per...@modusfx.com>

>  Greetings everyone,
>
> Its been a wild ride for me in the cross-platform compilation world. After
> several weeks pulling my hair, I figured it might be a good thing to ask
> for help before I go completely bald.
>
> To resume, I do have a fairly complex C++ "Visual Studio 10 Win64" project
> that needs to be maintained on windows and port to Linux and MacOSX. For
> simplicity sake, let's forget I just said that and let's get down to
> basics. Here is my setup:
>
> Windows 7
> CMake 2.8.9
> Intel Processor 64 bit
>
> I already have my CMake setup running using  the "Visual Studio 10 Win64"
> compiler and it works beautifully. Now, to get things rolling, I'd like to
> compile the same project with MinWG64 on Windows, for Windows.
>
>
Hi Yves,

Before I go any further, I'd like to know:
>
>    - Which MinGW64 "binary" package should I get from
>    http://sourceforge.net/projects/mingw-w64?**
>
> There are several you can choose from:
 - my Personal 
builds<http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/>:
I provide native and cross compilers which are nicely up to date. Choose
the 4.7.2 package if you want to have the latest stable stuff.
 - mingwbuilds <http://sourceforge.net/projects/mingwbuilds/>: another
person who reads this list and builds compilers. He often has very
specialized features enabled which I reserve for my experimental builds.
 - TDM GCC <http://tdm-gcc.tdragon.net/>: a MinGW classic, providing a
32-bit Windows to 64-bit Windows multilib compiler (which can compile for
both 32 and 64-bit)

All of these are either install+ add mingw*/bin to PATH or run the included
envsetup script which does that for you (like with mine). It goes without
saying I recommend my toolchain builds ;-)


>    - What would be the best compiler to use to get my code compliant for
>    the other platforms?
>
> You should use as much compilers as possible, which in this case means:
Visual Studio (which will be the limiting factor in any case), GCC (see
above) and Clang (see
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/clang-3.1-release/for
more details, read carefully). Clang may not be usable for what you
are
doing, as it misses certain features required for normal Windows code (like
dllexporting classes). It works fine in cases not using that though, but
only for 32-bit Windows.
To force GCC's strict mode, which is very useful, use the following
compiler flags when building:
-Wextra -pedantic -std=c++11
Some "optional" extra flags are:
-Wconversion -Wuninitialized -Winit-self -Wmissing-include-dirs
-Wstrict-aliasing
These options will not ensure your code will work on different OSes, but it
will make sure it is standards conformant as much as possible.
Note that MinGW inherently uses msvcrt, which means certain C functions may
not behave like you would expect. See MSDN in Visual C++ 2003 mode to see
the documentation for the functions MinGW exposes. If you're using fancy
C++11 library features (which include but are not limited to <thread>,
std::to_string, and <regex>) you will find GCC's libstdc++ unfortunately
lacking. Everything else is usually implemented better than on MSVC though,
including <tuple>.

To use CMake, just be sure "g++" is in PATH, and run
cmake path/to/source -G"MinGW Makefiles"

Hope this helps,

Ruben



> ** I say "binary" hoping I could avoid compiling compilers because this
> idea upsets me some how.
>
> Thank you very much for reading this.
>

>
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to