[sword-devel] Cross-build Toolchain Files

Greg Hellings greg.hellings at gmail.com
Mon Feb 13 19:01:57 MST 2012


For anyone who likes to cross-build from Linux into Windows (c'mon, I
know you all love it...) I have added a pair of toolchain files to the
engine which will work with either the MinGW packages I specifically
built for SWORD support in Ubuntu or with SuSE's toolchain. It also
works building with Xiphos' GLib patch, although that might take an
extra command line argument when it searches for GLib. For example, to
build the libsword.dll file, this CMake invocation will work when
invoked from within the build/ directory:

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/Toolchain-mingw64-x86.cmake
-DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32/sys-root/mingw/
-DLIBSWORD_LIBRARY_TYPE="Shared" ..

If you are using the Xiphos patch which adds dependency on GLib in
order to fix a bug in SWORD's handling of Unicode characters in file
paths, add the option

 -DGlibConfig_INCLUDE_DIR=/usr/i686-w64-mingw32/sys-root/mingw/lib/glib-2.0/include

when you invoke CMake under SuSE. It should "just work" under my
Ubuntu toolchain as I developed these toolchain files to operate in my
toolchain which is largely modeled off the one from SuSE. Fedora also
has a similar chain that is modeled on SuSE, but I haven't tested it
there. I believe they used a different autotools triple
(i686-pc-mingw32 instead of the SuSE/Ubuntu i686-w64-mingw32) last
time I used their toolchain but I could be mistaken. If anyone is a
die-hard Fedora user and wants to be able to cross-build for Windows,
you're welcome to use these files as a foundation to model on and add
some other Toolchains.

For those of us who are full-time Linux users this can be a little bit
of a sanity check to allow us to test building a Windows release and
should also make it simpler for "anyone" to make a release of the
Windows build of the tools when they get stale. Note, though, if you
like building with Ubuntu and opt to use the toolchain I've built, I
do include a decently up-to-date version of the SWORD library from SVN
in the toolchain already. So if you're a front-end developer wanting
to cross build, you don't have to use this to roll your own build. I
will happily update the packages to the newest SVN if you need it.
Just be forewarned that my build includes the patch from Xiphos and
thus includes a glib build-time and run-time dependency.

--Greg



More information about the sword-devel mailing list