|
75 | 75 | register: opencv_extra_repo_state
|
76 | 76 |
|
77 | 77 | - block:
|
| 78 | + - name: Check if there is a previous OpenCV build |
| 79 | + stat: path="../../opencv/build/install_manifest.txt" |
| 80 | + register: opencv_prev_build |
| 81 | + |
| 82 | + - block: |
| 83 | + - name: Uninstall previous OpenCV build |
| 84 | + make: target=uninstall |
| 85 | + args: |
| 86 | + chdir: "../../opencv/build" |
| 87 | + become: yes |
| 88 | + |
| 89 | + - name: Remove old OpenCV build folder |
| 90 | + file: path="../../opencv/build" state=absent |
| 91 | + when: opencv_prev_build.stat.exists |
| 92 | + |
| 93 | + - name: Remove remainings from previous OpenCV build (1/2) |
| 94 | + file: path="{{ item }}" state=absent |
| 95 | + with_items: |
| 96 | + - /usr/local/include/opencv |
| 97 | + - /usr/local/include/opencv2 |
| 98 | + - /usr/local/share/OpenCV |
| 99 | + become: yes |
| 100 | + |
| 101 | + # with_fileglob unfortunately seems to ignore symlinks, but they should not cause harm ... |
| 102 | + - name: Remove remainings from previous OpenCV build (2/2) |
| 103 | + file: path="{{ item }}" state=absent |
| 104 | + with_fileglob: |
| 105 | + - /usr/local/lib/libopencv_* |
| 106 | + become: yes |
| 107 | + |
78 | 108 | - name: Ensure build folder inside OpenCV repo
|
79 | 109 | file: path="../../opencv/build" state=directory
|
80 | 110 |
|
|
96 | 126 | -D BUILD_PERF_TESTS=OFF
|
97 | 127 | -D BUILD_TESTS=OFF
|
98 | 128 | -D BUILD_DOCS=OFF
|
99 |
| - -D ENABLE_FAST_MATH=1 .." |
| 129 | + -D BUILD_EXAMPLES={{ opencv_build_examples }} |
| 130 | + -D ENABLE_FAST_MATH=1 |
| 131 | + -D PROTOBUF_PROTOC_EXECUTABLE=/usr/bin/protoc .." |
100 | 132 | args:
|
101 | 133 | chdir: "../../opencv/build"
|
102 | 134 |
|
|
111 | 143 | chdir: "../../opencv/build"
|
112 | 144 | become: yes
|
113 | 145 | when:
|
114 |
| - - not opencv_installed.stat.exists |
| 146 | + - not opencv_installed.stat.exists or opencv_repo_state.changed or opencv_force_rebuild |
115 | 147 |
|
116 | 148 | - name: Add /usr/local/lib to system library paths
|
117 | 149 | lineinfile:
|
|
0 commit comments