-
-
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] Support cross-compiling out of the box #128
Labels
Comments
In order to build a C extension against a library, we may also want to add:
|
Ack. CMake is still "experimental" and you may be the first person to really try to use it for something. Will take a look, but prioritizing it behind some other work at the moment. |
stanhu
added a commit
to stanhu/mini_portile
that referenced
this issue
Jul 17, 2023
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 `CMAKE_SYSTEM_NAME` has to be set, or `cmake` won't try to cross-compile. Closes flavorjones#128
stanhu
added a commit
to stanhu/mini_portile
that referenced
this issue
Jul 18, 2023
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
stanhu
added a commit
to stanhu/mini_portile
that referenced
this issue
Jul 18, 2023
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
stanhu
added a commit
to stanhu/mini_portile
that referenced
this issue
Jul 18, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While working on mudge/re2#67, I had to add a number of configuration options to make cross-compiling work properly.
For the standard
make
, mini_portile2 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.I used 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:
I was surprised that
CMAKE_SYSTEM_NAME
has to be set, orcmake
won't try to cross-compile.I think
mini_portile2
should provide these options by default.The text was updated successfully, but these errors were encountered: