Attempted fix for Windows/macOS build
This commit is contained in:
parent
cd89d6cec6
commit
a24507ff1e
|
@ -16,6 +16,15 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
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
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
1
build.rs
1
build.rs
|
@ -18,6 +18,7 @@ fn main() {
|
||||||
.size_t_is_usize(true)
|
.size_t_is_usize(true)
|
||||||
.ctypes_prefix("types")
|
.ctypes_prefix("types")
|
||||||
.derive_debug(false)
|
.derive_debug(false)
|
||||||
|
.clang_arg("-std=c++14")
|
||||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,11 +54,7 @@
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
||||||
use alloc::{
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
alloc::{alloc_zeroed, dealloc, Layout},
|
|
||||||
boxed::Box,
|
|
||||||
vec::Vec,
|
|
||||||
};
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use core::ptr::null_mut;
|
use core::ptr::null_mut;
|
||||||
use core::{marker::PhantomData, mem::size_of};
|
use core::{marker::PhantomData, mem::size_of};
|
||||||
|
|
|
@ -113,12 +113,13 @@ mod tests {
|
||||||
|
|
||||||
use super::{compress::compress, decompress::decompress};
|
use super::{compress::compress, decompress::decompress};
|
||||||
|
|
||||||
|
const INPUT: &[u8] = include_bytes!("test1.txt");
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_round_trip() {
|
fn test_round_trip() {
|
||||||
let src = include_bytes!("test1.txt");
|
let compressed = compress(INPUT).expect("Failed to compress");
|
||||||
let compressed = compress(src).expect("Failed to compress");
|
let mut dst = vec![0u8; INPUT.len()];
|
||||||
let mut dst = vec![0u8; src.len()];
|
|
||||||
decompress(&compressed, &mut dst).expect("Failed to decompress");
|
decompress(&compressed, &mut dst).expect("Failed to decompress");
|
||||||
assert_eq!(&src[..], dst.as_slice());
|
assert_eq!(INPUT, dst.as_slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue