diff --git a/example/linux/Makefile b/example/linux/Makefile index 13bacd7e7..5cf7fa045 100644 --- a/example/linux/Makefile +++ b/example/linux/Makefile @@ -37,7 +37,7 @@ ALL_LIBS=$(FLUTTER_EMBEDDER_LIB) $(FLUTTER_ENGINE_LIB) $(PLUGIN_LIBS) # Headers PLUGIN_DIRS=$(patsubst %,$(PLUGINS_DIR)/%/linux,$(PLUGIN_NAMES)) LIBRARY_DIRS=$(FLUTTER_EMBEDDER_LIB_DIR) $(PLUGIN_DIRS) -INCLUDE_DIRS=$(patsubst %,%/include,$(LIBRARY_DIRS)) +INCLUDE_DIRS=$(patsubst %,%/include,$(LIBRARY_DIRS)) $(PROJECT_ROOT)/library/include # Tools BUILD_ASSETS_BIN=$(TOOLS_DIR)/build_flutter_assets @@ -85,6 +85,9 @@ endif CXX=g++ -std=c++14 CXXFLAGS=-Wall -Werror $(shell pkg-config --cflags jsoncpp) CPPFLAGS=$(patsubst %,-I%,$(INCLUDE_DIRS)) +ifdef USE_GN +CPPFLAGS+=-DUSE_FLATTENED_INCLUDES +endif LDFLAGS=-L$(OUT_LIB_DIR) \ -lglfw \ $(shell pkg-config --libs jsoncpp) \ diff --git a/example/linux/flutter_embedder_example.cc b/example/linux/flutter_embedder_example.cc index 92232f139..1a030828e 100644 --- a/example/linux/flutter_embedder_example.cc +++ b/example/linux/flutter_embedder_example.cc @@ -21,9 +21,14 @@ #include #include -#include #include +#ifdef USE_FLATTENED_INCLUDES +#include +#else +#include +#endif + namespace { // Returns the path of the directory containing this executable, or an empty diff --git a/library/BUILD.gn b/library/BUILD.gn index 0eb36cd65..6b31ae428 100644 --- a/library/BUILD.gn +++ b/library/BUILD.gn @@ -19,40 +19,51 @@ import("//library/engine.gni") published_shared_library("flutter_embedder") { if (is_linux) { sources = [ - "linux/src/internal/engine_method_result.cc", - "linux/src/internal/engine_method_result.h", - "linux/src/internal/json_message_codec.cc", - "linux/src/internal/json_message_codec.h", - "linux/src/internal/key_event_handler.cc", - "linux/src/internal/key_event_handler.h", - "linux/src/internal/keyboard_hook_handler.h", - "linux/src/internal/plugin_handler.cc", - "linux/src/internal/plugin_handler.h", - "linux/src/internal/text_input_model.cc", - "linux/src/internal/text_input_model.h", - "linux/src/internal/text_input_plugin.cc", - "linux/src/internal/text_input_plugin.h", "linux/src/embedder.cc", - "linux/src/json_method_call.cc", - "linux/src/json_method_codec.cc", - "linux/src/json_plugin.cc", - "linux/src/method_call.cc", - "linux/src/method_channel.cc", - "linux/src/method_codec.cc", - "linux/src/method_result.cc", - "linux/src/plugin.cc", ] public = [ - "linux/include/flutter_desktop_embedding/binary_messenger.h", - "linux/include/flutter_desktop_embedding/embedder.h", - "linux/include/flutter_desktop_embedding/json_method_call.h", - "linux/include/flutter_desktop_embedding/json_method_codec.h", - "linux/include/flutter_desktop_embedding/json_plugin.h", - "linux/include/flutter_desktop_embedding/method_call.h", - "linux/include/flutter_desktop_embedding/method_channel.h", - "linux/include/flutter_desktop_embedding/method_codec.h", - "linux/include/flutter_desktop_embedding/method_result.h", - "linux/include/flutter_desktop_embedding/plugin.h", + "include/flutter_desktop_embedding/linux/embedder.h", + ] + } + if (is_linux || is_win) { + sources += [ + "common/internal/engine_method_result.cc", + "common/internal/engine_method_result.h", + "common/internal/json_message_codec.cc", + "common/internal/json_message_codec.h", + "common/internal/plugin_handler.cc", + "common/internal/plugin_handler.h", + "common/internal/text_input_model.cc", + "common/internal/text_input_model.h", + "common/json_method_call.cc", + "common/json_method_codec.cc", + "common/json_plugin.cc", + "common/method_call.cc", + "common/method_channel.cc", + "common/method_codec.cc", + "common/method_result.cc", + "common/plugin.cc", + ] + public += [ + "include/flutter_desktop_embedding/binary_messenger.h", + "include/flutter_desktop_embedding/json_method_call.h", + "include/flutter_desktop_embedding/json_method_codec.h", + "include/flutter_desktop_embedding/json_plugin.h", + "include/flutter_desktop_embedding/method_call.h", + "include/flutter_desktop_embedding/method_channel.h", + "include/flutter_desktop_embedding/method_codec.h", + "include/flutter_desktop_embedding/method_result.h", + "include/flutter_desktop_embedding/plugin.h", + ] + } + # GLFW-specific code. + if (is_linux || is_win) { + sources += [ + "common/glfw/key_event_handler.cc", + "common/glfw/key_event_handler.h", + "common/glfw/keyboard_hook_handler.h", + "common/glfw/text_input_plugin.cc", + "common/glfw/text_input_plugin.h", ] } diff --git a/library/GN.md b/library/GN.md index 32cb98977..2288ee985 100644 --- a/library/GN.md +++ b/library/GN.md @@ -24,7 +24,11 @@ $ tools/gn_dart gen out $ ninja -C out flutter_embedder ``` -The build results will be in the top-level `out/` directory. +The build results will be in the top-level `out/` directory. `out/include/` will +have the public headers for all build libraries, so you can point dependent +builds at that single location rather than the `include/` directories in the +source tree. You will need to set USE\_FLATTENED\_INCLUDES in your build, since +the embedding header library layout is slightly different under `out/include/`. Subsequent builds only require the `ninja` step, as the build will automatically re-run GN generation if necessary. diff --git a/library/linux/src/internal/key_event_handler.cc b/library/common/glfw/key_event_handler.cc similarity index 94% rename from library/linux/src/internal/key_event_handler.cc rename to library/common/glfw/key_event_handler.cc index 1013a585b..0b6e4e36d 100644 --- a/library/linux/src/internal/key_event_handler.cc +++ b/library/common/glfw/key_event_handler.cc @@ -11,12 +11,12 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/src/internal/key_event_handler.h" +#include "library/common/glfw/key_event_handler.h" #include #include -#include "library/linux/src/internal/json_message_codec.h" +#include "library/common/internal/json_message_codec.h" static constexpr char kChannelName[] = "flutter/keyevent"; diff --git a/library/linux/src/internal/key_event_handler.h b/library/common/glfw/key_event_handler.h similarity index 81% rename from library/linux/src/internal/key_event_handler.h rename to library/common/glfw/key_event_handler.h index 203917239..1b1793feb 100644 --- a/library/linux/src/internal/key_event_handler.h +++ b/library/common/glfw/key_event_handler.h @@ -11,11 +11,11 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_SRC_INTERNAL_KEY_EVENT_HANDLER_H_ -#define LIBRARY_LINUX_SRC_INTERNAL_kEY_EVENT_HANDLER_H_ +#ifndef LIBRARY_COMMON_GLFW_KEY_EVENT_HANDLER_H_ +#define LIBRARY_COMMON_GLFW_kEY_EVENT_HANDLER_H_ -#include "library/linux/include/flutter_desktop_embedding/binary_messenger.h" -#include "library/linux/src/internal/keyboard_hook_handler.h" +#include "library/common/glfw/keyboard_hook_handler.h" +#include "library/include/flutter_desktop_embedding/binary_messenger.h" namespace flutter_desktop_embedding { @@ -41,4 +41,4 @@ class KeyEventHandler : public KeyboardHookHandler { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_SRC_INTERNAL_KEY_EVENT_HANDLER_H_ +#endif // LIBRARY_COMMON_GLFW_KEY_EVENT_HANDLER_H_ diff --git a/library/linux/src/internal/keyboard_hook_handler.h b/library/common/glfw/keyboard_hook_handler.h similarity index 84% rename from library/linux/src/internal/keyboard_hook_handler.h rename to library/common/glfw/keyboard_hook_handler.h index 18bfe2f56..35d2ff11d 100644 --- a/library/linux/src/internal/keyboard_hook_handler.h +++ b/library/common/glfw/keyboard_hook_handler.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_SRC_INTERNAL_INPUT_KEYBOARD_HOOK_HANDLER_H_ -#define LIBRARY_LINUX_SRC_INTERNAL_INPUT_KEYBOARD_HOOK_HANDLER_H_ +#ifndef LIBRARY_COMMON_GLFW_KEYBOARD_HOOK_HANDLER_H_ +#define LIBRARY_COMMON_GLFW_KEYBOARD_HOOK_HANDLER_H_ #include @@ -31,4 +31,4 @@ class KeyboardHookHandler { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_SRC_INTERNAL_INPUT_KEYBOARD_HOOK_HANDLER_H_ +#endif // LIBRARY_COMMON_GLFW_KEYBOARD_HOOK_HANDLER_H_ diff --git a/library/linux/src/internal/text_input_plugin.cc b/library/common/glfw/text_input_plugin.cc similarity index 99% rename from library/linux/src/internal/text_input_plugin.cc rename to library/common/glfw/text_input_plugin.cc index ffef8ecbd..d9890d13f 100644 --- a/library/linux/src/internal/text_input_plugin.cc +++ b/library/common/glfw/text_input_plugin.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/src/internal/text_input_plugin.h" +#include "library/common/glfw/text_input_plugin.h" #include #include diff --git a/library/linux/src/internal/text_input_plugin.h b/library/common/glfw/text_input_plugin.h similarity index 82% rename from library/linux/src/internal/text_input_plugin.h rename to library/common/glfw/text_input_plugin.h index 9c0c5e3d8..d5016cb64 100644 --- a/library/linux/src/internal/text_input_plugin.h +++ b/library/common/glfw/text_input_plugin.h @@ -11,15 +11,15 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_SRC_INTERNAL_TEXT_INPUT_PLUGIN_H_ -#define LIBRARY_LINUX_SRC_INTERNAL_TEXT_INPUT_PLUGIN_H_ +#ifndef LIBRARY_COMMON_GLFW_TEXT_INPUT_PLUGIN_H_ +#define LIBRARY_COMMON_GLFW_TEXT_INPUT_PLUGIN_H_ #include #include -#include "library/linux/include/flutter_desktop_embedding/json_plugin.h" -#include "library/linux/src/internal/keyboard_hook_handler.h" -#include "library/linux/src/internal/text_input_model.h" +#include "library/common/glfw/keyboard_hook_handler.h" +#include "library/common/internal/text_input_model.h" +#include "library/include/flutter_desktop_embedding/json_plugin.h" namespace flutter_desktop_embedding { @@ -58,4 +58,4 @@ class TextInputPlugin : public KeyboardHookHandler, public JsonPlugin { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_SRC_INTERNAL_TEXT_INPUT_PLUGIN_H_ +#endif // LIBRARY_COMMON_GLFW_TEXT_INPUT_PLUGIN_H_ diff --git a/library/linux/src/internal/engine_method_result.cc b/library/common/internal/engine_method_result.cc similarity index 97% rename from library/linux/src/internal/engine_method_result.cc rename to library/common/internal/engine_method_result.cc index 46850f3f2..91a7d73d1 100644 --- a/library/linux/src/internal/engine_method_result.cc +++ b/library/common/internal/engine_method_result.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/src/internal/engine_method_result.h" +#include "library/common/internal/engine_method_result.h" #include diff --git a/library/linux/src/internal/engine_method_result.h b/library/common/internal/engine_method_result.h similarity index 81% rename from library/linux/src/internal/engine_method_result.h rename to library/common/internal/engine_method_result.h index 23d9427d8..e97c0dedf 100644 --- a/library/linux/src/internal/engine_method_result.h +++ b/library/common/internal/engine_method_result.h @@ -11,15 +11,15 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_SRC_INTERNAL_ENGINE_METHOD_RESULT_H_ -#define LIBRARY_LINUX_SRC_INTERNAL_ENGINE_METHOD_RESULT_H_ +#ifndef LIBRARY_COMMON_INTERNAL_ENGINE_METHOD_RESULT_H_ +#define LIBRARY_COMMON_INTERNAL_ENGINE_METHOD_RESULT_H_ #include #include -#include "library/linux/include/flutter_desktop_embedding/binary_messenger.h" -#include "library/linux/include/flutter_desktop_embedding/method_codec.h" -#include "library/linux/include/flutter_desktop_embedding/method_result.h" +#include "library/include/flutter_desktop_embedding/binary_messenger.h" +#include "library/include/flutter_desktop_embedding/method_codec.h" +#include "library/include/flutter_desktop_embedding/method_result.h" namespace flutter_desktop_embedding { @@ -54,4 +54,4 @@ class EngineMethodResult : public MethodResult { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_SRC_INTERNAL_ENGINE_METHOD_RESULT_H_ +#endif // LIBRARY_COMMON_INTERNAL_ENGINE_METHOD_RESULT_H_ diff --git a/library/linux/src/internal/json_message_codec.cc b/library/common/internal/json_message_codec.cc similarity index 97% rename from library/linux/src/internal/json_message_codec.cc rename to library/common/internal/json_message_codec.cc index ad40e807b..8cf5dfb64 100644 --- a/library/linux/src/internal/json_message_codec.cc +++ b/library/common/internal/json_message_codec.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/src/internal/json_message_codec.h" +#include "library/common/internal/json_message_codec.h" #include #include diff --git a/library/linux/src/internal/json_message_codec.h b/library/common/internal/json_message_codec.h similarity index 89% rename from library/linux/src/internal/json_message_codec.h rename to library/common/internal/json_message_codec.h index 34d47ca88..fbd53e3f9 100644 --- a/library/linux/src/internal/json_message_codec.h +++ b/library/common/internal/json_message_codec.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_MESSAGE_CODEC_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_MESSAGE_CODEC_H_ +#ifndef LIBRARY_COMMON_INTERNAL_JSON_MESSAGE_CODEC_H_ +#define LIBRARY_COMMON_INTERNAL_JSON_MESSAGE_CODEC_H_ #include #include @@ -56,4 +56,4 @@ class JsonMessageCodec { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_MESSAGE_CODEC_H_ +#endif // LIBRARY_COMMON_INTERNAL_JSON_MESSAGE_CODEC_H_ diff --git a/library/linux/src/internal/plugin_handler.cc b/library/common/internal/plugin_handler.cc similarity index 90% rename from library/linux/src/internal/plugin_handler.cc rename to library/common/internal/plugin_handler.cc index 4acb94e5f..9454d84b9 100644 --- a/library/linux/src/internal/plugin_handler.cc +++ b/library/common/internal/plugin_handler.cc @@ -11,10 +11,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/src/internal/plugin_handler.h" +#include "library/common/internal/plugin_handler.h" -#include "library/linux/include/flutter_desktop_embedding/method_channel.h" -#include "library/linux/src/internal/engine_method_result.h" +#include "library/common/internal/engine_method_result.h" +#include "library/include/flutter_desktop_embedding/method_channel.h" #include @@ -81,10 +81,10 @@ void PluginHandler::HandleMethodCallMessage( void PluginHandler::Send(const std::string &channel, const uint8_t *message, const size_t message_size) const { FlutterPlatformMessage platform_message = { - .struct_size = sizeof(FlutterPlatformMessage), - .channel = channel.c_str(), - .message = message, - .message_size = message_size, + sizeof(FlutterPlatformMessage), + channel.c_str(), + message, + message_size, }; FlutterEngineSendPlatformMessage(engine_, &platform_message); } diff --git a/library/linux/src/internal/plugin_handler.h b/library/common/internal/plugin_handler.h similarity index 89% rename from library/linux/src/internal/plugin_handler.h rename to library/common/internal/plugin_handler.h index 46c1e06c1..65dfc1bbd 100644 --- a/library/linux/src/internal/plugin_handler.h +++ b/library/common/internal/plugin_handler.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_SRC_INTERNAL_PLUGIN_HANDLER_H_ -#define LIBRARY_LINUX_SRC_INTERNAL_PLUGIN_HANDLER_H_ +#ifndef LIBRARY_COMMON_INTERNAL_PLUGIN_HANDLER_H_ +#define LIBRARY_COMMON_INTERNAL_PLUGIN_HANDLER_H_ #include #include @@ -20,8 +20,8 @@ #include -#include "library/linux/include/flutter_desktop_embedding/binary_messenger.h" -#include "library/linux/include/flutter_desktop_embedding/plugin.h" +#include "library/include/flutter_desktop_embedding/binary_messenger.h" +#include "library/include/flutter_desktop_embedding/plugin.h" namespace flutter_desktop_embedding { @@ -74,4 +74,4 @@ class PluginHandler : public BinaryMessenger { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_SRC_INTERNAL_PLUGIN_HANDLER_H_ +#endif // LIBRARY_COMMON_INTERNAL_PLUGIN_HANDLER_H_ diff --git a/library/linux/src/internal/text_input_model.cc b/library/common/internal/text_input_model.cc similarity index 98% rename from library/linux/src/internal/text_input_model.cc rename to library/common/internal/text_input_model.cc index 127b370b5..579f5cf1c 100644 --- a/library/linux/src/internal/text_input_model.cc +++ b/library/common/internal/text_input_model.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/src/internal/text_input_model.h" +#include "library/common/internal/text_input_model.h" #include diff --git a/library/linux/src/internal/text_input_model.h b/library/common/internal/text_input_model.h similarity index 94% rename from library/linux/src/internal/text_input_model.h rename to library/common/internal/text_input_model.h index 19be7caf3..95058f319 100644 --- a/library/linux/src/internal/text_input_model.h +++ b/library/common/internal/text_input_model.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_SRC_INTERNAL_TEXT_INPUT_MODEL_H_ -#define LIBRARY_LINUX_SRC_INTERNAL_TEXT_INPUT_MODEL_H_ +#ifndef LIBRARY_COMMON_INTERNAL_TEXT_INPUT_MODEL_H_ +#define LIBRARY_COMMON_INTERNAL_TEXT_INPUT_MODEL_H_ #include @@ -95,4 +95,4 @@ class TextInputModel { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_SRC_INTERNAL_TEXT_INPUT_MODEL_H_ +#endif // LIBRARY_COMMON_INTERNAL_TEXT_INPUT_MODEL_H_ diff --git a/library/linux/src/json_method_call.cc b/library/common/json_method_call.cc similarity index 93% rename from library/linux/src/json_method_call.cc rename to library/common/json_method_call.cc index 3acdfaf9e..db2d847ff 100644 --- a/library/linux/src/json_method_call.cc +++ b/library/common/json_method_call.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/json_method_call.h" +#include "library/include/flutter_desktop_embedding/json_method_call.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/json_method_codec.cc b/library/common/json_method_codec.cc similarity index 93% rename from library/linux/src/json_method_codec.cc rename to library/common/json_method_codec.cc index 29107110f..69c3d4f16 100644 --- a/library/linux/src/json_method_codec.cc +++ b/library/common/json_method_codec.cc @@ -11,10 +11,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/json_method_codec.h" +#include "library/include/flutter_desktop_embedding/json_method_codec.h" -#include "library/linux/include/flutter_desktop_embedding/json_method_call.h" -#include "library/linux/src/internal/json_message_codec.h" +#include "library/common/internal/json_message_codec.h" +#include "library/include/flutter_desktop_embedding/json_method_call.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/json_plugin.cc b/library/common/json_plugin.cc similarity index 92% rename from library/linux/src/json_plugin.cc rename to library/common/json_plugin.cc index 2cb7b56d9..5f4b12ef9 100644 --- a/library/linux/src/json_plugin.cc +++ b/library/common/json_plugin.cc @@ -11,9 +11,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/json_plugin.h" +#include "library/include/flutter_desktop_embedding/json_plugin.h" -#include "library/linux/include/flutter_desktop_embedding/json_method_codec.h" +#include "library/include/flutter_desktop_embedding/json_method_codec.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/method_call.cc b/library/common/method_call.cc similarity index 91% rename from library/linux/src/method_call.cc rename to library/common/method_call.cc index adbcbc972..4dcd4c1cb 100644 --- a/library/linux/src/method_call.cc +++ b/library/common/method_call.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/method_call.h" +#include "library/include/flutter_desktop_embedding/method_call.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/method_channel.cc b/library/common/method_channel.cc similarity index 94% rename from library/linux/src/method_channel.cc rename to library/common/method_channel.cc index b4201310f..8ba9b406b 100644 --- a/library/linux/src/method_channel.cc +++ b/library/common/method_channel.cc @@ -11,11 +11,11 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/method_channel.h" +#include "library/include/flutter_desktop_embedding/method_channel.h" #include -#include "library/linux/src/internal/engine_method_result.h" +#include "library/common/internal/engine_method_result.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/method_codec.cc b/library/common/method_codec.cc similarity index 95% rename from library/linux/src/method_codec.cc rename to library/common/method_codec.cc index 03fb44bb2..9899041d5 100644 --- a/library/linux/src/method_codec.cc +++ b/library/common/method_codec.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/method_codec.h" +#include "library/include/flutter_desktop_embedding/method_codec.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/method_result.cc b/library/common/method_result.cc similarity index 93% rename from library/linux/src/method_result.cc rename to library/common/method_result.cc index 58ed27fce..c81c28fbd 100644 --- a/library/linux/src/method_result.cc +++ b/library/common/method_result.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/method_result.h" +#include "library/include/flutter_desktop_embedding/method_result.h" namespace flutter_desktop_embedding { diff --git a/library/linux/src/plugin.cc b/library/common/plugin.cc similarity index 89% rename from library/linux/src/plugin.cc rename to library/common/plugin.cc index aaf63642e..d6587f08f 100644 --- a/library/linux/src/plugin.cc +++ b/library/common/plugin.cc @@ -11,9 +11,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include "library/linux/include/flutter_desktop_embedding/plugin.h" +#include "library/include/flutter_desktop_embedding/plugin.h" -#include "library/linux/include/flutter_desktop_embedding/json_method_codec.h" +#include "library/include/flutter_desktop_embedding/json_method_codec.h" namespace flutter_desktop_embedding { diff --git a/library/linux/include/flutter_desktop_embedding/binary_messenger.h b/library/include/flutter_desktop_embedding/binary_messenger.h similarity index 90% rename from library/linux/include/flutter_desktop_embedding/binary_messenger.h rename to library/include/flutter_desktop_embedding/binary_messenger.h index d08bd6a3b..4e6f73b13 100644 --- a/library/linux/include/flutter_desktop_embedding/binary_messenger.h +++ b/library/include/flutter_desktop_embedding/binary_messenger.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_BINARY_MESSENGER_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_BINARY_MESSENGER_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_BINARY_MESSENGER_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_BINARY_MESSENGER_H_ #include #include @@ -59,4 +59,4 @@ class BinaryMessenger { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_BINARY_MESSENGER_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_BINARY_MESSENGER_H_ diff --git a/library/linux/include/flutter_desktop_embedding/json_method_call.h b/library/include/flutter_desktop_embedding/json_method_call.h similarity index 88% rename from library/linux/include/flutter_desktop_embedding/json_method_call.h rename to library/include/flutter_desktop_embedding/json_method_call.h index 7cb5b3ccd..bfc552468 100644 --- a/library/linux/include/flutter_desktop_embedding/json_method_call.h +++ b/library/include/flutter_desktop_embedding/json_method_call.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CALL_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CALL_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CALL_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CALL_H_ #include @@ -50,4 +50,4 @@ class JsonMethodCall : public MethodCall { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CALL_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CALL_H_ diff --git a/library/linux/include/flutter_desktop_embedding/json_method_codec.h b/library/include/flutter_desktop_embedding/json_method_codec.h similarity index 88% rename from library/linux/include/flutter_desktop_embedding/json_method_codec.h rename to library/include/flutter_desktop_embedding/json_method_codec.h index 38ac8fcc6..a34da1b65 100644 --- a/library/linux/include/flutter_desktop_embedding/json_method_codec.h +++ b/library/include/flutter_desktop_embedding/json_method_codec.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CODEC_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CODEC_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CODEC_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CODEC_H_ #include "method_codec.h" @@ -51,4 +51,4 @@ class JsonMethodCodec : public MethodCodec { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CODEC_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_METHOD_CODEC_H_ diff --git a/library/linux/include/flutter_desktop_embedding/json_plugin.h b/library/include/flutter_desktop_embedding/json_plugin.h similarity index 91% rename from library/linux/include/flutter_desktop_embedding/json_plugin.h rename to library/include/flutter_desktop_embedding/json_plugin.h index 0eaefde2e..59d4a85b4 100644 --- a/library/linux/include/flutter_desktop_embedding/json_plugin.h +++ b/library/include/flutter_desktop_embedding/json_plugin.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_PLUGIN_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_PLUGIN_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_PLUGIN_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_PLUGIN_H_ #include #include @@ -64,4 +64,4 @@ class JsonPlugin : public Plugin { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_PLUGIN_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_JSON_PLUGIN_H_ diff --git a/library/linux/include/flutter_desktop_embedding/embedder.h b/library/include/flutter_desktop_embedding/linux/embedder.h similarity index 92% rename from library/linux/include/flutter_desktop_embedding/embedder.h rename to library/include/flutter_desktop_embedding/linux/embedder.h index 217b5a10f..3fc973595 100644 --- a/library/linux/include/flutter_desktop_embedding/embedder.h +++ b/library/include/flutter_desktop_embedding/linux/embedder.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_EMBEDDER_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_EMBEDDER_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_LINUX_EMBEDDER_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_LINUX_EMBEDDER_H_ // Epoxy must be included before any graphics-related code. #include @@ -22,7 +22,11 @@ #include #include +#ifdef USE_FLATTENED_INCLUDES #include "plugin.h" +#else +#include "../plugin.h" +#endif namespace flutter_desktop_embedding { @@ -78,4 +82,4 @@ void FlutterWindowLoop(GLFWwindow *flutter_window); } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_EMBEDDER_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_LINUX_EMBEDDER_H_ diff --git a/library/linux/include/flutter_desktop_embedding/method_call.h b/library/include/flutter_desktop_embedding/method_call.h similarity index 87% rename from library/linux/include/flutter_desktop_embedding/method_call.h rename to library/include/flutter_desktop_embedding/method_call.h index 6616165a6..1e801718b 100644 --- a/library/linux/include/flutter_desktop_embedding/method_call.h +++ b/library/include/flutter_desktop_embedding/method_call.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CALL_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CALL_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CALL_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CALL_H_ #include @@ -43,4 +43,4 @@ class MethodCall { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CALL_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CALL_H_ diff --git a/library/linux/include/flutter_desktop_embedding/method_channel.h b/library/include/flutter_desktop_embedding/method_channel.h similarity index 91% rename from library/linux/include/flutter_desktop_embedding/method_channel.h rename to library/include/flutter_desktop_embedding/method_channel.h index 6f4f0f604..22b5cf4cd 100644 --- a/library/linux/include/flutter_desktop_embedding/method_channel.h +++ b/library/include/flutter_desktop_embedding/method_channel.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CHANNEL_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CHANNEL_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CHANNEL_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CHANNEL_H_ #include @@ -69,4 +69,4 @@ class MethodChannel { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CHANNEL_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CHANNEL_H_ diff --git a/library/linux/include/flutter_desktop_embedding/method_codec.h b/library/include/flutter_desktop_embedding/method_codec.h similarity index 92% rename from library/linux/include/flutter_desktop_embedding/method_codec.h rename to library/include/flutter_desktop_embedding/method_codec.h index d563c20b4..fc34f4d82 100644 --- a/library/linux/include/flutter_desktop_embedding/method_codec.h +++ b/library/include/flutter_desktop_embedding/method_codec.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CODEC_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CODEC_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CODEC_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CODEC_H_ #include #include @@ -65,4 +65,4 @@ class MethodCodec { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CODEC_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_CODEC_H_ diff --git a/library/linux/include/flutter_desktop_embedding/method_result.h b/library/include/flutter_desktop_embedding/method_result.h similarity index 91% rename from library/linux/include/flutter_desktop_embedding/method_result.h rename to library/include/flutter_desktop_embedding/method_result.h index f1c072d7a..205ca1f51 100644 --- a/library/linux/include/flutter_desktop_embedding/method_result.h +++ b/library/include/flutter_desktop_embedding/method_result.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_RESULT_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_RESULT_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_RESULT_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_RESULT_H_ #include @@ -59,4 +59,4 @@ class MethodResult { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_RESULT_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_METHOD_RESULT_H_ diff --git a/library/linux/include/flutter_desktop_embedding/plugin.h b/library/include/flutter_desktop_embedding/plugin.h similarity index 94% rename from library/linux/include/flutter_desktop_embedding/plugin.h rename to library/include/flutter_desktop_embedding/plugin.h index 02affff86..c69483739 100644 --- a/library/linux/include/flutter_desktop_embedding/plugin.h +++ b/library/include/flutter_desktop_embedding/plugin.h @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#ifndef LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_PLUGIN_H_ -#define LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_PLUGIN_H_ +#ifndef LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_PLUGIN_H_ +#define LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_PLUGIN_H_ #include #include @@ -84,4 +84,4 @@ class Plugin { } // namespace flutter_desktop_embedding -#endif // LIBRARY_LINUX_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_PLUGIN_H_ +#endif // LIBRARY_INCLUDE_FLUTTER_DESKTOP_EMBEDDING_PLUGIN_H_ diff --git a/library/linux/.gitignore b/library/linux/.gitignore index 61d1051b1..55d8c0ddd 100644 --- a/library/linux/.gitignore +++ b/library/linux/.gitignore @@ -1,3 +1,3 @@ .last_engine_version *.so -flutter_embedder.h +include diff --git a/library/linux/BUILD.gn b/library/linux/BUILD.gn index c9e903509..6b049638c 100644 --- a/library/linux/BUILD.gn +++ b/library/linux/BUILD.gn @@ -19,7 +19,7 @@ import("//library/engine.gni") # inculdes for its header rather than project-relative. config("relative_public_headers") { include_dirs = [ - "include", + "../include" ] } diff --git a/library/linux/Makefile b/library/linux/Makefile index e2f2b4b07..7c7f4db47 100644 --- a/library/linux/Makefile +++ b/library/linux/Makefile @@ -14,6 +14,8 @@ FLUTTER_ENGINE_LIB_NAME=flutter_engine FLUTTER_ENGINE_LIB_FILE=lib$(FLUTTER_ENGINE_LIB_NAME).so FLUTTER_ENGINE_HEADER=flutter_embedder.h +# Use an include/ directory for the engine header for consistency. +FLUTTER_ENGINE_HEADER_DIR=$(CURDIR)/include PROJECT_ROOT=../.. TOOLS_DIR=$(PROJECT_ROOT)/tools ENGINE_UPDATER=$(TOOLS_DIR)/update_flutter_engine @@ -22,7 +24,8 @@ LIBRARY_OUT=libflutter_embedder.so CXX=g++ -std=c++14 CXXFLAGS= -Wall -Werror -shared -fPIC \ -I$(PROJECT_ROOT) \ - -I$(CURDIR)/include \ + -I$(PROJECT_ROOT)/library/include \ + -I$(FLUTTER_ENGINE_HEADER_DIR) \ $(shell pkg-config --cflags gtk+-3.0 epoxy x11 jsoncpp) LDFLAGS= -L$(CURDIR) \ $(shell pkg-config --libs gtk+-3.0 epoxy x11 jsoncpp) \ @@ -31,8 +34,9 @@ LDFLAGS= -L$(CURDIR) \ LIBRARIES=$(FLUTTER_ENGINE_LIB_FILE) -HEADERS=$(shell find include/ -type f -name '*.h') -SOURCES=$(shell find src/ -type f -name '*.cc') +HEADERS=$(shell find $(PROJECT_ROOT)/library/include/ -type f -name '*.h') \ + $(FLUTTER_ENGINE_HEADER_DIR)/$(FLUTTER_ENGINE_HEADER) +SOURCES=$(shell find src/ $(PROJECT_ROOT)/library/common/ -type f -name '*.cc') .PHONY: all all: $(LIBRARY_OUT) @@ -45,10 +49,12 @@ $(LIBRARY_OUT): $(SOURCES) $(HEADERS) $(LIBRARIES) # time. Instead, this duplicates the dependency information that the script # already has, and makes things slightly more fragile, in exchange for # avoiding unnecessary relinks. -$(FLUTTER_ENGINE_LIB_FILE): $(FLUTTER_DIR)/bin/internal/engine.version +$(FLUTTER_ENGINE_LIB_FILE) $(FLUTTER_ENGINE_HEADER_DIR)/$(FLUTTER_ENGINE_HEADER): \ + $(FLUTTER_DIR)/bin/internal/engine.version $(ENGINE_UPDATER) --flutter_root=$(FLUTTER_DIR) ./ if [ -f $(FLUTTER_ENGINE_HEADER) ]; then \ - mv $(FLUTTER_ENGINE_HEADER) include/; \ + mkdir -p $(FLUTTER_ENGINE_HEADER_DIR) && \ + mv $(FLUTTER_ENGINE_HEADER) $(FLUTTER_ENGINE_HEADER_DIR)/; \ fi .PHONY: clean diff --git a/library/linux/src/embedder.cc b/library/linux/src/embedder.cc index 5ce1396e8..b793464a2 100644 --- a/library/linux/src/embedder.cc +++ b/library/linux/src/embedder.cc @@ -11,7 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include @@ -26,10 +26,10 @@ #include -#include "library/linux/src/internal/key_event_handler.h" -#include "library/linux/src/internal/keyboard_hook_handler.h" -#include "library/linux/src/internal/plugin_handler.h" -#include "library/linux/src/internal/text_input_plugin.h" +#include "library/common/glfw/key_event_handler.h" +#include "library/common/glfw/keyboard_hook_handler.h" +#include "library/common/glfw/text_input_plugin.h" +#include "library/common/internal/plugin_handler.h" // GLFW_TRUE & GLFW_FALSE are introduced since libglfw-3.3, // add definitions here to compile under the old versions. diff --git a/plugins/color_panel/BUILD.gn b/plugins/color_panel/BUILD.gn index 60ce61462..0b6bf3c8e 100644 --- a/plugins/color_panel/BUILD.gn +++ b/plugins/color_panel/BUILD.gn @@ -30,6 +30,8 @@ published_shared_library("color_panel") { ] } + defines = ["USE_FLATTENED_INCLUDES"] + deps = [ "//library:flutter_embedder", ] diff --git a/plugins/color_panel/linux/Makefile b/plugins/color_panel/linux/Makefile index b753a32df..4f8e167a8 100644 --- a/plugins/color_panel/linux/Makefile +++ b/plugins/color_panel/linux/Makefile @@ -15,21 +15,23 @@ LIBRARY_OUT=libflutter_embedder_color_panel.so PROJECT_ROOT=$(CURDIR)/../../.. # For dependency on the embedder shared library. -EMBEDDER_LIBRARY_DIR=$(PROJECT_ROOT)/library/linux +EMBEDDER_LIBRARY_DIR=$(PROJECT_ROOT)/library +EMBEDDER_LIBRARY_OUT_DIR=$(EMBEDDER_LIBRARY_DIR)/linux +EMBEDDER_LIBRARY_HEADER_DIR=$(EMBEDDER_LIBRARY_DIR)/include EMBEDDER_LIB_NAME=flutter_engine -EMBEDDER_LIB_FILE=$(EMBEDDER_LIBRARY_DIR)/lib$(EMBEDDER_LIB_NAME).so +EMBEDDER_LIB_FILE=$(EMBEDDER_LIBRARY_OUT_DIR)/lib$(EMBEDDER_LIB_NAME).so COMMON_DIR=$(CURDIR)/../common CXX=g++ -std=c++14 CXXFLAGS= -Wall -Werror -shared -fPIC \ -I$(PROJECT_ROOT) \ - -I$(EMBEDDER_LIBRARY_DIR)/include \ + -I$(EMBEDDER_LIBRARY_HEADER_DIR) \ $(shell pkg-config --cflags gtk+-3.0 jsoncpp) -LDFLAGS= -L$(EMBEDDER_LIBRARY_DIR) \ +LDFLAGS= -L$(EMBEDDER_LIBRARY_OUT_DIR) \ $(shell pkg-config --libs gtk+-3.0 jsoncpp) \ -l$(EMBEDDER_LIB_NAME) \ - -Wl,-rpath=$(EMBEDDER_LIBRARY_DIR) + -Wl,-rpath=$(EMBEDDER_LIBRARY_OUT_DIR) LIBRARIES=$(EMBEDDER_LIB_FILE) HEADERS=$(shell find include/ $(COMMON_DIR)/ -type f -name '*.h') diff --git a/plugins/file_chooser/BUILD.gn b/plugins/file_chooser/BUILD.gn index f38e4baef..86b3e8837 100644 --- a/plugins/file_chooser/BUILD.gn +++ b/plugins/file_chooser/BUILD.gn @@ -30,6 +30,8 @@ published_shared_library("file_chooser") { ] } + defines = ["USE_FLATTENED_INCLUDES"] + deps = [ "//library:flutter_embedder", ] diff --git a/plugins/file_chooser/linux/Makefile b/plugins/file_chooser/linux/Makefile index 419f5de08..bb2bf3f87 100644 --- a/plugins/file_chooser/linux/Makefile +++ b/plugins/file_chooser/linux/Makefile @@ -15,21 +15,23 @@ LIBRARY_OUT=libflutter_embedder_file_chooser.so PROJECT_ROOT=$(CURDIR)/../../.. # For dependency on the embedder shared library. -EMBEDDER_LIBRARY_DIR=$(PROJECT_ROOT)/library/linux +EMBEDDER_LIBRARY_DIR=$(PROJECT_ROOT)/library +EMBEDDER_LIBRARY_OUT_DIR=$(EMBEDDER_LIBRARY_DIR)/linux +EMBEDDER_LIBRARY_HEADER_DIR=$(EMBEDDER_LIBRARY_DIR)/include EMBEDDER_LIB_NAME=flutter_engine -EMBEDDER_LIB_FILE=$(EMBEDDER_LIBRARY_DIR)/lib$(EMBEDDER_LIB_NAME).so +EMBEDDER_LIB_FILE=$(EMBEDDER_LIBRARY_OUT_DIR)/lib$(EMBEDDER_LIB_NAME).so COMMON_DIR=$(CURDIR)/../common CXX=g++ -std=c++14 CXXFLAGS= -Wall -Werror -shared -fPIC \ -I$(PROJECT_ROOT) \ - -I$(EMBEDDER_LIBRARY_DIR)/include \ + -I$(EMBEDDER_LIBRARY_HEADER_DIR) \ $(shell pkg-config --cflags gtk+-3.0 jsoncpp) -LDFLAGS= -L$(EMBEDDER_LIBRARY_DIR) \ +LDFLAGS= -L$(EMBEDDER_LIBRARY_OUT_DIR) \ $(shell pkg-config --libs gtk+-3.0 jsoncpp) \ -l$(EMBEDDER_LIB_NAME) \ - -Wl,-rpath=$(EMBEDDER_LIBRARY_DIR) + -Wl,-rpath=$(EMBEDDER_LIBRARY_OUT_DIR) LIBRARIES=$(EMBEDDER_LIB_FILE) HEADERS=$(shell find include/ $(COMMON_DIR)/ -type f -name '*.h') diff --git a/plugins/menubar/BUILD.gn b/plugins/menubar/BUILD.gn index c4f8aa690..ab431f8ef 100644 --- a/plugins/menubar/BUILD.gn +++ b/plugins/menubar/BUILD.gn @@ -30,6 +30,8 @@ published_shared_library("menubar") { ] } + defines = ["USE_FLATTENED_INCLUDES"] + deps = [ "//library:flutter_embedder", ] diff --git a/plugins/menubar/linux/Makefile b/plugins/menubar/linux/Makefile index e867b8131..0ee350ef1 100644 --- a/plugins/menubar/linux/Makefile +++ b/plugins/menubar/linux/Makefile @@ -15,21 +15,23 @@ LIBRARY_OUT=libflutter_embedder_menubar.so PROJECT_ROOT=$(CURDIR)/../../.. # For dependency on the embedder shared library. -EMBEDDER_LIBRARY_DIR=$(PROJECT_ROOT)/library/linux +EMBEDDER_LIBRARY_DIR=$(PROJECT_ROOT)/library +EMBEDDER_LIBRARY_OUT_DIR=$(EMBEDDER_LIBRARY_DIR)/linux +EMBEDDER_LIBRARY_HEADER_DIR=$(EMBEDDER_LIBRARY_DIR)/include EMBEDDER_LIB_NAME=flutter_engine -EMBEDDER_LIB_FILE=$(EMBEDDER_LIBRARY_DIR)/lib$(EMBEDDER_LIB_NAME).so +EMBEDDER_LIB_FILE=$(EMBEDDER_LIBRARY_OUT_DIR)/lib$(EMBEDDER_LIB_NAME).so COMMON_DIR=$(CURDIR)/../common CXX=g++ -std=c++14 CXXFLAGS= -Wall -Werror -shared -fPIC \ -I$(PROJECT_ROOT) \ - -I$(EMBEDDER_LIBRARY_DIR)/include \ + -I$(EMBEDDER_LIBRARY_HEADER_DIR) \ $(shell pkg-config --cflags gtk+-3.0 jsoncpp) -LDFLAGS= -L$(EMBEDDER_LIBRARY_DIR) \ +LDFLAGS= -L$(EMBEDDER_LIBRARY_OUT_DIR) \ $(shell pkg-config --libs gtk+-3.0 jsoncpp) \ -l$(EMBEDDER_LIB_NAME) \ - -Wl,-rpath=$(EMBEDDER_LIBRARY_DIR) + -Wl,-rpath=$(EMBEDDER_LIBRARY_OUT_DIR) LIBRARIES=$(EMBEDDER_LIB_FILE) HEADERS=$(shell find include/ $(COMMON_DIR)/ -type f -name '*.h')