### Installing Application Executable Target Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This command installs the main application executable (`BINARY_NAME`) to the specified installation prefix. It marks the executable as a 'RUNTIME' component, ensuring it's part of the deployable application. ```CMake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Assets with Pre-Clean Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This block installs the `flutter_assets` directory, which contains all application assets. It includes an `install(CODE)` command to first remove any stale assets from previous installations, ensuring a clean and up-to-date deployment. ```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) ``` -------------------------------- ### Installing Flutter Core Library Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This command installs the main Flutter library file. This library is fundamental for the Flutter application to run, and it's placed in the designated library installation directory. ```CMake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Setting Installation Prefix and Cleaning Bundle (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This section defines the installation prefix for the build bundle and ensures a clean bundle directory for each build. If the default install prefix is used, it's overridden to point to the bundle directory within the project's binary directory. An install(CODE) command is used to remove the bundle directory recursively before 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() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Configuring Installation Bundle Directories Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This block sets up the installation directories for the application bundle. It ensures that support files are copied alongside the executable for in-place running, especially for Visual Studio builds, and defines data and library subdirectories. ```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 Dependencies Source: https://github.com/cristianmgm7/track_flow/blob/main/README.md This command fetches all the required Dart and Flutter package dependencies listed in the `pubspec.yaml` file for the TrackFlow project. It ensures all necessary libraries are available for compilation and execution. ```bash flutter pub get ``` -------------------------------- ### Navigating to Project Directory Source: https://github.com/cristianmgm7/track_flow/blob/main/README.md After cloning the repository, this command changes the current working directory to the newly cloned `track_flow` project folder, which is necessary before installing dependencies or running the application. ```bash cd track_flow ``` -------------------------------- ### Installing Core Application Components (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This snippet defines the destination directories for bundle data and libraries, then installs the main executable, ICU data file, and Flutter library into their respective locations within the bundle. These are essential components for the application's runtime. ```CMake 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) ``` -------------------------------- ### Installing Flutter Assets and AOT Library (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This final installation section handles Flutter assets and the AOT (Ahead-of-Time) compiled library. It ensures the flutter_assets directory is fully re-copied on each build to prevent stale files and installs the AOT library only for non-Debug builds, optimizing release packages. ```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) if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Installing Bundled Plugin Libraries (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This foreach loop iterates through a list of PLUGIN_BUNDLED_LIBRARIES and installs each library into the bundle's library directory. This ensures that all necessary plugin-related shared libraries are included in the final application 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/Release Builds Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This command installs the Ahead-Of-Time (AOT) compiled library. It is configured to be installed only for 'Profile' and 'Release' build configurations, as AOT compilation is typically not used for 'Debug' builds. ```CMake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Native Assets Directory Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This snippet defines the path to the native assets directory and installs its contents into the application's library bundle. These assets are typically generated by `build.dart` and are crucial for the application's functionality. ```CMake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Bundled Plugin Libraries Conditionally Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This conditional block installs any bundled plugin libraries if the `PLUGIN_BUNDLED_LIBRARIES` variable is defined. This ensures that all necessary plugin dependencies are included in the application's runtime directory. ```CMake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Installing Native Assets (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This snippet copies native assets generated by the build.dart script from all packages into the bundle's library directory. This ensures that platform-specific native code dependencies are included in the final application. ```CMake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter ICU Data File Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This snippet installs the Flutter ICU (International Components for Unicode) data file. This file is essential for Flutter applications to handle internationalization and localization correctly, ensuring it's placed in the data directory. ```CMake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Defining Flutter Library and Build Paths Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/flutter/CMakeLists.txt This section defines key paths for the Flutter build, including the main Flutter Linux GTK library (`libflutter_linux_gtk.so`), the ICU data file, the project's build directory, and the AOT compiled application library. These variables are set to `PARENT_SCOPE` to make them accessible in higher-level CMakeLists.txt files for installation purposes. ```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) ``` -------------------------------- ### Setting Up Initial CMake and Flutter Paths Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/flutter/CMakeLists.txt This snippet initializes the minimum required CMake version and defines essential directory paths for the Flutter build process. It includes a generated configuration file and sets a fallback platform if not already defined, ensuring the build environment is correctly established. ```CMake cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") # Set fallback configurations for older versions of the flutter tool. if (NOT DEFINED FLUTTER_TARGET_PLATFORM) set(FLUTTER_TARGET_PLATFORM "windows-x64") endif() ``` -------------------------------- ### Initializing Firebase, App Check, and Flutter Web App - JavaScript Source: https://github.com/cristianmgm7/track_flow/blob/main/web/index.html This JavaScript snippet initializes Firebase with a provided configuration, activates Firebase App Check using a reCAPTCHA v3 site key for security, and then loads the Flutter web application's entrypoint. It ensures that all necessary services and the Flutter app are ready to run once the page has fully loaded. ```JavaScript var serviceWorkerVersion = null; window.addEventListener('load', function(ev) { // Initialize Firebase with your config var firebaseConfig = { // Your Firebase config here }; firebase.initializeApp(firebaseConfig); // Initialize App Check const appCheck = firebase.appCheck(); // Pass your reCAPTCHA v3 site key (public key) to activate(). Make sure this // key is the counterpart to the secret key you set in the Firebase console. appCheck.activate( 'YOUR-RECAPTCHA-SITE-KEY', true ); // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, }, onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine().then(function(appRunner) { appRunner.runApp(); }); } }); }); ``` -------------------------------- ### Cloning TrackFlow Repository Source: https://github.com/cristianmgm7/track_flow/blob/main/README.md This command is used to clone the TrackFlow project repository from GitHub to your local machine. It's the first step in setting up the development environment. ```bash git clone https://github.com/cristianmgm7/track_flow.git ``` -------------------------------- ### Initializing CMake Project and Defining Binary Name (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This snippet initializes the CMake project, sets the required CMake version, defines the project name, and specifies the output binary name and GTK application ID. These settings are fundamental for project identification and application branding. ```CMake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) set(BINARY_NAME "trackflow") set(APPLICATION_ID "com.example.trackflow") ``` -------------------------------- ### Configuring Flutter Library Headers and Interface Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/flutter/CMakeLists.txt This snippet defines a list of Flutter library headers and then uses the custom `list_prepend` function to add the `EPHEMERAL_DIR/flutter_linux/` prefix to each. It then creates an `INTERFACE` library named `flutter`, specifies its include directories, links it against the main Flutter library and the previously found PkgConfig dependencies (GTK, GLIB, GIO), and adds a dependency on the `flutter_assemble` custom target. ```CMake list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Running TrackFlow Application Source: https://github.com/cristianmgm7/track_flow/blob/main/README.md This command compiles and runs the TrackFlow Flutter application on a connected device or emulator. It launches the app, allowing for testing and development. ```bash flutter run ``` -------------------------------- ### Configuring CMake Policies and Runtime Path (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This section explicitly opts into modern CMake behaviors to avoid warnings and sets the runtime path for bundled libraries. The CMP0063 policy is enabled for improved target property handling, and CMAKE_INSTALL_RPATH ensures libraries are found relative to the executable. ```CMake cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Including Flutter and System Dependencies (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This section includes Flutter-specific build rules and finds system-level dependencies. It adds the flutter subdirectory for Flutter's build logic and uses PkgConfig to locate and import the gtk+-3.0 library as a required dependency. ```CMake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) ``` -------------------------------- ### Defining Application Executable (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/runner/CMakeLists.txt This command defines the main application executable using the `BINARY_NAME` variable. It includes the core source files `main.cc`, `my_application.cc`, and the Flutter-managed plugin registrant, ensuring all necessary sources are compiled into the executable. ```CMake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) ``` -------------------------------- ### Defining Flutter C++ Wrapper for Plugins Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/flutter/CMakeLists.txt This snippet defines the source files for the C++ client wrapper, categorizing them into core, plugin, and app-specific components. It then creates a `STATIC` library, `flutter_wrapper_plugin`, combining core and plugin sources, applies standard settings, and configures properties like position-independent code and hidden C++ visibility. It links against the `flutter` library and depends on `flutter_assemble`. ```CMake # === Wrapper === list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Finding System Dependencies with PkgConfig Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/flutter/CMakeLists.txt This snippet uses `PkgConfig` to locate required system libraries for the Flutter application. It checks for `gtk+-3.0`, `glib-2.0`, and `gio-2.0`, ensuring they are available and importing them as CMake targets for linking. ```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) ``` -------------------------------- ### Defining Flutter C++ Wrapper for Application Runner Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/flutter/CMakeLists.txt This section defines the `flutter_wrapper_app` `STATIC` library, which combines the core C++ wrapper sources with application-specific sources. It applies standard build settings, links against the main `flutter` library, includes the wrapper's public headers, and establishes a dependency on the `flutter_assemble` target, essential for building the main application executable. ```CMake # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Integrating Flutter Tool Backend with Custom Command Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/flutter/CMakeLists.txt This section defines a custom CMake command that invokes the Flutter tool backend script (`tool_backend.sh`). It specifies the outputs (Flutter library, headers, and a phony file to force execution) and the command to run, passing environment variables and build configuration. A `flutter_assemble` custom target is then created, depending on these outputs, ensuring the tool backend runs during the build process. ```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 ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Initializing CMake Project for CXX Language Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This snippet sets the minimum required CMake version and defines the project name 'trackflow', specifying CXX as the primary language. This is the foundational step for any CMake project. ```CMake cmake_minimum_required(VERSION 3.14) project(trackflow LANGUAGES CXX) ``` -------------------------------- ### Linking Dependency Libraries (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/runner/CMakeLists.txt These commands link the necessary dependency libraries, `flutter` and `PkgConfig::GTK`, to the application executable. Linking these libraries provides access to Flutter's embedding API and GTK for UI rendering. ```CMake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### Linking Libraries and Including Directories in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt This snippet links essential libraries like 'flutter' and 'flutter_wrapper_app' to the executable, along with 'dwmapi.lib' for Windows desktop features. It also adds the source directory to the include paths for resolving headers. ```CMake target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Adding Application Subdirectory and Dependencies (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This snippet includes the runner subdirectory, which contains the main application's CMakeLists.txt. It also adds a dependency on flutter_assemble to ensure the Flutter tool portions of the build are executed before the main binary is linked. ```CMake add_subdirectory("runner") add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Configuring Flutter Core Library and Dependencies Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/flutter/CMakeLists.txt This section defines the main Flutter library DLL, ICU data file, and other build-related paths, making them available to parent scopes. It also sets up an `INTERFACE` library for Flutter, specifying its include directories and linking against the main Flutter library, and adds a dependency on the `flutter_assemble` target. ```CMake # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Configuring Profile Build Mode Flags Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This snippet sets the linker and compiler flags for the 'Profile' build configuration to mirror those of the 'Release' configuration. This ensures that the Profile build benefits from similar optimizations as Release, suitable for performance analysis. ```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}") ``` -------------------------------- ### TrackFlow Clean Architecture Directory Structure Source: https://github.com/cristianmgm7/track_flow/blob/main/README.md This snippet illustrates the directory structure of the TrackFlow project, adhering to clean architecture principles. It shows the separation of concerns into 'features', 'core', and 'main.dart', with 'features' further divided into 'data', 'domain', and 'presentation' layers for each module. ```text lib/ ├── features/ │ ├── auth/ │ │ ├── data/ │ │ ├── domain/ │ │ └── presentation/ │ ├── home/ │ ├── onboarding/ │ ├── profile/ │ └── settings/ ├── core/ │ ├── config/ │ ├── constants/ │ ├── data/ │ ├── models/ │ └── router/ └── main.dart ``` -------------------------------- ### Applying Standard Build Settings (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/runner/CMakeLists.txt This line applies a set of predefined standard build settings to the application target. It's a convenience function to ensure consistent build configurations, though it can be removed if custom settings are required. ```CMake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Applying Standard Build Settings in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt This command applies a predefined set of standard build settings to the executable target. It's a common practice to ensure consistent build configurations across different parts of a project. ```CMake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Defining Standard Compilation Settings Function Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This CMake function `APPLY_STANDARD_SETTINGS` applies common compilation options to a specified target. It enforces C++17 standard, sets warning levels, disables exceptions, and defines `_DEBUG` for Debug configurations, promoting consistent build practices. ```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() ``` -------------------------------- ### Adding Unicode Preprocessor Definitions Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This command adds preprocessor definitions `-DUNICODE` and `-D_UNICODE` to all projects. These definitions are crucial for enabling Unicode support in Windows applications, ensuring proper handling of wide characters. ```CMake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Setting Up Cross-Building Sysroot (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This conditional block configures the root filesystem for cross-building environments. If FLUTTER_TARGET_PLATFORM_SYSROOT is defined, it sets CMAKE_SYSROOT and adjusts CMAKE_FIND_ROOT_PATH_MODE variables to correctly locate programs, packages, libraries, and includes within the sysroot. ```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() ``` -------------------------------- ### Defining the Flutter Application Executable in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt This section defines the main application executable, using the BINARY_NAME variable for its name. It specifies the WIN32 type and lists all source files required for the Flutter desktop runner, including C++ files, resource files, and generated plugin registrants. ```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" ) ``` -------------------------------- ### Initializing CMake Project and Minimum Version Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt This snippet sets the minimum required CMake version for the project and defines the project name 'runner' along with the CXX (C++) language, which is essential for the Flutter desktop runner. ```CMake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) ``` -------------------------------- ### Defining Standard Compilation Settings Function (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This CMake function APPLY_STANDARD_SETTINGS applies common compilation features and options to a specified target. It enforces C++14 standard, enables -Wall and -Werror for strict warnings, and applies -O3 optimization and NDEBUG definition for non-Debug builds. ```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() ``` -------------------------------- ### Configuring Runtime Output Directory (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This snippet sets the RUNTIME_OUTPUT_DIRECTORY for the main binary to a subdirectory named intermediates_do_not_run. This prevents users from accidentally running the unbundled executable, as it requires resources to be in specific relative locations within the final bundle. ```CMake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Setting Minimum CMake Version and Project Name (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/runner/CMakeLists.txt This snippet specifies the minimum required CMake version for the project and defines the project name 'runner' with CXX as the enabled language. This is typically the first configuration in a CMakeLists.txt file. ```CMake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) ``` -------------------------------- ### Including Flutter Managed Directory in Build Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This snippet defines the path to the Flutter managed directory and includes it as a subdirectory in the CMake build. This step is essential for integrating Flutter's build rules and dependencies into the native application. ```CMake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Including Generated Flutter Plugins (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This line includes the generated_plugins.cmake file, which contains build rules for Flutter plugins. This file is automatically generated by the Flutter tool and manages the compilation and integration of plugins into the application. ```CMake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Invoking Flutter Tool Backend for Assembly Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/flutter/CMakeLists.txt This snippet defines a custom CMake command and target (`flutter_assemble`) to integrate with the Flutter tool backend. It uses a phony output file to force the command to run every time, ensuring that the Flutter tool generates necessary build artifacts like the Flutter library and C++ wrapper sources. The `flutter_assemble` target depends on all these generated outputs, orchestrating the final assembly process. ```CMake # === Flutter tool backend === # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Including Generated Flutter Plugins CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This line includes the `generated_plugins.cmake` file, which is automatically generated by Flutter. This file contains the build rules for all Flutter plugins used in the project, ensuring they are properly compiled and linked. ```CMake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Including Application Runner Subdirectory Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This command adds the 'runner' directory as a subdirectory to the CMake build. This directory typically contains the native application's main source code and build configurations, linking it with the Flutter components. ```CMake add_subdirectory("runner") ``` -------------------------------- ### Enabling Modern CMake Policy Behaviors Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This line explicitly opts into modern CMake behaviors for a specified version range (3.14 to 3.25). This helps avoid warnings and ensures compatibility with recent CMake features and practices. ```CMake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Adding Preprocessor Definitions (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/runner/CMakeLists.txt This command adds a preprocessor definition for `APPLICATION_ID` to the build. This allows the application's unique identifier to be used within the C++ source code during compilation. ```CMake add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Opening Flutter Xcode Workspace Source: https://github.com/cristianmgm7/track_flow/blob/main/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md This shell command is used to open the Xcode workspace for a Flutter project. It's the initial step required to access and modify iOS-specific project settings and assets, such as the launch screen images. ```Shell open ios/Runner.xcworkspace ``` -------------------------------- ### Adding Include Directories (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/runner/CMakeLists.txt This command adds the current source directory (`CMAKE_SOURCE_DIR`) to the include paths for the application target. This ensures that header files located in the project's root directory can be found during compilation. ```CMake target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Defining CMake Build Configuration Types Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This block configures the build types (Debug, Profile, Release) based on whether the generator supports multi-config builds (e.g., Visual Studio). It ensures a default 'Debug' build type if none is specified, providing flexibility for different build scenarios. ```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() ``` -------------------------------- ### Setting CMake Minimum Version and Ephemeral Directory Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/flutter/CMakeLists.txt This snippet sets the minimum required CMake version to 3.10 and defines the `EPHEMERAL_DIR` variable, which points to a directory containing generated build configurations and assets. It then includes a `generated_config.cmake` file provided by the Flutter tool. ```CMake cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) ``` -------------------------------- ### Defining CMake `list_prepend` Function Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/flutter/CMakeLists.txt This CMake function `list_prepend` prepends a given `PREFIX` to each element in a specified `LIST_NAME`. It iterates through the list, constructs a new list with prefixed elements, and then updates the original list in the parent scope. This function serves as a workaround for CMake versions older than 3.10 which lack `list(TRANSFORM ... PREPEND ...)`. ```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() ``` -------------------------------- ### Adding Flutter Version Preprocessor Definitions in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt These commands add preprocessor definitions to the executable, embedding Flutter version information (major, minor, patch, build) directly into the compiled binary. This is useful for runtime version checks and debugging. ```CMake target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") ``` -------------------------------- ### Defining Default Build Configuration Type (CMake) Source: https://github.com/cristianmgm7/track_flow/blob/main/linux/CMakeLists.txt This snippet defines the default build type if it hasn't been set, typically for Flutter build modes. It sets 'Debug' as the default and allows 'Profile' and 'Release' as valid options, ensuring a consistent build configuration. ```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() ``` -------------------------------- ### Adding Flutter Assemble Dependency in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt This command establishes a build dependency on 'flutter_assemble', ensuring that the Flutter tool's build steps (like asset bundling and code generation) are executed before the main application is compiled and linked. ```CMake add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Setting Application Executable Name in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/CMakeLists.txt This command defines the `BINARY_NAME` variable, which determines the on-disk name of the compiled application executable. It allows for easy modification of the output binary's filename. ```CMake set(BINARY_NAME "trackflow") ``` -------------------------------- ### Disabling NOMINMAX Macro for C++ Compatibility in CMake Source: https://github.com/cristianmgm7/track_flow/blob/main/windows/runner/CMakeLists.txt This definition prevents conflicts between Windows API macros (like min/max) and standard C++ library functions, ensuring proper compilation of C++ code that uses std::min or std::max. ```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.