Skip to content

Commit

Permalink
Require CMake 3.22 for Corrosion
Browse files Browse the repository at this point in the history
Remove the Legacy Generator code and require at least CMake 3.22.
The stable/v0.4 branch will continue to support older CMake versions
for a while, but the main branch of corrosion will move on.
  • Loading branch information
jschwe committed Sep 10, 2023
1 parent fed96bb commit d4f82e7
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 1,320 deletions.
80 changes: 11 additions & 69 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,6 @@ on:
- 'stable/**'
jobs:

test_legacy_linux:
name: Test Corrosion (CMake 3.15)
uses: ./.github/workflows/test_legacy.yaml
with :
os: ubuntu-20.04
rust: 1.46.0
test_legacy_mac:
name: Test Corrosion (CMake 3.15)
uses: ./.github/workflows/test_legacy.yaml
with:
os: macos-12
rust: 1.54.0
test_legacy_windows:
name: Test Corrosion (CMake 3.15)
uses: ./.github/workflows/test_legacy.yaml
with:
os: windows-2019
rust: 1.46.0

test_legacy_stable:
name: Legacy CMake + stable Rust
uses: ./.github/workflows/test_legacy.yaml
strategy:
fail-fast: false
matrix:
os:
- windows-2019 # windows-latest is currently not having a supported MSVC compiler
- ubuntu-20.04
- macos-12
with:
os: ${{ matrix.os }}
rust: stable

test_legacy_nightly:
name: Legacy CMake + nightly Rust
uses: ./.github/workflows/test_legacy.yaml
with:
os: ubuntu-20.04
rust: nightly

test_legacy_new_lockfile_msrv:
name: Test MSRV of the new lockfile
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install Rust
id: install_rust
uses: dtolnay/rust-toolchain@1.56
- name: Test Generator build with MSRV
run: cargo build
working-directory: generator

test:
name: Test Corrosion
runs-on: ${{ matrix.os }}
Expand All @@ -82,35 +30,34 @@ jobs:
- darwin
- msvc
cmake:
- 3.19.0
- 3.22.0
rust:
# Our MSRV is already tested with the legacy generator, so just test the current stable rust here.
- stable
- "stable"
generator:
- default # This is just whatever the platform default is
- ninja
compiler: [default]
include:
- rust: nightly
cmake: 3.19.0
cmake: 3.22.0
generator: ninja
arch: x86_64
abi: msvc
os: windows-2019
- rust: nightly
cmake: 3.19.0
cmake: 3.22.0
generator: ninja
arch: x86_64
abi: gnu
os: ubuntu-latest
- rust: nightly
cmake: 3.19.0
cmake: 3.22.0
generator: ninja
arch: x86_64
abi: darwin
os: macos-12
- rust: 1.54
cmake: 3.19.0
cmake: 3.22.0
generator: ninja
arch: x86_64
abi: msvc
Expand All @@ -119,7 +66,7 @@ jobs:
- os: ubuntu-latest
arch: x86_64
abi: gnu
cmake: 3.20.0
cmake: 3.22.0
rust: 1.54
generator: ninja-multiconfig

Expand Down Expand Up @@ -199,9 +146,9 @@ jobs:
- arch: x86_64
rust: 1.46.0
- os: windows-2019
cmake: 3.20.6 # Multi-config Generators require at least CMake 3.20
cmake: 3.22.0 # Multi-config Generators require at least CMake 3.20
- os: windows-2022
cmake: 3.21.5 # VS on windows-2022 requires at least CMake 3.21
cmake: 3.22.0

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -259,7 +206,7 @@ jobs:
uses: "./.github/actions/setup_test"
with:
target_arch: x86_64
cmake: 3.15.7
cmake: 3.22.0
rust: stable minus 2 releases
abi: ${{ matrix.abi }}
generator: ninja
Expand Down Expand Up @@ -290,7 +237,7 @@ jobs:
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: 3.18.0
cmake: 3.22.0
ninja: 1.10.0
- name: Install Rust
uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -334,11 +281,6 @@ jobs:
name: bors-ci-status
if: ${{ always() }}
needs:
- test_legacy_linux
- test_legacy_mac
- test_legacy_windows
- test_legacy_stable
- test_legacy_new_lockfile_msrv
- test
- test_msvc
- test_cxxbridge
Expand Down
80 changes: 0 additions & 80 deletions .github/workflows/test_legacy.yaml

This file was deleted.

39 changes: 7 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.22)
project(Corrosion
# Official releases will be major.minor.patch. When the `tweak` field is
# set it indicates that we are on a commit, that is not a officially
# tagged release. Users don't need to care about this, it is mainly to
# clearly see in configure logs which version was used, without needing to
# rely on `git`, since Corrosion may be installed or otherwise packaged.
VERSION 0.4.3
VERSION 0.4.99.99 # a 0.5-pre-release
LANGUAGES NONE
HOMEPAGE_URL "https://corrosion-rs.github.io/corrosion/"
)
Expand All @@ -22,12 +22,6 @@ endif()

# ==== Corrosion Configuration ====

option(
CORROSION_DEV_MODE
"Enables some additional features if you're developing Corrosion"
${_CORROSION_TOP_LEVEL}
)

option(
CORROSION_BUILD_TESTS
"Build Corrosion test project"
Expand All @@ -39,25 +33,18 @@ set(
"Use prebuilt, non-bootstrapped corrosion-generator")
mark_as_advanced(CORROSION_GENERATOR_EXECUTABLE)

if (CORROSION_GENERATOR_EXECUTABLE)
add_executable(Corrosion::Generator IMPORTED GLOBAL)
set_property(
TARGET Corrosion::Generator
PROPERTY IMPORTED_LOCATION ${CORROSION_GENERATOR_EXECUTABLE})
set(CORROSION_INSTALL_EXECUTABLE_DEFAULT OFF)
elseif(CORROSION_NATIVE_TOOLING OR CMAKE_VERSION VERSION_LESS 3.19.0)
set(CORROSION_INSTALL_EXECUTABLE_DEFAULT "ON")
else()
set(CORROSION_INSTALL_EXECUTABLE_DEFAULT OFF)
endif()

option(
CORROSION_INSTALL_EXECUTABLE
"Controls whether corrosion-generator is installed with the package"
${CORROSION_INSTALL_EXECUTABLE_DEFAULT}
)
mark_as_advanced(CORROSION_INSTALL_EXECUTABLE)

if (CORROSION_GENERATOR_EXECUTABLE OR CORROSION_INSTALL_EXECUTABLE)
message(FATAL_ERROR "The Cache variables CORROSION_GENERATOR_EXECUTABLE CORROSION_INSTALL_EXECUTABLE"
" were removed.")
endif()

if (_CORROSION_TOP_LEVEL)
# We need to enable a language for corrosions test to work.
# For projects using corrosion this is not needed
Expand Down Expand Up @@ -87,18 +74,6 @@ endif()

include(GNUInstallDirs)

if(CORROSION_INSTALL_EXECUTABLE)
get_property(
_CORROSION_GENERATOR_EXE
TARGET Corrosion::Generator PROPERTY IMPORTED_LOCATION
)
install(PROGRAMS "${_CORROSION_GENERATOR_EXE}" DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}")
else()
message(DEBUG "Not installing corrosion-generator since "
"`CORROSION_INSTALL_EXECUTABLE` is set to ${CORROSION_INSTALL_EXECUTABLE}"
)
endif()

# Generate the Config file
include(CMakePackageConfigHelpers)

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ add_executable(your_cpp_bin main.cpp)
target_link_libraries(your_cpp_bin PUBLIC rust-lib)
```

## Requirements

### Stable v0.4 Release

- CMake 3.15 or newer. Some features may only be available on more recents CMake versions
- Rust 1.46 or newer. Some platforms / features may require more recent Rust versions

### Development (master branch)

- CMake 3.22 or newer
7 changes: 7 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Unreleased

### Breaking Changes

- The master branch of corrosion now requires CMake 3.22. See also the
[v0.4.0 Release notes](#040-lts-2023-06-01) for more details.

# v0.4.3 (2023-09-09)

### Fixes
Expand Down
Loading

0 comments on commit d4f82e7

Please sign in to comment.