### Installing Application Executable - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Defines an installation rule to copy the main application executable (`${BINARY_NAME}`) to the specified installation prefix directory (`${CMAKE_INSTALL_PREFIX}`). ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Engine Library - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Installs the main Flutter engine library file (`${FLUTTER_LIBRARY}`) into the application's library/bundle directory (`${INSTALL_BUNDLE_LIB_DIR}`). ```CMake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Setting Up Installation Bundle Directory and Initial Clean - CMake Source: https://github.com/flutter/codelabs/blob/main/animated-responsive-layout/step_03/linux/CMakeLists.txt Defines the build directory for the application bundle and sets the installation prefix to this directory by default. It also includes an `install(CODE)` command to remove the bundle directory before starting the installation, ensuring a clean copy. ```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 " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Configuring Installation Bundle Paths - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Sets variables (`BUILD_BUNDLE_DIR`, `CMAKE_INSTALL_PREFIX`, `INSTALL_BUNDLE_DATA_DIR`, `INSTALL_BUNDLE_LIB_DIR`) to define where built artifacts and data files should be installed, often targeting the executable's directory for a simple bundle structure. ```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 Assets - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Defines the name for the Flutter assets directory. It first uses `install(CODE)` to remove any existing asset directory at the destination to prevent stale files, then uses `install(DIRECTORY)` to copy the newly built assets into the 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) ``` -------------------------------- ### Configuring Installation Paths and Steps CMake Source: https://github.com/flutter/codelabs/blob/main/animations/step_02_e/windows/CMakeLists.txt Sets up the installation process for the application. It defines installation directories relative to the build output, makes the 'install' step a default part of the build, and specifies various files and directories to be copied to the installation location. ```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 "$") # 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) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/generate_crossword/step_05_a/linux/CMakeLists.txt Defines an installation rule for the application executable, specifying its destination within the installation prefix. It installs the runtime component of the target. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/audio_soloud/step_03/windows/CMakeLists.txt This `install` command specifies that the main application target (`${BINARY_NAME}`) should be installed. It installs the runtime components (the executable) to the directory specified by `CMAKE_INSTALL_PREFIX`, assigning it to the `Runtime` component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installation - Bundle Setup CMake Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_04_e/linux/CMakeLists.txt Sets variables for the build bundle directory and forces the CMake install prefix to this directory if it hasn't been initialized, configuring the default 'install' target to create a relocatable bundle. ```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() ``` -------------------------------- ### Installation Setup and Cleanup CMake Source: https://github.com/flutter/codelabs/blob/main/dart-patterns-and-records/step_07_a/linux/CMakeLists.txt Configures the installation prefix to point to a 'bundle' directory within the build output by default. It includes an installation step to recursively remove the contents of this bundle directory at the start of the install process, ensuring a clean bundle. It also defines variables for standard data and library subdirectories within the bundle. ```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") ``` -------------------------------- ### Installation - Install Binary CMake Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_04_e/linux/CMakeLists.txt Installs the built executable binary (`BINARY_NAME`) to the installation prefix (`CMAKE_INSTALL_PREFIX`) during the 'Runtime' component installation. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install Application Executable Source: https://github.com/flutter/codelabs/blob/main/boring_to_beautiful/step_07/windows/CMakeLists.txt Installs the compiled application executable (`${BINARY_NAME}`) to the specified installation prefix (`${CMAKE_INSTALL_PREFIX}`). This makes the binary available in the designated output directory after the install step. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Basic Project Setup CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_07/example/linux/CMakeLists.txt Sets the minimum required version of CMake and defines the project name and enabled languages. This is the standard starting point for a CMake project. ```CMake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_03/windows/CMakeLists.txt Installs the main application executable (`${BINARY_NAME}`) to the defined installation prefix (`${CMAKE_INSTALL_PREFIX}`). This command makes the executable available in the build output or install directory. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Start Test Setup Conditional Block Source: https://github.com/flutter/codelabs/blob/main/github-client/window_to_front/linux/CMakeLists.txt Begins a conditional block that includes test build configuration only when the `include_${PROJECT_NAME}_tests` variable is true, typically when building the example application. ```CMake if (${include_${PROJECT_NAME}_tests}) if(${CMAKE_VERSION} VERSION_LESS "3.11.0") message("Unit tests require CMake 3.11.0 or later") else() ``` -------------------------------- ### Install Executable Source: https://github.com/flutter/codelabs/blob/main/generate_crossword/step_04/windows/CMakeLists.txt Uses the `install` command to specify that the target executable, defined by `${BINARY_NAME}`, should be copied to the install prefix directory during the installation step. It assigns the component name 'Runtime' to this installation rule. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Navigating to Codelab Step Directory - Console Source: https://github.com/flutter/codelabs/blob/main/firebase-get-to-know-flutter/steps/index.lab.md Changes the current directory to the starting point ('step_02') of the Firebase integration codelab within the cloned 'flutter-codelabs' repository. This command sets the context for opening the project in an IDE and beginning the codelab. ```console cd flutter-codelabs/firebase-get-to-know-flutter/step_02 ``` -------------------------------- ### Cleaning Build Bundle Directory Before Install Source: https://github.com/flutter/codelabs/blob/main/brick_breaker/step_04/linux/CMakeLists.txt Adds an installation step using `install(CODE)` to recursively remove the contents of the build bundle directory before starting the installation process. This ensures a clean state for each bundle creation. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Setting Up Installation Paths Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_01/linux/CMakeLists.txt Defines variables for the build bundle directory and sets the default installation prefix to this directory. This prepares for creating the application bundle during installation. ```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() ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/animations/step_02_d/windows/CMakeLists.txt Installs the main application executable (${BINARY_NAME}) to the defined installation prefix. This command ensures the built executable is placed in the correct location during the install step. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable - CMake Source: https://github.com/flutter/codelabs/blob/main/audio_soloud/step_04b/linux/CMakeLists.txt This `install(TARGETS ...)` command installs the application executable (`${BINARY_NAME}`) to the top level of the installation prefix (`${CMAKE_INSTALL_PREFIX}`). The `RUNTIME` keyword specifies that this is an executable target, and `COMPONENT Runtime` associates it with the 'Runtime' installation component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable with CMake Source: https://github.com/flutter/codelabs/blob/main/adaptive_app/step_06/windows/CMakeLists.txt Uses the `install` command to specify that the main application executable, identified by `BINARY_NAME`, should be installed. It designates the installation destination as the `CMAKE_INSTALL_PREFIX` and assigns it to the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/boring_to_beautiful/step_01/linux/CMakeLists.txt Installs the built application target (`${BINARY_NAME}`) to the installation prefix (`${CMAKE_INSTALL_PREFIX}`). The RUNTIME keyword ensures that the executable is placed correctly according to the platform's conventions (e.g., in the root of the bundle). ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Build Bundle Directory During Install Source: https://github.com/flutter/codelabs/blob/main/boring_to_beautiful/final/linux/CMakeLists.txt Adds a custom installation step using `install(CODE)` to recursively remove the contents of the build bundle directory (`${BUILD_BUNDLE_DIR}`) before starting the installation process. This ensures a clean bundle each time. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable (CMake Install) Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_02_c/linux/CMakeLists.txt Installs the built application executable (`${BINARY_NAME}`) to the root of the installation prefix (`${CMAKE_INSTALL_PREFIX}`). It is marked as a 'Runtime' component for installation. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Target and Files - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_03/example/windows/CMakeLists.txt Installs the main application executable target (`${BINARY_NAME}`) to the installation prefix and installs essential files like the Flutter ICU data file and the main Flutter library to their designated 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) ``` -------------------------------- ### Setting Up Installation Directories CMake Source: https://github.com/flutter/codelabs/blob/main/brick_breaker/step_06/windows/CMakeLists.txt These commands set up variables defining the installation directories. They configure the build bundle directory relative to the executable, make the 'install' step default in Visual Studio, and set the installation prefix for data and library files. ```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}") ``` -------------------------------- ### Clean Build Bundle Directory Source: https://github.com/flutter/codelabs/blob/main/generate_crossword/step_05_c/linux/CMakeLists.txt Adds an installation step that removes the entire build bundle directory before starting the installation process, ensuring a clean bundle on each install run. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Cleaning Build Bundle Directory CMake Source: https://github.com/flutter/codelabs/blob/main/animations/step_04_c/linux/CMakeLists.txt Adds a CMake `install(CODE)` step that removes the contents of the build bundle directory at the start of the installation process. This ensures a clean state for each install. ```CMake # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Setting Up Installation for Bundling Source: https://github.com/flutter/codelabs/blob/main/animations/step_04_a/linux/CMakeLists.txt Configures the installation prefix (`CMAKE_INSTALL_PREFIX`) to point to a 'bundle' directory within the build output directory. This sets up the standard `make install` command to create 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() ``` -------------------------------- ### Setting Up Installation Directories Source: https://github.com/flutter/codelabs/blob/main/animations/step_02_d/windows/CMakeLists.txt Configures variables related to the installation process, defining the target directory for the build bundle (usually next to the executable), making the install step default for Visual Studio, and setting variables for data and library subdirectories within the install location. ```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 "$") # 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}") ``` -------------------------------- ### Cleaning Bundle Directory During Install CMake Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_08/linux/CMakeLists.txt Adds an `install(CODE)` command that uses CMake's `file(REMOVE_RECURSE)` function to delete the contents of the build bundle directory before the installation process starts. This ensures a clean state for the bundle on each install run. ```CMake install(CODE "\n file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")\n " COMPONENT Runtime) ``` -------------------------------- ### Install Application Executable Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_11/windows/CMakeLists.txt Installs the main application executable (specified by `${BINARY_NAME}`) to the defined installation prefix. It is categorized under the 'Runtime' component for installation. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Setting Up Installation Paths and Defaults Source: https://github.com/flutter/codelabs/blob/main/adaptive_app/step_07/windows/CMakeLists.txt Configures installation paths for the built application bundle, sets the 'install' step as the default build step in Visual Studio, and ensures the `CMAKE_INSTALL_PREFIX` variable points to the build bundle directory. ```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() ``` -------------------------------- ### Cleaning Install Bundle Directory Source: https://github.com/flutter/codelabs/blob/main/audio_soloud/step_04a/linux/CMakeLists.txt Adds an installation step using CMake code to recursively remove the contents of the build bundle directory (${BUILD_BUNDLE_DIR}) before starting the installation, ensuring a clean bundle each time. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Defining Installation Directories CMake Source: https://github.com/flutter/codelabs/blob/main/forge2d_game/step_07/windows/CMakeLists.txt Sets variables for installation paths. `BUILD_BUNDLE_DIR` gets the executable's output directory. `CMAKE_INSTALL_PREFIX` is set to this directory, and `INSTALL_BUNDLE_DATA_DIR` and `INSTALL_BUNDLE_LIB_DIR` are defined based on 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}") ``` -------------------------------- ### Configuring Installation Directories and Behavior Source: https://github.com/flutter/codelabs/blob/main/testing_codelab/step_06/windows/CMakeLists.txt This section sets up the installation process, defining where build artifacts will be placed relative to the executable. It configures the build bundle directory, makes the 'install' step default in Visual Studio, sets the installation prefix, and defines the data and library installation subdirectories. ```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 "$") # 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 Source: https://github.com/flutter/codelabs/blob/main/namer/step_06_a_business_logic/linux/CMakeLists.txt Installs the built application executable ('${BINARY_NAME}') to the installation prefix (the bundle directory). The 'RUNTIME' destination type ensures it's installed correctly as an executable. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Previous Bundle Directory Source: https://github.com/flutter/codelabs/blob/main/adaptive_app/step_05/linux/CMakeLists.txt Adds an installation step that uses CMake code to recursively remove the contents of the build bundle directory (`BUILD_BUNDLE_DIR`) before starting the installation process. This ensures a clean bundle on each install. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable CMake Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_05_a/windows/CMakeLists.txt Installs the main application executable (`${BINARY_NAME}`) to the installation prefix (`${CMAKE_INSTALL_PREFIX}`). This makes the compiled application available in the designated output directory as part of the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Binary - CMake Source: https://github.com/flutter/codelabs/blob/main/namer/step_07_d_use_selectedindex/linux/CMakeLists.txt Defines an installation rule for the application binary target (`${BINARY_NAME}`). The `RUNTIME` keyword ensures the executable is installed, and `DESTINATION` places it in the root of the installation prefix (`CMAKE_INSTALL_PREFIX`) as part of the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Installation Bundle Directory - CMake Source: https://github.com/flutter/codelabs/blob/main/tfrs-flutter/step2/frontend/linux/CMakeLists.txt Defines a custom installation step using `install(CODE)` that executes CMake commands to recursively remove the contents of the `BUILD_BUNDLE_DIR`. This action is triggered as part of the 'Runtime' installation component to ensure the bundle directory starts clean before new files are copied. ```CMake # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Configuring Installation Paths and Bundle Setup - CMake Source: https://github.com/flutter/codelabs/blob/main/generate_crossword/step_02/linux/CMakeLists.txt Defines variables for the installation bundle directory and sets the default `CMAKE_INSTALL_PREFIX` to point to this bundle directory. ```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() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Setting Up Installation Directories and Defaults Source: https://github.com/flutter/codelabs/blob/main/animated-responsive-layout/step_04/windows/CMakeLists.txt These lines configure the installation paths and behavior. BUILD_BUNDLE_DIR is set to the executable's output directory, installation is made the default build step for Visual Studio, and INSTALL_BUNDLE_DATA_DIR/INSTALL_BUNDLE_LIB_DIR specify where data and libraries should be installed relative to the 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 Plugin Bundled Libraries - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Conditionally installs plugin-specific libraries (`${PLUGIN_BUNDLED_LIBRARIES}`) into the application's library/bundle directory if the variable is defined. ```CMake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/forge2d_game/step_03/linux/CMakeLists.txt Installs the application binary target (`${BINARY_NAME}`) to the installation prefix (`${CMAKE_INSTALL_PREFIX}`). The `RUNTIME` keyword ensures that the executable is placed in the appropriate location for runtime files. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installation Path Setup - CMake Source: https://github.com/flutter/codelabs/blob/main/dart-patterns-and-records/step_07_a/windows/CMakeLists.txt Defines variables related to the installation process. BUILD_BUNDLE_DIR is set to the directory containing the built executable, CMAKE_INSTALL_PREFIX is forced to this directory, and INSTALL_BUNDLE_DATA_DIR and INSTALL_BUNDLE_LIB_DIR are set for data and library installation paths within the bundle directory. ```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 "$") # 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 Up Installation Bundle Directory - CMake Source: https://github.com/flutter/codelabs/blob/main/dart-patterns-and-records/step_11_a/linux/CMakeLists.txt These commands configure the installation process. They define the directory where the final application bundle will be created and set the default installation prefix (`CMAKE_INSTALL_PREFIX`) to this bundle directory if it hasn't been set already. ```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() ``` -------------------------------- ### Setting Installation Directories and Configuration Source: https://github.com/flutter/codelabs/blob/main/haiku_generator/step1/windows/CMakeLists.txt Defines variables and settings for the installation process. It sets the install prefix to the target file directory, configures Visual Studio to include the install step, and defines subdirectories for data and libraries within 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}") ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/audio_soloud/step_05/linux/CMakeLists.txt Installs the main application executable (${BINARY_NAME}) to the installation prefix. The RUNTIME keyword indicates it's an executable. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Build Bundle Directory - CMake Source: https://github.com/flutter/codelabs/blob/main/animations/step_03_b/linux/CMakeLists.txt Uses an install code block to remove the contents of the bundle directory before starting the installation, ensuring a clean bundle each time. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Executable Target (CMake) Source: https://github.com/flutter/codelabs/blob/main/audio_soloud/step_04a/windows/CMakeLists.txt Defines an installation rule for the main application executable (`BINARY_NAME`). It specifies that the executable should be placed in the installation prefix directory as part of the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing AOT Library - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled Flutter library (`${AOT_LIBRARY}`) into the application's data directory (`${INSTALL_BUNDLE_DATA_DIR}`). This installation is conditional, only occurring for "Profile" and "Release" build configurations. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable - CMake Source: https://github.com/flutter/codelabs/blob/main/dart-patterns-and-records/step_11_a/linux/CMakeLists.txt This command installs the built application executable (`${BINARY_NAME}`) to the installation prefix (`CMAKE_INSTALL_PREFIX`). The `RUNTIME` keyword specifies it's an executable target. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Setting Up Installation Paths and Defaults in CMake Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_02_a/windows/CMakeLists.txt Defines variables used during the installation process, including the destination directory for the build bundle (co-located with the executable) and the installation prefix. It also sets the default build step in Visual Studio to include installation. ```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 "$") # 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}") ``` -------------------------------- ### Configure Installation Prefix and Clean Bundle Directory Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_07/linux/CMakeLists.txt Configures the installation prefix to point to a build bundle directory within the build output. It also includes a code snippet to remove the contents of this bundle directory at the start of the installation process to ensure a clean state. ```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() ``` ```CMake # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/namer/step_05_g_center_vertical/linux/CMakeLists.txt Installs the main application executable target (`${BINARY_NAME}`). The `RUNTIME` keyword specifies that this is an executable, and the `DESTINATION` sets its install location to the installation prefix (`${CMAKE_INSTALL_PREFIX}`). ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Native Assets - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Sets the source directory for native assets provided by `build.dart` scripts and installs these assets into the application's library/bundle directory. ```CMake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Set Up Installation Bundle Directory - CMake Source: https://github.com/flutter/codelabs/blob/main/haiku_generator/step2/linux/CMakeLists.txt Defines the directory where the application bundle will be created (`BUILD_BUNDLE_DIR`). If the CMake install prefix is at its default value, it forces the install prefix to this bundle directory, making 'install' effectively create 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() ``` -------------------------------- ### Installing Flutter ICU Data File - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Installs the Flutter International Components for Unicode (ICU) data file (`${FLUTTER_ICU_DATA_FILE}`) into the application's data directory (`${INSTALL_BUNDLE_DATA_DIR}`). ```CMake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Build Bundle Directory Source: https://github.com/flutter/codelabs/blob/main/testing_codelab/step_07/linux/CMakeLists.txt Installs a CMake code block that removes the contents of the build bundle directory (`BUILD_BUNDLE_DIR`) at the start of the installation process, ensuring a clean bundle every time. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Define Installation Directories Source: https://github.com/flutter/codelabs/blob/main/animated-responsive-layout/step_07/windows/CMakeLists.txt Sets variables for the data and library directories within the installation bundle based on the installation prefix. These variables are used in subsequent install commands. ```CMake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Install Application Executable Source: https://github.com/flutter/codelabs/blob/main/forge2d_game/step_05/linux/CMakeLists.txt Installs the main application executable (`${BINARY_NAME}`) to the root of the installation prefix. This is the primary binary that users will launch. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Cleaning Build Bundle Directory (CMake) Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_04_b/linux/CMakeLists.txt Adds a CMake `install(CODE)` command that removes the entire build bundle directory before starting the installation process. This ensures a clean state and prevents stale files from previous builds. ```CMake # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Cleaning Build Bundle Directory Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_04_a/linux/CMakeLists.txt This adds a custom installation step that executes CMake code. The code uses the `file(REMOVE_RECURSE)` command to delete the entire bundle directory before starting the installation process, ensuring a clean build. ```CMake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Configuring Installation Prefix for Bundling (CMake) Source: https://github.com/flutter/codelabs/blob/main/audio_soloud/step_04a/windows/CMakeLists.txt Sets the installation prefix to the directory containing the built executable, allowing the application and its dependencies to be bundled together for easy deployment. It also makes the 'install' step default in Visual Studio. ```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() ``` -------------------------------- ### Install Application Target and Core Flutter Files Source: https://github.com/flutter/codelabs/blob/main/generate_crossword/step_07/windows/CMakeLists.txt Installs the main application executable binary (`${BINARY_NAME}`) to the installation prefix and installs the Flutter ICU data file (`${FLUTTER_ICU_DATA_FILE}`) and the main Flutter library (`${FLUTTER_LIBRARY}`) to their designated bundle directories. These are essential runtime components. ```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) ``` -------------------------------- ### Start TF Serving Docker Container - Bash Source: https://github.com/flutter/codelabs/blob/main/tfserving-flutter/codelab2/finished/README.md Starts a TensorFlow Serving Docker container for the spam detection model. It maps ports 8500 (REST) and 8501 (gRPC) to the host and mounts the specified local path containing the SavedModel, setting the model name. ```bash docker run -t --rm -p 8500:8500 -p 8501:8501 -v "PATH/TO/SAVEDMODEL:/models/spam-detection" -e MODEL_NAME=spam-detection tensorflow/serving ``` -------------------------------- ### Setting Up Installation Prefix and Default Target CMake Source: https://github.com/flutter/codelabs/blob/main/tfrs-flutter/finished/frontend/windows/CMakeLists.txt Configures the installation prefix to be the directory containing the built executable and makes the 'install' target the default build step in Visual Studio. This streamlines the process of building and running the application. ```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() ``` -------------------------------- ### Installing Application Components (CMake) Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_03/linux/CMakeLists.txt Installs the main application executable (`${BINARY_NAME}`), the Flutter ICU data file (`${FLUTTER_ICU_DATA_FILE}`), the core Flutter library (`${FLUTTER_LIBRARY}`), bundled plugin libraries (`${PLUGIN_BUNDLED_LIBRARIES}`), and native assets into their designated locations within the installation bundle's `lib/` or `data/` subdirectories. ```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) # 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) ``` -------------------------------- ### Defining Executable Binary Name - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Sets the CMake variable `BINARY_NAME` to the desired name for the application executable. This variable is used later for installation and bundle configuration. ```CMake set(BINARY_NAME "ffigen_app_example") ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_06/example/windows/CMakeLists.txt Defines an installation rule to copy the built application executable (`${BINARY_NAME}`) to the specified installation prefix (`${CMAKE_INSTALL_PREFIX}`). It assigns the executable to the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Binary Source: https://github.com/flutter/codelabs/blob/main/intro_flutter_gpu/step_02/linux/CMakeLists.txt Installs the application binary executable to the root of the installation prefix (`CMAKE_INSTALL_PREFIX`). This places the main executable where it can be found and run within the bundle. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Configuring Firebase Project - Console Source: https://github.com/flutter/codelabs/blob/main/firebase-get-to-know-flutter/steps/index.lab.md Run the `flutterfire configure` command from the root of your Flutter app. This command guides you through selecting a Firebase project and apps to generate the platform-specific configuration file (`firebase_options.dart`). ```console $ flutterfire configure ``` -------------------------------- ### Setting Target Properties (CMake) Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_07/src/CMakeLists.txt Configures various properties for the `ffigen_app` target, including listing public and private header files and setting the output library name. These properties guide the build and installation process of the library. ```CMake set_target_properties(ffigen_app PROPERTIES PUBLIC_HEADER duktape.h PRIVATE_HEADER duk_config.h OUTPUT_NAME "ffigen_app" ) ``` -------------------------------- ### Installing Main Application Executable (CMake) Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_04_b/linux/CMakeLists.txt Adds an installation rule to copy the built application executable (`${BINARY_NAME}`) to the root of the installation prefix (the bundle directory). It is marked as a 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_03/example/linux/CMakeLists.txt Defines an install rule to copy the main application executable target (`${BINARY_NAME}`) to the installation prefix (`${CMAKE_INSTALL_PREFIX}`). It's marked with the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Main Application Executable Source: https://github.com/flutter/codelabs/blob/main/next-gen-ui/step_03_a/linux/CMakeLists.txt Adds an install rule to copy the main application executable (${BINARY_NAME}) to the installation prefix. It is included in the 'Runtime' component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Setting CMake Minimum Version and Project - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/example/windows/CMakeLists.txt Configures the minimum required CMake version for the project and defines the project name (`ffigen_app_example`) and supported languages (`CXX`). This is a standard starting point for CMake projects. ```CMake cmake_minimum_required(VERSION 3.14) project(ffigen_app_example LANGUAGES CXX) ``` -------------------------------- ### Configuring Installation Paths - CMake Source: https://github.com/flutter/codelabs/blob/main/animations/step_02_c/windows/CMakeLists.txt Sets up variables defining the installation directories. It determines the build output directory of the main executable (`BUILD_BUNDLE_DIR`), makes the install step default for Visual Studio, sets the install prefix (`CMAKE_INSTALL_PREFIX`) to this directory, and defines subdirectories for data (`data`) and libraries within the install prefix. This prepares the layout for deploying the application files. ```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 "$") # 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}") ``` -------------------------------- ### Conditional Test Build Setup Block Source: https://github.com/flutter/codelabs/blob/main/github-client/window_to_front/windows/CMakeLists.txt Initiates a conditional block (`if`) that only processes the subsequent commands if the variable `include_${PROJECT_NAME}_tests` is set (typically when building the example application). It sets the test runner name and enables testing. ```CMake if (${include_${PROJECT_NAME}_tests}) set(TEST_RUNNER "${PROJECT_NAME}_test") enable_testing() ``` -------------------------------- ### Installing Codelab Rebuild Tool Console Source: https://github.com/flutter/codelabs/blob/main/tooling/codelab_rebuild/README.md This command installs the `codelab_rebuild` tool globally using Dart's pub package manager. It activates the package from the current directory, making the `codelab_rebuild` executable available in the user's path. This is a prerequisite for running the tool. ```Console $ dart pub global activate --source path . ``` -------------------------------- ### Configuring Installation Prefix Source: https://github.com/flutter/codelabs/blob/main/adaptive_app/step_05/windows/CMakeLists.txt Sets the installation prefix to the directory where the executable is built, primarily for Visual Studio builds. This makes the 'install' step copy necessary files next to the executable for easy running. ```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() ``` -------------------------------- ### Setting General Target Properties - CMake Source: https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_06/src/CMakeLists.txt Configures various properties for the ffigen_app target. This includes defining public and private header files and setting the output name for the compiled shared library. These properties guide the build process and installation steps. ```CMake set_target_properties(ffigen_app PROPERTIES PUBLIC_HEADER duktape.h PRIVATE_HEADER duk_config.h OUTPUT_NAME "ffigen_app" ) ``` -------------------------------- ### Installing Application Executable CMake Source: https://github.com/flutter/codelabs/blob/main/namer/step_04_a_widget/linux/CMakeLists.txt This installation rule installs the application binary target (`${BINARY_NAME}`). It specifies that the executable should be placed directly in the install prefix directory and is part of the 'Runtime' installation component. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Define Installation Directory Variables Source: https://github.com/flutter/codelabs/blob/main/haiku_generator/finished/windows/CMakeLists.txt Sets variables for the installation directories of data and libraries within the installation bundle, based on the configured installation prefix. These variables are used in subsequent install commands. ```CMake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ```