-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·39 lines (33 loc) · 1.23 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·39 lines (33 loc) · 1.23 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
#!/bin/bash
echo "Building dynamic c library from Swift code..."
# Run the Swift package commands to build the dynamic c library
swift package clean
swift package update
swift build --configuration release
# Detect the operating system and set the library extension
if [[ "$OSTYPE" == "darwin"* ]]; then
LIBRARY_EXT="dylib"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
LIBRARY_EXT="so"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" ]]; then
SOURCE_LIB=".build/release/LoopAlgorithmToPython.dll"
DEST_LIB="./loop_to_python_api/libLoopAlgorithmToPython.dll"
LIBRARY_EXT="dll"
else
echo "Unsupported operating system: $OSTYPE"
exit 1
fi
## Earlier code commended out
## Copy the library
#if cp .build/release/libLoopAlgorithmToPython.$LIBRARY_EXT ./loop_to_python_api/; then
# echo "Library successfully copied to the loop_to_python_api folder!"
#else
# echo "Failed to copy the library to the loop_to_python_api folder."
#fi
# Copy the library
if cp "$SOURCE_LIB" "$DEST_LIB"; then
echo "Library successfully copied to the loop_to_python_api folder!"
else
echo "Failed to copy the library. Source: $SOURCE_LIB"
ls -la .build/release/*.dll 2>/dev/null || echo "No DLL files found"
fi