Skip to content

Commit de8827b

Browse files
committed
Fixing the build error
1 parent 3f77fe0 commit de8827b

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,16 @@ jobs:
6464
:: 1. Load the Visual Studio tools
6565
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
6666
67-
:: 2. Point to your specific DLL folder
68-
:: Note the backslashes for Windows pathing
67+
:: 2. Set Paths
6968
set "PATH=%GITHUB_WORKSPACE%\loop_to_python_api\dlibs\windows;%PATH%"
70-
71-
:: 3. Define the Swift SDK location
7269
set "SDKROOT=C:\Users\runneradmin\AppData\Local\Programs\Swift\Platforms\5.10.1\Windows.platform\Developer\SDKs\Windows.sdk"
7370
74-
:: 4. Verify we can see the DLLs (optional debug step)
75-
dir "%GITHUB_WORKSPACE%\loop_to_python_api\dlibs\windows"
71+
:: 3. Run Build with VERBOSE flag to see exactly why it's skipping
72+
echo Starting Fresh Swift Build...
73+
swift build -c release -v
7674
77-
:: 5. Run the build
78-
bash ./build.sh
75+
:: 4. Verify build output
76+
dir /s .build\*.dll
7977
8078
- name: Verify library was built
8179
shell: bash

build.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
echo "Building dynamic c library from Swift code..."
44

55
# 1. Clean and Build
6+
# Using -v (verbose) is critical for debugging why it's silent
67
swift package clean
78
swift package update
89
echo "Building Swift package..."
9-
swift build --configuration release --verbose
10+
swift build --configuration release -v
1011

1112
echo "Build completed. Locating artifacts..."
1213

@@ -15,33 +16,46 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
1516
echo "Detected macOS system..."
1617
OS_DIR="macos"
1718
EXT="dylib"
19+
PREFIX="lib"
1820
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OS" == "Windows_NT" ]]; then
1921
echo "Detected Windows system..."
2022
OS_DIR="windows"
2123
EXT="dll"
24+
PREFIX="" # Windows often drops the 'lib' prefix
2225
else
2326
echo "Detected Linux system..."
2427
OS_DIR="linux"
2528
EXT="so"
29+
PREFIX="lib"
2630
fi
2731

2832
# 3. DYNAMIC SEARCH
29-
# We search the whole .build folder because Windows/Linux use subfolders
30-
# like .build/x86_64-unknown-windows-msvc/release/
31-
echo "Searching for *LoopAlgorithmToPython.$EXT in .build directory..."
32-
SOURCE_LIB=$(find .build -name "*LoopAlgorithmToPython.$EXT" | grep -i "release" | head -n 1)
33+
echo "Searching for LoopAlgorithmToPython.$EXT in .build directory..."
34+
35+
# Try searching for both 'libLoopAlgorithmToPython' and 'LoopAlgorithmToPython'
36+
# We use -iname to ignore case and look specifically for the release folder
37+
SOURCE_LIB=$(find .build -type f \( -iname "libLoopAlgorithmToPython.$EXT" -o -iname "LoopAlgorithmToPython.$EXT" \) | grep -i "release" | head -n 1)
38+
39+
# If find fails, let's try a direct path check for the standard Windows output location
40+
if [ -z "$SOURCE_LIB" ]; then
41+
DIRECT_WIN_PATH=".build/x86_64-unknown-windows-msvc/release/LoopAlgorithmToPython.dll"
42+
if [ -f "$DIRECT_WIN_PATH" ]; then
43+
SOURCE_LIB="$DIRECT_WIN_PATH"
44+
fi
45+
fi
3346

3447
if [ -z "$SOURCE_LIB" ] || [ ! -f "$SOURCE_LIB" ]; then
3548
echo "ERROR: Could not find the compiled library!"
36-
echo "Check the Swift compiler logs above for errors."
49+
echo "Debugging: Current directory structure in .build:"
50+
ls -R .build 2>/dev/null | head -n 20
3751
exit 1
3852
fi
3953

4054
echo "Found library at: $SOURCE_LIB"
4155

4256
# 4. Prepare Destination
4357
DEST_DIR="./loop_to_python_api/dlibs/$OS_DIR"
44-
# On Windows, we ensure the output follows the 'lib...' naming convention for your Python API
58+
# We force the destination name to 'libLoopAlgorithmToPython.dll' so your Python code remains consistent
4559
DEST_LIB="$DEST_DIR/libLoopAlgorithmToPython.$EXT"
4660

4761
mkdir -p "$DEST_DIR"

0 commit comments

Comments
 (0)