File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -300,21 +300,24 @@ function(_pybind11_generate_lto target prefer_thin_lto)
300300 set (cxx_append ";-fno-fat-lto-objects" )
301301 endif ()
302302
303- if (CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le" OR CMAKE_SYSTEM_PROCESSOR MATCHES "mips64" )
304- set (NO_FLTO_ARCH TRUE )
303+ if (prefer_thin_lto )
304+ set (thin "=thin" )
305305 else ()
306- set (NO_FLTO_ARCH FALSE )
306+ set (thin "" )
307307 endif ()
308308
309- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang"
310- AND prefer_thin_lto
311- AND NOT NO_FLTO_ARCH)
309+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le" OR CMAKE_SYSTEM_PROCESSOR MATCHES "mips64" )
310+ # Do nothing
311+ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES emscripten)
312+ # This compile is very costly when cross-compiling, so set this without checking
313+ set (PYBIND11_LTO_CXX_FLAGS "-flto${thin}${cxx_append} " )
314+ set (PYBIND11_LTO_LINKER_FLAGS "-flto${thin}${linker_append} " )
315+ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
312316 _pybind11_return_if_cxx_and_linker_flags_work(
313- HAS_FLTO_THIN "-flto= thin${cxx_append} " "-flto=thin${linker_append} "
317+ HAS_FLTO_THIN "-flto${ thin} ${cxx_append} " "-flto=${ thin} ${linker_append} "
314318 PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
315319 endif ()
316-
317- if (NOT HAS_FLTO_THIN AND NOT NO_FLTO_ARCH)
320+ if (NOT HAS_FLTO_THIN)
318321 _pybind11_return_if_cxx_and_linker_flags_work(
319322 HAS_FLTO "-flto${cxx_append} " "-flto${linker_append} " PYBIND11_LTO_CXX_FLAGS
320323 PYBIND11_LTO_LINKER_FLAGS)
You can’t perform that action at this time.
0 commit comments