diff --git a/Dali.Toolkit/Dali.Toolkit.csproj b/Dali.Toolkit/Dali.Toolkit.csproj index 207b449..714d16a 100644 --- a/Dali.Toolkit/Dali.Toolkit.csproj +++ b/Dali.Toolkit/Dali.Toolkit.csproj @@ -4,7 +4,7 @@ Dali Copyright 2018 (c) INSA Rennes. All Right reserved. Éric Anquetil - netstandard2.0 + net8.0 true 1.1.167 1.1.167 diff --git a/Dali.Toolkit/IO/Input.cs b/Dali.Toolkit/IO/Input.cs index c487482..3a67c20 100644 --- a/Dali.Toolkit/IO/Input.cs +++ b/Dali.Toolkit/IO/Input.cs @@ -123,9 +123,9 @@ namespace DALI.ToolKit.IO public event EventHandler DeleteRequested; - //ICommand extract; - //public ICommand Extract - //{ + // ICommand extract; + // public ICommand Extract + // { // get // { // if (extract == null) @@ -146,6 +146,6 @@ namespace DALI.ToolKit.IO // }); // return extract; // } - //} + // } } } diff --git a/MathLib/Math.cs b/MathLib/Math.cs index 98984eb..cf20757 100644 --- a/MathLib/Math.cs +++ b/MathLib/Math.cs @@ -25,5 +25,4 @@ public class Math public float Add(float a, float b) { return a + b; - } -} + } \ No newline at end of file diff --git a/build.sh b/build.sh index ccdd122..dd79cf8 100755 --- a/build.sh +++ b/build.sh @@ -86,45 +86,62 @@ generate_project() { run "beyondnetgen beyondnetgen.android.config.json" } -# Function to build the Android libraries -build_android() { - generate_project +# Generic function to build a project +build_project() { + local platform="$1" + local config_file="$2" + local template_csproj="$3" + local output_dir="$4" + local library_extension="$5" + local abis=("${!6}") - # Copy android_fake_clang.* to generated project - cp android_fake_clang.* "$generated_project_dir/" + cd "$script_dir" + + # Copy template config file + cp "$config_file" "beyondnetgen.$platform.config.json" + replace_project_names "beyondnetgen.$platform.config.json" + + # Generate project + log "Generating $platform project" + run "beyondnetgen beyondnetgen.$platform.config.json" # Copy template csproj - cp template.csproj "$generated_project_dir/$generated_project_name.csproj" + cp "$template_csproj" "$generated_project_dir/$generated_project_name.csproj" replace_project_names "$generated_project_dir/$generated_project_name.csproj" - cd $generated_project_dir + cd "$generated_project_dir" # For each .dll in external folder add it as a reference in the generated project search_dir="$script_dir/external" for entry in "$search_dir"/*; do - dll_name=$(basename $entry) + dll_name=$(basename "$entry") log "Adding reference to $dll_name" # Add reference to the generated project by editing the csproj file # Search for the line # and add a reference to the dll below it sed -i '' "//a \\ - \\ + \\ " "$generated_project_dir/$generated_project_name.csproj" done - declare -A abis - abis["arm64"]="arm64-v8a" - abis["x64"]="x86_64" + if [ "$platform" == "android" ]; then + cp $script_dir/android_fake_clang.* "$generated_project_dir/" + fi # Build for each architecture - for arch in "${!abis[@]}"; do - log "Building Android library for $arch" + for arch in "${abis[@]}"; do + log "Building $platform library for $arch" - run "dotnet publish -r linux-bionic-$arch -v normal -c Release -p:DisableUnsupportedError=true -p:PublishAotUsingRuntimePack=true -p:RemoveSections=true -p:AllowUnsafeBlocks=true $generated_project_name.csproj" + run "dotnet publish -r $arch -v normal -c Release -p:DisableUnsupportedError=true -p:PublishAotUsingRuntimePack=true -p:RemoveSections=true -p:AllowUnsafeBlocks=true $generated_project_name.csproj" # Copy the generated library to the output directory - mkdir -p $output_dir/${abis[$arch]} - cp $generated_project_dir/bin/Release/$output_project_net_spec/linux-bionic-$arch/native/$generated_project_name.so $output_dir/${abis[$arch]}/lib$input_project_name.so + mkdir -p "$output_dir/$arch" + cp $generated_project_dir/bin/Release/$output_project_net_spec/$arch/native/$generated_project_name.$library_extension $output_dir/$arch/$input_project_name.$library_extension + if [ "$platform" == "ios" ]; then + cd $output_dir/$arch + install_name_tool -id "$(pwd)/"$input_project_name.$library_extension"" $input_project_name.$library_extension + cd - + fi done # Copy the generated headers to the output directory @@ -132,25 +149,26 @@ build_android() { cp "$generated_project_dir/Generated.h" "$output_dir/$input_project_name.h" } -# Function to build the iOS libraries +# Definition of specific parameters for each platform +android_config_file="template.beyondnetgen.android.config.json" +ios_config_file="template.beyondnetgen.ios.config.json" +android_template_csproj="template.android.csproj" +ios_template_csproj="template.ios.csproj" +ios_library_extension="dylib" +android_library_extension="so" + +# Definition of architectures for each platform +android_abis=("linux-bionic-arm64" "linux-bionic-x64") +ios_abis=( "osx-x64" "osx-arm64" "ios-arm64" "iossimulator-arm64" "iossimulator-x64") + +# Calling the generic function to build the Android project +build_android() { + build_project "android" "$android_config_file" "$android_template_csproj" "$output_dir" "$android_library_extension" android_abis[@] +} + +# Calling the generic function to build the iOS project build_ios() { - cd $script_dir - - # Copy template beyondnetgen.ios.config.json - cp template.beyondnetgen.ios.config.json beyondnetgen.ios.config.json - replace_project_names beyondnetgen.ios.config.json - - # Generate project - log "Generating iOS project" - run "beyondnetgen beyondnetgen.ios.config.json" - - # Copy $input_project_dir/bin/Release/net8.0/*.xcframework to output directory - log "Copying iOS libraries to output directory" - cp $input_project_dir/bin/Release/$output_project_net_spec/*.xcframework $output_dir - - # Copy the generated headers to the output directory - log "Copying header to output directory" - cp "$generated_project_dir/Generated.h" "$output_dir/$input_project_name.h" + build_project "ios" "$ios_config_file" "$ios_template_csproj" "$output_dir" "$ios_library_extension" ios_abis[@] } generate_flutter() { @@ -175,7 +193,7 @@ generate_flutter() { log "Copying generated files to flutter project" mkdir -p $flutter_project_name/android/app/src/main/jniLibs cp $generated_project_dir/Generated.h $flutter_project_name/Generated.h - cp -r libs/* $flutter_project_name/android/app/src/main/jniLibs/ + cp -r libs/linux* $flutter_project_name/android/app/src/main/jniLibs/ cp ffigen.yaml $flutter_project_name/ffigen.yaml cd $flutter_project_name diff --git a/template.csproj b/template.android.csproj similarity index 100% rename from template.csproj rename to template.android.csproj diff --git a/template.beyondnetgen.ios.config.json b/template.beyondnetgen.ios.config.json index 10bc2b8..0f2b92e 100644 --- a/template.beyondnetgen.ios.config.json +++ b/template.beyondnetgen.ios.config.json @@ -1,8 +1,5 @@ { "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/INPUT_NET_SPEC/INPUT_PROJECT_NAME.dll", "CSharpUnmanagedOutputPath": "GENERATED_PROJECT_NAME/Generated.cs", - "COutputPath": "GENERATED_PROJECT_NAME/Generated.h", - "Build": { - "Target": "apple-universal" - } -} + "COutputPath": "GENERATED_PROJECT_NAME/Generated.h" +} \ No newline at end of file diff --git a/template.ios.csproj b/template.ios.csproj new file mode 100644 index 0000000..ddedf02 --- /dev/null +++ b/template.ios.csproj @@ -0,0 +1,121 @@ + + + + Library + net8.0 + latest + true + true + true + true + true + + true + + + disable + + + + + true + + + + 13.0 + 16.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + <_IsAppleMobileLibraryMode>false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(DefaultItemExcludes);.gitignore;*.sln.DotSettings; + + + + + + + + + + + + + + \ No newline at end of file