Skip to content

Commit

Permalink
Unsupport the Linux x64 build (#248)
Browse files Browse the repository at this point in the history
* Remove x64-specific files and organize BUILD.gn

* Remove obsolete Linux-specific code

* Rename external_texture_surface_gl.cc and system_utils.cc

* Simplify GetExecutableDirectory

* Clean up
  • Loading branch information
swift-kim committed Sep 1, 2022
1 parent 5b3fc3c commit 7ba969b
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 305 deletions.
139 changes: 55 additions & 84 deletions shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -34,58 +34,44 @@ _public_headers = [
# added to the compiler's search paths. Since we are not using the Tizen CLI
# builder, we have to add them manually.
config("rootstrap_include_dirs") {
local_prefix = "$custom_sysroot/usr"

if (!embedder_for_target && target_cpu == "x64") {
defines = [ "__X64_SHELL__" ]

local_prefix += "/local"
}

include_dirs = [
"$local_prefix/include",
"$local_prefix/include/appfw",
"$local_prefix/include/base",
"$local_prefix/include/dlog",
"$local_prefix/include/ecore-1",
"$local_prefix/include/ecore-imf-1",
"$local_prefix/include/ecore-input-1",
"$local_prefix/include/ecore-wayland-1",
"$local_prefix/include/ecore-wl2-1",
"$local_prefix/include/efl-1",
"$local_prefix/include/efl-extension",
"$local_prefix/include/eina-1",
"$local_prefix/include/eina-1/eina",
"$local_prefix/include/emile-1",
"$local_prefix/include/eo-1",
"$local_prefix/include/feedback",
"$local_prefix/include/system",
"$local_prefix/include/tzsh",
"$local_prefix/include/wayland-extension",
"$custom_sysroot/usr/include",
"$custom_sysroot/usr/include/appfw",
"$custom_sysroot/usr/include/base",
"$custom_sysroot/usr/include/dlog",
"$custom_sysroot/usr/include/ecore-1",
"$custom_sysroot/usr/include/ecore-imf-1",
"$custom_sysroot/usr/include/ecore-input-1",
"$custom_sysroot/usr/include/ecore-wayland-1",
"$custom_sysroot/usr/include/ecore-wl2-1",
"$custom_sysroot/usr/include/efl-1",
"$custom_sysroot/usr/include/efl-extension",
"$custom_sysroot/usr/include/eina-1",
"$custom_sysroot/usr/include/eina-1/eina",
"$custom_sysroot/usr/include/emile-1",
"$custom_sysroot/usr/include/eo-1",
"$custom_sysroot/usr/include/feedback",
"$custom_sysroot/usr/include/system",
"$custom_sysroot/usr/include/tzsh",
"$custom_sysroot/usr/include/wayland-extension",
]

# Contain headers that the Evas_GL renderer depends on.
include_dirs += [
"$local_prefix/include/ecore-con-1",
"$local_prefix/include/ecore-evas-1",
"$local_prefix/include/ecore-file-1",
"$local_prefix/include/edje-1",
"$local_prefix/include/eet-1",
"$local_prefix/include/efl-1/interfaces",
"$local_prefix/include/efreet-1",
"$local_prefix/include/elementary-1",
"$local_prefix/include/ethumb-1",
"$local_prefix/include/ethumb-client-1",
"$local_prefix/include/evas-1",
"$custom_sysroot/usr/include/ecore-con-1",
"$custom_sysroot/usr/include/ecore-evas-1",
"$custom_sysroot/usr/include/ecore-file-1",
"$custom_sysroot/usr/include/edje-1",
"$custom_sysroot/usr/include/eet-1",
"$custom_sysroot/usr/include/efl-1/interfaces",
"$custom_sysroot/usr/include/efreet-1",
"$custom_sysroot/usr/include/elementary-1",
"$custom_sysroot/usr/include/ethumb-1",
"$custom_sysroot/usr/include/ethumb-client-1",
"$custom_sysroot/usr/include/evas-1",
]

if (!embedder_for_target && target_cpu == "x64") {
include_dirs += [ "$local_prefix/include/eldbus-1" ]

lib_dirs = [ "$local_prefix/lib/x86_64-linux-gnu" ]
} else {
lib_dirs = [ "$local_prefix/lib" ]
}
lib_dirs = [ "$custom_sysroot/usr/lib" ]

cflags_cc = [
"-Wno-newline-eof",
Expand Down Expand Up @@ -114,32 +100,56 @@ template("embedder") {
public = _public_headers

sources = [
"channels/app_control.cc",
"channels/app_control_channel.cc",
"channels/key_event_channel.cc",
"channels/lifecycle_channel.cc",
"channels/navigation_channel.cc",
"channels/platform_channel.cc",
"channels/platform_channel_tizen.cc",
"channels/platform_view_channel.cc",
"channels/settings_channel.cc",
"channels/settings_channel_tizen.cc",
"channels/text_input_channel.cc",
"channels/window_channel.cc",
"external_texture_pixel_gl.cc",
"external_texture_surface_gl.cc",
"flutter_project_bundle.cc",
"flutter_tizen.cc",
"flutter_tizen_engine.cc",
"flutter_tizen_texture_registrar.cc",
"key_event_handler.cc",
"logger.cc",
"system_utils.cc",
"tizen_event_loop.cc",
"tizen_input_method_context.cc",
"tizen_renderer.cc",
"touch_event_handler.cc",
]

libs = [
"base-utils-i18n",
"capi-appfw-application",
"capi-appfw-app-common",
"capi-appfw-app-control",
"capi-base-common",
"capi-system-info",
"capi-system-system-settings",
"capi-ui-efl-util",
"dlog",
"ecore",
"ecore_imf",
"ecore_input",
"efl-extension",
"eina",
"feedback",
"tbm",
"tdm-client",
"tzsh_common",
"tzsh_softkey",
"wayland-client",
"EGL",
"GLESv2",
]

defines += invoker.defines
Expand All @@ -153,45 +163,6 @@ template("embedder") {
"//flutter:config",
]

if (embedder_for_target) {
sources += [
"channels/app_control.cc",
"channels/app_control_channel.cc",
"channels/platform_channel_tizen.cc",
"channels/settings_channel_tizen.cc",
"channels/window_channel.cc",
"external_texture_surface_gl_tizen.cc",
"system_utils_tizen.cc",
]

libs += [
"base-utils-i18n",
"capi-appfw-application",
"capi-appfw-app-common",
"capi-appfw-app-control",
"capi-base-common",
"capi-system-info",
"capi-system-system-settings",
"capi-ui-efl-util",
"dlog",
"efl-extension",
"feedback",
"tbm",
"tdm-client",
"tzsh_common",
"tzsh_softkey",
"EGL",
"GLESv2",
]
} else {
sources += [
"channels/platform_channel_linux.cc",
"channels/settings_channel_linux.cc",
"external_texture_surface_gl_linux.cc",
"system_utils_linux.cc",
]
}

if (use_evas_gl_renderer) {
sources += [ "tizen_renderer_evas_gl.cc" ]

Expand Down
39 changes: 0 additions & 39 deletions shell/platform/tizen/channels/platform_channel_linux.cc

This file was deleted.

17 changes: 0 additions & 17 deletions shell/platform/tizen/channels/settings_channel_linux.cc

This file was deleted.

4 changes: 1 addition & 3 deletions shell/platform/tizen/channels/text_input_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ void TextInputChannel::SendStateUpdate(const TextInputModel& model) {
bool TextInputChannel::FilterEvent(Ecore_Event_Key* event, bool is_down) {
bool handled = false;

#if defined(__X64_SHELL__)
bool is_ime = false;
#elif defined(WEARABLE_PROFILE)
#ifdef WEARABLE_PROFILE
// Hardware keyboard is not supported on watch devices.
bool is_ime = true;
// FIXME: Only for wearable.
Expand Down
40 changes: 0 additions & 40 deletions shell/platform/tizen/external_texture_surface_gl_linux.cc

This file was deleted.

19 changes: 4 additions & 15 deletions shell/platform/tizen/flutter_project_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,32 @@

#include "flutter_project_bundle.h"

#ifdef __X64_SHELL__
#include "flutter/shell/platform/common/path_utils.h"
#else
#include <app_common.h>
#include <linux/limits.h>
#include <unistd.h>
#endif

#include <filesystem>

#include "flutter/shell/platform/common/path_utils.h"
#include "flutter/shell/platform/tizen/logger.h"

namespace flutter {

#ifndef __X64_SHELL__
namespace {

// Returns the path of the directory containing the app binary, or an empty
// string if the directory cannot be found.
std::filesystem::path GetExecutableDirectory() {
std::filesystem::path GetBinDirectory() {
auto* res_path = app_get_resource_path();
if (!res_path) {
char buffer[PATH_MAX + 1];
auto length = readlink("/proc/self/exe", buffer, sizeof(buffer));
if (length > PATH_MAX) {
return std::filesystem::path();
}
std::filesystem::path executable_path(std::string(buffer, length));
return executable_path.remove_filename();
return GetExecutableDirectory();
}
auto bin_path = std::filesystem::path(res_path) / ".." / "bin";
free(res_path);
return bin_path.lexically_normal();
}

} // namespace
#endif

FlutterProjectBundle::FlutterProjectBundle(
const FlutterDesktopEngineProperties& properties)
Expand All @@ -59,7 +48,7 @@ FlutterProjectBundle::FlutterProjectBundle(
// Resolve any relative paths.
if (assets_path_.is_relative() || icu_path_.is_relative() ||
(!aot_library_path_.empty() && aot_library_path_.is_relative())) {
std::filesystem::path executable_location = GetExecutableDirectory();
std::filesystem::path executable_location = GetBinDirectory();
if (executable_location.empty()) {
FT_LOG(Error)
<< "Unable to find executable location to resolve resource paths.";
Expand Down
9 changes: 2 additions & 7 deletions shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ FlutterDesktopEngineRef FlutterDesktopRunEngine(
if (project.HasArgument("--verbose-logging")) {
flutter::Logger::SetLoggingLevel(flutter::kLogLevelDebug);
}
#ifndef __X64_SHELL__
std::string logging_port;
if (project.GetArgumentValue("--tizen-logging-port", &logging_port)) {
flutter::Logger::SetLoggingPort(std::stoi(logging_port));
}
flutter::Logger::Start();
#endif

auto engine = std::make_unique<flutter::FlutterTizenEngine>(project);
if (window_properties.headed) {
Expand All @@ -69,10 +67,9 @@ FlutterDesktopEngineRef FlutterDesktopRunEngine(
}

void FlutterDesktopShutdownEngine(FlutterDesktopEngineRef engine_ref) {
#ifndef __X64_SHELL__
flutter::Logger::Stop();
#endif
auto engine = EngineFromHandle(engine_ref);

auto* engine = EngineFromHandle(engine_ref);
engine->StopEngine();
delete engine;
}
Expand Down Expand Up @@ -149,10 +146,8 @@ void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger,

void FlutterDesktopNotifyAppControl(FlutterDesktopEngineRef engine,
void* app_control) {
#ifndef __X64_SHELL__
EngineFromHandle(engine)->app_control_channel()->NotifyAppControl(
app_control);
#endif
}

void FlutterDesktopNotifyLocaleChange(FlutterDesktopEngineRef engine) {
Expand Down
Loading

0 comments on commit 7ba969b

Please sign in to comment.