Skip to content

Commit 3bdafe6

Browse files
updated CMakeLists.txt
1 parent 0e33039 commit 3bdafe6

16 files changed

Lines changed: 157 additions & 51 deletions

.flutter-plugins

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This is a generated file; do not edit or check into version control.
2+
flutter_barcode_scanner=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_barcode_scanner-2.0.0\\
3+
flutter_plugin_android_lifecycle=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_plugin_android_lifecycle-2.0.7\\
4+
permission_handler=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler-11.3.0\\
5+
permission_handler_android=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_android-12.0.3\\
6+
permission_handler_apple=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_apple-9.4.0\\
7+
permission_handler_html=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_html-0.1.1\\
8+
permission_handler_windows=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\permission_handler_windows-0.2.1\\
9+
webview_windows=C:\\Users\\kharag\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\webview_windows-0.3.0\\

.flutter-plugins-dependencies

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_barcode_scanner","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_barcode_scanner-2.0.0\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.4.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_barcode_scanner","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_barcode_scanner-2.0.0\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_plugin_android_lifecycle-2.0.7\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-12.0.3\\\\","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.2.1\\\\","native_build":true,"dependencies":[]},{"name":"webview_windows","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\webview_windows-0.3.0\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"permission_handler_html","path":"C:\\\\Users\\\\kharag\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_html-0.1.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_barcode_scanner","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"webview_windows","dependencies":[]}],"date_created":"2024-03-13 01:10:39.616459","version":"3.16.8"}

example/.metadata

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
8-
channel: stable
7+
revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4"
8+
channel: "stable"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
17-
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
16+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
17+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
1818
- platform: android
19-
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
20-
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
19+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
20+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
2121
- platform: ios
22-
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
23-
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
22+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
23+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
24+
- platform: linux
25+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
26+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
27+
- platform: macos
28+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
29+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
2430
- platform: web
25-
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
26-
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
31+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
32+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
2733
- platform: windows
28-
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
29-
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
34+
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
35+
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
3036

3137
# User provided section
3238

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Flutter
2+
import UIKit
3+
import XCTest
4+
5+
class RunnerTests: XCTestCase {
6+
7+
func testExample() {
8+
// If you add code to the Runner application, consider adding tests here.
9+
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10+
}
11+
12+
}

example/pubspec.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,26 @@ packages:
140140
dependency: transitive
141141
description:
142142
name: permission_handler
143-
sha256: "45ff3fbcb99040fde55c528d5e3e6ca29171298a85436274d49c6201002087d6"
143+
sha256: "74e962b7fad7ff75959161bb2c0ad8fe7f2568ee82621c9c2660b751146bfe44"
144144
url: "https://pub.dev"
145145
source: hosted
146-
version: "11.2.0"
146+
version: "11.3.0"
147147
permission_handler_android:
148148
dependency: transitive
149149
description:
150150
name: permission_handler_android
151-
sha256: "758284a0976772f9c744d6384fc5dc4834aa61e3f7aa40492927f244767374eb"
151+
sha256: "1acac6bae58144b442f11e66621c062aead9c99841093c38f5bcdcc24c1c3474"
152152
url: "https://pub.dev"
153153
source: hosted
154-
version: "12.0.3"
154+
version: "12.0.5"
155155
permission_handler_apple:
156156
dependency: transitive
157157
description:
158158
name: permission_handler_apple
159-
sha256: c6bf440f80acd2a873d3d91a699e4cc770f86e7e6b576dda98759e8b92b39830
159+
sha256: bdafc6db74253abb63907f4e357302e6bb786ab41465e8635f362ee71fd8707b
160160
url: "https://pub.dev"
161161
source: hosted
162-
version: "9.3.0"
162+
version: "9.4.0"
163163
permission_handler_html:
164164
dependency: transitive
165165
description:
@@ -172,10 +172,10 @@ packages:
172172
dependency: transitive
173173
description:
174174
name: permission_handler_platform_interface
175-
sha256: "5c43148f2bfb6d14c5a8162c0a712afe891f2d847f35fcff29c406b37da43c3c"
175+
sha256: "23dfba8447c076ab5be3dee9ceb66aad345c4a648f0cac292c77b1eb0e800b78"
176176
url: "https://pub.dev"
177177
source: hosted
178-
version: "4.1.0"
178+
version: "4.2.0"
179179
permission_handler_windows:
180180
dependency: transitive
181181
description:

example/windows/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(BINARY_NAME "example")
88

99
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
1010
# versions of CMake.
11-
cmake_policy(SET CMP0063 NEW)
11+
cmake_policy(VERSION 3.14...3.25)
1212

1313
# Define build configuration option.
1414
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
@@ -52,6 +52,7 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
5252
# Application build; see runner/CMakeLists.txt.
5353
add_subdirectory("runner")
5454

55+
5556
# Generated plugin build rules, which manage building the plugins and adding
5657
# them to the application.
5758
include(flutter/generated_plugins.cmake)
@@ -86,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES)
8687
COMPONENT Runtime)
8788
endif()
8889

90+
# Copy the native assets provided by the build.dart from all packages.
91+
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
92+
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
93+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
94+
COMPONENT Runtime)
95+
8996
# Fully re-copy the assets directory on each build to avoid having stale files
9097
# from a previous install.
9198
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")

example/windows/flutter/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
1010
# https://github.com/flutter/flutter/issues/57146.
1111
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
1212

13+
# Set fallback configurations for older versions of the flutter tool.
14+
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
15+
set(FLUTTER_TARGET_PLATFORM "windows-x64")
16+
endif()
17+
1318
# === Flutter Library ===
1419
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
1520

@@ -92,7 +97,7 @@ add_custom_command(
9297
COMMAND ${CMAKE_COMMAND} -E env
9398
${FLUTTER_TOOL_ENVIRONMENT}
9499
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95-
windows-x64 $<CONFIG>
100+
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
96101
VERBATIM
97102
)
98103
add_custom_target(flutter_assemble DEPENDS

example/windows/runner/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ add_executable(${BINARY_NAME} WIN32
2020
# that need different build settings.
2121
apply_standard_settings(${BINARY_NAME})
2222

23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
2330
# Disable Windows macros that collide with C++ standard library functions.
2431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
2532

2633
# Add dependency libraries and include directories. Add any application-specific
2734
# dependencies here.
2835
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36+
target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
2937
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
3038

3139
# Run the Flutter tool portions of the build. This must not be removed.

example/windows/runner/Runner.rc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif
@@ -93,7 +93,7 @@ BEGIN
9393
VALUE "FileDescription", "example" "\0"
9494
VALUE "FileVersion", VERSION_AS_STRING "\0"
9595
VALUE "InternalName", "example" "\0"
96-
VALUE "LegalCopyright", "Copyright (C) 2022 com.kharagedition. All rights reserved." "\0"
96+
VALUE "LegalCopyright", "Copyright (C) 2024 com.kharagedition. All rights reserved." "\0"
9797
VALUE "OriginalFilename", "example.exe" "\0"
9898
VALUE "ProductName", "example" "\0"
9999
VALUE "ProductVersion", VERSION_AS_STRING "\0"

example/windows/runner/flutter_window.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ bool FlutterWindow::OnCreate() {
2626
}
2727
RegisterPlugins(flutter_controller_->engine());
2828
SetChildContent(flutter_controller_->view()->GetNativeWindow());
29+
30+
flutter_controller_->engine()->SetNextFrameCallback([&]() {
31+
this->Show();
32+
});
33+
34+
// Flutter can complete the first frame before the "show window" callback is
35+
// registered. The following call ensures a frame is pending to ensure the
36+
// window is shown. It is a no-op if the first frame hasn't completed yet.
37+
flutter_controller_->ForceRedraw();
38+
2939
return true;
3040
}
3141

0 commit comments

Comments
 (0)