-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-dotnet-liboqs-macos.sh
More file actions
84 lines (68 loc) · 2.37 KB
/
Copy pathbuild-dotnet-liboqs-macos.sh
File metadata and controls
84 lines (68 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Build liboqs as a shared library for .NET interop on macOS
set -e # Exit on any error
# Default values
CONFIGURATION="${1:-Release}"
OUTPUT_DIR="${2:-./src/native}"
echo "Building liboqs as shared library for .NET on macOS..."
# Get the script directory before changing directories
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Create output directory
mkdir -p "$OUTPUT_DIR"
# Navigate to liboqs source
cd liboqs
# Create build directory
BUILD_DIR="build-dotnet-shared"
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
mkdir "$BUILD_DIR"
cd "$BUILD_DIR"
echo "Configuring CMake for shared library build..."
# Configure with shared library options
cmake .. \
-DCMAKE_BUILD_TYPE="$CONFIGURATION" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DOQS_USE_OPENSSL=OFF \
-DOQS_BUILD_ONLY_LIB=ON \
-DOQS_DIST_BUILD=YES \
-DOQS_PERMIT_UNSUPPORTED_ARCHITECTURE=ON \
-DOQS_ENABLE_KEM_ML_KEM=ON \
-DOQS_ENABLE_KEM_KYBER=ON \
-DOQS_ENABLE_KEM_FRODOKEM=ON \
-DOQS_ENABLE_KEM_BIKE=ON \
-DOQS_ENABLE_KEM_HQC=ON \
-DOQS_ENABLE_KEM_NTRUPRIME=ON \
-DOQS_ENABLE_KEM_CLASSIC_MCELIECE=ON \
-DOQS_ENABLE_SIG_ML_DSA=ON \
-DOQS_ENABLE_SIG_DILITHIUM=ON \
-DOQS_ENABLE_SIG_FALCON=ON \
-DOQS_ENABLE_SIG_SPHINCS=ON \
-DOQS_ENABLE_SIG_MAYO=ON \
-DOQS_ENABLE_SIG_CROSS=ON \
-DOQS_ENABLE_SIG_UOV=ON
echo "Building liboqs..."
cmake --build . --config "$CONFIGURATION"
# Find the built shared library
DYLIB_PATH=$(find . -name "liboqs*.dylib" -type f | head -n 1)
if [ -z "$DYLIB_PATH" ]; then
# Try in lib directory for different build layouts
DYLIB_PATH=$(find lib -name "liboqs*.dylib" -type f 2>/dev/null | head -n 1)
fi
if [ -n "$DYLIB_PATH" ]; then
# Use the script directory calculated at the beginning
TARGET_PATH="$SCRIPT_DIR/$OUTPUT_DIR"
# Ensure target directory exists
mkdir -p "$TARGET_PATH"
# Copy and rename to consistent name liboqs.dylib
cp "$DYLIB_PATH" "$TARGET_PATH/liboqs.dylib"
DYLIB_BASENAME=$(basename "$DYLIB_PATH")
echo "Successfully copied and renamed $DYLIB_BASENAME to liboqs.dylib in $TARGET_PATH"
else
echo "Warning: Could not find liboqs.dylib in build output"
echo "Build contents:"
find . -type f -name "*.dylib*" -o -name "*.so*" -o -name "*.dll" | head -20
fi
echo "Build complete!"