MESSAGE("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog liblaunchpad elementary glib-2.0 libsmack capi-appfw-app-common storage)
+PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog liblaunchpad glib-2.0 libsmack capi-appfw-app-common storage)
FOREACH(flag ${${PROJECT_NAME}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
)
ADD_LIBRARY(${DOTNET_LAUNCHER_UTIL} SHARED ${${DOTNET_LAUNCHER_UTIL}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER_UTIL} PROPERTIES COMPILE_FLAGS "-fPIC")
-TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER_UTIL} ${${PROJECT_NAME}_LDFLAGS})
+TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER_UTIL} ${${PROJECT_NAME}_LDFLAGS} "-ldl")
SET(DOTNET_LAUNCHER "dotnet-launcher")
SET(${DOTNET_LAUNCHER}_SOURCE_FILES
#include <aul.h>
#include <Ecore.h>
-#include <Elementary.h>
#include <bundle_internal.h>
#include <map>
static int __argc;
static char **__argv;
-static Evas_Object *__win;
class LaunchpadAdapterImpl : public LaunchpadAdapter
{
}
}
+// To run dotnet-launcher on the headless device, remove build dependency from EFL.
+#define ELEMENTARY_PATH "/usr/lib/libelementary.so.1"
+static void* __win;
+typedef int (*elm_init_ptr)(int argc, char **argv);
+typedef void (*elm_config_accel_preference_set_ptr)(const char *pref);
+typedef void* (*elm_win_add_ptr)(void* parent, const char* name, int type);
+typedef void (*elm_win_precreated_object_set_ptr)(void* win);
+
static void preCreateWindow(bundle *extra, int type, void *userData)
{
- int elmInitCnt = 0;
-
- // Precreate window
- elmInitCnt = elm_init(__argc, __argv);
- if (!elmInitCnt) {
- _ERR("[candidate] elm_init() failed");
+ struct stat sb;
+ if (stat(ELEMENTARY_PATH, &sb) != 0) {
+ _ERR("[candidate] libelememantary is not exist. skip precreation");
return;
}
- elm_config_accel_preference_set("hw");
+ int elmInitCnt = 0;
+ void* handle = nullptr;
+ elm_init_ptr elm_init = nullptr;
+ elm_config_accel_preference_set_ptr elm_config_accel_preference_set = nullptr;
+ elm_win_add_ptr elm_win_add = nullptr;
+ elm_win_precreated_object_set_ptr elm_win_precreated_object_set = nullptr;
+
+ handle = dlopen(ELEMENTARY_PATH, RTLD_NOW | RTLD_GLOBAL);
+ if (handle) {
+ elm_init = (elm_init_ptr)dlsym(handle, "elm_init");
+ if (elm_init) {
+ elmInitCnt = elm_init(__argc, __argv);
+
+ if (!elmInitCnt) {
+ _ERR("[candidate] elm_init() failed");
+ return;
+ }
+ }
- __win = elm_win_add(NULL, "package_name", ELM_WIN_BASIC);
- if (__win == NULL) {
- _ERR("[candidate] elm_win_add() failed");
- return;
- }
+ elm_config_accel_preference_set = (elm_config_accel_preference_set_ptr)dlsym(handle, "elm_config_accel_preference_set");
+ if (elm_config_accel_preference_set) {
+ elm_config_accel_preference_set("hw");
+ }
- elm_win_precreated_object_set(__win);
+ elm_win_add = (elm_win_add_ptr)dlsym(handle, "elm_win_add");
+ if (elm_win_add) {
+ // enum value of "ELM_WIN_BASIC" is 0
+ __win = elm_win_add(NULL, "package_name", 0);
+ if (__win == NULL) {
+ _ERR("[candidate] elm_win_add() failed");
+ return;
+ }
+ }
+
+ elm_win_precreated_object_set = (elm_win_precreated_object_set_ptr)dlsym(handle, "elm_win_precreated_object_set");
+ if (elm_win_precreated_object_set) {
+ elm_win_precreated_object_set(__win);
+ }
+ _INFO("elm window precreation is done");
+ }
}
int LaunchpadAdapterImpl::loaderMain(int argc, char* argv[])