Maverick Model 3D Installation For Win32
========================================

Maverick Model 3D runs on Windows 7 and later. It may run on
Windows XP and Vista if you compile Qt 5 with Windows XP support.
It will not work on older Windows versions.

Maverick Model 3D for Windows requires the MinGW environment and
the Open Source version of Qt 5 for Windows.  To run binaries
of mm3d you only need the Qt and MinGW DLLs, which are provided 
with the binary distribution.  To build from source you must
have a development environment set up with MinGW and Qt 5.


Binary Installation
===================

Get the latest installer from the web site.  It should have
a filename like 'mm3d-X_X_X-win32-installer.exe'.  Run
the installer and select an install location.

Optionally you may choose to enable file assciations with
Maverick Model 3D.  By default only .mm3d is associated.


Building in MSYS2
=================

This is an easy way to build for your own personal use however making
releases is not supported. MSYS2 has Qt depend on various libraries and
they aren't copied to the install directory by windeployqt and would not
be added to the MM3D NSIS installer.

1. Install MSYS2 and follow the guide for updating packages at
   <https://www.msys2.org>. You don't need to install the recommended
   base-devel or mingw toolchain packages though.

2. Open "MSYS2 MSYS" from the start menu and run the following command
   to install the necessary packages:

   pacman -S --needed git make mingw-w64-x86_64-{gcc,gdb} mingw-w64-x86_64-qt5-{base,imageformats,svg,tools,translations}

If you need to debug the application, you may want these as well:

   pacman -S --needed mingw-w64-x86_64-qt5-{base,imageformats,svg,tools}-debug

3. Open "MSYS2 MinGW 64-Bit" and run the following commands. They change
   to the Desktop folder, download Maverick from GitHub, build using the
   generic config.h and Makefile, and then "install" into
   Desktop/mm3d/build/mingw64-x86_64/install. (Feel free to use a folder
   besides Desktop.)

   cd /c/Users/$USERNAME/Desktop
   git clone https://github.com/zturtleman/mm3d.git
   cd mm3d
   cp config.h.generic config.h
   cp Makefile.generic Makefile
   echo "QTDIR=/mingw64" > Makefile.local
   make
   make install

4. Still in "MSYS2 MinGW 64-Bit" run the following to launch Maverick:

   PATH=/mingw64/bin:$PATH build/mingw64-x86_64/install/mm3d.x86_64.exe

If you edit the Makefile or it's failing to build after updating
packages do a fresh build using the following:

   make clean
   make

Attempting to run build/mingw64-x86_64/install/mm3d.x86_64.exe without
setting PATH enviornment variable (or copying to another PC without
MSYS2) will report errors about missing DLLs. Copy them using Windows
Explorer from C:\msys64\mingw64\bin\ or using "MSYS2 MinGW 64-Bit"
from /mingw64/bin/ :

   cd build/mingw64-x86_64/install

   cp /mingw64/bin/libbrotilcommon.dll .
   cp /mingw64/bin/libbrotildec.dll .
   cp /mingw64/bin/libbz2-1.dll .
   cp /mingw64/bin/libdouble-conversion.dll .
   cp /mingw64/bin/libfreetype-6.dll .
   cp /mingw64/bin/libglib-2-0-0.dll .
   cp /mingw64/bin/libgraphite2.dll .
   cp /mingw64/bin/libharfbuzz-0.dll .
   cp /mingw64/bin/libiconv-2.dll .
   cp /mingw64/bin/libicudt*.dll .
   cp /mingw64/bin/libicuin*.dll .
   cp /mingw64/bin/libicuuc*.dll .
   cp /mingw64/bin/libintl-8 .
   cp /mingw64/bin/libmd4c.dll .
   cp /mingw64/bin/libpcre-1.dll .
   cp /mingw64/bin/libpng16-16.dll .
   cp /mingw64/bin/libzstd.dll .
   cp /mingw64/bin/pcre2-16-0.dll .
   cp /mingw64/bin/zlib1.dll .

   cd ../../..



Below are directions for building using the official Qt installer.
Though it has not been tested with recent Qt 5 versions.



Prerequisites
=============

You can get Qt 5.x here:

   https://www.qt.io/

During the Qt 5 installer make you sure you check the box for
installing Qt 5.11.1 and MinGW 5.3 (or the latest versions).

You must set your QTDIR environment variable to the root Qt
directory (for example, "C:\Qt\5.11.1\mingw53_32").  The Mingw
bin directory must be added to your PATH environment variable
(for example, append "C:\Qt\Tools\mingw530_32\bin;").


Build Instructions
==================

Once you have installed Qt and MinGW, do the following steps:

1. Make sure QTDIR is set and MinGW's bin directory is in
   your PATH
2. Open a cmd prompt and go to the mm3d-X.X.X directory
3. Copy config.h.generic to config.h
4. Run 'mingw32-make -f Makefile.generic MINGW32_MAKE=1'


Install Instructions
====================

1. Run 'mingw32-make -f Makefile.generic MINGW32_MAKE=1 deploy'
   from the mm3d-X.X.X directory.

2. Copy the build\mingw32-x86\install\ directory to where
   ever you want. Settings are saved in %APPDATA$\Maverick Model 3D\

`make deploy` does not create any program menu or desktop
shortcuts.  If you want shortcuts you must create them manually,
or use the binary installer.

Optionally, you can install NSIS and then build the installer.
This will create shortcuts and some registry keys.

You can get NSIS here:

   http://nsis.sourceforge.net/

3. Run 'mingw32-make -f Makefile.generic MINGW32_MAKE=1 installer'
   from the mm3d-X.X.X directory.

