### Configuring Installation Paths and Defaults Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/windows/CMakeLists.txt This snippet defines the installation directories for the application bundle, data, and libraries. It also configures Visual Studio to automatically include the install step during the default build process and sets the installation prefix to the build bundle directory if it's at its default value, streamlining the deployment process. ```CMake set(BUILD_BUNDLE_DIR "$") 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}") ``` -------------------------------- ### Installing Application Executable and Core Flutter Files (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/windows/CMakeLists.txt This snippet defines installation rules for the main application executable (`BINARY_NAME`), the Flutter ICU data file, and the core Flutter library. It also conditionally installs any plugin-bundled libraries, placing all these runtime components into their respective installation directories. ```CMake 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 () ``` -------------------------------- ### Configuring Installation Directories (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/windows/CMakeLists.txt This snippet sets up installation paths. `BUILD_BUNDLE_DIR` points to the executable's output directory. It forces the 'install' step to be part of the default build in Visual Studio and sets `CMAKE_INSTALL_PREFIX` to the build bundle directory if not already defined. Finally, it defines `INSTALL_BUNDLE_DATA_DIR` and `INSTALL_BUNDLE_LIB_DIR` relative to the install prefix. ```CMake set(BUILD_BUNDLE_DIR "$") # 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}") ``` -------------------------------- ### Configuring Installation Paths and Defaults (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/pasteboard/example/windows/CMakeLists.txt This snippet configures the installation process, setting the `BUILD_BUNDLE_DIR` to the executable's directory for in-place execution. It makes the 'install' step default for Visual Studio builds and defines installation directories for data and libraries relative to the install prefix. ```CMake set(BUILD_BUNDLE_DIR "$") 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}") ``` -------------------------------- ### Installing Application Executable and Core Flutter Files Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/windows/CMakeLists.txt This section defines the installation rules for the main application executable, Flutter's ICU data file, and the core Flutter library. It ensures these critical components are placed in their designated installation directories, making the application runnable. It also conditionally installs any additional plugin-bundled libraries. ```CMake 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() ``` -------------------------------- ### Configuring Installation Paths for Flutter Desktop Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/windows/CMakeLists.txt This snippet defines the base directory for the build bundle and sets the default installation prefix to this bundle directory, which is crucial for running the application directly from the build output. It also defines specific subdirectories for data and library files within the installation prefix. ```CMake set(BUILD_BUNDLE_DIR "$") # 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}") ``` -------------------------------- ### Installing Application Executable and Libraries Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/windows/CMakeLists.txt This snippet defines installation rules for the application. It installs the main executable (`BINARY_NAME`), Flutter's ICU data file, the Flutter library, and any bundled plugin libraries to their respective destination directories, all as part of the 'Runtime' component. ```CMake 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() ``` -------------------------------- ### Configuring Installation Directories Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/windows/CMakeLists.txt This section defines the installation paths for the built application. It sets the `BUILD_BUNDLE_DIR` to the target file directory, ensures Visual Studio includes install to default build, and defines `CMAKE_INSTALL_PREFIX`, `INSTALL_BUNDLE_DATA_DIR`, and `INSTALL_BUNDLE_LIB_DIR` for organized deployment. ```CMake set(BUILD_BUNDLE_DIR "$") 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}") ``` -------------------------------- ### Installing Flutter Assets and AOT Library Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/windows/CMakeLists.txt This snippet manages the installation of Flutter assets by first removing any existing assets to prevent stale files, then copying the fresh asset directory. Additionally, it conditionally installs the AOT (Ahead-of-Time) library for 'Profile' and 'Release' builds, optimizing performance for production deployments. ```CMake 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) ``` -------------------------------- ### Installing Flutter Desktop Application and Runtime Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/windows/CMakeLists.txt This code block handles the installation of the main application executable, Flutter's ICU data file, and the core Flutter library. These components are installed into their designated bundle directories, ensuring all necessary runtime dependencies are present for the application to function. ```CMake 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) ``` -------------------------------- ### Installing and Refreshing Flutter Assets (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/windows/CMakeLists.txt This snippet handles the installation of Flutter assets. It first defines the asset directory name. Then, it uses an `install(CODE)` block to ensure that the existing asset directory is recursively removed before the new assets are copied from the build directory, preventing stale files. ```CMake 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) ``` -------------------------------- ### Installing Flutter Assets and AOT Library Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/windows/CMakeLists.txt This snippet manages the installation of Flutter assets and the AOT (Ahead-of-Time) compiled library. It ensures that the `flutter_assets` directory is always up-to-date by first removing existing assets before copying new ones. The AOT library is installed only for 'Profile' and 'Release' builds, optimizing the deployed application. ```CMake 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(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing and Updating Flutter Assets Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/windows/CMakeLists.txt This section handles the installation of Flutter assets. It first defines the asset directory name, then uses an `install(CODE)` block to ensure old assets are removed before copying the new assets directory from the build location to the installation data directory. ```CMake 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) ``` -------------------------------- ### Installing Flutter Assets and AOT Library (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/pasteboard/example/windows/CMakeLists.txt This snippet handles the installation of Flutter assets by first removing any existing asset directory to prevent stale files, then copying the new assets. It also conditionally installs the Ahead-Of-Time (AOT) compiled library for 'Profile' and 'Release' builds, optimizing performance for production. ```CMake 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(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Executable, Flutter Libraries, and Plugin Dependencies (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/pasteboard/example/windows/CMakeLists.txt This section uses CMake's `install` command to place the compiled executable, Flutter's ICU data file, and the main Flutter library into their respective installation directories. It also conditionally installs any bundled plugin libraries, ensuring all runtime dependencies are available. ```CMake 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() ``` -------------------------------- ### Installing Application Executable Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/pasteboard/example/linux/CMakeLists.txt This `install` command installs the main application executable, specified by `${BINARY_NAME}`, to the `CMAKE_INSTALL_PREFIX`. The `RUNTIME` keyword ensures that the executable is installed as a runtime component, making it part of the final application bundle. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing AOT Library for Profile and Release Builds Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/windows/CMakeLists.txt This snippet installs the Ahead-Of-Time (AOT) compiled library. It specifies that the AOT library should only be installed for 'Profile' and 'Release' build configurations, placing it in the bundle's data directory as a 'Runtime' component. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Plugin Bundled Libraries Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/windows/CMakeLists.txt This conditional block installs any libraries bundled by Flutter plugins into the application's library directory. This ensures that all plugin-specific shared libraries are correctly deployed alongside the main application, making them available at runtime. ```CMake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Initializing CMake Project for Flutter Desktop Example Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/windows/CMakeLists.txt This snippet sets the minimum required CMake version, defines the project name and supported languages, and sets the binary name. It also applies a specific CMake policy and configures the runtime path for installed libraries. ```CMake cmake_minimum_required(VERSION 3.15) project(desktop_drop_example LANGUAGES CXX) set(BINARY_NAME "desktop_drop_example") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Initializing CMake Project and Binary Name Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/windows/CMakeLists.txt This snippet sets the minimum required CMake version, defines the project name and supported languages, and specifies the output binary name. It also configures a CMake policy for modern behavior and sets the runtime path for installed libraries. ```CMake cmake_minimum_required(VERSION 3.14) project(desktop_multi_window_example LANGUAGES CXX) set(BINARY_NAME "desktop_multi_window_example") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Configuring Installation Directory Paths Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/windows/CMakeLists.txt This snippet sets up the installation directories for the application. It defines the build bundle directory based on the binary's location, makes the install step default for Visual Studio, and sets the installation prefix, data, and library directories. ```CMake set(BUILD_BUNDLE_DIR "$") # 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}") ``` -------------------------------- ### Installing Application Executable and Libraries (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_keep_screen_on/example/windows/CMakeLists.txt This snippet defines installation rules for the core application components. It installs the main executable (BINARY_NAME) to the installation prefix, the Flutter ICU data file to the data directory, and the Flutter library to the library directory. Additionally, if PLUGIN_BUNDLED_LIBRARIES are defined, it installs them to the library directory, all as part of the 'Runtime' component. ```CMake 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() ``` -------------------------------- ### Installing AOT Library for Profile and Release Builds (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/windows/CMakeLists.txt This snippet installs the Ahead-Of-Time (AOT) compiled Flutter library. This installation is conditional, occurring only for 'Profile' and 'Release' build configurations, as AOT compilation is typically used for optimized production builds, not for 'Debug' mode. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/windows/CMakeLists.txt This command installs the main application executable (BINARY_NAME) to the specified installation prefix. It's designated as a 'RUNTIME' component, ensuring it's placed in the appropriate location for execution. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Main Application Binary Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/fts5_simple/example/windows/CMakeLists.txt This command installs the main executable binary of the application to the specified installation prefix, categorizing it as a 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable and Flutter Libraries (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/win_toast/example/windows/CMakeLists.txt This snippet defines installation rules for the application. It installs the main executable (`BINARY_NAME`) to `CMAKE_INSTALL_PREFIX`, and Flutter's ICU data file and core library to their respective bundle directories. It also conditionally installs any `PLUGIN_BUNDLED_LIBRARIES`. ```CMake 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() ``` -------------------------------- ### Installing Application Executable and Core Libraries Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/linux/CMakeLists.txt This snippet defines installation rules for the application's runtime components. It installs the main executable (`BINARY_NAME`), Flutter's ICU data file, and the core Flutter library into their respective bundle destinations. It also conditionally installs any plugin-bundled libraries, ensuring all necessary runtime dependencies are included in the final application bundle. ```CMake 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() ``` -------------------------------- ### Configuring Flutter Application Installation Bundle Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/bring_window_to_front/example/linux/CMakeLists.txt This snippet configures the installation process for the Flutter application bundle. It defines the `BUILD_BUNDLE_DIR` and sets `CMAKE_INSTALL_PREFIX` to this directory if not already initialized. It also includes a custom install rule to clean the bundle directory before installation and defines paths for data and library directories within the bundle. ```CMake 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() 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") ``` -------------------------------- ### Installing WebKitGTK Dependencies on Fedora/RPM (Shell) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/README.md This shell command provides the necessary `dnf` installation instructions for Fedora and RPM-based Linux distributions. It installs `webkit2gtk4.1`, `webkit2gtk4.1-devel`, `libsoup3`, and `libsoup3-devel`, which are essential runtime and development libraries for WebKitGTK, the backend for webviews on Linux. ```Shell sudo dnf install webkit2gtk4.1 webkit2gtk4.1-devel libsoup3 libsoup3-devel ``` -------------------------------- ### Installing Application Executable to Bundle Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/linux/CMakeLists.txt This command installs the compiled application executable (`BINARY_NAME`) to the root of the installation prefix, marking it as a runtime component of the bundle. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing WebKitGTK Dependencies on Ubuntu/Debian (Shell) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/README.md This shell command provides the necessary `apt-get` installation instructions for Ubuntu and Debian-based Linux distributions. It installs `libwebkit2gtk-4.1-0`, `libwebkit2gtk-4.1-dev`, `libsoup-3.0-0`, and `libsoup-3.0-dev`, which are essential runtime and development libraries for WebKitGTK, the backend for webviews on Linux. ```Shell sudo apt-get install libwebkit2gtk-4.1-0 libwebkit2gtk-4.1-dev libsoup-3.0-0 libsoup-3.0-dev ``` -------------------------------- ### Configuring Installation Directories and Defaults Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/fts5_simple/example/windows/CMakeLists.txt This section defines the installation directories for the build bundle, sets the default install prefix to the build bundle directory for Visual Studio, and initializes variables for data and library installation paths within the bundle. ```CMake set(BUILD_BUNDLE_DIR "$") # 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}") ``` -------------------------------- ### Installing Flutter Application and Dependencies Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/bring_window_to_front/example/linux/CMakeLists.txt This snippet defines the installation rules for the Flutter application. It installs the main executable, Flutter's ICU data file, the Flutter library, and all bundled plugin libraries into their respective destinations within the installation prefix, ensuring all necessary components are included in the final relocatable bundle. ```CMake 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) ``` -------------------------------- ### Initializing CMake Project for Ogg Opus Player Example Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/windows/CMakeLists.txt This snippet sets the minimum required CMake version to 3.14 and defines the project name as 'ogg_opus_player_example', specifying CXX as the required language. This is the foundational setup for the CMake build system. ```CMake cmake_minimum_required(VERSION 3.14) project(ogg_opus_player_example LANGUAGES CXX) ``` -------------------------------- ### Configuring Installation Bundle Directory - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/linux/CMakeLists.txt This snippet sets up the default installation prefix to create a relocatable bundle within the build directory. It also includes an `install(CODE)` command to ensure the bundle directory is cleaned before each installation, preventing stale files. ```CMake 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 "\n file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")\n " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Installing Application Executable to Bundle Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/linux/CMakeLists.txt This command installs the compiled application executable (BINARY_NAME) into the root of the installation bundle, marked as a Runtime component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Installation Bundle Directory (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/breakpad_client/example/linux/CMakeLists.txt This `install(CODE)` command adds a custom step to the installation process that recursively removes the contents of the `BUILD_BUNDLE_DIR` before a new installation, ensuring a clean and up-to-date application bundle. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Cleaning Previous Installation Bundle Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/linux/CMakeLists.txt This install(CODE) command ensures that the target installation bundle directory is recursively removed before a new installation, preventing stale files from previous builds. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/windows/CMakeLists.txt Installs the main application executable (defined by BINARY_NAME) to the CMAKE_INSTALL_PREFIX as a Runtime component. This ensures the compiled application is placed in the designated installation directory. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable to Bundle Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/linux/CMakeLists.txt This install command installs the main application executable (BINARY_NAME) to the CMAKE_INSTALL_PREFIX (which is the bundle directory). It's marked as a RUNTIME component, meaning it's part of the application's runtime dependencies. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Configuring Installation Paths and Default Install (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/win_toast/example/windows/CMakeLists.txt This section defines installation directories. `BUILD_BUNDLE_DIR` is set to the executable's directory, `CMAKE_INSTALL_PREFIX` is configured to this bundle directory, and `INSTALL_BUNDLE_DATA_DIR` and `INSTALL_BUNDLE_LIB_DIR` are derived from it. It also makes the 'install' step default for Visual Studio builds. ```CMake set(BUILD_BUNDLE_DIR "$") # 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}") ``` -------------------------------- ### Setting CMake Policy and Install RPATH (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/windows/CMakeLists.txt This snippet sets CMake policy `CMP0063` to `NEW` behavior, which affects how target properties are handled. It also configures `CMAKE_INSTALL_RPATH` to `$ORIGIN/lib`, ensuring that the executable can find its shared libraries relative to its own location at runtime. ```CMake cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Configuring Installation Paths in CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/breakpad_client/example/windows/CMakeLists.txt This snippet sets up variables for the installation process. It defines the build bundle directory, forces Visual Studio to include the install step by default, and sets the CMAKE_INSTALL_PREFIX to the build bundle directory if it's not already initialized. It also defines subdirectories for data and libraries within the install prefix. ```CMake set(BUILD_BUNDLE_DIR "$") 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}") ``` -------------------------------- ### Installing Flutter Application Assets Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/linux/CMakeLists.txt This section handles the installation of Flutter application assets. It defines the asset directory name and uses an `install(CODE)` command to remove any existing asset directory in the bundle, ensuring a clean copy. It then installs the entire `flutter_assets` directory from the build output into the bundle's data directory, making sure all UI resources are available. ```CMake 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) ``` -------------------------------- ### Installing Core Application Components - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/linux/CMakeLists.txt This snippet defines installation rules for the main executable, Flutter's ICU data file, and the Flutter library itself. It also conditionally installs any additional bundled plugin libraries, ensuring all necessary runtime components are placed in the correct bundle directories. ```CMake 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() ``` -------------------------------- ### Configuring Installation Directories (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_keep_screen_on/example/windows/CMakeLists.txt This section defines the installation paths for the application. It sets BUILD_BUNDLE_DIR to the directory of the executable, forces Visual Studio to include the install step by default, and if CMAKE_INSTALL_PREFIX is at its default, it sets it to BUILD_BUNDLE_DIR. It also defines INSTALL_BUNDLE_DATA_DIR and INSTALL_BUNDLE_LIB_DIR relative to the install prefix. ```CMake set(BUILD_BUNDLE_DIR "$") 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}") ``` -------------------------------- ### Installing Application Executable (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/breakpad_client/example/linux/CMakeLists.txt This command installs the main application executable (`BINARY_NAME`) to the `CMAKE_INSTALL_PREFIX` as part of the 'Runtime' component, making it available in the final relocatable bundle. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Configuring Application Bundle Installation (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/linux/CMakeLists.txt This snippet defines the installation process for creating a relocatable application bundle. It sets the `CMAKE_INSTALL_PREFIX` to a 'bundle' directory within the build output, ensures a clean bundle directory on each build, and then installs the main executable, Flutter ICU data, Flutter library, and any plugin-bundled libraries into their respective destinations within the bundle structure. ```CMake 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() install(CODE "\n file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")\n " 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) ``` -------------------------------- ### Cleaning Installation Bundle Directory Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/linux/CMakeLists.txt This `install(CODE)` command ensures that the build bundle directory is recursively removed before each installation, preventing stale files from previous builds and ensuring a clean bundle. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Engine Library (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_keep_screen_on/example/linux/CMakeLists.txt This command installs the main Flutter engine library into the `INSTALL_BUNDLE_LIB_DIR`. This library contains the core Flutter runtime and rendering components required for the application to function. ```CMake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable and Core Libraries in CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/breakpad_client/example/windows/CMakeLists.txt This section defines installation rules for the application's runtime components. It installs the main executable, Flutter's ICU data file, and the Flutter library to their respective bundle directories. It also conditionally installs any bundled plugin libraries if they exist. ```CMake 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() ``` -------------------------------- ### Installing Flutter Application Assets Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/pasteboard/example/linux/CMakeLists.txt This snippet defines the name for the Flutter assets directory. It then uses an `install(CODE)` command to first remove any existing assets directory to ensure a clean copy, followed by an `install(DIRECTORY)` command to copy the entire `flutter_assets` directory from the build directory into the `data` directory of the bundle. ```CMake 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) ``` -------------------------------- ### Installing Flutter Assets - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/linux/CMakeLists.txt This snippet manages the installation of Flutter application assets. It first removes any existing asset directory to prevent stale files, then copies the entire `flutter_assets` directory from the build output to the installation bundle's data directory, ensuring assets are always up-to-date. ```CMake # 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 "\n file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")\n " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Library - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/windows/CMakeLists.txt Installs the main Flutter library (FLUTTER_LIBRARY) to the INSTALL_BUNDLE_LIB_DIR as a Runtime component. This ensures the core Flutter runtime library is available alongside the application. ```CMake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing AOT Library for Release/Profile Builds Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/windows/CMakeLists.txt This command installs the Ahead-Of-Time (AOT) compiled library, which contains optimized application code. This installation is conditional, occurring only for 'Profile' and 'Release' build configurations, and the library is placed in the application's data directory. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Assets and AOT Library (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/win_toast/example/windows/CMakeLists.txt This section handles the installation of Flutter assets and the AOT library. It first defines the asset directory name, then uses an `install(CODE)` block to ensure old assets are removed before copying the new `flutter_assets` directory. Finally, it installs the AOT library only for 'Profile' and 'Release' configurations. ```CMake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE "\n file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")\n " 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) ``` -------------------------------- ### Installing AOT Library for Profile/Release Builds - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library (AOT_LIBRARY) to INSTALL_BUNDLE_DATA_DIR as a Runtime component. This installation is specifically configured to occur only for "Profile" and "Release" build configurations, optimizing deployment for production-ready builds. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Building Application Executable - CMake Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/linux/CMakeLists.txt This comprehensive snippet defines and builds the main application executable, `webview_window_example`, from its source files. It applies standard compilation settings, links against Flutter and GTK libraries, and sets a custom output directory to prevent accidental execution of the unbundled binary. ```CMake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 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" ) ``` -------------------------------- ### Installing Application Executable (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_keep_screen_on/example/linux/CMakeLists.txt This command installs the compiled application executable (`BINARY_NAME`) into the `CMAKE_INSTALL_PREFIX` directory. It's marked as a `RUNTIME` component, indicating it's part of the application's runtime files. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing All Bundled Plugin Libraries Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/linux/CMakeLists.txt This foreach loop iterates through PLUGIN_BUNDLED_LIBRARIES and installs each library file to the INSTALL_BUNDLE_LIB_DIR within the application bundle. This ensures all necessary plugin dependencies are included in the final package. ```CMake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Installing AOT Library for Profile and Release Builds Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/fts5_simple/example/windows/CMakeLists.txt This command installs the Ahead-Of-Time (AOT) compiled library to the data bundle directory. This installation is conditional, occurring only for 'Profile' and 'Release' build configurations, optimizing the deployed application. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Configuring Installation Bundle Directory Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_drop/example/linux/CMakeLists.txt This section defines the `BUILD_BUNDLE_DIR` for the relocatable application bundle. It sets `CMAKE_INSTALL_PREFIX` to this bundle directory if it's at its default value. It also includes an `install(CODE)` command to ensure the bundle directory is cleaned before each installation, and defines paths for data and library directories within the bundle. ```CMake 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() 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") ``` -------------------------------- ### Installing Flutter Assets Directory (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/ogg_opus_player/example/linux/CMakeLists.txt This command installs the `flutter_assets` directory from the project's build output to the specified installation bundle's data directory. It ensures that all necessary Flutter assets are included in the final application bundle, making them available at runtime. This operation is also part of the `Runtime` component. ```CMake install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Defining Bundle Data and Library Directories Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_multi_window/example/linux/CMakeLists.txt These lines define variables for the data and library subdirectories within the installation bundle, standardizing paths for subsequent installation commands. ```CMake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Installing Flutter Engine Library Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/linux/CMakeLists.txt This install command copies the main FLUTTER_LIBRARY (the Flutter engine shared library) to the INSTALL_BUNDLE_LIB_DIR within the application bundle. This library is fundamental for the Flutter application to run. ```CMake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Bundled Plugin Libraries (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_keep_screen_on/example/linux/CMakeLists.txt This `foreach` loop iterates through a list of `PLUGIN_BUNDLED_LIBRARIES` and installs each one into the `INSTALL_BUNDLE_LIB_DIR`. This ensures that all necessary plugin-specific shared libraries are included in the final application bundle. ```CMake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Defining Bundle Data and Library Installation Paths Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/mixin_logger/example/linux/CMakeLists.txt This snippet defines variables for the data and library subdirectories within the installation bundle. INSTALL_BUNDLE_DATA_DIR points to 'data' and INSTALL_BUNDLE_LIB_DIR points to 'lib' relative to the CMAKE_INSTALL_PREFIX. ```CMake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Installing Native Assets (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/breakpad_client/example/linux/CMakeLists.txt This snippet defines the source directory for native assets generated by the `build.dart` script and then installs these assets into the `lib` directory of the application bundle, making them available at runtime. ```CMake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Initializing CMake Project and Setting Binary Name (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_webview_window/example/windows/CMakeLists.txt This snippet sets the minimum required CMake version, defines the project name 'webview_window_example' with CXX language support, and assigns the project name to the `BINARY_NAME` variable for consistent referencing throughout the build. ```CMake cmake_minimum_required(VERSION 3.14) project(webview_window_example LANGUAGES CXX) set(BINARY_NAME "webview_window_example") ``` -------------------------------- ### Configuring Installation Bundle Directory Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/linux/CMakeLists.txt This snippet defines the default build bundle directory and conditionally sets CMAKE_INSTALL_PREFIX to this bundle directory if it hasn't been initialized, ensuring that make install creates a relocatable application bundle. ```CMake 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() ``` -------------------------------- ### Initializing CMake Project for Flutter Desktop (C++) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_lifecycle/example/windows/CMakeLists.txt This snippet sets the minimum required CMake version, defines the project name 'desktop_lifecycle_example' with C++ language support, and specifies the output binary name. It also applies a modern CMake policy for improved behavior. ```CMake cmake_minimum_required(VERSION 3.14) project(desktop_lifecycle_example LANGUAGES CXX) set(BINARY_NAME "desktop_lifecycle_example") cmake_policy(SET CMP0063 NEW) ``` -------------------------------- ### Cleaning Build Bundle Directory on Install (CMake) Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/desktop_keep_screen_on/example/linux/CMakeLists.txt This `install(CODE)` command executes a CMake code block during the installation process. It ensures that the build bundle directory is completely removed before new files are installed, providing a clean installation. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Defining Bundle Data and Library Installation Paths Source: https://github.com/mixinnetwork/flutter-plugins/blob/main/packages/fts5_simple/example/linux/CMakeLists.txt These lines define the specific subdirectories within the installation prefix where application data and libraries will be placed. INSTALL_BUNDLE_DATA_DIR is for assets and other data, while INSTALL_BUNDLE_LIB_DIR is for shared libraries. ```CMake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ```