Commit 694a3826d0d03713b2070c40431f8ecf3d0b3663

Authored by Josh Klontz
1 parent 3fdc911d

introduced BR_DISABLE_ALGORITHMS to ship a limited version of br command line

app/CMakeLists.txt
1 1 # Build the command line interface
  2 +add_subdirectory(br)
  3 +
2 4 if(NOT BR_PACKAGE_THIRDPARTY)
3 5 if(NOT BR_EMBEDDED)
4   - add_subdirectory(br)
5   -
6 6 # Build examples/tests
7 7 add_subdirectory(examples)
8 8  
... ...
app/br/CMakeLists.txt
... ... @@ -2,6 +2,10 @@ if(UNIX)
2 2 find_package(Threads REQUIRED)
3 3 endif()
4 4  
  5 +if(BR_DISABLE_ALGORITHMS)
  6 + add_definitions(-DBR_DISABLE_ALGORITHMS)
  7 +endif()
  8 +
5 9 add_executable(br br.cpp ${BR_RESOURCES})
6 10 target_link_libraries(br openbr ${CMAKE_THREAD_LIBS_INIT})
7 11 qt5_use_modules(br ${QT_DEPENDENCIES})
... ...
app/br/br.cpp
... ... @@ -90,6 +90,7 @@ public:
90 90 argv = &argv[parc+1];
91 91  
92 92 // Core Tasks
  93 +#ifndef BR_DISABLE_ALGORITHMS
93 94 if (!strcmp(fun, "train")) {
94 95 check(parc >= 1, "Insufficient parameter count for 'train'.");
95 96 br_train_n(parc == 1 ? 1 : parc-1, parv, parc == 1 ? "" : parv[parc-1]);
... ... @@ -100,7 +101,9 @@ public:
100 101 } else if (!strcmp(fun, "compare")) {
101 102 check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'compare'.");
102 103 br_compare(parv[0], parv[1], parc == 3 ? parv[2] : "");
103   - } else if (!strcmp(fun, "eval")) {
  104 + } else
  105 +#endif // !BR_DISABLE_ALGORITHMS
  106 + if (!strcmp(fun, "eval")) {
104 107 check((parc >= 1) && (parc <= 4), "Incorrect parameter count for 'eval'.");
105 108 if (parc == 1) {
106 109 br_eval(parv[0], "", "", 0);
... ... @@ -192,7 +195,9 @@ public:
192 195 } else if (!strcmp(fun, "plotKNN")) {
193 196 check(parc >=2, "Incorrect parameter count for 'plotKNN'.");
194 197 br_plot_knn(parc-1, parv, parv[parc-1], true);
195   - } else if (!strcmp(fun, "project")) {
  198 + }
  199 +#ifndef BR_DISABLE_ALGORITHMS
  200 + else if (!strcmp(fun, "project")) {
196 201 check(parc == 2, "Insufficient parameter count for 'project'.");
197 202 br_project(parv[0], parv[1]);
198 203 } else if (!strcmp(fun, "deduplicate")) {
... ... @@ -202,6 +207,7 @@ public:
202 207 check(parc == 3, "Incorrect parameter count for 'likely'.");
203 208 br_likely(parv[0], parv[1], parv[2]);
204 209 }
  210 +#endif // !BR_DISABLE_ALGORITHMS
205 211  
206 212 // Miscellaneous
207 213 else if (!strcmp(fun, "help")) {
... ... @@ -271,9 +277,11 @@ private:
271 277 printf("<arg> = Input; {arg} = Output; [arg] = Optional; (arg0|...|argN) = Choice\n"
272 278 "\n"
273 279 "==== Core Commands ====\n"
  280 +#ifndef BR_DISABLE_ALGORITHMS
274 281 "-train <gallery> ... <gallery> [{model}]\n"
275 282 "-enroll <input_gallery> ... <input_gallery> {output_gallery}\n"
276 283 "-compare <target_gallery> <query_gallery> [{output}]\n"
  284 +#endif // !BR_DISABLE_ALGORITHMS
277 285 "-eval <simmat> [<mask>] [{csv}] [{matches}]\n"
278 286 "-plot <csv> ... <csv> {destination}\n"
279 287 "\n"
... ... @@ -298,9 +306,11 @@ private:
298 306 "-plotLandmarking <file> ... <file> {destination}\n"
299 307 "-plotMetadata <file> ... <file> <columns>\n"
300 308 "-plotKNN <file> ... <file> {destination}\n"
  309 +#ifndef BR_DISABLE_ALGORITHMS
301 310 "-project <input_gallery> {output_gallery}\n"
302 311 "-deduplicate <input_gallery> <output_gallery> <threshold>\n"
303 312 "-likely <input_type> <output_type> <output_likely_source>\n"
  313 +#endif // !BR_DISABLE_ALGORITHMS
304 314 "-getHeader <matrix>\n"
305 315 "-setHeader {<matrix>} <target_gallery> <query_gallery>\n"
306 316 "-<key> <value>\n"
... ...