diff --git a/packages/flutter_tools/templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl b/packages/flutter_tools/templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl index 580180401d..f710aa3d4e 100644 --- a/packages/flutter_tools/templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl +++ b/packages/flutter_tools/templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl @@ -1,5 +1,5 @@ # Project-level configuration. -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change @@ -54,25 +54,8 @@ add_subdirectory(${FLUTTER_MANAGED_DIR}) find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") - -# Define the application target. To change its name, change BINARY_NAME above, -# not the value here, or `flutter run` will no longer work. -# -# Any new source files that you add to the application should be added here. -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) - -# Apply the standard set of build settings. This can be removed for applications -# that need different build settings. -apply_standard_settings(${BINARY_NAME}) - -# Add dependency libraries. Add any application-specific dependencies here. -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/packages/flutter_tools/templates/app_shared/linux.tmpl/runner/CMakeLists.txt b/packages/flutter_tools/templates/app_shared/linux.tmpl/runner/CMakeLists.txt new file mode 100644 index 0000000000..e97dabc702 --- /dev/null +++ b/packages/flutter_tools/templates/app_shared/linux.tmpl/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/packages/flutter_tools/templates/app_shared/linux.tmpl/main.cc b/packages/flutter_tools/templates/app_shared/linux.tmpl/runner/main.cc similarity index 100% rename from packages/flutter_tools/templates/app_shared/linux.tmpl/main.cc rename to packages/flutter_tools/templates/app_shared/linux.tmpl/runner/main.cc diff --git a/packages/flutter_tools/templates/app_shared/linux.tmpl/my_application.cc.tmpl b/packages/flutter_tools/templates/app_shared/linux.tmpl/runner/my_application.cc.tmpl similarity index 100% rename from packages/flutter_tools/templates/app_shared/linux.tmpl/my_application.cc.tmpl rename to packages/flutter_tools/templates/app_shared/linux.tmpl/runner/my_application.cc.tmpl diff --git a/packages/flutter_tools/templates/app_shared/linux.tmpl/my_application.h b/packages/flutter_tools/templates/app_shared/linux.tmpl/runner/my_application.h similarity index 100% rename from packages/flutter_tools/templates/app_shared/linux.tmpl/my_application.h rename to packages/flutter_tools/templates/app_shared/linux.tmpl/runner/my_application.h diff --git a/packages/flutter_tools/templates/template_manifest.json b/packages/flutter_tools/templates/template_manifest.json index f22b4f65fa..98d9d70bc8 100644 --- a/packages/flutter_tools/templates/template_manifest.json +++ b/packages/flutter_tools/templates/template_manifest.json @@ -87,10 +87,11 @@ "templates/app_shared/linux.tmpl/.gitignore", "templates/app_shared/linux.tmpl/CMakeLists.txt.tmpl", "templates/app_shared/linux.tmpl/flutter/CMakeLists.txt", - "templates/app_shared/linux.tmpl/main.cc", - "templates/app_shared/linux.tmpl/my_application.cc", - "templates/app_shared/linux.tmpl/my_application.cc.tmpl", - "templates/app_shared/linux.tmpl/my_application.h", + "templates/app_shared/linux.tmpl/runner/CMakeLists.txt", + "templates/app_shared/linux.tmpl/runner/main.cc", + "templates/app_shared/linux.tmpl/runner/my_application.cc", + "templates/app_shared/linux.tmpl/runner/my_application.cc.tmpl", + "templates/app_shared/linux.tmpl/runner/my_application.h", "templates/app_shared/macos.tmpl/.gitignore", "templates/app_shared/macos.tmpl/Flutter/Flutter-Debug.xcconfig", "templates/app_shared/macos.tmpl/Flutter/Flutter-Release.xcconfig",