Skip to content

better readme #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 11, 2020
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
out
.vscode
build.sh
build_all.sh
compile_commands.json
.clang-format
build
out
build
build_debug
build_release
59 changes: 39 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ if(NOT FLUTTER_EMBEDDER_HEADER)
if(NOT FLUTTER_ENGINE_SHA)

if(NOT CHANNEL)
set(CHANNEL "stable" CACHE STRING "Choose the channel, options are: master, dev, beta, stable" FORCE)
message(STATUS "Flutter Channel not set, defaulting to stable")
set(CHANNEL "stable" CACHE STRING "The flutter channel to be used for downloading the flutter_embedder.h header file. Choose: master, dev, beta, stable" FORCE)
message(STATUS "Flutter Channel not set, defaulting to stable")
endif()

message(STATUS "Flutter Channel ........ ${CHANNEL}")
Expand All @@ -56,11 +56,11 @@ if(NOT FLUTTER_EMBEDDER_HEADER)

FetchContent_GetProperties(engine-version)
if(NOT engine-version_POPULATED)
FetchContent_Populate(engine-version)
file(READ ${CMAKE_BINARY_DIR}/engine.version FLUTTER_ENGINE_SHA)
string(REPLACE "\n" "" FLUTTER_ENGINE_SHA ${FLUTTER_ENGINE_SHA})
FetchContent_Populate(engine-version)
file(READ ${CMAKE_BINARY_DIR}/engine.version FLUTTER_ENGINE_SHA)
string(REPLACE "\n" "" FLUTTER_ENGINE_SHA ${FLUTTER_ENGINE_SHA})
else()
MESSAGE(FATAL "Unable to determine engine-version, please override FLUTTER_ENGINE_SHA")
MESSAGE(FATAL "Unable to determine engine-version, please override FLUTTER_ENGINE_SHA")
endif()

endif()
Expand All @@ -72,12 +72,12 @@ if(NOT FLUTTER_EMBEDDER_HEADER)
# Download and setup the flutter engine library header.
if(NOT EXISTS ${FLUTTER_EMBEDDER_HEADER})
file(DOWNLOAD
https://github.com/flutter/engine/blob/${FLUTTER_ENGINE_SHA}/shell/platform/embedder/embedder.h
https://raw.githubusercontent.com/flutter/engine/${FLUTTER_ENGINE_SHA}/shell/platform/embedder/embedder.h
${FLUTTER_EMBEDDER_HEADER}
)
endif()
else()
message(STATUS "Engine ................. ${FLUTTER_ENGINE_LIBRARY}")
message(STATUS "Flutter Header ......... ${FLUTTER_EMBEDDER_HEADER}")
endif()

include(ExternalProject)
Expand All @@ -93,7 +93,12 @@ pkg_check_modules(GLESV2 REQUIRED glesv2)
pkg_check_modules(LIBSYSTEMD REQUIRED libsystemd)
pkg_check_modules(LIBINPUT REQUIRED libinput)
pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon)
pkg_check_modules(LIBUDEV libudev)
pkg_check_modules(LIBUDEV REQUIRED libudev)

set(BUILD_TEXT_INPUT_PLUGIN ON CACHE BOOL "Include the text input plugin in the finished binary. Enables text input (to flutter text fields, for example) via attached keyboards.")
set(BUILD_RAW_KEYBOARD_PLUGIN ON CACHE BOOL "Include the raw keyboard plugin in the finished binary. Enables raw keycode listening in flutter via the flutter RawKeyboard interface.")
set(BUILD_TEST_PLUGIN OFF CACHE BOOL "Include the test plugin in the finished binary. Allows testing platform channel communication.")
set(BUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN ON CACHE BOOL "Include the omxplayer_video_player plugin in the finished binary. Allows for hardware accelerated video playback in flutter using omxplayer.")

set(FLUTTER_PI_SRC
src/flutter-pi.c
Expand All @@ -106,15 +111,19 @@ set(FLUTTER_PI_SRC
src/cursor.c
src/keyboard.c
src/plugins/services.c
src/plugins/testplugin.c
src/plugins/text_input.c
src/plugins/raw_keyboard.c
src/plugins/omxplayer_video_player.c
)

if (NOT LIBUDEV_FOUND)
message(STATUS "Could not find libudev.so and libudev development headers. flutter-pi will be built without udev (hotplugging) support. To install, execute 'sudo apt install libudev-dev'")
add_compile_options(-DBUILD_WITHOUT_UDEV_SUPPORT)
if (BUILD_TEXT_INPUT_PLUGIN)
list(APPEND FLUTTER_PI_SRC src/plugins/text_input.c)
endif()
if (BUILD_RAW_KEYBOARD_PLUGIN)
list(APPEND FLUTTER_PI_SRC src/plugins/raw_keyboard.c)
endif()
if (BUILD_TEST_PLUGIN)
list(APPEND FLUTTER_PI_SRC src/plugins/testplugin.c)
endif()
if (BUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN)
list(APPEND FLUTTER_PI_SRC src/plugins/omxplayer_video_player.c)
endif()

add_executable(flutter-pi ${FLUTTER_PI_SRC})
Expand Down Expand Up @@ -154,12 +163,22 @@ target_compile_options(flutter-pi PRIVATE
${LIBINPUT_CFLAGS}
${LIBUDEV_CFLAGS}
${LIBXKBCOMMON_CFLAGS}
-ggdb
-DBUILD_TEXT_INPUT_PLUGIN
-DBUILD_TEST_PLUGIN
-DBUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN
$<$<CONFIG:DEBUG>:-O0 -ggdb>
)

if (BUILD_TEXT_INPUT_PLUGIN)
target_compile_definitions(flutter-pi PRIVATE "BUILD_TEXT_INPUT_PLUGIN")
endif()
if (BUILD_RAW_KEYBOARD_PLUGIN)
target_compile_definitions(flutter-pi PRIVATE "BUILD_RAW_KEYBOARD_PLUGIN")
endif()
if (BUILD_TEST_PLUGIN)
target_compile_definitions(flutter-pi PRIVATE "BUILD_TEST_PLUGIN")
endif()
if (BUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN)
target_compile_definitions(flutter-pi PRIVATE "BUILD_OMXPLAYER_VIDEO_PLAYER_PLUGIN")
endif()

target_link_options(flutter-pi PRIVATE
-rdynamic
)
Expand Down
46 changes: 0 additions & 46 deletions Makefile

This file was deleted.

Loading