Browse Source

add aurora platform

master
Марков Сергей Викторович 1 year ago
parent
commit
beb48b1f84
  1. 39
      .metadata
  2. 35
      aurora/CMakeLists.txt
  3. 15
      aurora/argon2_ffi_plugin.cpp
  4. 16
      aurora/include/argon2_ffi/argon2_ffi_plugin.h
  5. 10
      aurora/include/argon2_ffi/globals.h
  6. 1
      example/aurora/.gitignore
  7. 47
      example/aurora/CMakeLists.txt
  8. 12
      example/aurora/desktop/com.example.argon2_ffi_example.desktop
  9. 14
      example/aurora/flutter/generated_plugin_registrant.cpp
  10. 12
      example/aurora/flutter/generated_plugin_registrant.h
  11. 32
      example/aurora/flutter/generated_plugins.cmake
  12. BIN
      example/aurora/icons/108x108.png
  13. BIN
      example/aurora/icons/128x128.png
  14. BIN
      example/aurora/icons/172x172.png
  15. BIN
      example/aurora/icons/86x86.png
  16. 9
      example/aurora/main.cpp
  17. 31
      example/aurora/rpm/com.example.argon2_ffi_example.spec
  18. 10
      example/pubspec.lock
  19. 8
      pubspec.lock
  20. 2
      pubspec.yaml

39
.metadata

@ -4,7 +4,42 @@
# This file should be version controlled and should not be manually edited. # This file should be version controlled and should not be manually edited.
version: version:
revision: 67826bdce54505760fe83b7ead70bdb5af6fe9f2 revision: "2828ddd9a707d09af00b793a42faaa0f0e2b957f"
channel: dev channel: "master"
project_type: plugin project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: android
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: ios
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: linux
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: aurora
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: macos
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
- platform: windows
create_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
base_revision: 2828ddd9a707d09af00b793a42faaa0f0e2b957f
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

35
aurora/CMakeLists.txt

@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME argon2_ffi)
set(PLUGIN_NAME ${PROJECT_NAME}_platform_plugin)
project(${PROJECT_NAME} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
find_package(PkgConfig REQUIRED)
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder)
add_library(${PLUGIN_NAME} SHARED
argon2_ffi_plugin.cpp
../ios/Classes/argon2_ffi.c
../ios/Classes/argon2src/argon2.c
../ios/Classes/argon2src/core.c
../ios/Classes/argon2src/encoding.c
../ios/Classes/argon2src/genkat.c
../ios/Classes/argon2src/ref.c
../ios/Classes/argon2src/thread.c
../ios/Classes/argon2src/blake2/blake2b.c
)
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder)
target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL)

15
aurora/argon2_ffi_plugin.cpp

@ -0,0 +1,15 @@
#include <argon2_ffi/argon2_ffi_plugin.h>
#include <flutter/method-channel.h>
#include <sys/utsname.h>
void Argon2FfiPlugin::RegisterWithRegistrar(PluginRegistrar &registrar)
{
registrar.RegisterMethodChannel("argon2_ffi",
MethodCodecType::Standard,
[this](const MethodCall &call) { this->onMethodCall(call); });
}
void Argon2FfiPlugin::onMethodCall(const MethodCall &call)
{
call.SendSuccessResponse(nullptr);
}

16
aurora/include/argon2_ffi/argon2_ffi_plugin.h

@ -0,0 +1,16 @@
#ifndef FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_H
#define FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_H
#include <flutter/plugin-interface.h>
#include <argon2_ffi/globals.h>
class PLUGIN_EXPORT Argon2FfiPlugin final : public PluginInterface
{
public:
void RegisterWithRegistrar(PluginRegistrar &registrar) override;
private:
void onMethodCall(const MethodCall &call);
};
#endif /* FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_H */

10
aurora/include/argon2_ffi/globals.h

@ -0,0 +1,10 @@
#ifndef FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_GLOBALS_H
#define FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_GLOBALS_H
#ifdef PLUGIN_IMPL
#define PLUGIN_EXPORT __attribute__((visibility("default")))
#else
#define PLUGIN_EXPORT
#endif
#endif /* FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_GLOBALS_H */

1
example/aurora/.gitignore vendored

@ -0,0 +1 @@
flutter/ephemeral

47
example/aurora/CMakeLists.txt

@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.10)
project(com.example.argon2_ffi_example LANGUAGES CXX)
include(GNUInstallDirs)
set(BINARY_NAME ${CMAKE_PROJECT_NAME})
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_SKIP_RPATH OFF)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib")
find_package(PkgConfig REQUIRED)
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder)
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder)
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR})
include(flutter/generated_plugins.cmake)
set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor)
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so
${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so)
install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR})
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR})
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172)
install(FILES icons/${ICONS_SIZE}.png
RENAME ${BINARY_NAME}.png
DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/)
endforeach(ICONS_SIZE)

12
example/aurora/desktop/com.example.argon2_ffi_example.desktop

@ -0,0 +1,12 @@
[Desktop Entry]
Type=Application
Name=argon2_ffi_example
Comment=Demonstrates how to use the argon2_ffi plugin.
Icon=com.example.argon2_ffi_example
Exec=/usr/bin/com.example.argon2_ffi_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=
OrganizationName=com.example
ApplicationName=argon2_ffi_example

14
example/aurora/flutter/generated_plugin_registrant.cpp

@ -0,0 +1,14 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include <flutter/application.h>
#include "generated_plugin_registrant.h"
void RegisterPlugins() {
Application::RegisterPlugins({
});
}

12
example/aurora/flutter/generated_plugin_registrant.h

@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT
#define GENERATED_PLUGIN_REGISTRANT
void RegisterPlugins();
#endif /* GENERATED_PLUGIN_REGISTRANT */

32
example/aurora/flutter/generated_plugins.cmake

@ -0,0 +1,32 @@
#
# Generated file, do not edit.
#
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}")
function(add_library TARGET)
_add_library(${TARGET} ${ARGN})
if (
FALSE
)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"$<TARGET_FILE:${TARGET}>"
"${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>")
endif()
endfunction()
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN})
target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin)
endforeach(PLUGIN)
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN})
endforeach(FFI_PLUGIN)

BIN
example/aurora/icons/108x108.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
example/aurora/icons/128x128.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
example/aurora/icons/172x172.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
example/aurora/icons/86x86.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

9
example/aurora/main.cpp

@ -0,0 +1,9 @@
#include <flutter/application.h>
#include "generated_plugin_registrant.h"
int main(int argc, char *argv[]) {
Application::Initialize(argc, argv);
RegisterPlugins();
Application::Launch();
return 0;
}

31
example/aurora/rpm/com.example.argon2_ffi_example.spec

@ -0,0 +1,31 @@
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$
Name: com.example.argon2_ffi_example
Summary: Demonstrates how to use the argon2_ffi plugin.
Version: 0.1.0
Release: 1
License: Proprietary
Source0: %{name}-%{version}.tar.zst
BuildRequires: cmake
BuildRequires: pkgconfig(flutter-embedder)
%description
%{summary}.
%prep
%autosetup
%build
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type}
%make_build
%install
%make_install
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png

10
example/pubspec.lock

@ -7,7 +7,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.0.0" version: "1.0.0+1"
argon2_ffi_base: argon2_ffi_base:
dependency: "direct main" dependency: "direct main"
description: description:
@ -68,10 +68,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
sha256: d97fffd9d86f3dccc7a9059128b468a99320c69007cc9d41a3a1bda07d4e86dc sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "2.1.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -86,10 +86,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: logging name: logging
sha256: "3730d4c02b0c2d1db80ef9904e27fa796d75474f572a70011e0e616ee6bfc0ff" sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.2.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

8
pubspec.lock

@ -61,10 +61,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
sha256: d97fffd9d86f3dccc7a9059128b468a99320c69007cc9d41a3a1bda07d4e86dc sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "2.1.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -79,10 +79,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: logging name: logging
sha256: "3730d4c02b0c2d1db80ef9904e27fa796d75474f572a70011e0e616ee6bfc0ff" sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.2.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

2
pubspec.yaml

@ -37,6 +37,8 @@ flutter:
android: android:
package: com.example.argon2_ffi package: com.example.argon2_ffi
pluginClass: Argon2FfiPlugin pluginClass: Argon2FfiPlugin
aurora:
pluginClass: Argon2FfiPlugin
ios: ios:
pluginClass: Argon2FfiPlugin pluginClass: Argon2FfiPlugin
macos: macos:

Loading…
Cancel
Save