Skip to content

Releases: corrosion-rs/corrosion

Beta v0.3

27 Oct 07:43
23603e8
Compare
Choose a tag to compare
Beta v0.3 Pre-release
Pre-release

Changes since v0.2.2

Breaking

  • The minimum supported rust version (MSRV) was increased to 1.46, due to a cargo issue that recently
    surfaced on CI when using crates.io. Please also note that on MacOS 12 at least Rust 1.54 is required.
  • MacOS 10 and 11 are no longer officially supported and untested in CI.
  • Increase the minimum required CMake version to 3.15.
  • Corrosion internally invokes cargo build. When passing arguments to cargo build, Corrosion
    now uses the CMake VERBATIM option. This may require you to change how you quote
    parameters passed to corrosion (e.g. via corrosion_add_target_rustflags()).
    For example setting a cfg option previously required double escaping the rustflag like this
    "--cfg=something=\\\"value\\\"", but now it should be passed to corrosion without any escapes:
    --cfg=something="value".

Breaking: Removed previously deprecated functionality

  • Removed add_crate() function. Use corrosio_import_crate instead.
  • Removed cargo_link_libraries() function. Use corrosion_link_libraries() instead.
  • Removed experimental CMake option CORROSION_EXPERIMENTAL_PARSER. This option was never included in an official
    release and has been marked as deprecated on the master branch since May 22.
    The corresponding stable option is CORROSION_NATIVE_TOOLING albeit with inverted semantics.
  • Previously Corrosion would set the HOST_CC and HOST_CXX environment variables when invoking
    cargo build, if the environment variables CC and CXX outside of CMake where set.
    However this did not work as expected in all cases and sometimes the HOST_CC variable would be set
    to a cross-compiler for unknown reasons. For this reason HOST_CC and HOST_CXX are not set by
    corrosion anymore, but users can still set them manually if required via corrosion_set_env_vars().
  • The CARGO_RUST_FLAGS family of cache variables were removed. Corrosion does not internally use them
    anymore.

Potentially breaking

  • The working directory when invoking cargo build was changed to the directory of the Manifest
    file. This now allows cargo to pick up .cargo/config.toml files located in the source tree.
    (205)
  • Adding a PRE_BUILD custom command on a cargo-build_<target_name> CMake target will no
    longer work as expected. To support executing user defined commands before cargo build is
    invoked users should use the newly added targets cargo-prebuild (before all cargo build invocations)
    or cargo-prebuild_<target_name> as a dependency target.
    Example: add_dependencies(cargo-prebuild code_generator_target)

New features

  • Support setting rustflags for only the main target and none of it's dependencies (215).
    A new function corrosion_add_target_local_rustflags(target_name rustc_flag [more_flags ...])
    is added for this purpose.
    This is useful in cases where you only need rustflags on the main-crate, but need to set different
    flags for different targets. Without "local" Rustflags this would require rebuilds of the
    dependencies when switching targets.
  • Support explicitly selecting a linker (208).
    The linker can be selected via corrosion_set_linker(target_name linker).
    Please note that this only has an effect for targets, where the final linker invocation is done
    by cargo, i.e. targets where foreign code is linked into rust code and not the other way around.
  • Corrosion now respects the CMake OUTPUT_DIRECTORY target properties and copies build artifacts to the expected
    locations (217), if the properties are set.
    This feature requires at least CMake 3.19 and is enabled by default if supported. Please note that the OUTPUT_NAME
    target properties are currently not supported.
    Specifically, the following target properties are now respected:
  • Corrosion now supports packages with potentially multiple binaries (bins) and a library (lib) at the
    same time. The only requirement is that the names of all bins and libs in the whole project must be unique.
    Users can set the names in the Cargo.toml by adding name = <unique_name> in the [[bin]] and [lib] tables.
  • FindRust now has improved support for the VERSION option of find_package and will now attempt to find a matching
    toolchain version. Previously it was only checked if the default toolchain matched to required version.
  • For rustup managed toolchains a CMake error is issued with a helpful message if the required target for
    the selected toolchain is not installed.

Fixes

  • Fix a CMake developer Warning when a Multi-Config Generator and Rust executable targets
    (#213).
  • FindRust now respects the QUIET option to find_package() in most cases.

Deprecation notice

  • Support for the MSVC Generators with CMake toolchains before 3.20 is deprecated and will be removed in the next
    release (v0.4). All other Multi-config Generators already require CMake 3.20.

Internal Changes

  • The CMake Generator written in Rust and CorrosionGenerator.cmake which are responsible for parsing
    cargo metadata output to create corresponding CMake targets for all Rust targets now share most code.
    This greatly simplified the CMake generator written in Rust and makes it much easier maintaining and adding
    new features regardless of how cargo metadata is parsed.

v0.2.2

01 Sep 11:29
Compare
Choose a tag to compare

0.2.2 (2022-09-01)

Fixes

  • Do not use C++17 in the tests (makes tests work with older C++ compilers) (184)
  • Fix finding cargo on NixOS (192)
  • Fix issue with Rustflags test when using a Build type other than Debug and Release (203).

v0.2.1

07 May 11:54
Compare
Choose a tag to compare

Fixes

  • Fix missing variables provided by corrosion, when corrosion is used as a subdirectory (181):
    Public Variables set by Corrosion were not visible when using Corrosion as a subdirectory, due to the wrong scope of the variables. This was fixed by promoting the respective variables to Cache variables.

v0.2.0

04 May 22:09
f617a7f
Compare
Choose a tag to compare

Breaking changes

  • Removed the integrator build script (#156).
    The build script provided by corrosion (for rust code that links in foreign code) is no longer necessary,
    so users can just remove the dependency.

Deprecations

  • Direct usage of the following target properties has been deprecated. The names of the custom properties are
    no longer considered part of the public API and may change in the future. Instead, please use the functions
    provided by corrosion. Internally different property names are used depending on the CMake version.
    • CORROSION_FEATURES, CORROSION_ALL_FEATURES, CORROSION_NO_DEFAULT_FEATURES. Instead please use
      corrosion_set_features(). See the updated Readme for details.
    • CORROSION_ENVIRONMENT_VARIABLES. Please use corrosion_set_env_vars() instead.
    • CORROSION_USE_HOST_BUILD. Please use corrosion_set_hostbuild() instead.
  • The Minimum CMake version will likely be increased for the next major release. At the very least we want to drop
    support for CMake 3.12, but requiring CMake 3.16 or even 3.18 is also on the table. If you are using a CMake version
    that would be no longer supported by corrosion, please comment on issue
    #168, so that we can gauge the number of affected users.

New features

  • Add NO_STD option to corrosion_import_crate (#154).
  • Remove the requirement of building the Rust based generator crate for CMake >= 3.19. This makes using corrosion as
    a subdirectory as fast as the installed version (since everything is done in CMake).
    (#131, #161)
    If you do choose to install Corrosion, then by default the old Generator is still compiled and installed, so you can
    fall back to using it in case you use multiple cmake versions on the same machine for different projects.

Fixes

  • Fix Corrosion on MacOS 11 and 12 (#167 and
    #164).
  • Improve robustness of parsing the LLVM version (exported in Rust_LLVM_VERSION). It now also works for
    Rust versions, where the LLVM version is reported as MAJOR.MINOR. (#148)
  • Fix a bug which occurred when Corrosion was added multiple times via add_subdirectory()
    (#143).
  • Set CC_<target_triple_undercore> and CXX_<target_triple_undercore> environment variables for the invocation of
    cargo build to the compilers selected by CMake (if any)
    (#138 and #161).
    This should ensure that C dependencies built in cargo buildscripts via cc-rs
    use the same compiler as CMake built dependencies. Users can override the compiler by specifying the higher
    priority environment variable variants with dashes instead of underscores (See cc-rs documentation for details).
  • Fix Ninja-Multiconfig Generator support for CMake versions >= 3.20. Previous CMake versions are missing a feature,
    which prevents us from supporting the Ninja-Multiconfig generator. (#137)

v0.1.0

01 Feb 14:46
Compare
Choose a tag to compare

This is the first release of corrosion after it was moved to the new corrosion-rs organization.
Since there are no previous releases, this is not a complete changelog but only lists changes since
September 2021.

New features

Fixes

Known issues:

  • Corrosion is currently not working on macos-11 and newer. See issue #104.
    Contributions are welcome.