diff options
-rw-r--r-- | boost.pri | 2 | ||||
-rw-r--r-- | mingw-cross-env.pri | 18 | ||||
-rw-r--r-- | openscad.pro | 9 | ||||
-rwxr-xr-x | scripts/mingw-x-build-dependencies.sh | 74 |
4 files changed, 98 insertions, 5 deletions
@@ -13,7 +13,7 @@ boost { DEFINES += BOOST_STATIC DEFINES += BOOST_THREAD_USE_LIB DEFINES += Boost_USE_STATIC_LIBS - BOOST_LINK_FLAGS = -lboost_thread_win32-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt + BOOST_LINK_FLAGS = -lboost_thread_win32-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -lboost_chrono-mt } isEmpty(BOOST_LINK_FLAGS):win32 { diff --git a/mingw-cross-env.pri b/mingw-cross-env.pri index b0735a2..bc6f33a 100644 --- a/mingw-cross-env.pri +++ b/mingw-cross-env.pri @@ -8,6 +8,24 @@ CONFIG(mingw-cross-env) { LIBS += mingw-cross-env/lib/libglu32.a LIBS += mingw-cross-env/lib/libopencsg.a LIBS += mingw-cross-env/lib/libmpfr.a + LIBS += mingw-cross-env/lib/libgmp.a LIBS += mingw-cross-env/lib/libCGAL.a QMAKE_CXXFLAGS += -fpermissive + + + # Use different location for the cross-compiled binaries + .o files + # This allows compiling unix build + mingw build in same tree + + DESTDIR=. + + Release:DESTDIR = release_mingw32 + Debug:DESTDIR = debug_mingw32 + + OBJECTS_DIR = $$DESTDIR/objects + MOC_DIR = $$DESTDIR/moc + RCC_DIR = $$DESTDIR/rcc + UI_DIR = $$DESTDIR/ui + } + + diff --git a/openscad.pro b/openscad.pro index 97f20e6..68aa1cc 100644 --- a/openscad.pro +++ b/openscad.pro @@ -103,10 +103,6 @@ netbsd* { QMAKE_CXXFLAGS *= -fno-strict-aliasing } -CONFIG(mingw-cross-env) { - include(mingw-cross-env.pri) -} - CONFIG(skip-version-check) { # force the use of outdated libraries DEFINES += OPENSCAD_SKIP_VERSION_CHECK @@ -130,6 +126,11 @@ DEFINES += USE_PROGRESSWIDGET include(common.pri) +# mingw has to come after other items so OBJECT_DIRS will work properly +CONFIG(mingw-cross-env) { + include(mingw-cross-env.pri) +} + win32 { FLEXSOURCES = src/lexer.l BISONSOURCES = src/parser.y diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh new file mode 100755 index 0000000..e820e20 --- /dev/null +++ b/scripts/mingw-x-build-dependencies.sh @@ -0,0 +1,74 @@ +#!/bin/sh -e +# +# This script builds all library dependencies of OpenSCAD for cross-compilation +# from linux to mingw32 for windows, using the MXE cross build system. +# +# This script must be run from the OpenSCAD source root directory +# +# Usage: ./scripts/mingw-x-build-dependencies.sh +# +# Prerequisites: +# +# Please see http://mxe.cc/#requirements +# +# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X +# + +OPENSCADDIR=$PWD +if [ ! -f $OPENSCADDIR/openscad.pro ]; then + echo "Must be run from the OpenSCAD source root directory" + exit 0 +fi +BASEDIR=$HOME/openscad_deps +MXEDIR=$BASEDIR/mxe +PATH=$MXEDIR/usr/bin:$PATH +mkdir -p $BASEDIR + +echo MXEDIR: $MXEDIR +echo BASEDIR: $BASEDIR +echo OPENSCADDIR: $OPENSCADDIR +echo PATH modified with $MXEDIR/usr/bin +if [ ! $NUMCPU ]; then + echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)"; + NUMCPU=1 +fi +if [ ! $NUMJOBS ]; then + echo "note: you can 'export NUMJOBS=x' for building multiple pkgs at once" + if [ $NUMCPU -gt 2 ]; then + NUMJOBS=$((NUMCPU/2)) + else + NUMJOBS=1 + fi +fi +echo NUMCPU: $NUMCPU +echo NUMJOBS: $NUMJOBS + +cd $BASEDIR +if [ ! -e mxe ]; then + echo "Downloading MXE into " $MXEDIR + git clone git://github.com/mxe/mxe.git +fi + +echo "entering" $MXEDIR +cd $MXEDIR +echo "make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS" +make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS +#make mpfr -j$NUMCPU JOBS=$NUMJOBS # for testing + +echo "leaving" $MXEDIR +echo "entering $OPENSCADDIR" +cd $OPENSCADDIR +if [ -e mingw-cross-env ]; then + rm ./mingw-cross-env +fi +echo "linking mingw-cross-env directory" +ln -s $MXEDIR/usr/i686-pc-mingw32/ ./mingw-cross-env + +echo +echo "now copy/paste the following to cross-build openscad" +echo +echo "export PATH=$MXEDIR/usr/bin:\$PATH" +echo "i686-pc-mingw32-qmake CONFIG+=mingw-cross-env openscad.pro" +#echo "make -j$NUMCPU" # causes parser_yacc.hpp errors +echo "make" +echo |