Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement experimental elinux support #435

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions flutter_package/cargokit/build_tool/lib/src/target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class Target {
rust: 'aarch64-unknown-linux-gnu',
flutter: 'linux-arm64',
),
Target(
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',
Expand Down
25 changes: 25 additions & 0 deletions flutter_package/elinux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
$<TARGET_FILE:rinf>
PARENT_SCOPE
)

# Include the CMake build file of the Rust code.
include(./rust.cmake)
20 changes: 20 additions & 0 deletions flutter_package/elinux/rust.cmake
Original file line number Diff line number Diff line change
@@ -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
)
2 changes: 2 additions & 0 deletions flutter_package/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ flutter:
ffiPlugin: true
linux:
ffiPlugin: true
elinux:
ffiPlugin: true
macos:
ffiPlugin: true
windows:
Expand Down