@@ -129,6 +129,7 @@ target_link_libraries(flutterpi_module PUBLIC
129
129
target_include_directories (flutterpi_module PUBLIC
130
130
${CMAKE_SOURCE_DIR} /third_party/flutter_embedder_header/include
131
131
${CMAKE_SOURCE_DIR} /src
132
+ ${CMAKE_BINARY_DIR}
132
133
)
133
134
134
135
target_compile_options (flutterpi_module PUBLIC
@@ -152,23 +153,18 @@ list(GET LIBINPUT_VERSION_AS_LIST 0 LIBINPUT_VERSION_MAJOR)
152
153
list (GET LIBINPUT_VERSION_AS_LIST 1 LIBINPUT_VERSION_MINOR)
153
154
list (GET LIBINPUT_VERSION_AS_LIST 2 LIBINPUT_VERSION_PATCH)
154
155
155
- target_compile_definitions (flutterpi_module PUBLIC
156
- LIBINPUT_VERSION_MAJOR=${LIBINPUT_VERSION_MAJOR}
157
- LIBINPUT_VERSION_MINOR=${LIBINPUT_VERSION_MINOR}
158
- LIBINPUT_VERSION_PATCH=${LIBINPUT_VERSION_PATCH}
159
- )
160
-
161
156
# TODO: Just unconditionally define those, make them optional later
162
- target_compile_definitions (flutterpi_module PUBLIC HAVE_KMS HAVE_GBM HAVE_FBDEV)
163
-
164
- # OpenGL
165
- pkg_check_modules(EGL IMPORTED_TARGET egl)
166
- pkg_check_modules(GLES2 IMPORTED_TARGET glesv2)
157
+ set (HAVE_KMS ON )
158
+ set (HAVE_GBM ON )
159
+ set (HAVE_FBDEV ON )
167
160
161
+ # OpenGL support
168
162
set (HAVE_EGL OFF )
169
163
set (HAVE_GLES2 OFF )
170
164
set (HAVE_EGL_GLES2 OFF )
171
165
166
+ pkg_check_modules(EGL IMPORTED_TARGET egl)
167
+ pkg_check_modules(GLES2 IMPORTED_TARGET glesv2)
172
168
if (ENABLE_OPENGL)
173
169
if (EGL_FOUND AND GLES2_FOUND)
174
170
target_sources (flutterpi_module PRIVATE
@@ -179,10 +175,10 @@ if (ENABLE_OPENGL)
179
175
PkgConfig::EGL
180
176
PkgConfig::GLES2
181
177
)
178
+
182
179
set (HAVE_EGL ON )
183
180
set (HAVE_GLES2 ON )
184
181
set (HAVE_EGL_GLES2 ON )
185
- target_compile_definitions (flutterpi_module PUBLIC HAVE_EGL HAVE_GLES2 HAVE_EGL_GLES2)
186
182
elseif (TRY_ENABLE_OPENGL)
187
183
message ("EGL and/or OpenGL was not found. Flutter-pi will build without EGL/OpenGL rendering support." )
188
184
else ()
@@ -192,16 +188,12 @@ endif()
192
188
193
189
message (STATUS "EGL/GLES support ....... ${HAVE_EGL_GLES2} " )
194
190
195
- if (LINT_EGL_HEADERS)
196
- target_compile_definitions (flutterpi_module PUBLIC LINT_EGL_HEADERS)
197
- message (STATUS "Lint EGL headers ....... ON" )
198
- else ()
199
- message (STATUS "Lint EGL headers ....... OFF" )
200
- endif ()
201
-
202
- pkg_check_modules(VULKAN IMPORTED_TARGET vulkan)
191
+ message (STATUS "Lint EGL headers ....... ${LINT_EGL_HEADERS} " )
203
192
193
+ # Vulkan support
204
194
set (HAVE_VULKAN OFF )
195
+
196
+ pkg_check_modules(VULKAN IMPORTED_TARGET vulkan)
205
197
if (ENABLE_VULKAN)
206
198
if (VULKAN_FOUND)
207
199
target_sources (flutterpi_module PRIVATE
@@ -211,8 +203,8 @@ if (ENABLE_VULKAN)
211
203
target_link_libraries (flutterpi_module PUBLIC
212
204
PkgConfig::VULKAN
213
205
)
206
+
214
207
set (HAVE_VULKAN ON )
215
- target_compile_definitions (flutterpi_module PUBLIC HAVE_VULKAN)
216
208
elseif (TRY_ENABLE_VULKAN)
217
209
message ("Vulkan was not found. Flutter-pi will build without vulkan rendering support." )
218
210
else ()
@@ -222,6 +214,7 @@ endif()
222
214
223
215
message (STATUS "Vulkan support ......... ${HAVE_VULKAN} " )
224
216
217
+ # We need at least one renderer
225
218
if (NOT HAVE_VULKAN AND NOT HAVE_EGL_GLES2)
226
219
message (SEND_ERROR "At least one of the EGL/GLES2 and Vulkan backends must be enabled." )
227
220
endif ()
@@ -234,14 +227,17 @@ if(NOT FILESYSTEM_LAYOUT IN_LIST FILESYSTEM_LAYOUTS)
234
227
endif ()
235
228
236
229
message (STATUS "Filesystem Layout ...... ${FILESYSTEM_LAYOUT} " )
230
+
231
+ # config.h takes the defines in form of #cmakedefine FILESYSTEM_LAYOUT_DEFAULT, ...
237
232
if (FILESYSTEM_LAYOUT STREQUAL default)
238
- target_compile_definitions (flutterpi_module PUBLIC " FILESYSTEM_LAYOUT_DEFAULT" )
233
+ set ( FILESYSTEM_LAYOUT_DEFAULT ON )
239
234
elseif (FILESYSTEM_LAYOUT STREQUAL meta-flutter)
240
- target_compile_definitions (flutterpi_module PUBLIC " FILESYSTEM_LAYOUT_METAFLUTTER" )
235
+ set ( FILESYSTEM_LAYOUT_METAFLUTTER ON )
241
236
endif ()
242
237
243
238
# Session switching support (using libseat)
244
- message (STATUS "Session switching ...... ${ENABLE_SESSION_SWITCHING} " )
239
+ set (HAVE_LIBSEAT OFF )
240
+
245
241
if (ENABLE_SESSION_SWITCHING)
246
242
if (TRY_ENABLE_SESSION_SWITCHING)
247
243
pkg_check_modules(LIBSEAT IMPORTED_TARGET libseat)
@@ -251,30 +247,22 @@ if (ENABLE_SESSION_SWITCHING)
251
247
252
248
if (LIBSEAT_FOUND)
253
249
target_link_libraries (flutterpi_module PUBLIC PkgConfig::LIBSEAT)
254
- target_compile_definitions (flutterpi_module PUBLIC HAVE_LIBSEAT)
250
+ set ( HAVE_LIBSEAT ON )
255
251
else ()
256
252
message ("libseat was not found. flutter-pi will be built without session switching support." )
257
253
endif ()
258
254
endif ()
259
255
260
- if (DEBUG_DRM_PLANE_ALLOCATIONS)
261
- target_compile_definitions (flutterpi_module PUBLIC DEBUG_DRM_PLANE_ALLOCATIONS)
262
- endif ()
263
-
264
- if (USE_LEGACY_KMS)
265
- target_compile_definitions (flutterpi_module PUBLIC USE_LEGACY_KMS)
266
- endif ()
256
+ message (STATUS "Session switching ...... ${HAVE_LIBSEAT} " )
267
257
268
258
# TODO: We actually don't need the compile definitions anymore, except for
269
259
# text input and raw keyboard plugin (because those have special treatment
270
260
# in flutter-pi.c)
271
261
if (BUILD_TEXT_INPUT_PLUGIN)
272
262
target_sources (flutterpi_module PRIVATE src/plugins/text_input.c)
273
- target_compile_definitions (flutterpi_module PUBLIC "BUILD_TEXT_INPUT_PLUGIN" )
274
263
endif ()
275
264
if (BUILD_RAW_KEYBOARD_PLUGIN)
276
265
target_sources (flutterpi_module PRIVATE src/plugins/raw_keyboard.c)
277
- target_compile_definitions (flutterpi_module PUBLIC "BUILD_RAW_KEYBOARD_PLUGIN" )
278
266
endif ()
279
267
if (BUILD_TEST_PLUGIN)
280
268
target_sources (flutterpi_module PRIVATE src/plugins/testplugin.c)
@@ -305,11 +293,6 @@ if (BUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN)
305
293
list (GET LIBGSTREAMER_VERSION_AS_LIST 1 LIBGSTREAMER_VERSION_MINOR)
306
294
list (GET LIBGSTREAMER_VERSION_AS_LIST 2 LIBGSTREAMER_VERSION_PATCH)
307
295
308
- target_compile_definitions (flutterpi_module PUBLIC
309
- LIBGSTREAMER_VERSION_MAJOR=${LIBGSTREAMER_VERSION_MAJOR}
310
- LIBGSTREAMER_VERSION_MINOR=${LIBGSTREAMER_VERSION_MINOR}
311
- LIBGSTREAMER_VERSION_PATCH=${LIBGSTREAMER_VERSION_PATCH}
312
- )
313
296
target_sources (flutterpi_module PRIVATE
314
297
src/plugins/gstreamer_video_player/plugin.c
315
298
src/plugins/gstreamer_video_player/player.c
@@ -359,10 +342,16 @@ endif()
359
342
target_link_options (flutterpi_module PUBLIC -rdynamic)
360
343
361
344
# Define VULKAN_DEBUG if it was set to On, or if it was set to AUTO and we're using debug mode.
362
- if (VULKAN_DEBUG STREQUAL "AUTO" )
363
- target_compile_definitions (flutterpi_module PUBLIC $<$<CONFIG:Debug>:VULKAN_DEBUG>)
364
- elseif (VULKAN_DEBUG)
365
- target_compile_definitions (flutterpi_module PUBLIC VULKAN_DEBUG)
345
+ if (VULKAN_DEBUG MATCHES AUTO)
346
+ if (CMAKE_BUILD_TYPE MATCHES DEBUG)
347
+ set (VULKAN_DEBUG ON )
348
+ else ()
349
+ set (VULKAN_DEBUG OFF )
350
+ endif ()
351
+ elseif (VULKAN_DEBUG MATCHES "OFF" )
352
+ set (VULKAN_DEBUG OFF )
353
+ elseif (VULKAN_DEBUG MATCHES "ON" )
354
+ set (VULKAN_DEBUG ON )
366
355
endif ()
367
356
368
357
# Some sanitizer configs.
@@ -389,9 +378,8 @@ if (ENABLE_UBSAN)
389
378
target_link_options (flutterpi_module PUBLIC -fsanitize=undefined)
390
379
target_compile_options (flutterpi_module PUBLIC -fsanitize=undefined)
391
380
endif ()
392
- if (ENABLE_MTRACE)
393
- target_compile_definitions (flutterpi_module PUBLIC "ENABLE_MTRACE" )
394
- endif ()
381
+
382
+ configure_file (config.h.in config.h @ONLY)
395
383
396
384
# Actual flutter-pi executable.
397
385
add_executable (
0 commit comments