mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-21 22:32:23 +00:00
base files
This commit is contained in:
parent
89b264a96e
commit
760a00cabd
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
Cargo.lock
|
||||||
|
/target/
|
||||||
|
/.vscode/
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
64
.travis.yml
Normal file
64
.travis.yml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
language: rust
|
||||||
|
sudo: false
|
||||||
|
git:
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
rust:
|
||||||
|
- 1.36.0
|
||||||
|
- stable
|
||||||
|
- beta
|
||||||
|
- nightly
|
||||||
|
|
||||||
|
os:
|
||||||
|
- osx
|
||||||
|
- linux
|
||||||
|
# Technically works, but super slow, so we use AppVeyor
|
||||||
|
#- windows
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- staging
|
||||||
|
- trying
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
allow_failures:
|
||||||
|
- rust: nightly
|
||||||
|
include:
|
||||||
|
# If we wanted to flag on --release mode we'd add a line like this
|
||||||
|
#- { os: linux, rust: 1.36.0, env: FLAGS=--release }
|
||||||
|
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=wasm32-unknown-unknown }
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=wasm32-wasi }
|
||||||
|
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=aarch64-linux-android }
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=armv7-linux-androideabi }
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=i686-linux-android }
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=x86_64-linux-android }
|
||||||
|
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=arm-unknown-linux-gnueabihf }
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=armv7-unknown-linux-gnueabihf }
|
||||||
|
- { os: linux, rust: 1.36.0, env: TARGET=thumbv7neon-unknown-linux-gnueabihf }
|
||||||
|
|
||||||
|
- { os: osx, rust: 1.36.0, env: TARGET=aarch64-apple-ios }
|
||||||
|
- { os: osx, rust: 1.36.0, env: TARGET=armv7-apple-ios }
|
||||||
|
- { os: osx, rust: 1.36.0, env: TARGET=armv7s-apple-ios }
|
||||||
|
- { os: osx, rust: 1.36.0, env: TARGET=i386-apple-ios }
|
||||||
|
- { os: osx, rust: 1.36.0, env: TARGET=x86_64-apple-ios }
|
||||||
|
|
||||||
|
script:
|
||||||
|
- pushd scripts
|
||||||
|
- ./travis.sh
|
||||||
|
- popd
|
||||||
|
|
||||||
|
# Configured so we cache cargo-web for WASM unit testing, otherwise it takes
|
||||||
|
# forever (13+ minutes) to compile. See also
|
||||||
|
# https://levans.fr/rust_travis_cache.html
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $TRAVIS_HOME/.cargo/
|
||||||
|
- $TRAVIS_HOME/.rustup/
|
||||||
|
before_cache:
|
||||||
|
- rm -rf "$TRAVIS_HOME/.cargo/registry/src"
|
18
Cargo.toml
Normal file
18
Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[package]
|
||||||
|
name = "bytemuck"
|
||||||
|
description = "A crate for mucking around with piles of bytes."
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Lokathor <zefria@gmail.com>"]
|
||||||
|
repository = "https://github.com/Lokathor/bytemuck"
|
||||||
|
readme = "README.md"
|
||||||
|
keywords = ["transmute", "bytes", "casting"]
|
||||||
|
categories = ["encoding", "no-std"]
|
||||||
|
edition = "2018"
|
||||||
|
license = "0BSD"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
extern_crate_alloc = []
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
appveyor = { repository = "Lokathor/bytemuck" }
|
||||||
|
travis-ci = { repository = "Lokathor/bytemuck" }
|
12
LICENSE-0BSD.md
Normal file
12
LICENSE-0BSD.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Copyright (C) 2019 Daniel Gee <zefria@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||||
|
with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
|
THIS SOFTWARE.
|
12
README.md
12
README.md
@ -1,2 +1,14 @@
|
|||||||
|
[![License:0BSD](https://img.shields.io/badge/License-0BSD-brightgreen.svg)](https://opensource.org/licenses/FPL-1.0.0)
|
||||||
|
![Minimum Rust Version](https://img.shields.io/badge/Min%20Rust-1.36-green.svg)
|
||||||
|
[![travis.ci](https://travis-ci.org/Lokathor/bytemuck.svg?branch=master)](https://travis-ci.org/Lokathor/bytemuck)
|
||||||
|
[![AppVeyor](https://ci.appveyor.com/api/projects/status/hgr4if0snmkmqj88/branch/master?svg=true)](https://ci.appveyor.com/project/Lokathor/bytemuck/branch/master)
|
||||||
|
[![crates.io](https://img.shields.io/crates/v/bytemuck.svg)](https://crates.io/crates/bytemuck)
|
||||||
|
[![docs.rs](https://docs.rs/bytemuck/badge.svg)](https://docs.rs/bytemuck/)
|
||||||
|
|
||||||
# bytemuck
|
# bytemuck
|
||||||
|
|
||||||
A crate for mucking around with piles of bytes
|
A crate for mucking around with piles of bytes
|
||||||
|
|
||||||
|
CI coverage:
|
||||||
|
* Tested on: `x86`, `x86_64`, `wasm`
|
||||||
|
* Built on: `armv7`, `aarch64`, `thumbv7neon`
|
||||||
|
45
appveyor.yml
Normal file
45
appveyor.yml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
os: Visual Studio 2015
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- staging
|
||||||
|
- trying
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
# Stable
|
||||||
|
- channel: 1.36.0
|
||||||
|
target: i686-pc-windows-msvc
|
||||||
|
- channel: 1.36.0
|
||||||
|
target: i686-pc-windows-gnu
|
||||||
|
- channel: 1.36.0
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
- channel: 1.36.0
|
||||||
|
target: x86_64-pc-windows-gnu
|
||||||
|
# Beta and Nightly are checked by TravisCI since builds there run in
|
||||||
|
# parallel.
|
||||||
|
|
||||||
|
install:
|
||||||
|
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||||
|
- rustup-init -y --default-toolchain %channel% --default-host %target%
|
||||||
|
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
|
||||||
|
- rustup component add rustfmt
|
||||||
|
- rustup component add clippy
|
||||||
|
- rustc -vV
|
||||||
|
- cargo -vV
|
||||||
|
|
||||||
|
# On advice of retep we skip the "build" script phase
|
||||||
|
build: false
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- cargo fmt -- --check
|
||||||
|
- cargo clippy
|
||||||
|
- cargo test --no-default-features
|
||||||
|
- cargo test
|
||||||
|
- cargo test --all-features
|
1
pedantic.bat
Normal file
1
pedantic.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
cargo clippy -- -W clippy::pedantic
|
7
rustfmt.toml
Normal file
7
rustfmt.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
error_on_line_overflow = false
|
||||||
|
merge_imports = true
|
||||||
|
reorder_imports = true
|
||||||
|
use_try_shorthand = true
|
||||||
|
tab_spaces = 2
|
||||||
|
max_width = 100
|
||||||
|
color = "Never"
|
16
scripts/generic-cross/.cargo/config
Normal file
16
scripts/generic-cross/.cargo/config
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Don't generate CPU mismatch warnings when cross-compiling
|
||||||
|
|
||||||
|
[target.arm-unknown-linux-gnueabihf]
|
||||||
|
ar = "arm-linux-gnueabihf-ar"
|
||||||
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.armv7-unknown-linux-gnueabihf]
|
||||||
|
ar = "arm-linux-gnueabihf-ar"
|
||||||
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.thumbv7neon-unknown-linux-gnueabihf]
|
||||||
|
ar = "arm-linux-gnueabihf-ar"
|
||||||
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
21
scripts/linux-android/.cargo/config
Normal file
21
scripts/linux-android/.cargo/config
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Android ar/linker/flags config for when building on linux.
|
||||||
|
|
||||||
|
[target.aarch64-linux-android]
|
||||||
|
ar = "aarch64-linux-android-ar"
|
||||||
|
linker = "aarch64-linux-android21-clang"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.armv7-linux-androideabi]
|
||||||
|
ar = "armv7a-linux-androideabi-ar"
|
||||||
|
linker = "armv7a-linux-androideabi21-clang"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.i686-linux-android]
|
||||||
|
ar = "i686-linux-android-ar"
|
||||||
|
linker = "i686-linux-android21-clang"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.x86_64-linux-android]
|
||||||
|
ar = "x86_64-linux-android-ar"
|
||||||
|
linker = "x86_64-linux-android21-clang"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
55
scripts/travis.sh
Normal file
55
scripts/travis.sh
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rustup component add clippy
|
||||||
|
cargo clippy
|
||||||
|
|
||||||
|
if [[ "$TARGET" != "" ]]; then rustup target install $TARGET; fi
|
||||||
|
|
||||||
|
if [[ "$TARGET" == "wasm32-"* && "$TARGET" != "wasm32-wasi" ]]; then
|
||||||
|
cargo-web --version || cargo install cargo-web
|
||||||
|
cargo web test --no-default-features $FLAGS --target=$TARGET
|
||||||
|
cargo web test $FLAGS --target=$TARGET
|
||||||
|
cargo web test --all-features $FLAGS --target=$TARGET
|
||||||
|
|
||||||
|
elif [[ "$TARGET" == *"-linux-android"* ]]; then
|
||||||
|
export PATH=/usr/local/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
|
||||||
|
pushd linux-android
|
||||||
|
cargo build --no-default-features --target=$TARGET $FLAGS
|
||||||
|
cargo build --target=$TARGET $FLAGS
|
||||||
|
cargo build --all-features --target=$TARGET $FLAGS
|
||||||
|
# Don't test, can't run android emulators successfully on travis currently
|
||||||
|
popd
|
||||||
|
|
||||||
|
elif [[ "$TARGET" == *"-apple-ios" || "$TARGET" == "wasm32-wasi" ]]; then
|
||||||
|
cargo build --no-default-features --target=$TARGET $FLAGS
|
||||||
|
cargo build --target=$TARGET $FLAGS
|
||||||
|
cargo build --all-features --target=$TARGET $FLAGS
|
||||||
|
# Don't test
|
||||||
|
# iOS simulator setup/teardown is complicated
|
||||||
|
# cargo-web doesn't support wasm32-wasi yet, nor can wasm-pack test specify a target
|
||||||
|
|
||||||
|
elif [[ "$TARGET" == *"-unknown-linux-gnueabihf" ]]; then
|
||||||
|
#sudo apt-get update
|
||||||
|
#sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
|
||||||
|
pushd generic-cross
|
||||||
|
cargo build --no-default-features --target=$TARGET $FLAGS
|
||||||
|
cargo build --target=$TARGET $FLAGS
|
||||||
|
cargo build --all-features --target=$TARGET $FLAGS
|
||||||
|
# Don't test
|
||||||
|
popd
|
||||||
|
|
||||||
|
elif [[ "$TARGET" != "" ]]; then
|
||||||
|
pushd generic-cross
|
||||||
|
cargo test --no-default-features --target=$TARGET $FLAGS
|
||||||
|
cargo test --target=$TARGET $FLAGS
|
||||||
|
cargo test --all-features --target=$TARGET $FLAGS
|
||||||
|
popd
|
||||||
|
|
||||||
|
else
|
||||||
|
# Push nothing, target host CPU architecture
|
||||||
|
cargo test --no-default-features $FLAGS
|
||||||
|
cargo test $FLAGS
|
||||||
|
cargo test --all-features $FLAGS
|
||||||
|
fi
|
21
scripts/windows-android/.cargo/config
Normal file
21
scripts/windows-android/.cargo/config
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Android ar/linker/flags config for when building on windows.
|
||||||
|
|
||||||
|
[target.aarch64-linux-android]
|
||||||
|
ar = "aarch64-linux-android-ar.cmd"
|
||||||
|
linker = "aarch64-linux-android21-clang.cmd"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.armv7-linux-androideabi]
|
||||||
|
ar = "armv7a-linux-androideabi-ar.cmd"
|
||||||
|
linker = "armv7a-linux-androideabi21-clang.cmd"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.i686-linux-android]
|
||||||
|
ar = "i686-linux-android-ar.cmd"
|
||||||
|
linker = "i686-linux-android21-clang.cmd"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
||||||
|
|
||||||
|
[target.x86_64-linux-android]
|
||||||
|
ar = "x86_64-linux-android-ar.cmd"
|
||||||
|
linker = "x86_64-linux-android21-clang.cmd"
|
||||||
|
rustflags = ["-C","target-cpu=generic"]
|
Loading…
Reference in New Issue
Block a user