Skip to content

Commit 09db644

Browse files
mablanchardpre-commit-ci[bot]rwgk
authored
IPO/LTO support for ICX (IntelLLVM) compiler (#4402)
* IPO/LTO support for ICX (IntelLLVM) compiler #4080 * style: pre-commit fixes * Add WARNING/HELP WANTED comment. Co-authored-by: Martin Blanchard <martin.blanchard@siemens.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
1 parent ece1206 commit 09db644

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/pybind11Common.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ function(_pybind11_generate_lto target prefer_thin_lto)
311311
HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}" PYBIND11_LTO_CXX_FLAGS
312312
PYBIND11_LTO_LINKER_FLAGS)
313313
endif()
314+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
315+
# IntelLLVM equivalent to LTO is called IPO; also IntelLLVM is WIN32/UNIX
316+
# WARNING/HELP WANTED: This block of code is currently not covered by pybind11 GitHub Actions!
317+
if(WIN32)
318+
_pybind11_return_if_cxx_and_linker_flags_work(
319+
HAS_INTEL_IPO "-Qipo" "-Qipo" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
320+
else()
321+
_pybind11_return_if_cxx_and_linker_flags_work(
322+
HAS_INTEL_IPO "-ipo" "-ipo" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
323+
endif()
314324
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
315325
# Intel equivalent to LTO is called IPO
316326
_pybind11_return_if_cxx_and_linker_flags_work(HAS_INTEL_IPO "-ipo" "-ipo"

0 commit comments

Comments
 (0)