-
-
Notifications
You must be signed in to change notification settings - Fork 177
gcc/clang warning fixes and CMake implementation #59
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f12fad7
cmake
jwinarske ecbece1
compiler warnings
jwinarske ce7b8e9
clang warning fixes
jwinarske 41e9011
Warn if libgpiod not found
jwinarske 9eee1b3
allow override of engine sha1
jwinarske aa88c64
channel selection
jwinarske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ out | |
.vscode | ||
build.sh | ||
compile_commands.json | ||
.clang-format | ||
.clang-format | ||
build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# | ||
# MIT License | ||
# | ||
# Copyright (c) 2020 Joel Winarske | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.10.2) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE) | ||
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to Release.") | ||
endif() | ||
|
||
project(flutter-pi LANGUAGES C) | ||
|
||
message(STATUS "Generator .............. ${CMAKE_GENERATOR}") | ||
message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}") | ||
|
||
if(NOT FLUTTER_ENGINE_LIBRARY) | ||
|
||
include(FetchContent) | ||
|
||
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") | ||
endif() | ||
|
||
message(STATUS "Flutter Channel ........ ${CHANNEL}") | ||
|
||
FetchContent_Declare(engine-version | ||
URL https://raw.githubusercontent.com/flutter/flutter/${CHANNEL}/bin/internal/engine.version | ||
DOWNLOAD_NAME engine.version | ||
DOWNLOAD_NO_EXTRACT TRUE | ||
DOWNLOAD_DIR ${CMAKE_BINARY_DIR} | ||
) | ||
|
||
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}) | ||
else() | ||
MESSAGE(FATAL "Unable to determine engine-version, please override FLUTTER_ENGINE_SHA") | ||
endif() | ||
|
||
endif() | ||
|
||
message(STATUS "Engine SHA1 ............ ${FLUTTER_ENGINE_SHA}") | ||
|
||
# Download and setup the Flutter Engine. | ||
|
||
set(FLUTTER_EMBEDDER_ARTIFACTS_ZIP ${CMAKE_BINARY_DIR}/flutter_embedder_${FLUTTER_ENGINE_SHA}.zip) | ||
set(FLUTTER_BUCKET_BASE "https://storage.googleapis.com/flutter_infra/flutter") | ||
|
||
if(NOT EXISTS ${FLUTTER_EMBEDDER_ARTIFACTS_ZIP}) | ||
file(DOWNLOAD | ||
${FLUTTER_BUCKET_BASE}/${FLUTTER_ENGINE_SHA}/linux-x64/linux-x64-embedder | ||
${FLUTTER_EMBEDDER_ARTIFACTS_ZIP} | ||
SHOW_PROGRESS | ||
) | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${FLUTTER_EMBEDDER_ARTIFACTS_ZIP} | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
) | ||
endif() | ||
|
||
set(FLUTTER_ENGINE_LIBRARY ${CMAKE_BINARY_DIR}/libflutter_engine.so) | ||
else() | ||
message(STATUS "Engine ................. ${FLUTTER_ENGINE_LIBRARY}") | ||
endif() | ||
|
||
include(ExternalProject) | ||
|
||
set(ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH}) | ||
message(STATUS "PKG_CONFIG_PATH ........ $ENV{PKG_CONFIG_PATH}") | ||
|
||
include(FindPkgConfig) | ||
pkg_check_modules(GBM REQUIRED gbm) | ||
pkg_check_modules(DRM REQUIRED libdrm) | ||
pkg_check_modules(GLESV2 REQUIRED glesv2) | ||
pkg_check_modules(EGL REQUIRED egl) | ||
pkg_check_modules(GPIOD libgpiod) | ||
|
||
set(FLUTTER_PI_SRC | ||
src/flutter-pi.c | ||
src/platformchannel.c | ||
src/pluginregistry.c | ||
src/console_keyboard.c | ||
src/plugins/elm327plugin.c | ||
src/plugins/services.c | ||
src/plugins/testplugin.c | ||
src/plugins/text_input.c | ||
src/plugins/raw_keyboard.c | ||
src/plugins/spidev.c | ||
) | ||
|
||
if(GPIOD_FOUND) | ||
list(APPEND FLUTTER_PI_SRC src/plugins/gpiod.c) | ||
add_compile_options(-DBUILD_GPIOD_PLUGIN) | ||
else() | ||
message(STATUS "Could not find gpiod library and development headers. flutter-pi will be built without gpiod support. To install, execute 'sudo apt install libgpiod-dev'") | ||
endif() | ||
jwinarske marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
add_executable(flutter-pi ${FLUTTER_PI_SRC}) | ||
|
||
target_link_libraries(flutter-pi | ||
${FLUTTER_ENGINE_LIBRARY} ${GPIOD_LDFLAGS} ${GBM_LDFLAGS} | ||
${DRM_LDFLAGS} ${GLESV2_LDFLAGS} ${EGL_LDFLAGS} | ||
pthread dl | ||
) | ||
|
||
target_include_directories(flutter-pi PRIVATE | ||
${CMAKE_BINARY_DIR} | ||
${CMAKE_SOURCE_DIR}/include | ||
${CMAKE_SOURCE_DIR}/include/plugins | ||
${GBM_INCLUDE_DIRS} ${DRM_INCLUDE_DIRS} | ||
${GLESV2_INCLUDE_DIRS} ${EGL_INCLUDE_DIRS} | ||
) | ||
|
||
target_compile_options(flutter-pi PRIVATE | ||
${GBM_CFLAGS} ${DRM_CFLAGS} | ||
${GLESV2_CFLAGS} ${EGL_CFLAGS} | ||
${GPIOD_CFLAGS} -ggdb | ||
-DBUILD_TEXT_INPUT_PLUGIN | ||
-DBUILD_ELM327_PLUGIN | ||
-DBUILD_SPIDEV_PLUGIN | ||
-DBUILD_TEST_PLUGIN | ||
) | ||
|
||
install(TARGETS flutter-pi RUNTIME DESTINATION bin) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,8 @@ int console_restore(void) { | |
} | ||
|
||
is_raw = false; | ||
|
||
return 0; | ||
} | ||
|
||
size_t utf8_symbol_length(char *c) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.