Skip to content

Commit e364dc9

Browse files
stuartmorgan-gEgor
authored andcommitted
Add windows directory to examples (flutter#3149)
When Windows support was added to these plugins, the app template wasn't yet stabilized, so was not checked in. Now that it is stable, this adds them so that the plugin_tools workaround that created them on each run can be removed. Other than CHANGELOG.md updates and updating the verison in pubspec.yaml, this is purely the result of running 'flutter create .' in the example/ folders and adding the resulting windows/ directories (then clang-format-ing the result).
1 parent eb9d7ce commit e364dc9

File tree

132 files changed

+6204
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+6204
-6
lines changed

packages/path_provider/path_provider/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.6.23
2+
3+
* Check in windows/ directory for example/
4+
15
## 1.6.22
26

37
* Switch to guava-android dependency instead of full guava.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
flutter/ephemeral/
2+
3+
# Visual Studio user-specific files.
4+
*.suo
5+
*.user
6+
*.userosscache
7+
*.sln.docstates
8+
9+
# Visual Studio build-related files.
10+
x64/
11+
x86/
12+
13+
# Visual Studio cache files
14+
# files ending in .cache can be ignored
15+
*.[Cc]ache
16+
# but keep track of directories ending in .cache
17+
!*.[Cc]ache/
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(example LANGUAGES CXX)
3+
4+
set(BINARY_NAME "example")
5+
6+
cmake_policy(SET CMP0063 NEW)
7+
8+
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9+
10+
# Configure build options.
11+
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12+
if(IS_MULTICONFIG)
13+
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
14+
CACHE STRING "" FORCE)
15+
else()
16+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
17+
set(CMAKE_BUILD_TYPE "Debug" CACHE
18+
STRING "Flutter build mode" FORCE)
19+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
20+
"Debug" "Profile" "Release")
21+
endif()
22+
endif()
23+
24+
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
25+
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
26+
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
27+
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
28+
29+
# Use Unicode for all projects.
30+
add_definitions(-DUNICODE -D_UNICODE)
31+
32+
# Compilation settings that should be applied to most targets.
33+
function(APPLY_STANDARD_SETTINGS TARGET)
34+
target_compile_features(${TARGET} PUBLIC cxx_std_17)
35+
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
36+
target_compile_options(${TARGET} PRIVATE /EHsc)
37+
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
38+
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
39+
endfunction()
40+
41+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42+
43+
# Flutter library and tool build rules.
44+
add_subdirectory(${FLUTTER_MANAGED_DIR})
45+
46+
# Application build
47+
add_subdirectory("runner")
48+
49+
# Generated plugin build rules, which manage building the plugins and adding
50+
# them to the application.
51+
include(flutter/generated_plugins.cmake)
52+
53+
54+
# === Installation ===
55+
# Support files are copied into place next to the executable, so that it can
56+
# run in place. This is done instead of making a separate bundle (as on Linux)
57+
# so that building and running from within Visual Studio will work.
58+
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
59+
# Make the "install" step default, as it's required to run.
60+
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62+
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63+
endif()
64+
65+
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66+
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67+
68+
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69+
COMPONENT Runtime)
70+
71+
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72+
COMPONENT Runtime)
73+
74+
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75+
COMPONENT Runtime)
76+
77+
if(PLUGIN_BUNDLED_LIBRARIES)
78+
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80+
COMPONENT Runtime)
81+
endif()
82+
83+
# Fully re-copy the assets directory on each build to avoid having stale files
84+
# from a previous install.
85+
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86+
install(CODE "
87+
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88+
" COMPONENT Runtime)
89+
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91+
92+
# Install the AOT library on non-Debug builds only.
93+
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94+
CONFIGURATIONS Profile;Release
95+
COMPONENT Runtime)
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4+
5+
# Configuration provided via flutter tool.
6+
include(${EPHEMERAL_DIR}/generated_config.cmake)
7+
8+
# TODO: Move the rest of this into files in ephemeral. See
9+
# https://github.com/flutter/flutter/issues/57146.
10+
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
11+
12+
# === Flutter Library ===
13+
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
14+
15+
# Published to parent scope for install step.
16+
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
17+
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
18+
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
19+
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
20+
21+
list(APPEND FLUTTER_LIBRARY_HEADERS
22+
"flutter_export.h"
23+
"flutter_windows.h"
24+
"flutter_messenger.h"
25+
"flutter_plugin_registrar.h"
26+
)
27+
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
28+
add_library(flutter INTERFACE)
29+
target_include_directories(flutter INTERFACE
30+
"${EPHEMERAL_DIR}"
31+
)
32+
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
33+
add_dependencies(flutter flutter_assemble)
34+
35+
# === Wrapper ===
36+
list(APPEND CPP_WRAPPER_SOURCES_CORE
37+
"core_implementations.cc"
38+
"standard_codec.cc"
39+
)
40+
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
41+
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
42+
"plugin_registrar.cc"
43+
)
44+
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
45+
list(APPEND CPP_WRAPPER_SOURCES_APP
46+
"flutter_engine.cc"
47+
"flutter_view_controller.cc"
48+
)
49+
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
50+
51+
# Wrapper sources needed for a plugin.
52+
add_library(flutter_wrapper_plugin STATIC
53+
${CPP_WRAPPER_SOURCES_CORE}
54+
${CPP_WRAPPER_SOURCES_PLUGIN}
55+
)
56+
apply_standard_settings(flutter_wrapper_plugin)
57+
set_target_properties(flutter_wrapper_plugin PROPERTIES
58+
POSITION_INDEPENDENT_CODE ON)
59+
set_target_properties(flutter_wrapper_plugin PROPERTIES
60+
CXX_VISIBILITY_PRESET hidden)
61+
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
62+
target_include_directories(flutter_wrapper_plugin PUBLIC
63+
"${WRAPPER_ROOT}/include"
64+
)
65+
add_dependencies(flutter_wrapper_plugin flutter_assemble)
66+
67+
# Wrapper sources needed for the runner.
68+
add_library(flutter_wrapper_app STATIC
69+
${CPP_WRAPPER_SOURCES_CORE}
70+
${CPP_WRAPPER_SOURCES_APP}
71+
)
72+
apply_standard_settings(flutter_wrapper_app)
73+
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
74+
target_include_directories(flutter_wrapper_app PUBLIC
75+
"${WRAPPER_ROOT}/include"
76+
)
77+
add_dependencies(flutter_wrapper_app flutter_assemble)
78+
79+
# === Flutter tool backend ===
80+
# _phony_ is a non-existent file to force this command to run every time,
81+
# since currently there's no way to get a full input/output list from the
82+
# flutter tool.
83+
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
84+
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
85+
add_custom_command(
86+
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
87+
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
88+
${CPP_WRAPPER_SOURCES_APP}
89+
${PHONY_OUTPUT}
90+
COMMAND ${CMAKE_COMMAND} -E env
91+
${FLUTTER_TOOL_ENVIRONMENT}
92+
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
93+
windows-x64 $<CONFIG>
94+
)
95+
add_custom_target(flutter_assemble DEPENDS
96+
"${FLUTTER_LIBRARY}"
97+
${FLUTTER_LIBRARY_HEADERS}
98+
${CPP_WRAPPER_SOURCES_CORE}
99+
${CPP_WRAPPER_SOURCES_PLUGIN}
100+
${CPP_WRAPPER_SOURCES_APP}
101+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
#include "generated_plugin_registrant.h"
6+
7+
void RegisterPlugins(flutter::PluginRegistry* registry) {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
#ifndef GENERATED_PLUGIN_REGISTRANT_
6+
#define GENERATED_PLUGIN_REGISTRANT_
7+
8+
#include <flutter/plugin_registry.h>
9+
10+
// Registers Flutter plugins.
11+
void RegisterPlugins(flutter::PluginRegistry* registry);
12+
13+
#endif // GENERATED_PLUGIN_REGISTRANT_
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
list(APPEND FLUTTER_PLUGIN_LIST
6+
)
7+
8+
set(PLUGIN_BUNDLED_LIBRARIES)
9+
10+
foreach(plugin ${FLUTTER_PLUGIN_LIST})
11+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
12+
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
13+
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
14+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
15+
endforeach(plugin)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(runner LANGUAGES CXX)
3+
4+
add_executable(${BINARY_NAME} WIN32
5+
"flutter_window.cpp"
6+
"main.cpp"
7+
"run_loop.cpp"
8+
"utils.cpp"
9+
"win32_window.cpp"
10+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
11+
"Runner.rc"
12+
"runner.exe.manifest"
13+
)
14+
apply_standard_settings(${BINARY_NAME})
15+
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
16+
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
17+
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
18+
add_dependencies(${BINARY_NAME} flutter_assemble)

0 commit comments

Comments
 (0)