Skip to content

Commit 8925e1f

Browse files
Move the Linux runner into a subdirectory (#153812)
Fixes flutter/flutter#60213
1 parent 6458fd9 commit 8925e1f

File tree

6 files changed

+34
-24
lines changed

6 files changed

+34
-24
lines changed

packages/flutter_tools/templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Project-level configuration.
2-
cmake_minimum_required(VERSION 3.10)
2+
cmake_minimum_required(VERSION 3.13)
33
project(runner LANGUAGES CXX)
44

55
# The name of the executable created for the application. Change this to change
@@ -54,25 +54,8 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
5454
find_package(PkgConfig REQUIRED)
5555
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
5656

57-
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58-
59-
# Define the application target. To change its name, change BINARY_NAME above,
60-
# not the value here, or `flutter run` will no longer work.
61-
#
62-
# Any new source files that you add to the application should be added here.
63-
add_executable(${BINARY_NAME}
64-
"main.cc"
65-
"my_application.cc"
66-
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67-
)
68-
69-
# Apply the standard set of build settings. This can be removed for applications
70-
# that need different build settings.
71-
apply_standard_settings(${BINARY_NAME})
72-
73-
# Add dependency libraries. Add any application-specific dependencies here.
74-
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75-
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
57+
# Application build; see runner/CMakeLists.txt.
58+
add_subdirectory("runner")
7659

7760
# Run the Flutter tool portions of the build. This must not be removed.
7861
add_dependencies(${BINARY_NAME} flutter_assemble)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
project(runner LANGUAGES CXX)
3+
4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
9+
add_executable(${BINARY_NAME}
10+
"main.cc"
11+
"my_application.cc"
12+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
13+
)
14+
15+
# Apply the standard set of build settings. This can be removed for applications
16+
# that need different build settings.
17+
apply_standard_settings(${BINARY_NAME})
18+
19+
# Add preprocessor definitions for the application ID.
20+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
21+
22+
# Add dependency libraries. Add any application-specific dependencies here.
23+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
24+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
25+
26+
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

packages/flutter_tools/templates/template_manifest.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@
8787
"templates/app_shared/linux.tmpl/.gitignore",
8888
"templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl",
8989
"templates/app_shared/linux.tmpl/flutter/CMakeLists.txt",
90-
"templates/app_shared/linux.tmpl/main.cc",
91-
"templates/app_shared/linux.tmpl/my_application.cc",
92-
"templates/app_shared/linux.tmpl/my_application.cc.tmpl",
93-
"templates/app_shared/linux.tmpl/my_application.h",
90+
"templates/app_shared/linux.tmpl/runner/CMakeLists.txt",
91+
"templates/app_shared/linux.tmpl/runner/main.cc",
92+
"templates/app_shared/linux.tmpl/runner/my_application.cc",
93+
"templates/app_shared/linux.tmpl/runner/my_application.cc.tmpl",
94+
"templates/app_shared/linux.tmpl/runner/my_application.h",
9495
"templates/app_shared/macos.tmpl/.gitignore",
9596
"templates/app_shared/macos.tmpl/Flutter/Flutter-Debug.xcconfig",
9697
"templates/app_shared/macos.tmpl/Flutter/Flutter-Release.xcconfig",

0 commit comments

Comments
 (0)