Attempted fix for Windows/macOS build

This commit is contained in:
Luke Street 2021-08-25 18:56:21 -04:00
parent cd89d6cec6
commit a24507ff1e
4 changed files with 16 additions and 9 deletions

View File

@ -16,6 +16,15 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
if: matrix.config.platform == 'windows-latest'
with:
version: 12.0.1
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.config.platform == 'windows-latest'
- uses: actions/checkout@v2
with:
submodules: recursive

View File

@ -18,6 +18,7 @@ fn main() {
.size_t_is_usize(true)
.ctypes_prefix("types")
.derive_debug(false)
.clang_arg("-std=c++14")
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
#[cfg(not(feature = "std"))]
{

View File

@ -54,11 +54,7 @@
extern crate alloc;
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::{
alloc::{alloc_zeroed, dealloc, Layout},
boxed::Box,
vec::Vec,
};
use alloc::{boxed::Box, vec::Vec};
#[cfg(feature = "alloc")]
use core::ptr::null_mut;
use core::{marker::PhantomData, mem::size_of};

View File

@ -113,12 +113,13 @@ mod tests {
use super::{compress::compress, decompress::decompress};
const INPUT: &[u8] = include_bytes!("test1.txt");
#[test]
fn test_round_trip() {
let src = include_bytes!("test1.txt");
let compressed = compress(src).expect("Failed to compress");
let mut dst = vec![0u8; src.len()];
let compressed = compress(INPUT).expect("Failed to compress");
let mut dst = vec![0u8; INPUT.len()];
decompress(&compressed, &mut dst).expect("Failed to decompress");
assert_eq!(&src[..], dst.as_slice());
assert_eq!(INPUT, dst.as_slice());
}
}