- 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: I3e44fc7d258431cc9b3829fa16940d673acf9c96
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
ADD_DEFINITIONS("-DSHAREDIR=\"${SHAREDIR}\"")
ADD_DEFINITIONS("-DTIZEN_VERSION=\"${TIZEN_VERSION}\"")
-IF(TIZEN_PROFILE STREQUAL "tv")
- ADD_DEFINITIONS("-DTIZEN_TV")
-ELSEIF(TIZEN_PROFILE STREQUAL "mobile")
- ADD_DEFINITIONS("-DTIZEN_MOBILE")
-ELSEIF(TIZEN_PROFILE STREQUAL "wearable")
- ADD_DEFINITIONS("-DTIZEN_WEARABLE")
-ENDIF()
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(XGDMIME_DEPS REQUIRED xdgmime)
PKG_CHECK_MODULES(MANIFEST_PARSER_DEPS REQUIRED manifest-parser)
PKG_CHECK_MODULES(MANIFEST_PARSER_UTILS_DEPS REQUIRED manifest-parser-utils)
+PKG_CHECK_MODULES(CAPI_SYSTEM_INFO REQUIRED capi-system-info)
FIND_PACKAGE(GTest REQUIRED)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(xdgmime)
BuildRequires: pkgconfig(manifest-parser)
+BuildRequires: pkgconfig(capi-system-info)
Requires: ca-certificates-tizen
Requires: libtzplatform-config
# is used in CMakeLists.txt files to distinguish, which project
# is currently being build.
%cmake . -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
- -DTIZEN_VERSION=%{tizen_version} \
- -DTIZEN_PROFILE=%{profile}
+ -DTIZEN_VERSION=%{tizen_version}
make %{?_smp_mflags}
XGDMIME_DEPS
MANIFEST_PARSER_UTILS_DEPS
Boost
+ CAPI_SYSTEM_INFO
)
# Extra
// found in the LICENSE-xwalk file.
#include "wgt_manifest_handlers/platform_version.h"
+#include <stdlib.h>
+#include <system_info.h>
namespace parser {
}
utils::VersionNumber GetMinimumPlatformVersion() {
-#ifdef TIZEN_TV
- return utils::VersionNumber("2.3");
-#elif TIZEN_WEARABLE
- return utils::VersionNumber("2.3");
-#else
- return utils::VersionNumber("2.2.1");
-#endif
+
+ switch (GetProfile()) {
+ case TIZEN_PROFILE_TV:
+ return utils::VersionNumber("2.3");
+ case TIZEN_PROFILE_WEARABLE:
+ return utils::VersionNumber("2.3");
+ default:
+ return utils::VersionNumber("2.2.1");
+ }
+}
+
+tizen_profile_t GetProfile() {
+ static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+ char *profileName;
+
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ 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;
}
} // namespace parser
*/
utils::VersionNumber GetMinimumPlatformVersion();
+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;
+
+/**
+ * @brief GetProfile
+ * @return identify Tizen profile at runtime.
+ */
+tizen_profile_t GetProfile();
+
} // namespace parser
#endif // WGT_MANIFEST_HANDLERS_PLATFORM_VERSION_H_
#include "manifest_parser/utils/version_number.h"
#include "wgt_manifest_handlers/application_manifest_constants.h"
#include "wgt_manifest_handlers/tizen_application_handler.h"
+#include "platform_version.h"
namespace {
std::string* error) const {
const SettingInfo& setting_info = static_cast<const SettingInfo&>(data);
-#if defined(TIZEN_MOBILE) || defined(TIZEN_WEARABLE)
- // backward compatibility
- if (setting_info.orientation_defaulted()) {
- const TizenApplicationInfo& app_info =
- static_cast<const TizenApplicationInfo&>(
- *handlers_output.find(TizenApplicationInfo::Key())->second);
- utils::VersionNumber required_version(app_info.required_version());
- if (!required_version.IsValid()) {
- *error = "Cannot retrieve required API version from widget";
- return false;
- }
- if (required_version < kDefaultAutoOrientationVersion) {
- auto& constless_setting_info = const_cast<SettingInfo&>(setting_info);
- constless_setting_info.set_screen_orientation(
- SettingInfo::ScreenOrientation::PORTRAIT);
- // keep claiming it is default
- constless_setting_info.set_orientation_defaulted(true);
+ if (parser::GetProfile() & (parser::TIZEN_PROFILE_MOBILE | parser::TIZEN_PROFILE_WEARABLE)) {
+ // backward compatibility
+ if (setting_info.orientation_defaulted()) {
+ const TizenApplicationInfo& app_info =
+ static_cast<const TizenApplicationInfo&>(
+ *handlers_output.find(TizenApplicationInfo::Key())->second);
+ utils::VersionNumber required_version(app_info.required_version());
+ if (!required_version.IsValid()) {
+ *error = "Cannot retrieve required API version from widget";
+ return false;
+ }
+ if (required_version < kDefaultAutoOrientationVersion) {
+ auto& constless_setting_info = const_cast<SettingInfo&>(setting_info);
+ constless_setting_info.set_screen_orientation(
+ SettingInfo::ScreenOrientation::PORTRAIT);
+ // keep claiming it is default
+ constless_setting_info.set_orientation_defaulted(true);
+ }
}
+ } else {
+ (void)handlers_output;
}
-#else
- (void)handlers_output;
-#endif
if (setting_info.screen_orientation() !=
SettingInfo::ScreenOrientation::AUTO &&