DoctorRyan b533fd
Grimaud 7c3890
# Building on Windows
Grimaud 7c3890
DoctorRyan b533fd
This software can be built using Visual Studio 2015 or above and Qt 5.9 (later Qt versions still not working correctly.)
Grimaud 7c3890
Grimaud 7c3890
## Required Software
Grimaud 7c3890
DoctorRyan b533fd
### Visual Studio Express 2015 or higher for Windows Desktop
J.P. Turcotte 0e6a35
- https://www.visualstudio.com/vs/older-downloads/
DoctorRyan b533fd
- Make sure the target platform is "for Windows Desktop", not "for Windows".
DoctorRyan b533fd
- Community and Professional versions of Visual Studio for Windows Desktop also work.
J.P. Turcotte 0e6a35
- During the installation, make sure to select all the Visual C++ packages.
Grimaud 7c3890
Grimaud 7c3890
### CMake
Grimaud 7c3890
- https://cmake.org/download/
Shinya Kitaoka 0c20bd
- This will be used to create the `MSVC 2015` project file.
Grimaud 7c3890
Grimaud 7c3890
### Qt
Shinya Kitaoka 0c20bd
- https://www.qt.io/download-open-source/
Grimaud 7c3890
- Qt is a cross-platform GUI framework.
DoctorRyan b533fd
- Install Qt 5.9 (64-bit version, tested up to 5.9.9) with the [Qt Online Installer for Windows](http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe).
Grimaud 7c3890
Grimaud 7c3890
### boost
J.P. Turcotte 0e6a35
- Boost 1.55.0 or later is required (tested up to 1.61.0).
Shinya Kitaoka 0c20bd
- http://www.boost.org/users/history/version_1_61_0.html
DoctorRyan b533fd
- Download boost_1_73_0.zip from the above link. Extract all contents to the - '$opentoonz/thirdparty/boost' directory.
Shinya Kitaoka 0c20bd
- Install the following patch (Make the changes listed in the patch file), if you use Boost 1.55.0 with Visual Studio 2013.
DoctorRyan b533fd
- https://svn.boost.org/trac/boost/attachment/ticket/9369/vc12_fix_has_member_function_callable_with.patch
DoctorRyan b533fd
DoctorRyan b533fd
## Acquiring the Source Code
DoctorRyan b533fd
- Note: You can also perform these next commands with Github for Desktop client.
DoctorRyan b533fd
- Clone the base repository.
DoctorRyan b533fd
- Throughout the explanation `$opentoonz` will represent the root for the base repository.
Grimaud 7c3890
DoctorRyan b533fd
### lib and dll
Stephen Shkardoon e239ec
DoctorRyan b533fd
- `lib` and `dll` files are tracked by [Git Large File Storage](https://git-lfs.github.com/).
DoctorRyan b533fd
- Note: git-lfs is also installed with Github Desktop.
DoctorRyan b533fd
- Visual Studio 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 `MSVS` as well.
DoctorRyan b533fd
- In order to prevent this, please change the following setting in git so that it will preserve the proper endline characters:
DoctorRyan b533fd
- `git config core.safecrlf true`
DoctorRyan b533fd
- Execute `git lfs pull` after `git clone` by using the lfs client.
Grimaud 7c3890
Grimaud 7c3890
### Using CMake to Create a Visual Studio Project
DoctorRyan b533fd
- Launch CMake
DoctorRyan b533fd
- In `Where is the source code`, navigate to `$opentoonz/toonz/sources`
DoctorRyan b533fd
- In `Where to build the binaries`, navigate to `$opentoonz/toonz/build`
DoctorRyan b533fd
- Or to wherever you usually build to.
DoctorRyan b533fd
- If the build directory is in the git repository, be sure to add the directory to .gitignore
DoctorRyan b533fd
- If the build directory is different from the one above, be sure to change to the specified directory where appropriate below.
DoctorRyan b533fd
-Click on Configure and select the version of Visual Studio you are using.
DoctorRyan b533fd
-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 `msvc2015_64`. Rerun Configure.
DoctorRyan b533fd
-If red lines appear in the bottom box, you can safely ignore them.
DoctorRyan b533fd
-Click Generate
DoctorRyan b533fd
-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:
DoctorRyan b533fd
- `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.vc` to `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.h`
DoctorRyan b533fd
- `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.vc.h` to `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.h`
DoctorRyan b533fd
- `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.vc.h to $opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.h`
DoctorRyan b533fd
- `$opentoonz/thirdparty/libpng-1.6.21/scripts/pnglibconf.h.prebuilt to $opentoonz/thirdparty/libpng-1.6.21/pnglibconf.h`
DoctorRyan b533fd
- Note that the destination is a different folder for the last file.
Grimaud 7c3890
Grimaud 7c3890
## Building
DoctorRyan b533fd
- Open `$opentoonz/toonz/build/OpenToonz.sln` and change to `Debug` or `Release` in the top bar.
DoctorRyan b533fd
- Compile the build.
DoctorRyan b533fd
- The output will be in the corresponding folder in `$opentoonz/toonz/build/`
Grimaud 7c3890
Jeremy Bullock f15907
## Building with extended stop motion support for webcams and Canon DSLR cameras.
DoctorRyan b533fd
 You will need three additional libraries.
DoctorRyan b533fd
- [OpenCV](https://opencv.org/) (v4.1.0 and later)
Jeremy Bullock f15907
  - [libjpeg-turbo](https://www.libjpeg-turbo.org/)
Jeremy Bullock f15907
  - The Canon SDK.  This requires applying for the Canon developer program and downloading the SDK.
Jeremy Bullock f15907
Jeremy Bullock f15907
Copy the following folders into the `$opentoonz/thirdparty` folder.
Jeremy Bullock f15907
  - Copy the Header and library folders from the Canon SDK to `$opentoonz/thirdparty/canon`
Jeremy Bullock f15907
    - Make sure that the library is the one from the EDSDK_64 folder.
Jeremy Bullock f15907
  - Copy the lib and include folders from libjpeg-turbo64 into `$opentoonz/thirdparty/libjpeg-turbo64`.
Jeremy Bullock f15907
Jeremy Bullock f15907
Check the checkbox in CMake to build with stop motion support.
shun-iwasawa 590082
On configuring with CMake or in the environmental variables, specify `OpenCV_DIR` to the `build` folder in the install folder of OpenCV (like `C:/opencv/build`).
Jeremy Bullock f15907
Jeremy Bullock f15907
To run the program with stop motion support, you will need to copy the .dll files from opencv2, libjpeg-turbo and the Canon SDK into the folder where your project is built.
Jeremy Bullock f15907
Grimaud 7c3890
## Running the Program
Grimaud 7c3890
### Setting Up the Program's Path
DoctorRyan b533fd
1. Copy the entire contents of $opentoonz/toonz/build/Release to an appropriate folder.
Jeremy Bullock e442b1
DoctorRyan b533fd
2. Open a Command Prompt and navigate to `QT_DIR/msvc2015_64/bin`. Run the Qt program `windeployqt.exe` with the path for `OpenToonz.exe` as an argument. (Another way to do this is navigate to the exe that was created in your Release folder and drag and drop the Opentoonz.exe on top of the windeployqt.exe This will automatically generate the QT files and folders you will need.)
DoctorRyan b533fd
 - The necessary Qt library files should be in the same folder as `OpenToonz.exe`
Jeremy Bullock e442b1
  - These include:
Jeremy Bullock e442b1
    - `Qt5Core.dll`
Jeremy Bullock e442b1
    - `Qt5Gui.dll`
Jeremy Bullock e442b1
    - `Qt5Network.dll`
Jeremy Bullock e442b1
    - `Qt5OpenGL.dll`
Jeremy Bullock e442b1
    - `Qt5PrintSupport.dll`
Jeremy Bullock e442b1
    - `Qt5Script.dll`
Jeremy Bullock e442b1
    - `Qt5Svg.dll`
Jeremy Bullock e442b1
    - `Qt5Widgets.dll`
Jeremy Bullock a61010
    - `Qt5Multimedia.dll`
shun-iwasawa f39ea0
  - These files should be in the corresponding folders in the same folder `OpenToonz.exe`
Jeremy Bullock e442b1
    - `/bearer/qgenericbearer.dll`
Jeremy Bullock e442b1
    - `/bearer/qnativewifibearer.dll`
Jeremy Bullock e442b1
    - `/iconengines/qsvgicon.dll`
Jeremy Bullock e442b1
    - `/imageformats/qdds.dll`
Jeremy Bullock e442b1
    - `/imageformats/qgif.dll`
Jeremy Bullock e442b1
    - `/imageformats/qicns.dll`
Jeremy Bullock e442b1
    - `/imageformats/qico.dll`
Jeremy Bullock e442b1
    - `/imageformats/qjpeg.dll`
Jeremy Bullock e442b1
    - `/imageformats/qsvg.dll`
Jeremy Bullock e442b1
    - `/imageformats/qtga.dll`
Jeremy Bullock e442b1
    - `/imageformats/qtiff.dll`
Jeremy Bullock e442b1
    - `/imageformats/qwbmp.dll`
Jeremy Bullock e442b1
    - `/imageformats/qwebp.dll`
Jeremy Bullock e442b1
    - `/platforms/qwindows.dll`
Jeremy Bullock e442b1
shun-iwasawa f39ea0
3. Copy the following files to the same folder as `OpenToonz.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`
Jeremy Bullock e442b1
shun-iwasawa f39ea0
4. Copy the `srv` folder from the previous OpenToonz installation to the same folder as `OpenToonz.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.
shun-iwasawa f39ea0
  - HKEY_LOCAL_MACHINE\SOFTWARE\OpenToonz\OpenToonz\TOONZROOT
Grimaud 7c3890
Grimaud 7c3890
### Running
shun-iwasawa f39ea0
`OpenToonz.exe` can now be run.  Congratulations!
Grimaud 7c3890
J.P. Turcotte 0e6a35
## Debugging
shun-iwasawa f39ea0
1. In the Solution Explorer, select the OpenToonz project within the OpenToonz solution.
J.P. Turcotte 0e6a35
2. In the Project menu, choose Set as StartUp Project.
J.P. Turcotte 0e6a35
Shinya Kitaoka 0c20bd
## 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
Shinya Kitaoka 0c20bd
- https://www.qt.io/download-open-source/
shun_iwasawa 31362d
- Install Qt 5.9 (32-bit version) by the  by [Qt Online Installer for Windows](http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.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:
Shinya Kitaoka 0c20bd
  - `$opentoonz/toonz/build` to `$opentoonz/toonz/build32`
Shinya Kitaoka 0c20bd
  - `Visual Studio 14 2015 Win64` to `Visual Studio 14 2015`
Shinya Kitaoka 0c20bd
- Change `QT_PATH` 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
Shinya Kitaoka 0c20bd
### 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`.