### Setup Flutter Project Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Navigate to the Flutter example directory, fetch dependencies, and run the application on iOS. ```bash cd examples/flutter flutter pub get flutter run -d ios ``` -------------------------------- ### Install Native iOS Dependencies Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Navigate to the iOS example directory and install CocoaPods dependencies. ```bash cd examples/ios pod install open NativeKLineExample.xcworkspace ``` -------------------------------- ### Setup Flutter Project for Android Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Navigate to the Flutter example directory, fetch dependencies, and run the application on Android. ```bash cd examples/flutter flutter pub get flutter run -d android ``` -------------------------------- ### Install Native Android Dependencies Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Navigate to the Android example directory and build the debug version of the application. ```bash cd examples/android ./gradlew installDebug ``` -------------------------------- ### Installation Configuration Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Configures the installation process, setting the install prefix to a bundle directory and ensuring a clean build bundle on each 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) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Install React Native KLine View (Git) Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Install the library directly from its GitHub repository using Yarn. After installation, run `pod install` for iOS. ```bash yarn add native-kline-view@https://github.com/hellohublot/native-kline-view.git ``` ```bash cd ios && pod install ``` -------------------------------- ### Install Application Executable Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Installs the main application executable to the specified runtime destination. This makes the executable available after the build process. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Library Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Installs the main Flutter library file to the root of the application bundle's installation directory. This is a core component for Flutter applications. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Application Components Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Installs the main executable, ICU data file, Flutter library, bundled plugin libraries, and native assets into the designated bundle directories. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Installs the Flutter assets directory, ensuring it's cleared and re-copied on each build to prevent stale files. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library on non-Debug builds. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Set Installation Prefix for Runtime Components Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Configures the installation prefix to be next to the executable for runtime components. This allows the application to run directly from the build directory, especially useful for Visual Studio. ```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 Bundled Plugin Libraries Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Installs any bundled native libraries associated with plugins to the application bundle. This ensures that plugins have their required native dependencies. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install AOT Library for Release/Profile Builds Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library only for 'Profile' and 'Release' build configurations. This optimizes performance for non-debug builds. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Native Assets Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Installs native assets provided by the build.dart script into the application bundle. These assets are typically required 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) ``` -------------------------------- ### Install ICU Data File Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Installs the ICU data file to the data directory of the application bundle. This file is necessary for internationalization and localization. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Native iOS KLine View Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Integrate the Native KLine View library into your iOS project using CocoaPods. You can specify the podspec URL for remote installation or a local path if you have a cloned repository. ```ruby pod 'NativeKLineView', :podspec => 'https://raw.githubusercontent.com/hellohublot/native-kline-view/main/ios/NativeKLineView.podspec' ``` ```ruby pod 'NativeKLineView', :path => '../native-kline-view/ios' ``` -------------------------------- ### Configure Flutter Library and Dependencies Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/flutter/CMakeLists.txt Finds required system libraries (GTK, GLIB, GIO) using PkgConfig and sets up the Flutter library path and headers. This is essential for linking the Flutter engine and its components. ```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) 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) ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/runner/CMakeLists.txt Applies a predefined set of standard build settings to the application target. This can be customized for applications requiring different build configurations. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/runner/CMakeLists.txt Applies a predefined set of build settings to the application target. This can be removed if custom build configurations are required. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Project and Build Configuration Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Sets the minimum CMake version, project name, executable name, and application ID. It also configures build type and standard compilation settings. ```cmake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) set(BINARY_NAME "flutter_example") set(APPLICATION_ID "com.example.flutter_example") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 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() 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() ``` -------------------------------- ### Flutter Tool Backend Custom Command Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Sets up a custom command to execute the Flutter tool backend script. It defines output files and uses environment variables to run the script, generating necessary build artifacts. ```cmake # _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 ) ``` -------------------------------- ### Flutter and System Dependencies Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Includes Flutter's managed libraries and finds system-level GTK dependencies using PkgConfig. ```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) ``` -------------------------------- ### Enable Unicode Support Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Adds preprocessor definitions to enable Unicode support in the project. This is crucial for handling international characters correctly. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Include Generated Plugins Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Includes the CMake script that manages the building and integration of generated plugins. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Add Include Directories Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/runner/CMakeLists.txt Specifies include directories for the application's build process. The source directory is added for general access. ```cmake target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Link Dependencies and Include Directories Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/runner/CMakeLists.txt Specifies the libraries and include directories required for the application. This includes Flutter's core libraries and Windows-specific system libraries. ```cmake # Add dependency libraries and include directories. Add any application-specific # dependencies here. 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}") ``` -------------------------------- ### Configure Build Types for Multi-Config Generators Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Sets the available build configurations (Debug, Profile, Release) for multi-configuration generators like Visual Studio. This ensures consistent build options across different build types. ```cmake set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) ``` -------------------------------- ### Configure C++ Wrapper Library for Plugins Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Defines a static C++ wrapper library for plugins, including core and plugin-specific sources. It applies standard settings, sets properties for position-independent code and visibility, links against the Flutter library, and sets include directories. ```cmake 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}/") # 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) ``` -------------------------------- ### Link Dependency Libraries Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/runner/CMakeLists.txt Links the necessary libraries for the application. Add any application-specific dependencies here. This includes the core Flutter library and GTK for Linux integration. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### Executable Output Directory Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/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" ) ``` -------------------------------- ### Application Build and Dependencies Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Adds the runner subdirectory for application-specific build rules and ensures the main binary depends on the Flutter assembly. ```cmake add_subdirectory("runner") add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Configure Flutter Library and Headers Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Defines the Flutter library path, ICU data file, project build directory, and AOT library path. It also lists and prepends the Flutter library headers. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 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}/") ``` -------------------------------- ### Define List Prepend Function for CMake < 3.10 Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/flutter/CMakeLists.txt Defines a custom function 'list_prepend' to add a prefix to each element of a list, as the 'list(TRANSFORM ... PREPEND ...)' command 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() ``` -------------------------------- ### Configure C++ Wrapper Library for Runner Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Defines a static C++ wrapper library for the runner application, including core and app-specific sources. It applies standard settings, links against the Flutter library, and sets include directories. ```cmake 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 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) ``` -------------------------------- ### Define Profile Build Mode Linker and Compiler Flags Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Sets linker and compiler flags for the 'Profile' build mode, typically mirroring the 'Release' mode settings. This ensures consistent performance optimizations for profiling. ```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}") ``` -------------------------------- ### Add Preprocessor Definitions for Build Version Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/runner/CMakeLists.txt Sets preprocessor definitions to embed Flutter version information directly into the build. This allows the application to access version details at compile time. ```cmake # 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}") ``` -------------------------------- ### Add Flutter KLine View Dependency Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Add the Flutter plugin to your `pubspec.yaml` file, specifying the Git repository and path. For iOS, ensure the native pod is correctly linked in your Podfile. ```yaml dependencies: native_kline_view: git: url: https://github.com/hellohublot/native-kline-view.git path: flutter/native_kline_view ``` ```ruby pod 'NativeKLineView', :path => '../../../ios' ``` ```ruby pod 'NativeKLineView', :podspec => 'https://raw.githubusercontent.com/hellohublot/native-kline-view/main/ios/NativeKLineView.podspec' ``` -------------------------------- ### Apply Standard Compilation Settings Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt A CMake function to apply common compilation settings to a target, including C++ standard, warning levels, exception handling, and debug definitions. Use with caution as plugins might use this by default. ```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() ``` -------------------------------- ### Include Runner Application Build Rules Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Includes the CMake build rules for the runner application. This is typically located in a 'runner' subdirectory. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Custom Command for Flutter Tool Backend Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/flutter/CMakeLists.txt Defines a custom command to execute the Flutter tool backend script. This command is triggered to generate necessary build artifacts like the Flutter library and headers, using environment variables and build configurations. ```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} ) ``` -------------------------------- ### Define Executable Target Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/runner/CMakeLists.txt Defines the main executable for the Linux application. Ensure BINARY_NAME is consistent with the top-level CMakeLists.txt for `flutter run` to function correctly. Add any new source files to this list. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) ``` -------------------------------- ### Define Flutter Interface Library Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Creates an INTERFACE library for Flutter, setting include directories and linking the Flutter library. It also adds a dependency on flutter_assemble. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Opt-in to Modern CMake Behaviors Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Explicitly enables modern CMake behaviors to prevent warnings in newer CMake versions. This ensures compatibility and adherence to current CMake standards. ```cmake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Add Application ID Preprocessor Definition Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/runner/CMakeLists.txt Adds a preprocessor definition for the application ID, making it available during compilation. ```cmake add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Specifies the minimum required CMake version and defines the project name for the C++ executable. ```cmake cmake_minimum_required(VERSION 3.14) project(flutter_example LANGUAGES CXX) ``` -------------------------------- ### Set Executable Binary Name Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Defines the on-disk name for the application's executable. This can be modified to change the application's file name. ```cmake set(BINARY_NAME "flutter_example") ``` -------------------------------- ### Define Application Executable Target Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/runner/CMakeLists.txt Defines the main executable target for the Windows runner. The binary name is typically set in the top-level CMakeLists.txt to ensure `flutter run` compatibility. ```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 Standard Compilation Settings Function Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/CMakeLists.txt Defines a function to apply common compilation features and options to targets, including C++ standard, warning levels, 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() ``` -------------------------------- ### Add Flutter Assemble Dependency Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/runner/CMakeLists.txt Ensures that the Flutter tool's assembly process is completed before the application target is built. This is a mandatory step for Flutter projects. ```cmake # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Define Flutter Library Interface Target Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/linux/flutter/CMakeLists.txt Creates an interface library target named 'flutter' and configures its include directories and link libraries. This allows other targets to easily depend on the Flutter library. ```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) ``` -------------------------------- ### Add Native Android KLine View Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Include the Native KLine View library in your Android project by adding it as a submodule or cloned directory and configuring your Gradle files. The XML layout includes the custom view for rendering. ```bash git submodule add https://github.com/hellohublot/native-kline-view.git ``` ```gradle // settings.gradle include(":native-kline-view") project(":native-kline-view").projectDir = new File(rootDir, "../native-kline-view/android") ``` ```gradle // app/build.gradle implementation project(":native-kline-view") ``` ```xml ``` -------------------------------- ### Flutter KLine View Usage Source: https://github.com/hellohublot/native-kline-view/blob/main/README.md Instantiate the `NativeKLineView` widget in your Flutter application, providing configuration options and callback handlers for drawing events. ```dart NativeKLineView( optionList: optionListJson, onDrawItemDidTouch: (payload) {}, onDrawItemComplete: () {}, onDrawPointComplete: (count) {}, ) ``` -------------------------------- ### Set Flutter Target Platform Fallback Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Sets a fallback value for FLUTTER_TARGET_PLATFORM if it's not already defined, ensuring a default platform configuration. ```cmake if (NOT DEFINED FLUTTER_TARGET_PLATFORM) set(FLUTTER_TARGET_PLATFORM "windows-x64") endif() ``` -------------------------------- ### Include Flutter Managed Directory Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Adds the Flutter managed directory as a subdirectory to the CMake project. This allows CMake to process the Flutter build rules. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Set Default Build Type if Not Specified Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/CMakeLists.txt Sets the default build type to 'Debug' if it's not already defined and no other build types are specified. This ensures a default build mode is always active. ```cmake set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") ``` -------------------------------- ### Flutter Assemble Custom Target Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/flutter/CMakeLists.txt Defines a custom target 'flutter_assemble' that depends on the generated Flutter library, headers, and wrapper sources. This target ensures these components are built when needed. ```cmake add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Disable Conflicting Windows Macros Source: https://github.com/hellohublot/native-kline-view/blob/main/examples/flutter/windows/runner/CMakeLists.txt Disables Windows-specific macros like NOMINMAX that can conflict with standard C++ library functions, preventing potential compilation errors. ```cmake # Disable Windows macros that collide with C++ standard library functions. 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.