Марков Сергей Викторович
1 year ago
20 changed files with 282 additions and 11 deletions
@ -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) |
@ -0,0 +1,15 @@
|
||||
#include <argon2_ffi/argon2_ffi_plugin.h> |
||||
#include <flutter/method-channel.h> |
||||
#include <sys/utsname.h> |
||||
|
||||
void Argon2FfiPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
||||
{ |
||||
registrar.RegisterMethodChannel("argon2_ffi", |
||||
MethodCodecType::Standard, |
||||
[this](const MethodCall &call) { this->onMethodCall(call); }); |
||||
} |
||||
|
||||
void Argon2FfiPlugin::onMethodCall(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(nullptr); |
||||
} |
@ -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 ®istrar) override; |
||||
|
||||
private: |
||||
void onMethodCall(const MethodCall &call); |
||||
}; |
||||
|
||||
#endif /* FLUTTER_PLUGIN_ARGON2_FFI_PLUGIN_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 */ |
@ -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) |
@ -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 |
@ -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({ |
||||
}); |
||||
} |
@ -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 */ |
@ -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) |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 6.5 KiB |
@ -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; |
||||
} |
@ -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 |
Loading…
Reference in new issue