From a8ef9bf8fc1f1668548b25f72c7f9af4fa0c1fce Mon Sep 17 00:00:00 2001 From: Losses Don <1384036+Losses@users.noreply.github.com> Date: Fri, 13 Sep 2024 20:22:10 +0800 Subject: [PATCH 1/4] feat: Add elinux to pubspec --- flutter_package/pubspec.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flutter_package/pubspec.yaml b/flutter_package/pubspec.yaml index cbc9ade8..7cb3a393 100644 --- a/flutter_package/pubspec.yaml +++ b/flutter_package/pubspec.yaml @@ -45,6 +45,8 @@ flutter: ffiPlugin: true linux: ffiPlugin: true + elinux: + ffiPlugin: true macos: ffiPlugin: true windows: From d30d90f025b2204a7cc714fcd546f055cb4b0bf5 Mon Sep 17 00:00:00 2001 From: LOSSES Don <1384036+Losses@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:29:04 +0000 Subject: [PATCH 2/4] feat: Add elinux support for packages --- flutter_package/elinux/CMakeLists.txt | 25 +++++++++++++++++++++++++ flutter_package/elinux/rust.cmake | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 flutter_package/elinux/CMakeLists.txt create mode 100644 flutter_package/elinux/rust.cmake diff --git a/flutter_package/elinux/CMakeLists.txt b/flutter_package/elinux/CMakeLists.txt new file mode 100644 index 00000000..61897ca5 --- /dev/null +++ b/flutter_package/elinux/CMakeLists.txt @@ -0,0 +1,25 @@ +# The Flutter tooling requires that developers have CMake 3.10 or later +# installed. You should not increase this version, as doing so will cause +# the plugin to fail to compile for some customers of the plugin. +cmake_minimum_required(VERSION 3.10) + +# Project-level configuration. +set(PROJECT_NAME "rinf") +project(${PROJECT_NAME} LANGUAGES CXX) + +# Invoke the build for native code shared with the other target platforms. +# This can be changed to accommodate different builds. +add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared") + +# 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(rinf_bundled_libraries + # Defined in ../src/CMakeLists.txt. + # This can be changed to accommodate different builds. + $ + PARENT_SCOPE +) + +# Include the CMake build file of the Rust code. +include(./rust.cmake) \ No newline at end of file diff --git a/flutter_package/elinux/rust.cmake b/flutter_package/elinux/rust.cmake new file mode 100644 index 00000000..e4cf45a2 --- /dev/null +++ b/flutter_package/elinux/rust.cmake @@ -0,0 +1,20 @@ +cmake_policy(SET CMP0079 NEW) +apply_standard_settings(${BINARY_NAME}) + +set_target_properties( + ${BINARY_NAME} PROPERTIES + CXX_VISIBILITY_PRESET hidden + BUILD_RPATH_USE_ORIGIN ON +) + +target_compile_definitions(${BINARY_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) +target_link_libraries(${BINARY_NAME} PRIVATE flutter) + +include("../cargokit/cmake/cargokit.cmake") +apply_cargokit(${BINARY_NAME} ${CMAKE_SOURCE_DIR}/../native/hub hub "") + +set( + rinf_bundled_libraries + "${${BINARY_NAME}_cargokit_lib}" + PARENT_SCOPE +) \ No newline at end of file From 65712f9a0a518c6ebd281deb416ffc055f85e2a0 Mon Sep 17 00:00:00 2001 From: LOSSES Don <1384036+Losses@users.noreply.github.com> Date: Sat, 14 Sep 2024 20:12:25 +0800 Subject: [PATCH 3/4] fix: elinux platform not found --- flutter_package/cargokit/build_tool/lib/src/target.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flutter_package/cargokit/build_tool/lib/src/target.dart b/flutter_package/cargokit/build_tool/lib/src/target.dart index 9287b23c..a1f62f92 100644 --- a/flutter_package/cargokit/build_tool/lib/src/target.dart +++ b/flutter_package/cargokit/build_tool/lib/src/target.dart @@ -51,6 +51,10 @@ class Target { rust: 'aarch64-unknown-linux-gnu', flutter: 'linux-arm64', ), + Target( + rust: 'aarch64-unknown-linux-gnu', + flutter: 'elinux-x64', + ), Target( rust: 'x86_64-apple-darwin', darwinPlatform: 'macosx', From cbc7b5fd6d6f9c91e236a51286b5ea2787a7a699 Mon Sep 17 00:00:00 2001 From: Losses Don <1384036+Losses@users.noreply.github.com> Date: Sun, 15 Sep 2024 00:05:08 +0800 Subject: [PATCH 4/4] feat: Add elinux-arm64 --- flutter_package/cargokit/build_tool/lib/src/target.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flutter_package/cargokit/build_tool/lib/src/target.dart b/flutter_package/cargokit/build_tool/lib/src/target.dart index a1f62f92..a7132530 100644 --- a/flutter_package/cargokit/build_tool/lib/src/target.dart +++ b/flutter_package/cargokit/build_tool/lib/src/target.dart @@ -52,9 +52,13 @@ class Target { flutter: 'linux-arm64', ), Target( - rust: 'aarch64-unknown-linux-gnu', + rust: 'x86_64-unknown-linux-gnu', flutter: 'elinux-x64', ), + Target( + rust: 'aarch64-unknown-linux-gnu', + flutter: 'elinux-arm64', + ), Target( rust: 'x86_64-apple-darwin', darwinPlatform: 'macosx',