Skip to content

Commit

Permalink
Do not regenerate importlib.h and importlib_external.h when cross-com…
Browse files Browse the repository at this point in the history
…piling

They are already present in source releases, so it is possible to ignore
the regeneration step. We do that only when cross-compiling, because it
is not possible to build for both the host and the target with a single
pass of CMake.
  • Loading branch information
Victor Paleologue authored and jcfr committed Jun 28, 2023
1 parent 392edb2 commit 7a07b4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/libpython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ if(WIN32 AND IS_PY3)
endif()

set(LIBPYTHON_FROZEN_SOURCES )
if(IS_PY3)
if(IS_PY3 AND NOT CMAKE_CROSSCOMPILING)

# Build _freeze_importlib executable
add_executable(_freeze_importlib
Expand Down Expand Up @@ -512,6 +512,11 @@ endif()
# the frozen sources.
add_custom_target(freeze_modules DEPENDS ${LIBPYTHON_FROZEN_SOURCES})

elseif(IS_PY3 AND CMAKE_CROSSCOMPILING)

# KLUDGE: suppose importlib.h and importlib_external.h are already present.
add_custom_target(freeze_modules)

endif()

if(PY_VERSION VERSION_LESS "3.8")
Expand Down

0 comments on commit 7a07b4d

Please sign in to comment.