From: MyungJoo Ham Date: Thu, 17 Nov 2016 08:56:03 +0000 (+0900) Subject: Remove Profile Build Dependency: Do it at runtime X-Git-Tag: submit/tizen/20161128.050026^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F98433%2F2;p=platform%2Fcore%2Flocation%2Fmaps-plugin-here.git Remove Profile Build Dependency: Do it at runtime - This is for Tizen 4.0. : Tizen 4.0 Configurability and Build Blocks require to remove all profile-depending build options in spec files. (No More profile macros) - It is recommended to distinguish features/profiles at runtime. unless it incurs too much overhead, which requires you to create multiple binaries and subpackages. Change-Id: Ie152163ca83de32b081912e9fce66df55ad91cbe Signed-off-by: MyungJoo Ham --- diff --git a/heremaps-uc/CMakeLists.txt b/heremaps-uc/CMakeLists.txt index 6261d20..f6fb07a 100644 --- a/heremaps-uc/CMakeLists.txt +++ b/heremaps-uc/CMakeLists.txt @@ -28,11 +28,6 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") -IF(TIZEN_WEARABLE) - MESSAGE(TIZEN_WEARABLE) - ADD_DEFINITIONS("-DTIZEN_WEARABLE") -ENDIF(TIZEN_WEARABLE) - INCLUDE(FindPkgConfig) # Check external libraries diff --git a/heremaps-uc/src/heremaps-uc.c b/heremaps-uc/src/heremaps-uc.c index bedadbd..48c2130 100644 --- a/heremaps-uc/src/heremaps-uc.c +++ b/heremaps-uc/src/heremaps-uc.c @@ -20,9 +20,53 @@ */ #include "heremaps-uc-common.h" +#include +#include #define EDJE_PATH "/usr/apps/org.tizen.heremaps-uc/res/edje/heremaps-uc.edj" +typedef enum { + TIZEN_PROFILE_UNKNOWN = 0, + TIZEN_PROFILE_MOBILE = 0x1, + TIZEN_PROFILE_WEARABLE = 0x2, + TIZEN_PROFILE_TV = 0x4, + TIZEN_PROFILE_IVI = 0x8, + TIZEN_PROFILE_COMMON = 0x10, +} tizen_profile_t; + +static tizen_profile_t _get_tizen_profile() +{ + static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN; + if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1)) + return profile; + + char *profileName; + system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); + switch (*profileName) { + case 'm': + case 'M': + profile = TIZEN_PROFILE_MOBILE; + break; + case 'w': + case 'W': + profile = TIZEN_PROFILE_WEARABLE; + break; + case 't': + case 'T': + profile = TIZEN_PROFILE_TV; + break; + case 'i': + case 'I': + profile = TIZEN_PROFILE_IVI; + break; + default: // common or unknown ==> ALL ARE COMMON. + profile = TIZEN_PROFILE_COMMON; + } + free(profileName); + + return profile; +} + static Evas_Object *create_conformant(Evas_Object * parent) { LS_FUNC_ENTER @@ -75,7 +119,6 @@ static void save_vconf(int value) } } -#ifndef TIZEN_WEARABLE static void disagree_btn_cb(void *data, Evas_Object * obj, void *event) { LS_FUNC_ENTER @@ -84,7 +127,6 @@ static void disagree_btn_cb(void *data, Evas_Object * obj, void *event) elm_exit(); } -#endif static void agree_btn_cb(void *data, Evas_Object * obj, void *event) { @@ -122,7 +164,6 @@ static Evas_Object *create_win(const char *name) return eo; } -#ifdef TIZEN_WEARABLE static Evas_Object *create_popup_wearable(Evas_Object *layout, heremaps_uc_app_data *ad) { LS_FUNC_ENTER @@ -177,7 +218,6 @@ static Evas_Object *create_popup_wearable(Evas_Object *layout, heremaps_uc_app_d return popup; } -#else static Evas_Object *create_popup(Evas_Object *layout, heremaps_uc_app_data *ad) { LS_FUNC_ENTER @@ -217,7 +257,6 @@ static Evas_Object *create_popup(Evas_Object *layout, heremaps_uc_app_data *ad) LS_FUNC_EXIT return popup; } -#endif static bool _app_create_cb(void *user_data) { @@ -271,11 +310,10 @@ static void _app_control_cb(app_control_h app_control, void *user_data) ad->conformant = create_conformant(ad->win_main); ad->layout_main = create_layout(ad->conformant); -#ifdef TIZEN_WEARABLE - ad->popup = create_popup_wearable(ad->layout_main, ad); -#else - ad->popup = create_popup(ad->layout_main, ad); -#endif + if (_get_tizen_profile() == TIZEN_PROFILE_WEARABLE) + ad->popup = create_popup_wearable(ad->layout_main, ad); + else + ad->popup = create_popup(ad->layout_main, ad); evas_object_show(ad->win_main); LS_FUNC_EXIT diff --git a/packaging/maps-plugin-here.spec b/packaging/maps-plugin-here.spec index 985222d..6427511 100644 --- a/packaging/maps-plugin-here.spec +++ b/packaging/maps-plugin-here.spec @@ -68,11 +68,7 @@ This package provides Plugin APIs capsulating HERE Maps Engine Library for Maps %build MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%if "%{profile}" == "wearable" -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=%{_libdir} -DARCH=%{ARCH} -DSYSCONF_DIR=%{_sysconfdir} -DTIZEN_WEARABLE=YES -%else cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=%{_libdir} -DARCH=%{ARCH} -DSYSCONF_DIR=%{_sysconfdir} -%endif make %{?jobs:-j%jobs} %install