Skip to content

Conversation

ilammy
Copy link
Contributor

@ilammy ilammy commented Jan 2, 2022

Emscripten toolchain has emcmake helper which sets the proper CMAKE_TOOLCHAIN_FILE and other CMake variables that get CMake to produce build files for cross-compiling via Emscripten.

There is also emmake helper that sets the environment variables for cross-compilation. It should not be necessary for CMake when used with Makefiles and Ninja, but Emscripten recommends it anyway.

See #117 and Building Projects.

@ilammy ilammy marked this pull request as draft January 2, 2022 10:19
@alexcrichton
Copy link
Member

Can this link to documentation on the web? Also if this is to be supported it might be good to add something to CI so it's known when it breaks.

ilammy added 3 commits January 9, 2022 16:21
There is another local variable called "target" -- the one for
compilation target platform. This variable is CMake build target.
Move it closer to the only place where it's used to avoid shadowing
the other "target", which will soon be needed.
Soon these commands are going to become a bit different, make sure they
can stay different.
Emscripten toolchain has "emcmake" helper which sets the proper
CMAKE_TOOLCHAIN_FILE and other CMake variables that get CMake
to produce build files for cross-compiling via Emscripten.

There is also "emmake" helper that sets the environment variables
for cross-compilation. It should not be necessary for CMake when
used with Makefiles and Ninja, but Emscripten recommends it anyway.
@ilammy ilammy marked this pull request as ready for review January 9, 2022 07:59
@ilammy
Copy link
Contributor Author

ilammy commented Jan 9, 2022

Can this link to documentation on the web?

Done. I've added a link to Emscripten site, explaining the use of emcmake and emmake.

Also if this is to be supported it might be good to add something to CI so it's known when it breaks.

Given that cmake-rs does not have any tests bundled with it whatsoever, I'm not putting them into this PR.

But I am working on some small example to test CMake integration, not only with Emscripten targets.

It's a bit tricky to get that tested "nicely".

  • You can't have custom build.rs for integration tests or examples, so that has to be a separate crate – a pretty minor hurdle.
  • cargo test does not support testing cross-compiled binaries that need a special runner. You need to build a test binary, then run in a special way.

@alexcrichton
Copy link
Member

Ok, sorry but I've decided that I will no longer maintain this crate and it needs a new maintainer.

@m-ou-se m-ou-se merged commit 03c8f49 into rust-lang:master May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants