Skip to content

Commit 9573fc2

Browse files
committed
revert previous. Now add Python3_FIND_ABI and explicitly set Python3 as dependency of custom_ops target
1 parent ac8116d commit 9573fc2

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

src/torchcodec/_core/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(PYBIND11_FINDPYTHON ON)
77
find_package(pybind11 REQUIRED)
88
find_package(Torch REQUIRED)
9+
10+
if (WIN32)
11+
set(Python3_FIND_ABI "ANY" "ANY" "ANY" "ANY")
12+
endif()
913
find_package(Python3 ${PYTHON_VERSION} EXACT COMPONENTS Development)
1014

1115
if(DEFINED TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR AND TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR)
@@ -141,6 +145,9 @@ function(make_torchcodec_libraries
141145
${core_library_name}
142146
${Python3_LIBRARIES}
143147
)
148+
if (WIN32)
149+
list(APPEND custom_ops_dependencies Python3::Python)
150+
endif()
144151
make_torchcodec_sublibrary(
145152
"${custom_ops_library_name}"
146153
SHARED

src/torchcodec/_core/ops.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,6 @@
1313
from typing import List, Optional, Tuple, Union
1414

1515
import torch
16-
17-
18-
def _init_dll_path():
19-
"""Initialize DLL search paths for Windows
20-
21-
On Windows Python-3.8+ has `os.add_dll_directory` call,
22-
which is called to configure dll search path.
23-
To find FFmpeg and other dependent dlls we need to make sure the
24-
conda environment/bin path and other system paths are configured.
25-
"""
26-
if os.name == "nt":
27-
for path in os.environ.get("PATH", "").split(";"):
28-
if os.path.exists(path):
29-
try:
30-
os.add_dll_directory(path)
31-
except Exception:
32-
# Ignore paths that can't be added
33-
pass
34-
35-
36-
# Initialize DLL paths on Windows before attempting to load libraries
37-
if os.name == "nt":
38-
_init_dll_path()
3916
from torch.library import get_ctx, register_fake
4017

4118
from torchcodec._internally_replaced_utils import ( # @manual=//pytorch/torchcodec/src:internally_replaced_utils

0 commit comments

Comments
 (0)