feat: net spec selection

This commit is contained in:
Hugo Pointcheval 2023-11-15 14:34:01 +01:00
parent 5a847408ca
commit 80fdf5bd79
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC
4 changed files with 15 additions and 4 deletions

View File

@ -45,6 +45,7 @@ Options:
--ndk Android NDK path (default: ANDROID_NDK_HOME environment variable)
--no-android Disable Android build (default: false)
--no-ios Disable iOS build (default: false)
--spec Net spec (default: net8.0)
```
## What is this?

View File

@ -26,6 +26,7 @@ help() {
echo " --ndk Android NDK path (default: ANDROID_NDK_HOME environment variable)"
echo " --no-android Disable Android build (default: false)"
echo " --no-ios Disable iOS build (default: false)"
echo " --spec Net spec (default: net8.0)"
}
# Function to log a message to the console and log file
@ -49,6 +50,7 @@ command_exists() {
replace_project_names() {
sed -i '' "s/INPUT_PROJECT_NAME/$input_project_name/g" $1
sed -i '' "s/GENERATED_PROJECT_NAME/$generated_project_name/g" $1
sed -i '' "s/NET_SPEC/$input_project_net_spec/g" $1
}
# Function to ask for confirmation before continuing
@ -94,7 +96,7 @@ build_android() {
# Copy the generated library to the output directory
mkdir -p $output_dir/${abis[$arch]}
cp $generated_project_dir/bin/Release/net8.0/linux-bionic-$arch/native/$generated_project_name.so $output_dir/${abis[$arch]}/lib$input_project_name.so
cp $generated_project_dir/bin/Release/$input_project_net_spec/linux-bionic-$arch/native/$generated_project_name.so $output_dir/${abis[$arch]}/lib$input_project_name.so
done
# Copy the generated headers to the output directory
@ -116,7 +118,7 @@ build_ios() {
# 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/net8.0/*.xcframework $output_dir
cp $input_project_dir/bin/Release/$input_project_net_spec/*.xcframework $output_dir
# Copy the generated headers to the output directory
log "Copying header to output directory"
@ -159,6 +161,10 @@ while [ "$1" != "" ]; do
shift
export ANDROID_NDK_HOME=$1
;;
--spec)
shift
input_project_net_spec=$1
;;
--no-android)
WANT_TO_BUILD_ANDROID=false
;;
@ -186,6 +192,10 @@ if [ -z "$generated_project_name" ]; then
generated_project_name="$input_project_name.Generated"
fi
if [ -z "$input_project_net_spec" ]; then
input_project_net_spec="net8.0"
fi
if [ -z "$output" ]; then
output="libs"
fi

View File

@ -1,5 +1,5 @@
{
"AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/net8.0/INPUT_PROJECT_NAME.dll",
"AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/NET_SPEC/INPUT_PROJECT_NAME.dll",
"CSharpUnmanagedOutputPath": "GENERATED_PROJECT_NAME/Generated.cs",
"COutputPath": "GENERATED_PROJECT_NAME/Generated.h",
"ExcludedTypeNames": [

View File

@ -1,5 +1,5 @@
{
"AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/net8.0/INPUT_PROJECT_NAME.dll",
"AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/NET_SPEC/INPUT_PROJECT_NAME.dll",
"CSharpUnmanagedOutputPath": "GENERATED_PROJECT_NAME/Generated.cs",
"COutputPath": "GENERATED_PROJECT_NAME/Generated.h",
"Build": {