Skip to content

Commit 24b2514

Browse files
committed
bump to latest tf version 1.4.0 and opencv 3.3.1, include cleanup of previous build for opencv when recompiling, added option to enable/disable build opencv examples and forec recompilation
1 parent cd39055 commit 24b2514

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

ansible/roles/opencv/tasks/main.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,36 @@
7575
register: opencv_extra_repo_state
7676

7777
- 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+
78108
- name: Ensure build folder inside OpenCV repo
79109
file: path="../../opencv/build" state=directory
80110

@@ -96,7 +126,9 @@
96126
-D BUILD_PERF_TESTS=OFF
97127
-D BUILD_TESTS=OFF
98128
-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 .."
100132
args:
101133
chdir: "../../opencv/build"
102134

@@ -111,7 +143,7 @@
111143
chdir: "../../opencv/build"
112144
become: yes
113145
when:
114-
- not opencv_installed.stat.exists
146+
- not opencv_installed.stat.exists or opencv_repo_state.changed or opencv_force_rebuild
115147

116148
- name: Add /usr/local/lib to system library paths
117149
lineinfile:

config/config.local.sample.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tf_enable_gpu: false
99

1010
tf_build_from_source: false
1111
tf_repo_name: tensorflow
12-
tf_repo_branch: v1.3.1
12+
tf_repo_branch: v1.4.0
1313

1414
tf_models_repo_name: tensorflow_models
1515
tf_models_repo_url: tensorflow/models
@@ -19,7 +19,9 @@ tf_models_repo_branch: master
1919

2020
# Note: Before switching to a new version, you can cleanup the previous by simply running 'sudo make uninstall' inside opencv/build/ folder
2121

22-
opencv_version: 3.3.0
23-
opencv_repo_branch: 3.3.0
24-
opencv_contrib_repo_branch: 3.3.0
25-
opencv_extra_repo_branch: 3.3.0
22+
opencv_version: 3.3.1
23+
opencv_repo_branch: 3.3.1
24+
opencv_contrib_repo_branch: 3.3.1
25+
opencv_extra_repo_branch: 3.3.1
26+
opencv_build_examples: OFF
27+
opencv_force_rebuild: false

0 commit comments

Comments
 (0)