@@ -144,59 +144,42 @@ jobs:
144144 python -m pip install --upgrade pip
145145 python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
146146
147- - name : Create Windows build script
148- run : |
149- # Create a build script that sets up the VS environment and runs the build
150- cat > build_with_vs.bat << 'EOF'
151- @echo off
152-
153- :: Get conda environment info
154- for /f "tokens=*" %%i in ('conda info --base') do set CONDA_BASE=%%i
155- set CONDA_ENV_PATH=%CONDA_BASE%\envs\build
156- set LIBRARY_LIB_PATH=%CONDA_ENV_PATH%\Library\lib
157- set LIBRARY_BIN_PATH=%CONDA_ENV_PATH%\Library\bin
158- set LIBRARY_INCLUDE_PATH=%CONDA_ENV_PATH%\Library\include
159-
160- :: Add conda Library/bin to PATH for DLL loading
161- set PATH=%LIBRARY_BIN_PATH%;%PATH%
162-
163- :: Set PKG_CONFIG_PATH
164- set PKG_CONFIG_PATH=%CONDA_ENV_PATH%\Library\lib\pkgconfig
165-
166- :: Set additional paths for the linker
167- set LIB=%LIBRARY_LIB_PATH%;%LIB%
168- set LIBPATH=%LIBRARY_LIB_PATH%;%LIBPATH%
169- set INCLUDE=%LIBRARY_INCLUDE_PATH%;%INCLUDE%
170-
171- :: Set CMAKE_ARGS with more comprehensive settings
172- set CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Release -DTORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_LIBRARY_PATH=%LIBRARY_LIB_PATH% -DCMAKE_INCLUDE_PATH=%LIBRARY_INCLUDE_PATH% -DCMAKE_PREFIX_PATH=%LIBRARY_LIB_PATH%;%LIBRARY_INCLUDE_PATH% -DCMAKE_VERBOSE_MAKEFILE=ON
173-
174- echo Building with CMAKE_ARGS: %CMAKE_ARGS%
175- echo LIB path: %LIB%
176- echo PKG_CONFIG_PATH: %PKG_CONFIG_PATH%
177- echo PATH (first few entries):
178- echo %PATH% | cut -d; -f1-3
179-
180- :: Debug: Show what libraries are available
181- echo Available .lib files in conda lib directory:
182- dir "%LIBRARY_LIB_PATH%\*.lib" 2>nul || echo No .lib files found
183-
184- :: Debug: Test pkg-config within the script
185- echo Testing pkg-config from within build script:
186- pkg-config --exists libavcodec && echo libavcodec found || echo libavcodec NOT found
187-
188- :: Use vc_env_helper.bat to set up VS environment and build
189- call packaging\vc_env_helper.bat python -m pip install -e . --no-build-isolation -v
190- EOF
191-
192- - name : Verify Visual Studio environment and build
193- shell : cmd
147+ - name : Setup Visual Studio environment
148+ uses : ilammy/msvc-dev-cmd@v1
149+ with :
150+ arch : x64
151+
152+ - name : Build torchcodec from source
194153 run : |
195- echo Checking Visual Studio installation...
196- call packaging\vc_env_helper.bat echo Visual Studio environment setup complete
154+ # Build without BUILD_AGAINST_ALL_FFMPEG_FROM_S3 to use system FFmpeg
155+ echo "Building torchcodec from source using system FFmpeg..."
156+
157+ # Verify that torch is available
158+ python -c "import torch; print('PyTorch found:', torch.__version__)"
159+
160+ # Set up environment variables for the build
161+ conda_env_path=$(conda info --base)/envs/build
162+ library_lib_path="$conda_env_path/Library/lib"
163+ library_bin_path="$conda_env_path/Library/bin"
164+ library_include_path="$conda_env_path/Library/include"
165+
166+ # Set CMAKE_ARGS with proper library paths
167+ export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DTORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_LIBRARY_PATH=$library_lib_path -DCMAKE_INCLUDE_PATH=$library_include_path -DCMAKE_PREFIX_PATH=$library_lib_path;$library_include_path -DCMAKE_VERBOSE_MAKEFILE=ON"
168+
169+ echo "CMAKE_ARGS: $CMAKE_ARGS"
170+ echo "Python executable: $(which python)"
171+ echo "Conda environment: $CONDA_PREFIX"
172+
173+ # Debug: Show what libraries are available
174+ echo "Available .lib files in conda lib directory:"
175+ ls -la "$library_lib_path"/*.lib 2>/dev/null || echo "No .lib files found"
176+
177+ # Debug: Test that torch is still available
178+ echo "Testing PyTorch availability:"
179+ python -c "import torch; print('PyTorch version:', torch.__version__)"
197180
198- echo Running build with Visual Studio environment...
199- call build_with_vs.bat
181+ # Build using pip install with the current conda environment
182+ python -m pip install -e . --no-build-isolation -v
200183
201184 - name : Test torchcodec import
202185 run : |
0 commit comments