-
-
Notifications
You must be signed in to change notification settings - Fork 325
CMake: Fix Fortran cross-compilation support #6108
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
base: develop
Are you sure you want to change the base?
Conversation
93ef341 to
f91fb3c
Compare
|
Location: config/toolchain/mingw64.cmake:28-29 Problem: The toolchain file sets CMAKE_CROSSCOMPILING_EMULATOR=wine64 without WINEPATH configuration. Current State: set(CMAKE_CROSSCOMPILING_EMULATOR wine64) # Missing WINEPATH! Option A: Simple solution: Option B (Wrapper script - cleaner): Create wrapper script at configure timefile(WRITE "${CMAKE_BINARY_DIR}/mingw-wine-wrapper.sh" "#!/bin/sh set(CMAKE_CROSSCOMPILING_EMULATOR "${CMAKE_BINARY_DIR}/mingw-wine-wrapper.sh") ALSO: Current:if (NOT CMAKE_CROSSCOMPILING OR (CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR)) Simplified:if (NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR) Summary: Proposed Change to config/toolchain/mingw64.cmake: Untested |
4f6c278 to
2591ce2
Compare
a94f659 to
4549437
Compare
a4b08e1 to
bcfa3cb
Compare
|
@brtnfld no need for cmake to generate the wrapper script, it can be a preexisting file like the toolchain script, see the file wine64.sh I added |
The current CMAKE_CROSSCOMPILING paths lead here to dummy commands "cmake -E env" being emitted that dont seem to do anything even when CROSSCOMPILING_PATH is set (#5720) as it must be followed by an actual command, and not another COMMAND entry:
It seems CROSSCOMPILING_PATH is intented to pass environment variables to the emulator.
A cleaner way is to set them via a script that actually calls the emulator instead of adding CROSSCOMPILING_PATH to every executable target invocation.
Then this script would be passed as CMAKE_CROSSCOMPILING_EMULATOR instead of the emulator itself.
A common use-case is to pass WINEPATH to wine so that standard dlls are found when running mingw executables:
Anyway we can simplify the two paths of the if/else, CMAKE_CROSSCOMPILING_EMULATOR being empty when CMAKE_CROSSCOMPILING is false.
Note that we need to use CMAKE_CROSSCOMPILING_EMULATOR explicitely here otherwise it would be omitted by cmake when generator expressions like these,
and you cannot always rely on binfmt_misc to forward to the right emulator.
/cc @byrnHDF
Tested with mingw from linux.
Important
Simplifies CMake cross-compilation by merging paths and using
CMAKE_CROSSCOMPILING_EMULATORconsistently across multiple files.if/elsepaths infortran/src/CMakeLists.txt,fortran/test/CMakeLists.txt, andhl/fortran/src/CMakeLists.txt.CMAKE_CROSSCOMPILING_EMULATORconsistently for executing target files.cmake -E env ${CROSSCOMPILING_PATH}in favor ofCMAKE_CROSSCOMPILING_EMULATOR.CMAKE_CROSSCOMPILING_EMULATORis not set.This description was created by
for f91fb3c. You can customize this summary. It will automatically update as commits are pushed.