File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ def _build_all_extensions_with_cmake(self):
112
112
torch_dir = Path (torch .utils .cmake_prefix_path ) / "Torch"
113
113
cmake_build_type = os .environ .get ("CMAKE_BUILD_TYPE" , "Release" )
114
114
enable_cuda = os .environ .get ("ENABLE_CUDA" , "" )
115
+ torchcodec_disable_compile_warning_as_error = os .environ .get (
116
+ "TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR" , "OFF"
117
+ )
115
118
python_version = sys .version_info
116
119
cmake_args = [
117
120
f"-DCMAKE_INSTALL_PREFIX={ self ._install_prefix } " ,
@@ -120,6 +123,7 @@ def _build_all_extensions_with_cmake(self):
120
123
f"-DCMAKE_BUILD_TYPE={ cmake_build_type } " ,
121
124
f"-DPYTHON_VERSION={ python_version .major } .{ python_version .minor } " ,
122
125
f"-DENABLE_CUDA={ enable_cuda } " ,
126
+ f"-DTORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR={ torchcodec_disable_compile_warning_as_error } " ,
123
127
]
124
128
125
129
Path (self .build_temp ).mkdir (parents = True , exist_ok = True )
Original file line number Diff line number Diff line change @@ -8,7 +8,13 @@ find_package(pybind11 REQUIRED)
8
8
find_package (Torch REQUIRED)
9
9
find_package (Python3 ${PYTHON_VERSION} EXACT COMPONENTS Development)
10
10
11
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Werror ${TORCH_CXX_FLAGS} " )
11
+ if (DEFINED TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR AND TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR)
12
+ set (TORCHCODEC_WERROR_OPTION "" )
13
+ else ()
14
+ set (TORCHCODEC_WERROR_OPTION "-Werror" )
15
+ endif ()
16
+
17
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic ${TORCHCODEC_WERROR_OPTION} ${TORCH_CXX_FLAGS} " )
12
18
13
19
function (make_torchcodec_sublibrary
14
20
library_name
You can’t perform that action at this time.
0 commit comments