Skip to content

Commit de0311c

Browse files
committed
Correctly set _GLIBCXX_USE_CXX11_ABI pybind compile options
1 parent 2451027 commit de0311c

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

CMakeLists.txt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -716,15 +716,27 @@ if(EXECUTORCH_BUILD_PYBIND)
716716
endif()
717717

718718
# compile options for pybind
719-
set(_pybind_compile_options
720-
-Wno-deprecated-declarations
721-
-fPIC
722-
-frtti
723-
-fexceptions
724-
# libtorch is built with the old ABI, so we need to do the same for any
725-
# .cpp files that include torch, c10, or ATen targets.
726-
-D_GLIBCXX_USE_CXX11_ABI=0
727-
)
719+
if(EXECUTORCH_DO_NOT_USE_CXX11_ABI)
720+
set(_pybind_compile_options
721+
-Wno-deprecated-declarations
722+
-fPIC
723+
-frtti
724+
-fexceptions
725+
# libtorch is built with the old ABI, so we need to do the same for any
726+
# .cpp files that include torch, c10, or ATen targets. Note that PyTorch
727+
# nightly binary is built with _GLIBCXX_USE_CXX11_ABI set to 0 while its
728+
# CI build sets this to 1 (default)
729+
-D_GLIBCXX_USE_CXX11_ABI=0
730+
)
731+
else()
732+
set(_pybind_compile_options
733+
-Wno-deprecated-declarations
734+
-fPIC
735+
-frtti
736+
-fexceptions
737+
)
738+
endif()
739+
728740
# util lib
729741
add_library(
730742
util ${CMAKE_CURRENT_SOURCE_DIR}/extension/evalue_util/print_evalue.cpp

0 commit comments

Comments
 (0)