tahoma2d/doc/how_to_build_macosx.md

155 lines
6.7 KiB
Markdown
Raw Permalink Normal View History

2016-04-04 21:24:34 +12:00
# Setting Up the Development Environment on macOS
2016-03-27 10:00:25 +13:00
## Necessary Software
- git
- brew
- Xcode
2019-04-21 18:57:47 +12:00
- cmake (3.2.2 or later)
- Qt (5.9.2 or later)
- boost (1.55.0 or later)
2020-04-13 02:43:17 +12:00
- OpenCV
- Jpeg-turbo
2016-03-27 10:00:25 +13:00
## Building on macOS
2020-02-04 07:54:14 +13:00
### Download boost from https://boost.org
2016-03-27 10:00:25 +13:00
Download the .bz2 mac (unix if mac not specified) version 1_55_0 or later (last tested with 1_72_0)
2016-04-04 21:24:34 +12:00
2019-04-21 18:57:47 +12:00
Save for later step.
2016-04-04 21:24:34 +12:00
### Download and install Xcode from Apple
2016-03-27 10:00:25 +13:00
When downloading Xcode, you should use the appropriate version for your OS version. You can refer to the Version Comparison Table on https://en.wikipedia.org/wiki/Xcode to find out which version you should use.
2019-04-21 18:57:47 +12:00
Apple store usually provides for the most recent macOS version. For older versions, you will need to go to the Apple Developer site.
After installing the application, you will need to start it in order to complete the installation.
2020-04-13 02:43:17 +12:00
2019-04-21 18:57:47 +12:00
### Install Homebrew from https://brew.sh
Check site for any changes in installation instructions, but they will probably just be this:
1. Open a Terminal window
2. Execute the following statement:
```
2020-03-26 15:08:49 +13:00
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2019-04-21 18:57:47 +12:00
```
### Install required software using brew
In a Terminal window, execute the following statements:
2016-03-27 10:00:25 +13:00
```
$ brew install glew lz4 libjpeg libpng lzo pkg-config cmake git-lfs libmypaint qt opencv jpeg-turbo
2019-04-21 18:57:47 +12:00
$ git lfs install
2016-03-27 10:00:25 +13:00
```
2019-04-21 18:57:47 +12:00
NOTE: This will install the latest version of QT which may not be compatible with older OS versions.
2016-04-04 21:24:34 +12:00
If you cannot use the most recent version, download the online installer from https://www.qt.io/download and install the appropriate `macOS` version (min 5.9.2). If installing via this method, be sure to install the `Qt Script (Deprecated)` libraries.
2016-04-04 21:24:34 +12:00
### Remove incompatible symbolic directory
Check to see if this symbolic glew directory exists. If so, remove it:
```
$ ls -l /usr/local/lib/cmake/glew
$ rm /usr/local/lib/cmake/glew
```
2020-10-02 19:20:33 +13:00
### Set up Tahoma2D repository
2016-03-27 10:00:25 +13:00
2020-10-02 19:20:33 +13:00
These steps will put the Tahoma2D repository under /Users/yourlogin/Documents.
2016-03-27 10:00:25 +13:00
```
2019-04-21 18:57:47 +12:00
$ cd ~/Documents #or where you want to store the repository#
2021-02-12 06:02:54 +13:00
$ git clone https://github.com/tahoma2d/tahoma2d
2020-10-02 19:20:33 +13:00
$ cd tahoma2d
2019-04-21 18:57:47 +12:00
$ git lfs pull
$ cd thirdparty/boost
$ mv ~/Downloads/boost_1_72_0.tar.bz2 . #or whatever the boost filename you downloaded is#
$ tar xvjf boost_1_72_0.tar.bz2
2019-04-21 18:57:47 +12:00
$ cd ../lzo
$ cp -r 2.03/include/lzo driver
2022-08-28 13:23:40 +12:00
$ cd ../tiff-4.2.0
$ ./configure --disable-webp --disable-zstd --without-x && make
2016-03-27 10:00:25 +13:00
```
2019-04-21 18:57:47 +12:00
### Configure build for QT version
2020-10-02 19:20:33 +13:00
Edit the `/Users/yourlogin/Documents/tahoma2d/toonz/sources/CMakeLists.txt` file at line 160 (64-bit OS) or 172 (32-bit OS) and modify the root path for the QT lib directory
2016-03-27 10:00:25 +13:00
If you installed QT using `brew`, you can get the version and path to use with: `$ brew info qt`. The lib path will look something like this: `/usr/local/Cellar/qt/5.12.2/lib`
If you downloaded the QT installer and installed to `/Users/yourlogin/Qt`, your lib path may look something like this: `~/Qt/5.12.2/clang_64/lib` or `~/Qt/5.12.2/clang_32/lib`
2016-03-27 10:00:25 +13:00
2020-10-02 19:20:33 +13:00
### Configure environment and Build Tahoma2D
2019-04-21 18:57:47 +12:00
1. Create the build directory with the following:
2016-03-27 10:00:25 +13:00
```
2020-10-02 19:20:33 +13:00
$ cd ~/Documents/tahoma2d/toonz
2019-04-21 18:57:47 +12:00
$ mkdir build
$ cd build
2020-04-13 02:43:17 +12:00
$ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/jpeg-turbo/lib/pkgconfig"
2016-03-27 10:00:25 +13:00
```
2019-04-21 18:57:47 +12:00
2. Set up build environment
2016-03-27 10:00:25 +13:00
2019-04-21 18:57:47 +12:00
To build from command line, do the following:
2016-03-27 10:00:25 +13:00
```
$ CMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.12.2 cmake ../sources #replace QT path with your installed QT version#
2019-04-21 18:57:47 +12:00
$ make
2016-03-27 10:00:25 +13:00
```
To build using Xcode, do the following:
2016-03-27 10:00:25 +13:00
```
2019-04-21 18:57:47 +12:00
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
$ CMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.12.2 cmake -G Xcode ../sources -B. #replace QT path with your installed QT version#
2016-03-27 10:00:25 +13:00
```
2020-10-02 19:20:33 +13:00
- Open Xcode app and open project /Users/yourlogin/Documents/tahoma2d/toonz/build/Tahoma2D.xcodeproj
- Change `ALL_BUILD` to `Tahoma2D`
2019-04-21 18:57:47 +12:00
- Start build with: Product -> Build
2019-04-21 18:57:47 +12:00
- NOTE about rebuilding in Xcode: The initial build should succeed without any errors. There after, the build will succeed but the following 3 errors can be ignored:
```
2020-10-02 19:20:33 +13:00
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: for: /Users/yourlogin/Documents/tahoma2d/toonz/build/toonz/Debug/Tahoma2D.app/Contents/MacOS/Tahoma2D (for architecture x86_64) option "-add_rpath @executable_path/." would duplicate path, file already has LC_RPATH for: @executable_path/.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: for: /Users/yourlogin/Documents/tahoma2d/toonz/build/toonz/Debug/Tahoma2D.app/Contents/MacOS/Tahoma2D (for architecture x86_64) option "-add_rpath /usr/local/Cellar/qt/5.12.2/lib/" would duplicate path, file already has LC_RPATH for: /usr/local/Cellar/qt/5.12.2/lib/
2019-04-21 18:57:47 +12:00
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
```
Side note: If you want the option to build by command line and Xcode, create a separate build directory for each.
2019-04-21 18:57:47 +12:00
### Create the stuff Directory
2016-03-27 10:00:25 +13:00
2020-10-02 19:20:33 +13:00
If you have installed Tahoma2D on the machine already, you can skip this. Otherwise, you need to create the stuff folder with the following:
2016-03-27 10:00:25 +13:00
```
2020-10-02 19:20:33 +13:00
$ cd ~/Documents/tahoma2d
$ sudo mkdir /Applications/Tahoma2D
$ sudo cp -r stuff /Applications/Tahoma2D/Tahoma2D_stuff
$ sudo chmod -R 777 /Applications/Tahoma2D
2016-03-27 10:00:25 +13:00
```
2020-04-13 02:43:17 +12:00
## Building with extended stop motion support for webcams and Canon DSLR cameras.
You will need one additional library:
- The Canon SDK. This requires applying for the Canon developer program and downloading the SDK.
2020-10-02 19:20:33 +13:00
Copy the Header and Framework folders from the Canon SDK to `$tahoma2d/thirdparty/canon`
2020-04-13 02:43:17 +12:00
2020-10-02 19:20:33 +13:00
Edit the `/Users/yourlogin/Documents/tahoma2d/toonz/sources/CMakeLists.txt` file at the end of line 104, changing the `WITH_CANON` build option from `OFF` to `ON`.
2020-04-13 02:43:17 +12:00
2020-10-02 19:20:33 +13:00
To run the program with stop motion support, you will need to copy the EDSDK.framework directory from the Canon SDK and place it in `Macintosh HD/Library/Frameworks`. It could also be placed in the same folder as `Tahoma2D.app`. If opening Tahoma2D.app fails because "EDSDK.framework can't be opened", go to `Preferences -> Security & Privacy -> General` and select "Open Anyway". Open Tahoma2D again and select "Open" when the "EDSDK.framework can't be opened" warning appears.
2016-03-27 10:00:25 +13:00
2019-04-21 18:57:47 +12:00
### Running the build
2016-03-27 10:00:25 +13:00
- If built using command line, run the following:
2016-03-27 10:00:25 +13:00
```
2020-10-02 19:20:33 +13:00
$ open ~/Documents/tahoma2d/build/toonz/Tahoma2D.app
2016-03-27 10:00:25 +13:00
```
2019-04-21 18:57:47 +12:00
- If built using Xcode, do the following:
2020-10-02 19:20:33 +13:00
- Open Scheme editor for Tahoma2D: Product -> Scheme -> Edit Scheme
2019-04-23 16:44:21 +12:00
- Uncheck: Run -> Options -> Document Versions
- Run in Debug mode: Product -> Run
2019-04-21 18:57:47 +12:00
2020-10-02 19:20:33 +13:00
- To open with command line or from Finder window, the application is found in `/Users/yourlogin/Documents/tahoma2d/toonz/build/Debug/Tahoma2D.app`