Skip to content

Releases: corrosion-rs/corrosion

v0.4.1 LTS

03 Jun 07:14
Compare
Choose a tag to compare

This is a bugfix release.

Fixes

  • Fixes a regression on multi-config Generators (#405)

v0.4 LTS

01 Jun 18:38
Compare
Choose a tag to compare

0.4.0 LTS (2023-06-01)

No changes compared to v0.4.0-beta2.

Announcements

The v0.4.x LTS series will be the last release to support older CMake and Rust versions.
If necessary, fixes will be backported to the v0.4 branch. New features will not be
actively backported after the next major release, but community contributions are possible.
The v0.4.x series is currently planned to be maintained until the end of 2024.

The following major release will increase the minimum required CMake version to 3.22. The
minimum supported Rust version will also be increased to make use of newly added flags, but
the exact version is not fixed yet.

Changes compared to v0.3.5:

Breaking Changes

  • The Visual Studio Generators now require at least CMake 3.20.
    This was previously announced in the 0.3.0 release notes and is the same
    requirement as for the other Multi-Config Generators.
  • The previously deprecated function corrosion_set_linker_language()
    will now raise an error when called and may be removed without further
    notice in future stable releases. Use corrosion_set_linker() instead.
  • Improved the FindRust target triple detection, which may cause different behavior in some cases.
    The detection does not require an enabled language anymore and will always fall back
    to the default host target triple. A warning is issued if target triple detection failed.

Potentially Breaking Changes

  • Corrosion now sets the IMPORTED_NO_SONAME property for shared rust libraries, since by
    default they won't have an soname field.
    If you add a rustflag like -Clink-arg=-Wl,-soname,libmycrate.so in your project,
    you should set this property to false on the shared rust library.
  • Corrosion now uses a mechanism to determine which native libraries need to be linked with
    Rust staticlib targets into C/C++ targets. The previous mechanism contained a hardcoded list.
    The new mechanism asks rustc which libraries are needed at minimum for a given
    target triple (with std support). This should not be a breaking change, but if you
    do encounter a new linking issue when upgrading with staticlib targets, please open an
    issue.

New features

  • corrosion_import_crate() has two new options LOCKED and FROZEN which pass the
    --locked and --frozen flags to all invocations of cargo.
  • FindRust now provides cache variables containing information on the default host
    target triple:
    • Rust_CARGO_HOST_ARCH
    • Rust_CARGO_HOST_VENDOR
    • Rust_CARGO_HOST_OS
    • Rust_CARGO_HOST_ENV

Other changes

  • When installing Corrosion with CMake >= 3.19, the legacy Generator tool is
    no longer built and installed by default.
  • Corrosion now issues a warning when setting the linker or setting linker
    options for a Rust static library.
  • Corrosion no longer enables the C language when CMake is in crosscompiling mode and
    no languages where previously enabled. This is not considered a breaking change.
  • corrosion_import_crate() now warns about unexpected arguments.

Fixes

  • Fix building when the dev profile is explicitly set by the user.

Experimental features (may be changed or removed without a major version bump)

  • Experimental cxxbridge and cbindgen integration.
  • Add a helper function to parse the package version from a Cargo.toml file
  • Expose rustup toolchains discovered by FindRust in the following cache variables
    which contain a list.
    • Rust_RUSTUP_TOOLCHAINS: List of toolchains names
    • Rust_RUSTUP_TOOLCHAINS_VERSION: List of rustc version of the toolchains
    • Rust_RUSTUP_TOOLCHAINS_RUSTC_PATH: List of the path to rustc
    • Rust_RUSTUP_TOOLCHAINS_CARGO_PATH: List of the path to cargo. Entries may be NOTFOUND if cargo
      is not available for that toolchain.
  • Add target properties INTERFACE_CORROSION_RUSTC and INTERFACE_CORROSION_CARGO, which may
    be set to paths to rustc and cargo respectively to override the toolchain for a specific
    target.

v0.4 beta 2

20 May 08:59
Compare
Choose a tag to compare
v0.4 beta 2 Pre-release
Pre-release

Changes compared to v0.4 beta 1

  • Fix determining required link libraries (in workspaces) by @crabtw in #391

Full Changelog: v0.4-beta1...v0.4-beta2

v0.4 beta 1 - Please test and report issues

10 May 08:37
Compare
Choose a tag to compare

0.4.0-beta1 (2023-05-10)

Please test and provide feedback for issues you encounter. We are especially interested in receiving feedback for the things in the experimental section of the release notes, especially the cbindgen and cxxbridge integration.

Changes compared to v0.3.5:

Breaking Changes

  • The Visual Studio Generators now require at least CMake 3.20.
    This was previously announced in the 0.3.0 release notes and is the same
    requirement as for the other Multi-Config Generators.
  • The previously deprecated function corrosion_set_linker_language()
    will now raise an error when called and may be removed without further
    notice in future stable releases. Use corrosion_set_linker() instead.
  • Improved the FindRust target triple detection, which may cause different behavior in some cases.
    The detection does not require an enabled language anymore and will always fall back
    to the default host target triple. A warning is issued if target triple detection failed.

Potentially Breaking Changes

  • Corrosion now sets the IMPORTED_NO_SONAME property for shared rust libraries, since by
    default they won't have an soname field.
    If you add a rustflag like -Clink-arg=-Wl,-soname,libmycrate.so in your project,
    you should set this property to false on the shared rust library.
  • Corrosion now uses a mechanism to determine which native libraries need to be linked with
    Rust staticlib targets into C/C++ targets. The previous mechanism contained a hardcoded list.
    The new mechanism asks rustc which libraries are needed at minimum for a given
    target triple (with std support). This should not be a breaking change, but if you
    do encounter a new linking issue when upgrading with staticlib targets, please open an
    issue.

New features

  • corrosion_import_crate() has two new options LOCKED and FROZEN which pass the
    --locked and --frozen flags to all invocations of cargo.
  • FindRust now provides cache variables containing information on the default host
    target triple:
    • Rust_CARGO_HOST_ARCH
    • Rust_CARGO_HOST_VENDOR
    • Rust_CARGO_HOST_OS
    • Rust_CARGO_HOST_ENV

Other changes

  • When installing Corrosion with CMake >= 3.19, the legacy Generator tool is
    no longer built and installed by default.
  • Corrosion now issues a warning when setting the linker or setting linker
    options for a Rust static library.
  • Corrosion no longer enables the C language when CMake is in crosscompiling mode and
    no languages where previously enabled. This is not considered a breaking change.
  • corrosion_import_crate() now warns about unexpected arguments.

Fixes

  • Fix building when the dev profile is explicitly set by the user.

Experimental status (may be changed or removed before a stable release)

  • Experimental cxxbridge and cbindgen integration.
  • Add a helper function to parse the package version from a Cargo.toml file
  • Expose rustup toolchains discovered by FindRust in the following cache variables
    which contain a list.
    • Rust_RUSTUP_TOOLCHAINS: List of toolchains names
    • Rust_RUSTUP_TOOLCHAINS_VERSION: List of rustc version of the toolchains
    • Rust_RUSTUP_TOOLCHAINS_RUSTC_PATH: List of the path to rustc
    • Rust_RUSTUP_TOOLCHAINS_CARGO_PATH: List of the path to cargo. Entries may be NOTFOUND if cargo
      is not available for that toolchain.
  • Add target properties INTERFACE_CORROSION_RUSTC and INTERFACE_CORROSION_CARGO, which may
    be set to paths to rustc and cargo respectively to override the toolchain for a specific
    target.

v0.3.5

19 Mar 10:26
Compare
Choose a tag to compare

Fixes

  • Fix building the Legacy Generator on Rust toolchains < 1.56 (#365)

v0.3.4

02 Mar 16:26
Compare
Choose a tag to compare

Fixes

  • Fix hostbuild (when Corrosion is configured for cross-compiling and a target options is set to build a target for the host instead of cross-compiling) if clang is used (#338).

Other

  • Pass --no-deps to cargo metadata (#334).
  • Bump the legacy generator dependencies

v0.3.3

17 Feb 14:34
Compare
Choose a tag to compare

New features (Only available on CMake >= 3.19)

  • Add new IMPORTED_CRATES flag to corrosion_import_crate() to retrieve the list of imported crates in the current
    scope (#312).

Fixes

  • Fix imported location target property when the rust target name contains dashes
    and a custom OUTPUT_DIRECTORY was specified by the user (#322).
  • Fix building for custom rust target-triples (#316)

v0.3.2

11 Jan 17:31
Compare
Choose a tag to compare

New features (Only available on CMake >= 3.19)

  • Add new CRATE_TYPES flag to corrosion_import_crate() to restrict which
    crate types should be imported (#269).
  • Add NO_LINKER_OVERRIDE flag to let Rust choose the default linker for the target
    instead of what Corrosion thinks is the appropriate linker driver (#272).

Fixes

  • Fix clean target when cross-compiling (#291).
  • Don't set the linker for Rust static libraries (#275).
  • Minor fixes in FindRust #297:
    • fix a logic error in the version detection
    • fix a logic error in QUIET mode when rustup is not found.

v0.3.1

13 Dec 10:24
Compare
Choose a tag to compare

Fixes

  • Fix a regression in detecting the MSVC abi (#256)
  • Fix an issue on macOS 13 which affected rust crates compiling C++ code in build scripts (#254).
  • Fix corrosion not respecting CMAKE_<XYZ>_OUTPUT_DIRECTORY values (#268).
  • Don't override rusts linker choice for the msvc abi (previously this was only skipped for msvc generators) (#271)

v0.3.0

31 Oct 13:46
Compare
Choose a tag to compare

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. On MacOS 12 and Windows-2022 at least Rust 1.54 is required.
  • MacOS 10 and 11 are no longer officially supported and untested in CI.
  • The minimum required CMake version is now 3.15.
  • 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)

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.
    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)
  • Corrosion internally invokes cargo build. When passing arguments to cargo build, Corrosion
    now uses the CMake VERBATIM option. In rare cases 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 can be passed to corrosion without any escapes:
    --cfg=something="value".
  • Corrosion now respects the CMake OUTPUT_DIRECTORY target properties. More details in the "New features" section.

New features

  • Support setting rustflags for only the main target and none of its 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.