Add CMake toolchain script for mingw32/64 compilation, and update documentation

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1090 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
beuc 2012-03-09 20:34:51 +00:00
parent e3c597fe0d
commit 11a4f362e1
3 changed files with 56 additions and 9 deletions

1
.gitattributes vendored
View File

@ -79,6 +79,7 @@ freeglut/freeglut/include/GL/freeglut_ext.h svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/include/GL/freeglut_std.h svn_keywords=Author+Date+Id+Revision freeglut/freeglut/include/GL/freeglut_std.h svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/include/GL/glut.h svn_keywords=Author+Date+Id+Revision freeglut/freeglut/include/GL/glut.h svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/include/Makefile.am svn_keywords=Author+Date+Id+Revision freeglut/freeglut/include/Makefile.am svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/mingw_cross_toolchain.cmake -text
freeglut/freeglut/progs/Makefile.am svn_keywords=Author+Date+Id+Revision freeglut/freeglut/progs/Makefile.am svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.c svn_keywords=Author+Date+Id+Revision freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.c svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.dsp svn_keywords=Author+Date+Id+Revision freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.dsp svn_keywords=Author+Date+Id+Revision

View File

@ -1,24 +1,61 @@
Cross-compilation from GNU/Linux (static and shared DLL) Cross-compilation from GNU/Linux (static and shared DLL)
======================================================== ========================================================
Install MinGW32 and prepare FreeGLUT on Debian/Ubuntu: Install MinGW, and specify which MinGW you're using:
apt-get install mingw32 - on Debian/Ubuntu, mingw-w64, 32-bit executables:
./configure --host=i586-mingw32msvc --prefix=/freeglut
Install MinGW32 and prepare FreeGLUT on Fedora: apt-get install mingw-w64
GNU_HOST=i686-w64-mingw32
- on Debian/Ubuntu, mingw-w64, 64-bit executables:
apt-get install mingw-w64
GNU_HOST=x86_64-w64-mingw32
- on Fedora, mingw32, 32-bit executables:
yum install mingw32-gcc yum install mingw32-gcc
./configure --host=i686-pc-mingw32 --prefix=/freeglut GNU_HOST=i686-pc-mingw32
Cross-compile! - on Debian/Ubuntu, mingw32 (deprecated):
make apt-get install mingw32
GNU_HOST=i586-mingw32msvc
With the GNU Autotools
----------------------
Cross-compile with:
./configure --host=$GNU_HOST --prefix=/freeglut
make -j4
make install DESTDIR=$(pwd) make install DESTDIR=$(pwd)
Everything is in the new freeglut/ directory. Everything is now in the new 'freeglut/' directory.
The .dll is in the freeglut/bin/. The .dll is in 'freeglut/bin/'.
With CMake
----------
Cross-compile with:
cmake \
-D GNU_HOST=$GNU_HOST \
-D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain.cmake \
-D CMAKE_INSTALL_PREFIX=/freeglut \
.
make -j4
make install DESTDIR=$(pwd)
Everything is now in the new 'freeglut/' directory.
The .dll is in 'freeglut/lib/'.
Compiling your code
-------------------
Compilation of your own programs is done as usual. Compilation of your own programs is done as usual.
See README.cygwin_mingw for details. See README.cygwin_mingw for details.

View File

@ -0,0 +1,9 @@
# CMake toolchain file, cf. README.mingw_cross
SET(CMAKE_SYSTEM_NAME Windows)
include(CMakeForceCompiler)
IF("${GNU_HOST}" STREQUAL "")
SET(GNU_HOST i586-mingw32msvc)
ENDIF()
# Prefix detection only works with compiler id "GNU"
CMAKE_FORCE_C_COMPILER(${GNU_HOST}-gcc GNU)
SET(CMAKE_RC_COMPILER ${GNU_HOST}-windres)