Add next and previous navigation links to all tutorials
[platform/upstream/opencv.git] / doc / tutorials / introduction / ios_install / ios_install.markdown
1 Installation in iOS {#tutorial_ios_install}
2 ===================
3
4 @prev_tutorial{tutorial_macos_install}
5 @next_tutorial{tutorial_arm_crosscompile_with_cmake}
6
7 Required Packages
8 -----------------
9
10 -   CMake 2.8.8 or higher
11 -   Xcode 4.2 or higher
12
13 ### Getting the Cutting-edge OpenCV from Git Repository
14
15 Launch Git client and clone OpenCV repository from [GitHub](http://github.com/opencv/opencv).
16
17 In MacOS it can be done using the following command in Terminal:
18
19 @code{.bash}
20 cd ~/<my_working _directory>
21 git clone https://github.com/opencv/opencv.git
22 @endcode
23
24 If you want to install OpenCV’s extra modules, clone the opencv_contrib repository as well:
25
26 @code{.bash}
27 cd ~/<my_working _directory>
28 git clone https://github.com/opencv/opencv_contrib.git
29 @endcode
30
31
32 Building OpenCV from Source, using CMake and Command Line
33 ---------------------------------------------------------
34
35 1.  Make sure the xcode command line tools are installed:
36     @code{.bash}
37     xcode-select --install
38     @endcode
39
40 2.  Build OpenCV framework:
41     @code{.bash}
42     cd ~/<my_working_directory>
43     python opencv/platforms/ios/build_framework.py ios
44     @endcode
45
46 3.  To install OpenCV’s extra modules, append `--contrib opencv_contrib` to the python command above. **Note:** the extra modules are not included in the iOS Pack download at [OpenCV Releases](https://opencv.org/releases/). If you want to use the extra modules (e.g. aruco), you must build OpenCV yourself and include this option:
47     @code{.bash}
48     cd ~/<my_working_directory>
49     python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib
50     @endcode
51
52 4.  To exclude a specific module, append `--without <module_name>`. For example, to exclude the "optflow" module from opencv_contrib:
53     @code{.bash}
54     cd ~/<my_working_directory>
55     python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib --without optflow
56     @endcode
57
58 5.  The build process can take a significant amount of time. Currently (OpenCV 3.4 and 4.1), five separate architectures are built: armv7, armv7s, and arm64 for iOS plus i386 and x86_64 for the iPhone simulator. If you want to specify the architectures to include in the framework, use the `--iphoneos_archs` and/or `--iphonesimulator_archs` options. For example, to only build arm64 for iOS and x86_64 for the simulator:
59     @code{.bash}
60     cd ~/<my_working_directory>
61     python opencv/platforms/ios/build_framework.py ios --contrib opencv_contrib --iphoneos_archs arm64 --iphonesimulator_archs x86_64
62     @endcode
63
64 If everything’s fine, the build process will create
65 `~/<my_working_directory>/ios/opencv2.framework`. You can add this framework to your Xcode projects.
66
67 Further Reading
68 ---------------
69
70 You can find several OpenCV+iOS tutorials here @ref tutorial_table_of_content_ios.