Skip to content

Commit 57b8925

Browse files
committed
[initial] Commit, using the new CMake structure.
1 parent c54db71 commit 57b8925

6 files changed

Lines changed: 463 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required(VERSION 3.7)
2+
3+
include(${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/cmake/tools.cmake)
4+
5+
set(PLUGIN_NAME Launcher)
6+
7+
message("Setting up ${PLUGIN_NAME}")
8+
9+
# This is a plugin so we need the Plugin configuration section.
10+
find_package(Plugins REQUIRED)
11+
12+
set(PLUGIN_SOURCES
13+
Launcher.cpp
14+
Module.cpp)
15+
16+
# How, using regular CMake (PLUGIN_SUPPORT_DEFINITIONS) can we tell fuck CMake to inherit this.
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
18+
19+
# Library definition section
20+
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})
21+
add_library(${MODULE_NAME} SHARED ${PLUGIN_SOURCES})
22+
include_directories(${PLUGIN_SUPPORT_INCLUDE_DIR})
23+
target_link_libraries(${MODULE_NAME} ${PLUGIN_SUPPORT_LIBRARIES})
24+
25+
# Library installation section
26+
string(TOLOWER ${NAMESPACE} STORAGENAME)
27+
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${STORAGENAME}/plugins)
28+
29+
write_config(${PLUGIN_NAME} ${PLUGIN_NAME})

Launcher.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
set (autostart true)
2+
set (preconditions Platform)

Launcher.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "Launcher.h"
2+
3+
namespace WPEFramework {
4+
namespace Plugin {
5+
6+
SERVICE_REGISTRATION(Launcher, 1, 0);
7+
8+
9+
/* virtual */ const string Launcher::Initialize(PluginHost::IShell* service)
10+
{
11+
string message;
12+
Config config;
13+
14+
ASSERT(_service == nullptr);
15+
16+
// Setup skip URL for right offset.
17+
_service = service;
18+
19+
20+
config.FromString(_service->ConfigLine());
21+
Core::Process::Options options(config.Command.Value().c_str());
22+
auto iter = config.Parameters.Elements();
23+
24+
return message;
25+
}
26+
27+
/* virtual */ void Launcher::Deinitialize(PluginHost::IShell* service)
28+
{
29+
ASSERT(_service == service);
30+
31+
_service = nullptr;
32+
}
33+
34+
/* virtual */ string Launcher::Information() const
35+
{
36+
// No additional info to report.
37+
return (string());
38+
}
39+
40+
void Launcher::Update(const ProcessObserver::Info& info)
41+
{
42+
// This can potentially be called on a socket thread, so the deactivation (wich in turn kills this object) must be done
43+
// on a seperate thread. Also make sure this call-stack can be unwound before we are totally destructed.
44+
if (_process.Id() == info.Id()) {
45+
ASSERT(_service != nullptr);
46+
PluginHost::WorkerPool::Instance().Submit(PluginHost::IShell::Job::Create(_service, PluginHost::IShell::DEACTIVATED, PluginHost::IShell::FAILURE));
47+
}
48+
}
49+
50+
} //namespace Plugin
51+
} // namespace WPEFramework

0 commit comments

Comments
 (0)