### Install Application Target Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Installs the main application executable to the specified runtime destination. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Define Installation Directories Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Sets variables for the installation directories for bundle data and libraries. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Install Flutter Library Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Installs the main Flutter library file to the bundle library directory. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installation Bundle Configuration Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Configures the installation prefix to create a relocatable bundle in the build directory and sets up directories for data and libraries. ```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") ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Installs any bundled plugin libraries to the bundle library directory if they exist. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install Executable and Data Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Installs the application executable to the bundle's root and the ICU data file to the data directory. ```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 ICU Data File Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Installs the ICU data file to the bundle data directory. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library to the bundle data directory, but only for Profile and Release configurations. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Set Installation Prefix for Bundle Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Configures the installation prefix to be next to the executable, supporting in-place running and Visual Studio builds. ```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() ``` -------------------------------- ### Install Flutter Library and Bundled Libraries Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Installs the main Flutter library and any bundled plugin libraries to the bundle's library directory. ```cmake 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) ``` -------------------------------- ### Install Flutter Assets Directory Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Removes stale assets and then copies the current Flutter assets directory to the bundle data directory. This ensures assets are always up-to-date. ```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 AOT Library Conditionally Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Installs the AOT library to the runtime destination only when the build type is not Debug. Ensure the AOT_LIBRARY variable is correctly defined. ```cmake # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Cross-Building Sysroot Configuration Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Sets up the sysroot and search paths for cross-compilation environments. ```cmake if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() ``` -------------------------------- ### System Dependencies Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Finds and checks for the PkgConfig and GTK+ 3.0 libraries, making them available for linking. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Add Dependencies and Include Directories Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/runner/CMakeLists.txt Specifies libraries to link against and directories to search for include files. Application-specific dependencies should be added here. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/runner/CMakeLists.txt Applies a standard set of build settings to the specified target. This can be customized for applications requiring different build configurations. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Find and check GTK, GLIB, and GIO modules Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/flutter/CMakeLists.txt Uses PkgConfig to find and check for GTK, GLIB, and GIO system libraries, which are required for Flutter's Linux desktop embedding. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### Project and Executable Naming Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Sets the minimum CMake version, project name, and the executable name for the application. Change BINARY_NAME to alter the on-disk name. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "example") set(APPLICATION_ID "com.example.example") ``` -------------------------------- ### Runtime Library Path Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Configures the runtime search path for libraries to be relative to the binary location. ```cmake set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Enable Unicode Support Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Adds definitions to enable Unicode support for all projects. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Configure Build Configurations Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Sets the available build configurations (Debug, Profile, Release) based on whether the generator is multi-config. ```cmake get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() ``` -------------------------------- ### Include Generated Plugins Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Includes the CMake script that manages building and adding generated plugins to the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Create Flutter interface library Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/flutter/CMakeLists.txt Defines an INTERFACE library target named 'flutter' and sets its include directories and link libraries, including the Flutter library and the previously checked PkgConfig modules (GTK, GLIB, GIO). It also adds a dependency on the 'flutter_assemble' target. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Enable Modern CMake Behaviors Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Explicitly opts into modern CMake behaviors to avoid warnings with recent CMake versions. ```cmake cmake_policy(SET CMP0063 NEW) ``` -------------------------------- ### Apply Standard Compilation Settings Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt A function to apply common compilation settings to a target, including C++ standard, warning levels, and preprocessor definitions. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() ``` -------------------------------- ### Application Executable Target Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Defines the main application executable target, listing its source files. New sources should be added here. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Standard Build Settings Function Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Defines a function to apply common compilation settings like C++ standard, warnings, optimization, and NDEBUG definition. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "<$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "<$>:NDEBUG>") endfunction() ``` -------------------------------- ### Configure Flutter library and headers Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/flutter/CMakeLists.txt Sets variables for the Flutter library path, ICU data file, project build directory, and AOT library. It also defines a list of Flutter library headers and uses the custom list_prepend function to add a prefix to their paths. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") ``` -------------------------------- ### Runtime Output Directory Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Sets the runtime output directory for the executable to a subdirectory to prevent accidental execution of unbundled copies. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Include Runner Subdirectory Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Includes the 'runner' subdirectory, which contains the application's specific build rules. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Define Profile Build Mode Settings Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Sets linker and compiler flags for the Profile build mode, typically mirroring Release settings. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### Custom command for Flutter tool backend Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/flutter/CMakeLists.txt Defines a custom command to execute the Flutter tool backend script. This command is set to run every time by using a non-existent output file '_phony_' to ensure the build artifacts are generated. It sets environment variables and passes platform and build type arguments to the script. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Specifies the minimum required CMake version and defines the project name and languages. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) ``` -------------------------------- ### Build Type Configuration Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Sets the default build type to 'Debug' if not already specified, and defines allowed build types. ```cmake if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### Linking Dependencies Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/CMakeLists.txt Links the application target against the Flutter library and GTK+ 3.0. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### Integrate Flutter Build Tools Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/runner/CMakeLists.txt Ensures that the Flutter tool's build components are integrated into the build process. This step is mandatory and should not be removed. ```cmake add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Include Flutter Managed Directory Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Adds the Flutter managed directory as a subdirectory, likely to include Flutter's build rules. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Define Executable Target Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/runner/CMakeLists.txt Defines the main executable target for the Windows runner application. Source files and resources are listed here. Ensure BINARY_NAME is consistent with the top-level CMakeLists.txt for `flutter run` compatibility. ```cmake add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) ``` -------------------------------- ### Define list_prepend function Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/flutter/CMakeLists.txt Defines a custom CMake function to prepend a prefix to all elements in a list, as list(TRANSFORM ... PREPEND ...) is not available in CMake version 3.10. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### Set Executable Name Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/CMakeLists.txt Defines the name of the executable file for the application. This can be changed to alter the on-disk name. ```cmake set(BINARY_NAME "example") ``` -------------------------------- ### Custom target for Flutter assembly Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/linux/flutter/CMakeLists.txt Creates a custom target 'flutter_assemble' that depends on the Flutter library and its headers. This target ensures that the Flutter build artifacts are generated before they are needed by other parts of the build. ```cmake add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Disable Conflicting Macros Source: https://github.com/ionicfirebaseapp/getwidget/blob/master/example/windows/runner/CMakeLists.txt Disables Windows-specific macros that might conflict with C++ standard library functions, ensuring cleaner compilation. ```cmake target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.