mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Combine lua-vendored and luajit-vendored features into "vendored"
This commit is contained in:
+17
-26
@@ -10,7 +10,6 @@ jobs:
|
||||
thing:
|
||||
- stable
|
||||
- macos-x86_64
|
||||
# - aarch64-linux
|
||||
- x86_64-msvc
|
||||
include:
|
||||
- thing: stable
|
||||
@@ -21,10 +20,6 @@ jobs:
|
||||
target: x86_64-apple-darwin
|
||||
rust: stable
|
||||
os: macos-latest
|
||||
- thing: aarch64-linux
|
||||
target: aarch64-unknown-linux-gnu
|
||||
rust: stable
|
||||
os: ubuntu-latest
|
||||
- thing: x86_64-msvc
|
||||
target: x86_64-pc-windows-msvc
|
||||
rust: stable-x86_64-msvc
|
||||
@@ -53,24 +48,20 @@ jobs:
|
||||
if: matrix.thing == 'aarch64-linux'
|
||||
shell: bash
|
||||
- run: rustup target add ${{ matrix.target }}
|
||||
- name: Build (Lua 5.1/5.2/5.3 and LuaJIT vendored)
|
||||
- name: Build (Lua 5.3/5.2/5.1 and LuaJIT vendored)
|
||||
run: |
|
||||
for FEATURE in lua51 lua52 lua53; do
|
||||
for FEATURE in lua53 lua52 lua51 luajit; do
|
||||
echo "Building $FEATURE"
|
||||
cargo build --target ${{ matrix.target }} --release --no-default-features --features "$FEATURE lua-vendored"
|
||||
cargo build --target ${{ matrix.target }} --release --no-default-features --features "$FEATURE vendored"
|
||||
done
|
||||
echo "Building luajit"
|
||||
cargo build --target ${{ matrix.target }} --release --no-default-features --features "luajit luajit-vendored"
|
||||
shell: bash
|
||||
- name: Build (Lua 5.1/5.2/5.3 and LuaJIT via pkg-config)
|
||||
- name: Build (Lua 5.3/5.2/5.1 and LuaJIT via pkg-config)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
for FEATURE in lua51 lua52 lua53; do
|
||||
for FEATURE in lua53 lua52 lua51 luajit; do
|
||||
echo "Building $FEATURE"
|
||||
cargo build --target ${{ matrix.target }} --release --no-default-features --features $FEATURE
|
||||
done
|
||||
echo "Building luajit"
|
||||
cargo build --target ${{ matrix.target }} --release --no-default-features --features luajit
|
||||
shell: bash
|
||||
|
||||
test_linux:
|
||||
@@ -83,16 +74,16 @@ jobs:
|
||||
run: rustup update stable --no-self-update && rustup default stable
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.3 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua53 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.2 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua52 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.1 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua51 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (LuaJIT vendored)
|
||||
run: cargo test --release --no-default-features --features "luajit luajit-vendored"
|
||||
run: cargo test --release --no-default-features --features "luajit vendored"
|
||||
shell: bash
|
||||
|
||||
test_macos:
|
||||
@@ -107,16 +98,16 @@ jobs:
|
||||
echo ::add-path::$HOME/.cargo/bin
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.3 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua53 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.2 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua52 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.1 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua51 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (LuaJIT vendored)
|
||||
run: cargo test --release --no-default-features --features "luajit luajit-vendored"
|
||||
run: cargo test --release --no-default-features --features "luajit vendored"
|
||||
shell: bash
|
||||
|
||||
test_windows:
|
||||
@@ -129,16 +120,16 @@ jobs:
|
||||
run: rustup update stable --no-self-update && rustup default stable
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.3 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua53 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.2 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua52 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (Lua 5.1 vendored)
|
||||
run: cargo test --release --no-default-features --features "lua53 lua-vendored"
|
||||
run: cargo test --release --no-default-features --features "lua51 vendored"
|
||||
shell: bash
|
||||
- name: Run tests (LuaJIT vendored)
|
||||
run: cargo test --release --no-default-features --features "luajit luajit-vendored"
|
||||
run: cargo test --release --no-default-features --features "luajit vendored"
|
||||
shell: bash
|
||||
|
||||
rustfmt:
|
||||
|
||||
+2
-3
@@ -25,13 +25,12 @@ members = [
|
||||
]
|
||||
|
||||
[features]
|
||||
default = ["lua53", "lua-vendored"]
|
||||
default = ["lua53"]
|
||||
lua53 = []
|
||||
lua52 = []
|
||||
lua51 = []
|
||||
luajit = []
|
||||
lua-vendored = ["lua-src"]
|
||||
luajit-vendored = ["luajit", "luajit-src"]
|
||||
vendored = ["lua-src", "luajit-src"]
|
||||
|
||||
[dependencies]
|
||||
num-traits = { version = "0.2.6" }
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[cfg(feature = "lua-vendored")]
|
||||
#[cfg(any(feature = "lua53", feature = "lua52", feature = "lua51"))]
|
||||
use lua_src;
|
||||
#[cfg(feature = "luajit-vendored")]
|
||||
#[cfg(feature = "luajit")]
|
||||
use luajit_src;
|
||||
|
||||
pub fn probe_lua() -> PathBuf {
|
||||
#[cfg(all(feature = "lua53", feature = "lua-vendored"))]
|
||||
#[cfg(feature = "lua53")]
|
||||
let artifacts = lua_src::Build::new().build(lua_src::Lua53);
|
||||
#[cfg(all(feature = "lua52", feature = "lua-vendored"))]
|
||||
#[cfg(feature = "lua52")]
|
||||
let artifacts = lua_src::Build::new().build(lua_src::Lua52);
|
||||
#[cfg(all(feature = "lua51", feature = "lua-vendored"))]
|
||||
#[cfg(feature = "lua51")]
|
||||
let artifacts = lua_src::Build::new().build(lua_src::Lua51);
|
||||
#[cfg(feature = "luajit-vendored")]
|
||||
#[cfg(feature = "luajit")]
|
||||
let artifacts = luajit_src::Build::new().build();
|
||||
|
||||
#[cfg(all(feature = "luajit", feature = "lua-vendored"))]
|
||||
let artifacts = lua_src::Build::new().build(lua_src::Lua51); // Invalid case! Workaround to get panic
|
||||
|
||||
artifacts.print_cargo_metadata();
|
||||
artifacts.include_dir().to_owned()
|
||||
}
|
||||
|
||||
+2
-11
@@ -5,14 +5,8 @@ use std::io::{Error, ErrorKind, Result};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
#[cfg_attr(
|
||||
any(feature = "lua-vendored", feature = "luajit-vendored"),
|
||||
path = "find_vendored.rs"
|
||||
)]
|
||||
#[cfg_attr(
|
||||
not(any(feature = "lua-vendored", feature = "luajit-vendored")),
|
||||
path = "find_normal.rs"
|
||||
)]
|
||||
#[cfg_attr(feature = "vendored", path = "find_vendored.rs")]
|
||||
#[cfg_attr(not(feature = "vendored"), path = "find_normal.rs")]
|
||||
mod find;
|
||||
|
||||
trait CommandExt {
|
||||
@@ -87,9 +81,6 @@ fn main() {
|
||||
#[cfg(all(feature = "lua51", feature = "luajit"))]
|
||||
panic!("You can enable only one of the features: lua53, lua52, lua51, luajit");
|
||||
|
||||
#[cfg(all(feature = "lua-vendored", feature = "luajit"))]
|
||||
panic!("You cannot mix lua-vendored and luajit features");
|
||||
|
||||
let include_dir = find::probe_lua();
|
||||
build_glue(&include_dir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user