1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-14 03:19:06 +00:00

desktop_photo_search Rebuild script (#1356)

This commit is contained in:
Brett Morgan
2022-08-02 19:39:19 +10:00
committed by GitHub
parent bca6bbd37a
commit bc8cc85052
31 changed files with 414 additions and 173 deletions

View File

@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.14)
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} WIN32
"flutter_window.cpp"
"main.cpp"
@@ -10,8 +15,18 @@ add_executable(${BINARY_NAME} WIN32
"Runner.rc"
"runner.exe.manifest"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
# Add dependency libraries and include directories. Add any application-specific
# dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)

View File

@@ -90,10 +90,10 @@ BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "A Photo Search sample app." "\0"
VALUE "FileDescription", "desktop_photo_search" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "desktop_photo_search" "\0"
VALUE "LegalCopyright", "Copyright (C) 2020 com.example. All rights reserved." "\0"
VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "desktop_photo_search.exe" "\0"
VALUE "ProductName", "desktop_photo_search" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"

View File

@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"Photo Search", origin, size)) {
if (!window.CreateAndShow(L"desktop_photo_search", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);

View File

@@ -48,10 +48,10 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) {
int target_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, nullptr, 0, nullptr, nullptr);
if (target_length == 0) {
return std::string();
}
std::string utf8_string;
if (target_length == 0 || target_length > utf8_string.max_size()) {
return utf8_string;
}
utf8_string.resize(target_length);
int converted_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,