diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 84896c2..751cb5f 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,8 +1,8 @@ # Build the command line interface +add_subdirectory(br) + if(NOT BR_PACKAGE_THIRDPARTY) if(NOT BR_EMBEDDED) - add_subdirectory(br) - # Build examples/tests add_subdirectory(examples) diff --git a/app/br/CMakeLists.txt b/app/br/CMakeLists.txt index dfa60ed..c66c234 100644 --- a/app/br/CMakeLists.txt +++ b/app/br/CMakeLists.txt @@ -2,6 +2,10 @@ if(UNIX) find_package(Threads REQUIRED) endif() +if(BR_DISABLE_ALGORITHMS) + add_definitions(-DBR_DISABLE_ALGORITHMS) +endif() + add_executable(br br.cpp ${BR_RESOURCES}) target_link_libraries(br openbr ${CMAKE_THREAD_LIBS_INIT}) qt5_use_modules(br ${QT_DEPENDENCIES}) diff --git a/app/br/br.cpp b/app/br/br.cpp index 89cd232..199c21b 100644 --- a/app/br/br.cpp +++ b/app/br/br.cpp @@ -90,6 +90,7 @@ public: argv = &argv[parc+1]; // Core Tasks +#ifndef BR_DISABLE_ALGORITHMS if (!strcmp(fun, "train")) { check(parc >= 1, "Insufficient parameter count for 'train'."); br_train_n(parc == 1 ? 1 : parc-1, parv, parc == 1 ? "" : parv[parc-1]); @@ -100,7 +101,9 @@ public: } else if (!strcmp(fun, "compare")) { check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'compare'."); br_compare(parv[0], parv[1], parc == 3 ? parv[2] : ""); - } else if (!strcmp(fun, "eval")) { + } else +#endif // !BR_DISABLE_ALGORITHMS + if (!strcmp(fun, "eval")) { check((parc >= 1) && (parc <= 4), "Incorrect parameter count for 'eval'."); if (parc == 1) { br_eval(parv[0], "", "", 0); @@ -192,7 +195,9 @@ public: } else if (!strcmp(fun, "plotKNN")) { check(parc >=2, "Incorrect parameter count for 'plotKNN'."); br_plot_knn(parc-1, parv, parv[parc-1], true); - } else if (!strcmp(fun, "project")) { + } +#ifndef BR_DISABLE_ALGORITHMS + else if (!strcmp(fun, "project")) { check(parc == 2, "Insufficient parameter count for 'project'."); br_project(parv[0], parv[1]); } else if (!strcmp(fun, "deduplicate")) { @@ -202,6 +207,7 @@ public: check(parc == 3, "Incorrect parameter count for 'likely'."); br_likely(parv[0], parv[1], parv[2]); } +#endif // !BR_DISABLE_ALGORITHMS // Miscellaneous else if (!strcmp(fun, "help")) { @@ -271,9 +277,11 @@ private: printf(" = Input; {arg} = Output; [arg] = Optional; (arg0|...|argN) = Choice\n" "\n" "==== Core Commands ====\n" +#ifndef BR_DISABLE_ALGORITHMS "-train ... [{model}]\n" "-enroll ... {output_gallery}\n" "-compare [{output}]\n" +#endif // !BR_DISABLE_ALGORITHMS "-eval [] [{csv}] [{matches}]\n" "-plot ... {destination}\n" "\n" @@ -298,9 +306,11 @@ private: "-plotLandmarking ... {destination}\n" "-plotMetadata ... \n" "-plotKNN ... {destination}\n" +#ifndef BR_DISABLE_ALGORITHMS "-project {output_gallery}\n" "-deduplicate \n" "-likely \n" +#endif // !BR_DISABLE_ALGORITHMS "-getHeader \n" "-setHeader {} \n" "- \n"