Skip to content

Commit d4fbfdf

Browse files
committed
bundle flutter_embedder.h with project
- only way to ensure flutter-pi doesn't break with embedder API updates - also, that's the whole benefit of the ABI-backwards compatibility of the embedder header - don't download embedder header in CMakeLists.txt - remove FLUTTER_EMBEDDER_HEADER option
1 parent def1681 commit d4fbfdf

File tree

3 files changed

+2983
-48
lines changed

3 files changed

+2983
-48
lines changed

CMakeLists.txt

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -68,55 +68,9 @@ set_property(CACHE FILESYSTEM_LAYOUT PROPERTY STRINGS ${FILESYSTEM_LAYOUTS})
6868

6969
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
7070

71-
# Download the flutter_embedder.h if it's not specified
72-
if(NOT FLUTTER_EMBEDDER_HEADER)
73-
74-
include(FetchContent)
75-
76-
if(NOT FLUTTER_ENGINE_SHA)
77-
78-
if(NOT CHANNEL)
79-
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)
80-
message(STATUS "Flutter Channel not set, defaulting to stable")
81-
endif()
82-
83-
message(STATUS "Flutter Channel ........ ${CHANNEL}")
84-
85-
FetchContent_Declare(engine-version
86-
URL https://raw.githubusercontent.com/flutter/flutter/${CHANNEL}/bin/internal/engine.version
87-
DOWNLOAD_NAME engine.version
88-
DOWNLOAD_NO_EXTRACT TRUE
89-
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}
90-
)
91-
92-
FetchContent_GetProperties(engine-version)
93-
if(NOT engine-version_POPULATED)
94-
FetchContent_Populate(engine-version)
95-
file(READ ${CMAKE_BINARY_DIR}/engine.version FLUTTER_ENGINE_SHA)
96-
string(REPLACE "\n" "" FLUTTER_ENGINE_SHA ${FLUTTER_ENGINE_SHA})
97-
else()
98-
MESSAGE(FATAL "Unable to determine engine-version, please override FLUTTER_ENGINE_SHA")
99-
endif()
100-
101-
endif()
102-
103-
message(STATUS "Engine SHA1 ............ ${FLUTTER_ENGINE_SHA}")
104-
105-
set(FLUTTER_EMBEDDER_HEADER ${CMAKE_BINARY_DIR}/flutter_embedder.h)
106-
107-
# Download and setup the flutter engine library header.
108-
if(NOT EXISTS ${FLUTTER_EMBEDDER_HEADER})
109-
file(DOWNLOAD
110-
https://raw.githubusercontent.com/flutter/engine/${FLUTTER_ENGINE_SHA}/shell/platform/embedder/embedder.h
111-
${FLUTTER_EMBEDDER_HEADER}
112-
)
113-
endif()
114-
else()
115-
message(STATUS "Flutter Header ......... ${FLUTTER_EMBEDDER_HEADER}")
116-
endif()
117-
11871
include(ExternalProject)
11972
include(CheckCCompilerFlag)
73+
include(FetchContent)
12074

12175
# Those libraries we definitely need.
12276
include(FindPkgConfig)
@@ -170,7 +124,7 @@ target_link_libraries(flutterpi_module PUBLIC
170124
)
171125

172126
target_include_directories(flutterpi_module PUBLIC
173-
${CMAKE_BINARY_DIR}
127+
${CMAKE_SOURCE_DIR}/third_party/flutter_embedder_header/include
174128
${CMAKE_SOURCE_DIR}/src
175129
)
176130

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d44b5a94c976fbb65815374f61ab5392a220b084

0 commit comments

Comments
 (0)