### Configure Windows Flutter build and installation in CMakeLists.txt Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/windows/CMakeLists.txt This CMakeLists.txt configures the Windows build for the audiotags example Flutter application. It sets the project name, binary name, and build modes (Debug, Profile, Release), applies standard compilation settings with warnings as errors, and includes Flutter and plugin build rules. The installation section copies the executable, ICU data, Flutter library, bundled plugin libraries, assets, and AOT library (on Profile/Release) into the build bundle directory so the app can run in place from Visual Studio. ```cmake cmake_minimum_required(VERSION 3.14) project(audiotags_example LANGUAGES CXX) set(BINARY_NAME "audiotags_example") cmake_policy(SET CMP0063 NEW) 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() 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}") add_definitions(-DUNICODE -D_UNICODE) 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() set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) add_subdirectory("runner") include(flutter/generated_plugins.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}") 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() set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install main binary Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Installs the main binary to the bundle prefix as part of the Runtime component. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install Flutter assets and AOT library Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt This snippet configures the installation of the Flutter assets directory and the AOT library for the Linux example. It removes the existing assets directory before copying to avoid stale files, and installs the AOT library only on non-Debug builds. ```CMake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE "${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install bundled plugin libraries Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Installs each bundled plugin library to the bundle lib directory as part of the Runtime component. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Install Flutter library Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Installs the Flutter library to the bundle lib directory as part of the Runtime component. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Clean build bundle directory on install Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Installs a script that removes the build bundle directory recursively every time, ensuring a clean bundle directory before installation. ```cmake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Run plugin_tool.py commands Source: https://github.com/erikas-taroza/audiotags/blob/master/CONTRIBUTING.md Commands for the plugin_tool.py script, which must be run from the root directory. The help command shows usage, -c generates code, and -b builds for a specified platform. Missing dependencies like flutter_rust_bridge_codegen are installed automatically. ```bash python plugin_tool.py --help ``` ```bash python plugin_tool.py -c ``` ```bash python plugin_tool.py -b platform ``` -------------------------------- ### Set bundle data and library directories Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Defines the installation directories for data and library files within the bundle. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Set build bundle directory and install prefix Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Sets the build bundle directory to the project binary directory's 'bundle' subdirectory. If the install prefix is still the default, it is overridden 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() ``` -------------------------------- ### Install Flutter ICU data file Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Installs the Flutter ICU data file to the bundle data directory as part of the Runtime component. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Write audio metadata Source: https://github.com/erikas-taroza/audiotags/blob/master/README.md Creates a Tag object with specified metadata and writes it to the audio file at the given path. Use this to set or update metadata fields. The example includes a picture with raw bytes and a mime type of null. ```dart Tag tag = Tag( title: "Title", trackArtist: "Track Artist", album: "Album", albumArtist: "Album Artist", genre: "Genre", year: 2000, trackNumber: 1, trackTotal: 2, discNumber: 1, discTotal: 3, pictures: [ Picture( bytes: Uint8List.fromList([0, 0, 0, 0]), mimeType: null, pictureType: PictureType.other ) ] ); AudioTags.write(path, tag); ``` -------------------------------- ### Flutter Windows CMakeLists.txt for plugin build Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/windows/flutter/CMakeLists.txt This is the standard Flutter Windows CMakeLists.txt that defines the build steps for a Flutter plugin or app. It sets up the Flutter library, the C++ wrapper libraries (flutter_wrapper_plugin and flutter_wrapper_app), and a custom command that invokes the Flutter tool backend to generate the necessary artifacts. It should not be edited; it is controlled by the Flutter tool. ```cmake # This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) # === Wrapper === list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) # === Flutter tool backend === # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" windows-x64 $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Configure Flutter and system dependencies Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Adds the Flutter managed build directory, finds the GTK+3 package via PkgConfig, and defines the APPLICATION_ID macro. ```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) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Configure audiotags Windows plugin with CMake Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/windows/CMakeLists.txt CMake configuration for the audiotags Windows plugin. Requires CMake 3.14 or later and Visual Studio. Defines the plugin target, applies standard settings, hides symbols, links Flutter dependencies, downloads and extracts the audiotags.dll binary from GitHub, and exposes the DLL as a bundled library. ```cmake cmake_minimum_required(VERSION 3.14) # Project-level configuration. set(PROJECT_NAME "audiotags") project(${PROJECT_NAME} LANGUAGES CXX) # This value is used when generating builds using this plugin, so it must # not be changed set(PLUGIN_NAME "audiotags_plugin") # Any new source files that you add to the plugin should be added here. list(APPEND PLUGIN_SOURCES "audiotags_plugin.cpp" "audiotags_plugin.h" ) # Define the plugin library target. Its name must not be changed (see comment # on PLUGIN_NAME above). add_library(${PLUGIN_NAME} SHARED "include/audiotags/audiotags_plugin_c_api.h" "audiotags_plugin_c_api.cpp" ${PLUGIN_SOURCES} ) # Apply a standard set of build settings that are configured in the # application-level CMakeLists.txt. This can be removed for plugins that want # full control over build settings. apply_standard_settings(${PLUGIN_NAME}) # Symbols are hidden by default to reduce the chance of accidental conflicts # between plugins. This should not be removed; any symbols that should be # exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) # Source include directories and library dependencies. Add any plugin-specific # dependencies here. target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) # Download the binary from GitHub. set(Version "1.4.5") set(LibPath "${CMAKE_CURRENT_SOURCE_DIR}/windows.tar.gz") if(NOT EXISTS ${LibPath}) file(DOWNLOAD "https://github.com/erikas-taroza/audiotags/releases/download/v${Version}/windows.tar.gz" ${LibPath} TLS_VERIFY ON ) endif() if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/audiotags.dll") execute_process( COMMAND ${CMAKE_COMMAND} -E tar -xzf windows.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) endif() # List of absolute paths to libraries that should be bundled with the plugin. # This list could contain prebuilt libraries, or libraries created by an # external build triggered from this build file. set(audiotags_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/audiotags.dll" PARENT_SCOPE ) ``` -------------------------------- ### Include generated plugins build rules Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Includes the generated plugin build rules file, which manages building the plugins and adding them to the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Download and extract audiotags Android binaries Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/android/CMakeLists.txt CMake script that downloads the audiotags Android binaries (version 1.4.5) from GitHub and extracts them into the jniLibs directory. It checks for the archive and the target library before downloading and extracting. ```cmake cmake_minimum_required(VERSION 3.10) # Download the binaries from GitHub. set(Version "1.4.5") set(LibPath "${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs") set(ArchivePath "${CMAKE_CURRENT_SOURCE_DIR}/android.tar.gz") if(NOT EXISTS ${ArchivePath}) file(DOWNLOAD "https://github.com/erikas-taroza/audiotags/releases/download/v${Version}/android.tar.gz" ${ArchivePath} TLS_VERIFY ON ) endif() if(NOT EXISTS "${LibPath}/arm64-v8a/libaudiotags.so") file(MAKE_DIRECTORY ${LibPath}) execute_process( COMMAND ${CMAKE_COMMAND} -E tar -xzf ${ArchivePath} WORKING_DIRECTORY ${LibPath} ) endif() ``` -------------------------------- ### Define standard build settings function Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Defines a CMake function that applies standard build settings to a target: enables C++14, adds -Wall and -Werror, and adds -O3 and NDEBUG for non-Debug configurations. ```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() ``` -------------------------------- ### Set runtime output directory to intermediates_do_not_run Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Sets the runtime output directory for the target binary to a subdirectory named 'intermediates_do_not_run' to prevent users from running the unbundled copy, since resources must be in the correct relative locations. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Configure audiotags Flutter plugin with CMake Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/linux/CMakeLists.txt CMake configuration for the audiotags Flutter plugin on Linux. It defines the plugin target, applies standard settings, hides symbols, links against Flutter and GTK, downloads the prebuilt libaudiotags.so from GitHub (version 1.4.5) if missing, and exposes the bundled library path via audiotags_bundled_libraries. ```cmake cmake_minimum_required(VERSION 3.10) # Project-level configuration. set(PROJECT_NAME "audiotags") project(${PROJECT_NAME} LANGUAGES CXX) # This value is used when generating builds using this plugin, so it must # not be changed. set(PLUGIN_NAME "audiotags_plugin") # Define the plugin library target. Its name must not be changed (see comment # on PLUGIN_NAME above). # # Any new source files that you add to the plugin should be added here. add_library(${PLUGIN_NAME} SHARED "audiotags_plugin.cc" ) # Apply a standard set of build settings that are configured in the # application-level CMakeLists.txt. This can be removed for plugins that want # full control over build settings. apply_standard_settings(${PLUGIN_NAME}) # Symbols are hidden by default to reduce the chance of accidental conflicts # between plugins. This should not be removed; any symbols that should be # exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) # Source include directories and library dependencies. Add any plugin-specific # dependencies here. target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) # Download the binary from GitHub. set(Version "1.4.5") set(LibPath "${CMAKE_CURRENT_SOURCE_DIR}/linux.tar.gz") if(NOT EXISTS ${LibPath}) file(DOWNLOAD "https://github.com/erikas-taroza/audiotags/releases/download/v${Version}/linux.tar.gz" ${LibPath} TLS_VERIFY ON ) endif() if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libaudiotags.so") execute_process( COMMAND ${CMAKE_COMMAND} -E tar -xzf linux.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) endif() # List of absolute paths to libraries that should be bundled with the plugin. # This list could contain prebuilt libraries, or libraries created by an # external build triggered from this build file. set(audiotags_bundled_libraries "${CMAKE_CURRENT_SOURCE_DIR}/libaudiotags.so" PARENT_SCOPE ) ``` -------------------------------- ### Define application executable target Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/linux/CMakeLists.txt Creates the executable target for the Flutter application, applies standard settings, links Flutter and GTK libraries, and adds the Flutter tool build dependency. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Configure Flutter Windows runner with CMake Source: https://github.com/erikas-taroza/audiotags/blob/master/audiotags/example/windows/runner/CMakeLists.txt Defines the Windows runner executable for a Flutter application. Sets the target name from BINARY_NAME, applies standard build settings, adds version preprocessor definitions, disables NOMINMAX, links Flutter libraries, and depends on flutter_assemble. Changing BINARY_NAME here instead of the top-level CMakeLists.txt will break `flutter run`. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Read audio metadata Source: https://github.com/erikas-taroza/audiotags/blob/master/README.md Reads audio metadata from a file at the given path. Returns a Tag object with nullable fields for title, artist, album, etc. Use this to retrieve metadata for display or further processing. ```dart Tag? tag = await AudioTags.read(path); String? title = tag?.title; String? trackArtist = tag?.trackArtist; String? album = tag?.album; String? albumArtist = tag?.albumArtist; String? genre = tag?.genre; int? year = tag?.year; int? trackNumber = tag?.trackNumber; int? trackTotal = tag?.trackTotal; int? discNumber = tag?.discNumber; int? discTotal = tag?.discTotal; int? duration = tag?.duration; List? pictures = tag?.pictures; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.