From b80434300f4f32a6c4a39fead4eaa21ee813931f Mon Sep 17 00:00:00 2001 From: Mu-Woong Lee Date: Tue, 12 Jan 2016 15:59:35 +0900 Subject: [PATCH] Build flags for disabling place recognition & prediction engines Change-Id: I6e346f4464f72a66c6314678c988d8df6db11367 Signed-off-by: Mu-Woong Lee --- src/place/CMakeLists.txt | 16 +++++++++++++--- src/place/place_context_provider.cpp | 9 +++++++-- src/statistics/CMakeLists.txt | 12 +++++++++++- src/statistics/statistics_context_provider.cpp | 8 ++++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/place/CMakeLists.txt b/src/place/CMakeLists.txt index 47ec7df..9ee741d 100644 --- a/src/place/CMakeLists.txt +++ b/src/place/CMakeLists.txt @@ -1,16 +1,22 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(target "ctx-place") +# Build flag for the place auto detection engine. +# Set this to "yes" to enable the engine. +SET(enable_recog_engine "no") + # Common Profile FILE(GLOB srcs *.cpp) # Mobile Profile IF("${PROFILE}" STREQUAL "mobile") FILE(GLOB_RECURSE srcs ${srcs} geofence/*.cpp) - FILE(GLOB_RECURSE srcs ${srcs} recognition/*.cpp) - SET(deps "${deps} capi-location-manager") SET(deps "${deps} capi-geofence-manager") - SET(deps "${deps} capi-network-wifi") + IF("${enable_recog_engine}" STREQUAL "yes") + FILE(GLOB_RECURSE srcs ${srcs} recognition/*.cpp) + SET(deps "${deps} capi-location-manager") + SET(deps "${deps} capi-network-wifi") + ENDIF("${enable_recog_engine}" STREQUAL "yes") ENDIF("${PROFILE}" STREQUAL "mobile") MESSAGE("Place Provider Sources: ${srcs}") @@ -30,5 +36,9 @@ SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"CONTEX SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${MAJORVER}) SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${FULLVER}) +IF(NOT "${enable_recog_engine}" STREQUAL "yes") + SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "_DISABLE_RECOG_ENGINE_") +ENDIF(NOT "${enable_recog_engine}" STREQUAL "yes") + # Install INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries) diff --git a/src/place/place_context_provider.cpp b/src/place/place_context_provider.cpp index d5adcde..934f780 100644 --- a/src/place/place_context_provider.cpp +++ b/src/place/place_context_provider.cpp @@ -21,8 +21,10 @@ #ifdef _MOBILE_ #include "geofence/place_geofence.h" +#ifndef _DISABLE_RECOG_ENGINE_ #include "recognition/place_recognition.h" -#endif +#endif /* _DISABLE_RECOG_ENGINE_ */ +#endif /* _MOBILE_ */ template void register_provider(const char *subject, const char *privilege) @@ -40,8 +42,11 @@ EXTAPI bool ctx::init_place_context_provider() register_provider(PLACE_SUBJ_GEOFENCE, PLACE_PRIV_GEOFENCE); place_geofence_provider::submit_trigger_item(); +#ifndef _DISABLE_RECOG_ENGINE_ place_recognition_provider::create(NULL); register_provider(PLACE_SUBJ_RECOGNITION, PLACE_PRIV_RECOGNITION); -#endif +#endif /* _DISABLE_RECOG_ENGINE_ */ + +#endif /* _MOBILE_ */ return true; } diff --git a/src/statistics/CMakeLists.txt b/src/statistics/CMakeLists.txt index d0ee7d6..1085dce 100644 --- a/src/statistics/CMakeLists.txt +++ b/src/statistics/CMakeLists.txt @@ -1,6 +1,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(target "ctx-statistics") +# Build flag for the prediction engine. +# Set this to "yes" to enable the engine. +SET(enable_prediction_engine "no") + # Common Options INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/shared @@ -10,7 +14,9 @@ INCLUDE_DIRECTORIES( FILE(GLOB srcs ./*.cpp) FILE(GLOB srcs ${srcs} shared/*.cpp) FILE(GLOB srcs ${srcs} app/*.cpp) -FILE(GLOB srcs ${srcs} prediction/*.cpp) +IF("${enable_prediction_engine}" STREQUAL "yes") + FILE(GLOB srcs ${srcs} prediction/*.cpp) +ENDIF("${enable_prediction_engine}" STREQUAL "yes") SET(deps "capi-system-runtime-info pkgmgr pkgmgr-info capi-appfw-package-manager") SET(deps "${deps} capi-appfw-application capi-appfw-app-manager") @@ -58,5 +64,9 @@ SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"CONTEX SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${MAJORVER}) SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${FULLVER}) +IF(NOT "${enable_prediction_engine}" STREQUAL "yes") + SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "_DISABLE_PREDICTION_ENGINE_") +ENDIF(NOT "${enable_prediction_engine}" STREQUAL "yes") + # Install INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries) diff --git a/src/statistics/statistics_context_provider.cpp b/src/statistics/statistics_context_provider.cpp index 62fea4d..13e9c40 100644 --- a/src/statistics/statistics_context_provider.cpp +++ b/src/statistics/statistics_context_provider.cpp @@ -20,6 +20,10 @@ #include "app/app_stats_provider.h" +#ifndef _DISABLE_PREDICTION_ENGINE_ +// include prediction engine header files here +#endif + #ifdef _MOBILE_ #include "media/media_stats_provider.h" #include "social/social_stats_provider.h" @@ -50,6 +54,10 @@ EXTAPI bool ctx::init_statistics_context_provider() register_provider(APP_SUBJ_FREQUENCY, APP_HISTORY_PRIV); app_statistics_provider::submit_trigger_item(); +#ifndef _DISABLE_PREDICTION_ENGINE_ +// initialize the prediction engine here +#endif + #ifdef _MOBILE_ media_statistics_provider::create(NULL); register_provider(MEDIA_SUBJ_PEAK_TIME_FOR_MUSIC, MEDIA_HISTORY_PRIV); -- 2.7.4