-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support cross-compiling in the libmagic vcpkg port overlay, attempt 2. #5338
Conversation
3d5554f
to
07579db
Compare
566a9ec
to
0edab59
Compare
0edab59
to
5703699
Compare
if(VCPKG_CROSSCOMPILING) | ||
vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/libmagic") | ||
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) | ||
set(EXTRA_ARGS "ADD_BIN_TO_PATH") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We move this block before the configure and install steps, so that libmagic's build system can find the file
command in the path we built it for the host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, not quite sure what this does, but have you tested this with cross compilation? (If it works for x86_64 and crosscompilation x86_64->aarch64)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tested as outlined in #5338 (comment).
As for what this does, in libmagic's CMakeLists.txt
we have this command:
add_custom_command(OUTPUT magic.mgc
COMMAND file -C -m magic
COMMENT "Compiling magic file"
)
When not cross-compiling, CMake resolves file
to the file
executable we built, but when cross-compiling file
will be passed to the shell as-is and resolved from PATH
. The vcpkg_add_to_path
command ensures the host's file
we built gets found.
The elseif
part makes sure libmagic.dll
gets found on Windows if we are using dynamic linkage for the dependencies (which we don't currently do).
This block exists in the upstream port BTW.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the explanation!
Conda nightlies and Release workflow succeed. This is ready to review. I tried locally to cross-compile to Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
TYPE: NO_HISTORY