Skip to content

Commit

Permalink
Rename CompilerBackend to CrossCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Dec 21, 2024
1 parent ab11dca commit d1a7a32
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, nightly]
cross-compiler: [clang-cl, clang]
env:
XWIN_CROSS_COMPILER: ${{ matrix.cross-compiler }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
Expand Down
22 changes: 11 additions & 11 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use clap::{
use fs_err as fs;
use which::which_in;

/// MSVC cross compiler backend
/// MSVC cross compiler
#[derive(Clone, Debug, Default, ValueEnum)]
pub enum CompilerBackend {
pub enum CrossCompiler {
/// clang-cl backend
#[default]
ClangCl,
Expand All @@ -23,9 +23,9 @@ pub enum CompilerBackend {
/// common xwin options
#[derive(Clone, Debug, Parser)]
pub struct XWinOptions {
/// The cross compiler backend to use
#[arg(long, env = "XWIN_COMPILER_BACKEND", default_value = "clang-cl")]
pub compiler_backend: CompilerBackend,
/// The cross compiler to use
#[arg(long, env = "XWIN_CROSS_COMPILER", default_value = "clang-cl")]
pub cross_compiler: CrossCompiler,

/// xwin cache directory
#[arg(long, env = "XWIN_CACHE_DIR", hide = true)]
Expand Down Expand Up @@ -78,7 +78,7 @@ impl Default for XWinOptions {
xwin_version: "16".to_string(),
xwin_include_debug_libs: false,
xwin_include_debug_symbols: false,
compiler_backend: CompilerBackend::ClangCl,
cross_compiler: CrossCompiler::ClangCl,
}
}
}
Expand All @@ -90,13 +90,13 @@ impl XWinOptions {
cargo: &cargo_options::CommonOptions,
cmd: &mut Command,
) -> Result<()> {
match self.compiler_backend {
CompilerBackend::ClangCl => {
let clang_cl = crate::backend::clang_cl::ClangCl::new(self);
match self.cross_compiler {
CrossCompiler::ClangCl => {
let clang_cl = crate::compiler::clang_cl::ClangCl::new(self);
clang_cl.apply_command_env(manifest_path, cargo, cmd)?;
}
CompilerBackend::Clang => {
let clang = crate::backend::clang::Clang::new(self);
CrossCompiler::Clang => {
let clang = crate::compiler::clang::Clang::new(self);
clang.apply_command_env(manifest_path, cargo, cmd)?;
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod backend;
mod common;
mod compiler;
mod macros;
mod run;
mod test;
Expand Down

0 comments on commit d1a7a32

Please sign in to comment.