Grimaud 7c3890
# Building on Windows
Grimaud 7c3890
Stephen Shkardoon 3d9be0
This software can be built using Visual Studio 2013 and Qt 5.6
Grimaud 7c3890
Grimaud 7c3890
## Required Software
Grimaud 7c3890
Grimaud 7c3890
### Visual Studio Express 2013 for Windows Desktop
Grimaud 7c3890
- https://www.microsoft.com/en-us/download/details.aspx?id=44914
Grimaud 7c3890
- Make sure that the target platform is "for Windows Desktop" not "for Windows".
Grimaud 7c3890
- Community and Provessional versions of Visual Studio 2013 for Windows Desktop also work.
Grimaud 7c3890
Grimaud 7c3890
### CMake
Grimaud 7c3890
- https://cmake.org/download/
Grimaud 7c3890
- This will be used to create the VS2013 project file.
Grimaud 7c3890
Grimaud 7c3890
## Acquiring the Source Code
Grimaud 7c3890
- Clone the base repository.
Grimaud 7c3890
- Throughout the explanation `$opentoonz` will represent the root for the base repository.
Grimaud 7c3890
- Visual Studio 2013 cannot recognize UTF-8 without BOM source code properly.  Furthermore, since the endline character is represented with only the LF character, one line comments in Japanese will often cause the following line to be treated as a comment by VS2013 as well.
Grimaud 7c3890
- In order to prevent this, please change the following setting in git so that it will preserve the proper endline characters:
Grimaud 7c3890
  - `git config core.safecrlf true`
Grimaud 7c3890
Grimaud 7c3890
## Installation of Required Libraries
Grimaud 7c3890
Because of the size of these libraries, they are not maintained in the git repository.
Grimaud 7c3890
They will have to be installed seperately as follows.
Grimaud 7c3890
Grimaud 7c3890
### Qt
Stephen Shkardoon 3d9be0
- http://download.qt.io/official_releases/qt/5.6/5.6.0/
Grimaud 7c3890
- Qt is a cross-platform GUI framework.
Grimaud 7c3890
- Select the following file from the above link:
Stephen Shkardoon 3d9be0
  - qt-opensource-windows-x86-msvc2013_64-5.6.0.exe
Grimaud 7c3890
Grimaud 7c3890
### boost
Stephen Shkardoon e239ec
- boost 1.55.0 or later is required (tested up to 1.60.0), but the support build is using 1.55.0 exactly.
Grimaud 7c3890
- http://www.boost.org/users/history/version_1_55_0.html
Grimaud 7c3890
- Download boost_1_55_0.zip from the above link.  Extract all contents to the '$opentoonz/thirdparty/boost' directory.
Grimaud 7c3890
- Install the following path for Visual Studio 2013
Grimaud 7c3890
  - https://svn.boost.org/trac/boost/attachment/ticket/9369/vc12_fix_has_member_function_callable_with.patch
Grimaud 7c3890
Stephen Shkardoon e239ec
Grimaud 7c3890
## Building
Grimaud 7c3890
Grimaud 7c3890
### Using CMake to Create a Visual Studio Project
Grimaud 7c3890
1. Launch CMake
Grimaud 7c3890
2. In `Where is the source code`, navigate to `$opentoonz/toonz/sources`
Grimaud 7c3890
3. In `Where to build the binaries`, navigate to `$opentoonz/toonz/build`
Grimaud 7c3890
  - Or to wherever you usually build to.
Grimaud 7c3890
  - If the build directory is in the git repository, be sure to add the directory to .gitignore
Grimaud 7c3890
  - If the build directory is different from the one above, be sure to change to the specified directory where appropriate below.
Grimaud 7c3890
4. Click on Configure and select Visual Studio 12 2013 Win64.
Grimaud 7c3890
5. If Qt was installed to a directory other than the default, and the error `Specify QT_PATH properly` appears, navigate to the `QT_DIR` install folder and specify the path to `msvc2013_64`.
Grimaud 7c3890
6. Click Generate
Grimaud 7c3890
  - Should the CMakeLists.txt file change, such as during automatic build cleanup, there is no need to rerun CMake.
Grimaud 7c3890
Grimaud 7c3890
## Setting Up Libraries
Grimaud 7c3890
Rename the following files:
Grimaud 7c3890
  - `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.vc` → `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.h`
Grimaud 7c3890
  - `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.vc.h` → `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.h`
Grimaud 7c3890
  - `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.vc.h` → `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.h`
Grimaud 7c3890
  - `$opentoonz/thirdparty/libpng-1.6.21/scripts/pnglibconf.h.prebuilt` → `$opentoonz/thirdparty/libpng-1.6.21/pnglibconf.h`
Grimaud 7c3890
Grimaud 7c3890
## Building
Grimaud 7c3890
1. Open `$opentoonz/toonz/build/OpenToonz.sln` and change to `Release`
Grimaud 7c3890
2. The output will be in `$opentoonz/toonz/build/Release`
Grimaud 7c3890
Grimaud 7c3890
## Running the Program
Grimaud 7c3890
### Setting Up the Program's Path
Grimaud 7c3890
1. Copy the entire contents of `$opentoonz/toonz/build/Release` to an appropriate folder.
Grimaud 7c3890
2. In the path for `OpenToonz_1.0.exe`, append the Qt program `windeployqt.exe` as an argument.
Grimaud 7c3890
  - The necessary Qt library files should be in the same folder as `OpenToonz_1.0.exe`
Grimaud 7c3890
3. Copy the following files to the same folder as `OpenToonz_1.0.exe`
Grimaud 7c3890
  - `$opentoonz/thirdparty/glut/3.7.6/lib/glut64.dll`
Grimaud 7c3890
  - `$opentoonz/thirdparty/glew/glew-1.9.0/bin/64bit/glew32.dll`
Grimaud 7c3890
4. Copy the `srv` folder from the previous OpenToonz installation to the same folder as `OpenToonz_1.0.exe`
Grimaud 7c3890
  - If there is no `srv` folder, OpenToonz can still be used.  However, various file formats such as `mov` cannot be used.
Grimaud 7c3890
  - Creating the files for `srv` is discussed later.
Grimaud 7c3890
Grimaud 7c3890
### Creating the stuff Folder
Grimaud 7c3890
If a previous binary of OpenToonz was already installed, this step and the following about creating a registry key has already been dealt with.  So feel free to skip these parts.
Grimaud 7c3890
Grimaud 7c3890
1. Copy the files from `$opentoonz/stuff` to an appropriate folder.
Grimaud 7c3890
Grimaud 7c3890
### Creating Registry Keys
Grimaud 7c3890
1. Using the registry editor, create the following key and copy the path of the `$opentoonz/stuff` folder from above to it.
Grimaud 7c3890
  - HKEY_LOCAL_MACHINE\SOFTWARE\OpenToonz\OpenToonz\1.0\TOONZROOT
Grimaud 7c3890
Grimaud 7c3890
### Running
Grimaud 7c3890
`OpenToonz_1.0.exe` can now be run.  Congratulations!
Grimaud 7c3890
Grimaud 7c3890
## Creating the Files for the srv Folder
Grimaud 7c3890
OpenToonz utilizes the QuickTime SDK's `mov` and associated file formats.  Since the QuickTime SDK only comes in 32-bit versions, the 32-bit file `t32bitsrv.exe` from the QuickTime SDK is used in both the 64-bit and 32-bit versions of OpenToonz.  As a result, the following instructions apply to both the 32 and 64-bit versions of OpenToonz.
Grimaud 7c3890
Grimaud 7c3890
### Qt
Stephen Shkardoon 3d9be0
- http://download.qt.io/official_releases/qt/5.6/5.6.0/
Grimaud 7c3890
- Find the following file from the above link and install in the appropriate folder.
Stephen Shkardoon 3d9be0
  - qt-opensource-windows-x86-msvc2013-5.6.0.exe
Grimaud 7c3890
Grimaud 7c3890
### QuickTime SDK
Grimaud 7c3890
1. Sign in using your Apple developer ID and download `QuickTime 7.3 SDK for Windows.zip` from the following url.
Grimaud 7c3890
  - https://developer.apple.com/downloads/?q=quicktime
Grimaud 7c3890
2. After installing the QuickTime SDK, copy the contents of `C:\Program Files (x86)\QuickTime SDK` to `$opentoonz/thirdparty/quicktime/QT73SDK`
Grimaud 7c3890
Grimaud 7c3890
### Using CMake to Create a Visual Studio 32-bit Project
Grimaud 7c3890
- Follow the same instructions as for the 64-bit version, but change the following:
Grimaud 7c3890
  - `$opentoonz/toonz/build` → `$opentoonz/toonz/build32`
Grimaud 7c3890
  - Visual Studio 12 2013 Win64 → Visual Studio 12 2013
Grimaud 7c3890
- Change `QT_DIR` to the path of your 32-bit version of Qt
Grimaud 7c3890
Grimaud 7c3890
### Building the 32-bit Version
Grimaud 7c3890
1. Open `$opentoonz/toonz/build32/OpenToonz.sln`
Grimaud 7c3890
Grimaud 7c3890
### Layout of the srv Folder
Grimaud 7c3890
- For the 64-bit version, copy the following files to the `srv` folder:
Grimaud 7c3890
  - From `$opentoonz/toonz/build32/Release`
Grimaud 7c3890
    - t32bitsrv.exe
Grimaud 7c3890
    - image.dll
Grimaud 7c3890
    - tnzcore.dll
Grimaud 7c3890
  - From the 32-bit version of Qt
Grimaud 7c3890
    - Qt5Core.dll
Grimaud 7c3890
    - Qt5Network.dll
Grimaud 7c3890
  - `$opentoonz/thirdparty/glut/3.7.6/lib/glut32.dll`
Grimaud 7c3890
Grimaud 7c3890
## Creating Translation Files
Grimaud 7c3890
Qt translation files are generated first from the source code to .ts files, then from .ts files to a .qm file.  These files can be created in Visual Studio if the `translation_` project and `Build translation_??? only` (`translation_???`のみをビルド」) is used.  These files are not created in the default `Build Project Solution`.