-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
[cmake] Automatically add required cross-compilation variables #130
[cmake] Automatically add required cross-compilation variables #130
Conversation
06092d7
to
c76c45d
Compare
For the standard `make`, mini_portile provides the `configure` script with the `--host` parameter, and the script figures out the target compilers to use. With CMake, we don't have that benefit so we need to set the C and C++ compilers ourselves. This commit uses a simple heuristic to find the target compilers: 1. For macOS, use `clang` and `clang++`. Otherwise use `gcc` and `gcc++`. 2. We search the PATH for `<host>-compiler`. Use that if we find it. Otherwise default to the base compilers. To make CMake work with cross-compilation, a number of variables have to be set: - CMAKE_SYSTEM_PROCESSOR - CMAKE_SYSTEM_NAME - CMAKE_C_COMPILER - CMAKE_CXX_COMPILER Closes flavorjones#128
c76c45d
to
527a813
Compare
Ruby compiled for x64-mingw-ucrt appears to return a processor type of x64, but CMake only understands x86_64.
This looks great! Thank you! |
This pulls in flavorjones/mini_portile#130. We no longer need to write custom logic for finding the right compilers and setting CMake variables for cross-compilation.
Great addition! Thank you! |
This pulls in flavorjones/mini_portile#130. We no longer need to write custom logic for finding the right compilers and setting CMake variables for cross-compilation.
This pulls in flavorjones/mini_portile#130. We no longer need to write custom logic for finding the right compilers and setting CMake variables for cross-compilation.
@stanhu I'm curious why we're not using Asking because OpenBSD and FreeBSD support have been ... interesting. |
@flavorjones Yeah, that could would work. It looks like
|
I think I might have been focused on |
I've opened a PR to simplify compiler detection at #144 |
For the standard
make
, mini_portile provides theconfigure
script with the--host
parameter, and the script figures out the target compilers to use. With CMake, we don't have that benefit so we need to set the C and C++ compilers ourselves.This commit uses a simple heuristic to find the target compilers:
clang
andclang++
. Otherwise usegcc
andgcc++
.<host>-compiler
. Use that if we find it. Otherwise default to the base compilers.To make CMake work with cross-compilation, a number of variables have to be set:
Closes #128