File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 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):
112112 torch_dir = Path (torch .utils .cmake_prefix_path ) / "Torch"
113113 cmake_build_type = os .environ .get ("CMAKE_BUILD_TYPE" , "Release" )
114114 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+ )
115118 python_version = sys .version_info
116119 cmake_args = [
117120 f"-DCMAKE_INSTALL_PREFIX={ self ._install_prefix } " ,
@@ -120,6 +123,7 @@ def _build_all_extensions_with_cmake(self):
120123 f"-DCMAKE_BUILD_TYPE={ cmake_build_type } " ,
121124 f"-DPYTHON_VERSION={ python_version .major } .{ python_version .minor } " ,
122125 f"-DENABLE_CUDA={ enable_cuda } " ,
126+ f"-DTORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR={ torchcodec_disable_compile_warning_as_error } " ,
123127 ]
124128
125129 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)
88find_package (Torch REQUIRED)
99find_package (Python3 ${PYTHON_VERSION} EXACT COMPONENTS Development)
1010
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} " )
1218
1319function (make_torchcodec_sublibrary
1420 library_name
You can’t perform that action at this time.
0 commit comments