check ivi-layermanagement-api availability 63/7263/3
authorTasuku Suzuki <tasuku.suzuki@qt.io>
Mon, 21 Nov 2016 05:40:40 +0000 (14:40 +0900)
committerJens Bocklage <jens_bocklage@mentor.com>
Mon, 21 Nov 2016 09:35:24 +0000 (09:35 +0000)
replace #ifdef __arm__ with a definition that comes from availability
test

Change-Id: Id9fa4baefcc9f38acd3e98d40054040fc69029c6
Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
HomeScreen.pro
HomeScreen/HomeScreen.pro
HomeScreen/src/main.cpp
HomeScreenAppFrameworkBinderAGL/HomeScreenAppFrameworkBinderAGL.pro
HomeScreenAppFrameworkBinderAGL/src/homescreenappframeworkbinderagl.cpp
WindowManager/WindowManager.pro
WindowManager/src/windowmanager.cpp
WindowManager/src/windowmanager.hpp
config.tests/ivi_layermanagement_api/ivi_layermanagement_api.cpp [new file with mode: 0644]
config.tests/ivi_layermanagement_api/ivi_layermanagement_api.pro [new file with mode: 0644]
ivi_layermanagement_api.pri [new file with mode: 0644]

index 2812840..9badcb7 100644 (file)
@@ -14,6 +14,9 @@
 
 TEMPLATE = subdirs
 
+load(configure)
+qtCompileTest(ivi_layermanagement_api)
+
 SUBDIRS = interfaces \
     libhomescreen \
     HomeScreen \
index a9e950e..9951a0f 100644 (file)
@@ -17,6 +17,7 @@ TARGET = HomeScreen
 QT = widgets dbus
 
 include(../interfaces/interfaces.pri)
+include(../ivi_layermanagement_api.pri)
 
 SOURCES += \
     src/main.cpp \
index 434cf6c..a896c2e 100644 (file)
@@ -45,14 +45,12 @@ int main(int argc, char *argv[])
 
     MainWindow w;
     w.show();
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     // the WindowManager positions the surface correctly
-#endif
-#ifdef __i386__
+#else
     w.move(0, 0);
 #endif
 
-
 #ifdef __arm__
     qDebug("Running on ARM architecture");
 #endif
index f194609..7cc7927 100644 (file)
@@ -17,6 +17,7 @@ TARGET = HomeScreenAppFrameworkBinderAGL
 QT = core dbus
 
 include(../interfaces/interfaces.pri)
+include(../ivi_layermanagement_api.pri)
 
 SOURCES += src/main.cpp \
     src/homescreenappframeworkbinderagl.cpp
index 91df6f7..593a882 100644 (file)
@@ -39,7 +39,7 @@ HomeScreenAppFrameworkBinderAgl::HomeScreenAppFrameworkBinderAgl(QObject *parent
                                               QDBusConnection::sessionBus(),
                                               0);
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     QString runnables = mp_dBusAfmUserProxy->runnables("{\"dummy\": \"entry\"}");
     qDebug("runnables: %s", runnables.toStdString().c_str());
 
@@ -55,8 +55,7 @@ HomeScreenAppFrameworkBinderAgl::HomeScreenAppFrameworkBinderAgl(QObject *parent
         m_apps.append(appInfo);
 
     }
-#endif
-#ifdef __i386__
+#else
     // for the simulation
     /*AppInfo ai;
     ai.setName("org.test.app1");
@@ -82,7 +81,7 @@ QList<AppInfo> HomeScreenAppFrameworkBinderAgl::getAvailableApps()
 int HomeScreenAppFrameworkBinderAgl::launchApp(const QString &name)
 {
     int pid = -1;
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     qDebug("launchApp name: %s", name.toStdString().c_str());
     QString jsonLaunch = "{\"id\":\"" + name + "\", \"mode\":\"local\"}";
     qDebug("jsonLaunch %s", jsonLaunch.toStdString().c_str());
@@ -110,8 +109,7 @@ int HomeScreenAppFrameworkBinderAgl::launchApp(const QString &name)
     }
 
     qDebug("launchApp pid: %d", pid);
-#endif
-#ifdef __i386__
+#else
     qDebug("launchApp name: %s", name.toStdString().c_str());
     pid = qrand();
 #endif
index 51fc972..6f33e13 100644 (file)
@@ -17,6 +17,7 @@ TARGET = WindowManager
 QT = core dbus
 
 include(../interfaces/interfaces.pri)
+include(../ivi_layermanagement_api.pri)
 
 SOURCES += src/main.cpp \
     src/windowmanager.cpp
@@ -24,7 +25,7 @@ SOURCES += src/main.cpp \
 HEADERS += \
     src/windowmanager.hpp
 
-contains(QT_ARCH, arm.*) {
+config_ivi_layermanagement_api {
     LIBS += -lilmControl -lilmCommon
 }
 
index 054c43c..047734f 100644 (file)
@@ -60,7 +60,7 @@ void WindowManager::start()
 {
     qDebug("-=[start]=-");
     mp_layoutAreaToSurfaceIdAssignment = new QMap<int, unsigned int>;
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     ilmErrorTypes err;
 
     err = ilm_init();
@@ -80,7 +80,7 @@ WindowManager::~WindowManager()
 {
     qDebug("-=[~WindowManager]=-");
     delete mp_windowManagerAdaptor;
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     ilm_destroy();
 #endif
     delete mp_layoutAreaToSurfaceIdAssignment;
@@ -110,7 +110,7 @@ void WindowManager::dumpScene()
     }
 }
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
 
 void WindowManager::createNewLayer(int layerId)
 {
@@ -220,7 +220,7 @@ void WindowManager::updateScreen()
 {
     qDebug("-=[updateScreen]=-");
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     if (-1 != m_currentLayout)
     {
 
@@ -283,7 +283,7 @@ void WindowManager::updateScreen()
 #endif
 }
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
 void WindowManager::notificationFunc_non_static(ilmObjectType object,
                                     t_ilm_uint id,
                                     t_ilm_bool created)
@@ -483,7 +483,7 @@ QList<Layout> WindowManager::getAllLayouts()
 QList<int> WindowManager::getAllSurfacesOfProcess(int pid)
 {
     QList<int> result;
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     struct ilmSurfaceProperties surfaceProperties;
 
     for (int i = 0; i < m_surfaces.size(); ++i)
@@ -548,7 +548,7 @@ void WindowManager::hideLayer(int layer)
     qDebug("-=[hideLayer]=-");
     qDebug("layer %d", layer);
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     if (0 == layer)
     {
         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_FALSE);
@@ -627,7 +627,7 @@ void WindowManager::showLayer(int layer)
     qDebug("-=[showLayer]=-");
     qDebug("layer %d", layer);
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     if (0 == layer)
     {
         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_TRUE);
index a4d9d4f..30affd6 100644 (file)
@@ -24,9 +24,9 @@
 #include "windowmanager_adapter.h"
 
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
 extern "C" {
-#include "ilm/ilm_control.h"
+#include <ilm/ilm_control.h>
 }
 #endif
 
@@ -49,7 +49,7 @@ private:
 
     void dumpScene();
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     void createNewLayer(int layerId);
     void addSurfaceToLayer(int surfaceId, int layerId);
 #endif
@@ -59,7 +59,7 @@ private:
 public:
     static void* myThis;
 
-#ifdef __arm__
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
     // for general notifications
     void notificationFunc_non_static(ilmObjectType object,
                                         t_ilm_uint id,
diff --git a/config.tests/ivi_layermanagement_api/ivi_layermanagement_api.cpp b/config.tests/ivi_layermanagement_api/ivi_layermanagement_api.cpp
new file mode 100644 (file)
index 0000000..579abdd
--- /dev/null
@@ -0,0 +1,7 @@
+#include <ilm/ilm_control.h>
+
+int main(int argc,char **argv)
+{
+    return 0;
+}
+
diff --git a/config.tests/ivi_layermanagement_api/ivi_layermanagement_api.pro b/config.tests/ivi_layermanagement_api/ivi_layermanagement_api.pro
new file mode 100644 (file)
index 0000000..d230384
--- /dev/null
@@ -0,0 +1,5 @@
+SOURCES = ivi_layermanagement_api.cpp
+
+CONFIG -= qt dylib
+
+LIBS += -lilmControl -lilmCommon
diff --git a/ivi_layermanagement_api.pri b/ivi_layermanagement_api.pri
new file mode 100644 (file)
index 0000000..ac03c1f
--- /dev/null
@@ -0,0 +1,5 @@
+config_ivi_layermanagement_api {
+    DEFINES += HAVE_IVI_LAYERMANAGEMENT_API
+} else {
+    message(HAVE_IVI_LAYERMANAGEMENT_API not available)
+}