macos work

This commit is contained in:
John Smith 2022-01-30 17:47:46 -05:00
parent d3bdd4adc2
commit ccfde9977f
7 changed files with 50 additions and 14 deletions

View File

@ -1,8 +1,8 @@
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CARGO_MANIFEST_PATH=$SCRIPTDIR/Cargo.toml
CARGO_MANIFEST_PATH=$(python -c "import os; print(os.path.realpath(\"$SCRIPTDIR/Cargo.toml\"))")
# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH
if [ "$CONFIGURATION" == "Debug" ]; then
EXTRA_CARGO_OPTIONS="$@"
@ -25,6 +25,8 @@ do
echo Unsupported ARCH: $arch
continue
fi
env -i PATH=/usr/bin:/bin:/usr/local/bin:/opt/homebrew/bin ~/.cargo/bin/cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
HOMEBREW_DIR=$(dirname `which brew`)
CARGO_DIR=$(dirname `which cargo`)
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
done

View File

@ -15,7 +15,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
veilid: 8d01491ca5ee1b58110c98f7778124c3ead89a7c
veilid: fd5957b2b4ff66a1dbeba0433afdce762d21d90c
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c

View File

@ -26,6 +26,7 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
40BAB9F027A74B09000EC229 /* libveilid_flutter.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 40BAB9EF27A74B09000EC229 /* libveilid_flutter.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
8526E2FC060241577E5281A0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E89F2D855D7BDA4933E1A2EC /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
@ -46,6 +47,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
40BAB9F027A74B09000EC229 /* libveilid_flutter.dylib in Bundle Framework */,
);
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
@ -68,6 +70,7 @@
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
40BAB9EF27A74B09000EC229 /* libveilid_flutter.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libveilid_flutter.dylib; path = ../../macos/lib/libveilid_flutter.dylib; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
B8606FB3C4AA619FC22C3115 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
@ -101,6 +104,7 @@
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
40BAB9EF27A74B09000EC229 /* libveilid_flutter.dylib */,
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
@ -159,7 +163,6 @@
233B6A2BBF071AE96501823B /* Pods-Runner.release.xcconfig */,
B8606FB3C4AA619FC22C3115 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};

1
veilid-flutter/macos/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lib

View File

@ -7,11 +7,11 @@ Pod::Spec.new do |s|
s.version = '0.0.1'
s.summary = 'Veilid Network'
s.description = <<-DESC
Veilid Network
Veilid Network Plugin
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.homepage = 'http://veilid.com'
s.license = 'LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)'
s.author = { 'John Smith' => 'jsmith@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'FlutterMacOS'
@ -20,6 +20,26 @@ Veilid Network
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.0'
s.script_phase = { :name => 'Cargo Build', :script => '../rust/macos_build.sh', :execution_position => :before_compile }
s.script_phase = {
:name => 'Cargo Build',
:script => File.join(File.dirname(__dir__), 'rust', 'macos_build.sh'),
:execution_position => :before_compile,
:output_files => [ File.join(File.dirname(__dir__), 'lib', 'libveilid_flutter.dylib') ]
}
# s.prepare_command = <<-CMD
# mkdir -p lib/Release/
# cp /dev/null lib/Release/libveilid_flutter.dylib
# CMD
# require 'json'
# require 'pathname'
# rust_dylib_absolute = File.join(File.dirname(JSON.parse(`cargo locate-project`)['root']), 'target', 'x86_64-apple-darwin', 'release', 'libveilid_flutter.dylib')
# rust_dylib_relative = Pathname.new(rust_dylib_absolute).relative_path_from(Pathname.new(Dir.pwd)).to_s
# require 'pp'
# print 'Rust dylib: '
# pp rust_dylib_relative
# s.vendored_libraries = 'lib/Release/libveilid_flutter.dylib'
# s.libraries = [ 'veilid_flutter' ]
end

View File

@ -1,8 +1,8 @@
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CARGO_MANIFEST_PATH=$SCRIPTDIR/Cargo.toml
CARGO_MANIFEST_PATH=$(python -c "import os; print(os.path.realpath(\"$SCRIPTDIR/Cargo.toml\"))")
# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH
if [ "$CONFIGURATION" == "Debug" ]; then
EXTRA_CARGO_OPTIONS="$@"

View File

@ -1,15 +1,19 @@
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CARGO_MANIFEST_PATH=$SCRIPTDIR/Cargo.toml
CARGO_MANIFEST_PATH=$(python -c "import os; print(os.path.realpath(\"$SCRIPTDIR/Cargo.toml\"))")
TARGET_DIR=$(dirname `cargo locate-project --message-format plain`)/target
# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH
if [ "$CONFIGURATION" == "Debug" ]; then
EXTRA_CARGO_OPTIONS="$@"
RUST_CONFIGURATION="debug"
else
EXTRA_CARGO_OPTIONS="$@ --release"
RUST_CONFIGURATION="release"
fi
ARCHS=${ARCHS:=x86_64}
echo ARCHS: $ARCHS
for arch in $ARCHS
do
if [ "$arch" == "arm64" ]; then
@ -28,5 +32,11 @@ do
HOMEBREW_DIR=$(dirname `which brew`)
CARGO_DIR=$(dirname `which cargo`)
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
# xxx add to lipo list?
done
OUTPUT_DIR=$SCRIPTDIR/../macos/lib
mkdir -p $OUTPUT_DIR
# xxx use lipo library?
cp $TARGET_DIR/x86_64-apple-darwin/$RUST_CONFIGURATION/libveilid_flutter.dylib $OUTPUT_DIR