AniCh Documentation

一个支持超分辨率的在线动漫弹幕APP。多平台,多番剧源,多弹幕,高清无广告。追番看番必备软件。

6,904 stars Dart Dart 2 files · ~8,163 tokens #acg#anime#anime-chan#anime-channel#anime4k#bangumi#danmaku
RAW Doc

File: README.md

[Binary file]


File: analysis_options.yaml

This file configures the analyzer, which statically analyzes Dart code to

check for errors, warnings, and lints.

The issues identified by the analyzer are surfaced in the UI of Dart-enabled

IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be

invoked from the command line by running `flutter analyze`.

packages, and plugins designed to encourage good coding practices.

include: package:flutter_lints/flutter.yaml

linter:

The lint rules applied to this project can be customized in the

section below to disable rules from the `package:flutter_lints/flutter.yaml`

included above or to enable additional rules. A list of all available lints

and their documentation is published at https://dart.dev/lints.

Instead of disabling a lint rule for the entire project in the

section below, it can also be suppressed for a single line of code

or a specific dart file by using the `// ignore: name_of_lint` and

`// ignore_for_file: name_of_lint` syntax on the line or in the file

producing the lint.

rules:
# avoid_print: false # Uncomment to disable the avoid_print rule
# prefer_single_quotes: true # Uncomment to enable the prefer_single_quotes rule

Additional information about this file can be found at

https://dart.dev/guides/language/analysis-options


File: api.json

{
"baseUrl": "https://ani.emmmm.eu.org",
"bilibiliApiUrl": "https://bili-dm.emmmm.eu.org",
"qqVideoApiUrl": "https://dm.video.qq.com",
"updateUrl": "https://api.github.com/repos/Sle2p/AniCh/releases/latest",
"githubProxyUrl": "https://gh.llkk.cc",
"apis": [
"https://api.500403.xyz",
"https://ani.emmmm.eu.org",
"https://api.emmmm.eu.org.cdn.cloudflare.net"
]
}


File: app_version.json

{
"version": "1.0.0",
"version_desc": "初始版本",
"prerelease": false,
"download_url": "https://github.com/Sle2p/xs.cx/releases"
}


File: pubspec.yaml

name: xs

The following line prevents the package from being accidentally published to

pub.dev using `flutter pub publish`. This is preferred for private packages.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

The following defines the version and build number for your application.

A version number is three numbers separated by dots, like 1.2.43

followed by an optional build number separated by a +.

Both the version and the builder number may be overridden in flutter

build by specifying --build-name and --build-number, respectively.

In Android, build-name is used as versionName while build-number used as versionCode.

Read more about Android versioning at https://developer.android.com/studio/publish/versioning

In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.

Read more about iOS versioning at

https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

In Windows, build-name is used as the major, minor, and patch parts

of the product and file versions while build-number is used as the build suffix.

version: 1.0.0+1

environment:
sdk: '>=3.4.4 <4.0.0'

Dependencies specify other packages that your package needs in order to work.

To automatically upgrade your package dependencies to the latest versions

consider running `flutter pub upgrade --major-versions`. Alternatively,

dependencies can be manually updated by changing the version numbers below to

the latest version available on pub.dev. To see which dependencies have newer

versions available, run `flutter pub outdated`.

dependencies:
flutter:
sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.6

框架、工具

get: ^4.6.6 # 状态管理、路由管理、国际化
protobuf: ^3.1.0 # dart pub global activate protoc_plugin
dio: ^5.4.3+1 # 网络请求
get_storage: ^2.1.1 # 持久化
dynamic_color: ^1.7.0 # 动态颜色
logger: ^2.4.0 # 日志
intl: ^0.19.0 # 国际化

系统交互

wakelock_plus: ^1.2.7 # 屏幕常亮
window_manager: ^0.4.0 # 窗口管理
package_info_plus: ^8.0.1 # 包信息
device_info_plus: ^10.1.1 # 设备信息
floating: ^4.0.1 # 画中画
perfect_volume_control: ^1.0.5 # 音量控制
screen_brightness: ^0.2.2+1 # 亮度控制
auto_orientation: ^2.3.1 # 屏幕方向
photo_view: ^0.15.0 # 图片预览
image_gallery_saver: ^2.0.3 # 图片保存
file_picker: ^8.0.7 # 文件选择
permission_handler: ^11.3.1 # 权限管理
path_provider: ^2.1.4 # 常用路径
url_launcher: ^6.3.0 #打开链接

Widget

flutter_staggered_grid_view: ^0.7.0 # 瀑布流
flutter_svg: ^2.0.10+1 # SVG
flutter_smart_dialog: ^4.9.7+9 # 弹窗

视频播放

media_kit: ^1.1.10+1
media_kit_video: ^1.2.4
media_kit_libs_video: ^1.0.4

dev_dependencies:
flutter_test:
sdk: flutter

encourage good coding practices. The lint set provided by the package is

activated in the `analysis_options.yaml` file located at the root of your

package. See that file for information about deactivating specific lint

rules and activating additional ones.

flutter_lints: ^3.0.0
flutter_launcher_icons: ^0.13.1
change_app_package_name: ^1.5.0

For information on the generic Dart part of this file, see the

following page: https://dart.dev/tools/pub/pubspec

The following section is specific to Flutter packages.

flutter:

The following line ensures that the Material Icons font is

included with your application, so that you can use the icons in

the material Icons class.

uses-material-design: true

To add assets to your application, add an assets section, like this:

assets:
- assets/images/
- assets/icons/

- images/a_dot_burr.jpeg

- images/a_dot_ham.jpeg

An image asset can refer to one or more resolution-specific "variants", see

https://flutter.dev/assets-and-images/#resolution-aware

For details regarding adding assets from package dependencies, see

https://flutter.dev/assets-and-images/#from-packages

To add custom fonts to your application, add a fonts section here,

in this "flutter" section. Each entry in this list should have a

"family" key with the font family name, and a "fonts" key with a

list giving the asset and other descriptors for the font. For

example:

fonts:
- family: Ubuntu
fonts:
- asset: fonts/Ubuntu.ttf
# - asset: fonts/Ubuntu-RI.ttf
# style: italic
# - asset: fonts/Ubuntu-M.ttf
# weight: 700

fonts:

- family: Schyler

fonts:

- asset: fonts/Schyler-Regular.ttf

- asset: fonts/Schyler-Italic.ttf

style: italic

- family: Trajan Pro

fonts:

- asset: fonts/TrajanPro.ttf

- asset: fonts/TrajanPro_Bold.ttf

weight: 700

For details regarding fonts from package dependencies,

see https://flutter.dev/custom-fonts/#from-packages

flutter pub run flutter_launcher_icons:main

flutter_launcher_icons:
android: true
ios: true
remove_alpha_ios: true
image_path: assets/images/icon.png
image_path_android: assets/images/icon.png
image_path_ios: assets/images/icon.png
adaptive_icon_background: "#ffffff"
adaptive_icon_foreground: assets/images/icon.png
adaptive_icon_monochrome: assets/images/icon.png
macos:
generate: true
image_path: assets/images/icon.png
windows:
generate: true
image_path: assets/images/icon.png
icon_size: 256 # min:48, max:256, default: 48


File: ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json

{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "[email protected]",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}


File: ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md

Launch Screen Assets

You can customize the launch screen with your own desired assets by replacing the image files in this directory.

You can also do it by opening your Flutter project's Xcode project with open ios/Runner.xcworkspace, selecting Runner/Assets.xcassets in the Project Navigator and dropping in the desired images.


File: ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json

{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}


File: linux/CMakeLists.txt

Project-level configuration.

cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)

The name of the executable created for the application. Change this to change

the on-disk name of your application.

set(BINARY_NAME "xs")

The unique GTK application identifier for this application. See:

https://wiki.gnome.org/HowDoI/ChooseApplicationID

set(APPLICATION_ID "cx.xs")

Explicitly opt in to modern CMake behaviors to avoid warnings with recent

versions of CMake.

cmake_policy(SET CMP0063 NEW)

Load bundled libraries from the lib/ directory relative to the binary.

set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")

Root filesystem for cross-building.

if(FLUTTER_TARGET_PLATFORM_SYSROOT)
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()

Define build configuration options.

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()

Compilation settings that should be applied to most targets.

Be cautious about adding new options here, as plugins use this function by

default. In most cases, you should add new options to specific targets instead

of modifying this function.

function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$CONFIG:Debug>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$CONFIG:Debug>:NDEBUG>")
endfunction()

Flutter library and tool build rules.

set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})

System-level dependencies.

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)

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

add_dependencies(${BINARY_NAME} flutter_assemble)

Only the install-generated bundle's copy of the executable will launch

correctly, since the resources must in the right relative locations. To avoid

people trying to run the unbundled copy, put it in a subdirectory instead of

the default top-level location.

set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)

Generated plugin build rules, which manage building the plugins and adding

them to the application.

include(flutter/generated_plugins.cmake)

=== Installation ===

By default, "installing" just makes a relocatable bundle in the build

directory.

set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()

Start with a clean build bundle directory every time.

install(CODE "
file(REMOVE_RECURSE "${BUILD_BUNDLE_DIR}/")
" COMPONENT Runtime)

set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")

install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)

install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endforeach(bundled_library)

Copy the native assets provided by the build.dart from all packages.

set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

Fully re-copy the assets directory on each build to avoid having stale files

from a previous install.

set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE "${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)

Install the AOT library on non-Debug builds only.

if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()


File: linux/flutter/CMakeLists.txt

This file controls Flutter-level build steps. It should not be edited.

cmake_minimum_required(VERSION 3.10)

set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")

Configuration provided via flutter tool.

include(${EPHEMERAL_DIR}/generated_config.cmake)

TODO: Move the rest of this into files in ephemeral. See

https://github.com/flutter/flutter/issues/57146.

Serves the same purpose as list(TRANSFORM ... PREPEND ...),

which isn't available in 3.10.

function(list_prepend LIST_NAME PREFIX)
set(NEW_LIST "")
foreach(element ${${LIST_NAME}})
list(APPEND NEW_LIST "${PREFIX}${element}")
endforeach(element)
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
endfunction()

=== Flutter Library ===

System-level dependencies.

find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)

set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")

Published to parent scope for install step.

set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)

list(APPEND FLUTTER_LIBRARY_HEADERS
"fl_basic_message_channel.h"
"fl_binary_codec.h"
"fl_binary_messenger.h"
"fl_dart_project.h"
"fl_engine.h"
"fl_json_message_codec.h"
"fl_json_method_codec.h"
"fl_message_codec.h"
"fl_method_call.h"
"fl_method_channel.h"
"fl_method_codec.h"
"fl_method_response.h"
"fl_plugin_registrar.h"
"fl_plugin_registry.h"
"fl_standard_message_codec.h"
"fl_standard_method_codec.h"
"fl_string_codec.h"
"fl_value.h"
"fl_view.h"
"flutter_linux.h"
)
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
target_link_libraries(flutter INTERFACE
PkgConfig::GTK
PkgConfig::GLIB
PkgConfig::GIO
)
add_dependencies(flutter flutter_assemble)

=== Flutter tool backend ===

_phony_ is a non-existent file to force this command to run every time,

since currently there's no way to get a full input/output list from the

flutter tool.

add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/phony
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
)


File: linux/packaging/deb/make_config.yaml

display_name: 像宿
package_name: xs
maintainer:
name: Sle2p
email: [email protected]
priority: optional
section: x11
installed_size: 24400
essential: false
icon: assets/images/icon.png

keywords:

  • xs

generic_name: xs

categories:

  • Media

startup_notify: true


File: macos/packaging/dmg/make_config.yaml

title: 像宿
contents:

  • x: 448
    y: 344
    type: link
    path: "/Applications"
  • x: 192
    y: 344
    type: file
    path: xs.app

File: macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json

{
"info": {
"version": 1,
"author": "xcode"
},
"images": [
{
"size": "16x16",
"idiom": "mac",
"filename": "app_icon_16.png",
"scale": "1x"
},
{
"size": "16x16",
"idiom": "mac",
"filename": "app_icon_32.png",
"scale": "2x"
},
{
"size": "32x32",
"idiom": "mac",
"filename": "app_icon_32.png",
"scale": "1x"
},
{
"size": "32x32",
"idiom": "mac",
"filename": "app_icon_64.png",
"scale": "2x"
},
{
"size": "128x128",
"idiom": "mac",
"filename": "app_icon_128.png",
"scale": "1x"
},
{
"size": "128x128",
"idiom": "mac",
"filename": "app_icon_256.png",
"scale": "2x"
},
{
"size": "256x256",
"idiom": "mac",
"filename": "app_icon_256.png",
"scale": "1x"
},
{
"size": "256x256",
"idiom": "mac",
"filename": "app_icon_512.png",
"scale": "2x"
},
{
"size": "512x512",
"idiom": "mac",
"filename": "app_icon_512.png",
"scale": "1x"
},
{
"size": "512x512",
"idiom": "mac",
"filename": "app_icon_1024.png",
"scale": "2x"
}
]
}


File: web/manifest.json

{
"name": "xs",
"short_name": "xs",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "icons/Icon-maskable-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "icons/Icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}


File: windows/CMakeLists.txt

Project-level configuration.

cmake_minimum_required(VERSION 3.14)
project(xs LANGUAGES CXX)

The name of the executable created for the application. Change this to change

the on-disk name of your application.

set(BINARY_NAME "xs")

Explicitly opt in to modern CMake behaviors to avoid warnings with recent

versions of CMake.

cmake_policy(VERSION 3.14...3.25)

Define build configuration option.

get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTICONFIG)
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
CACHE STRING "" FORCE)
else()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
endif()

Define settings for the Profile build mode.

set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")

Use Unicode for all projects.

add_definitions(-DUNICODE -D_UNICODE)

Compilation settings that should be applied to most targets.

Be cautious about adding new options here, as plugins use this function by

default. In most cases, you should add new options to specific targets instead

of modifying this function.

function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$CONFIG:Debug:_DEBUG>")
endfunction()

Flutter library and tool build rules.

set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})

Application build; see runner/CMakeLists.txt.

add_subdirectory("runner")

Generated plugin build rules, which manage building the plugins and adding

them to the application.

include(flutter/generated_plugins.cmake)

=== Installation ===

Support files are copied into place next to the executable, so that it can

run in place. This is done instead of making a separate bundle (as on Linux)

so that building and running from within Visual Studio will work.

set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")

Make the "install" step default, as it's required to run.

set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()

set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")

install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)

install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

if(PLUGIN_BUNDLED_LIBRARIES)
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()

Copy the native assets provided by the build.dart from all packages.

set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

Fully re-copy the assets directory on each build to avoid having stale files

from a previous install.

set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE "${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)

Install the AOT library on non-Debug builds only.

install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
CONFIGURATIONS Profile;Release
COMPONENT Runtime)


File: windows/flutter/CMakeLists.txt

This file controls Flutter-level build steps. It should not be edited.

cmake_minimum_required(VERSION 3.14)

set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")

Configuration provided via flutter tool.

include(${EPHEMERAL_DIR}/generated_config.cmake)

TODO: Move the rest of this into files in ephemeral. See

https://github.com/flutter/flutter/issues/57146.

set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

Set fallback configurations for older versions of the flutter tool.

if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

=== Flutter Library ===

set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Published to parent scope for install step.

set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)

list(APPEND FLUTTER_LIBRARY_HEADERS
"flutter_export.h"
"flutter_windows.h"
"flutter_messenger.h"
"flutter_plugin_registrar.h"
"flutter_texture_registrar.h"
)
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
add_dependencies(flutter flutter_assemble)

=== Wrapper ===

list(APPEND CPP_WRAPPER_SOURCES_CORE
"core_implementations.cc"
"standard_codec.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
"plugin_registrar.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_APP
"flutter_engine.cc"
"flutter_view_controller.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")

Wrapper sources needed for a plugin.

add_library(flutter_wrapper_plugin STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
)
apply_standard_settings(flutter_wrapper_plugin)
set_target_properties(flutter_wrapper_plugin PROPERTIES
POSITION_INDEPENDENT_CODE ON)
set_target_properties(flutter_wrapper_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
target_include_directories(flutter_wrapper_plugin PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_plugin flutter_assemble)

Wrapper sources needed for the runner.

add_library(flutter_wrapper_app STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_APP}
)
apply_standard_settings(flutter_wrapper_app)
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
target_include_directories(flutter_wrapper_app PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_app flutter_assemble)

=== Flutter tool backend ===

_phony_ is a non-existent file to force this command to run every time,

since currently there's no way to get a full input/output list from the

flutter tool.

set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/phony")
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
${PHONY_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
${FLUTTER_TARGET_PLATFORM} $
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
)


File: windows/packaging/msix/make_config.yaml

display_name: 像宿
publisher_display_name: Sle2p
identity_name: cx.xs
logo_path: assets/images/icon.png
capabilities: internetClient
languages: zh-cn
install_certificate: "false"


File: windows/runner/CMakeLists.txt

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"
"utils.cpp"
"win32_window.cpp"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
"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})

Add preprocessor definitions for the build version.

target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION="${FLUTTER_VERSION}"")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")

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_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
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)