Skip to content

Instantly share code, notes, and snippets.

@otmb
Last active May 1, 2019 20:44
Show Gist options
  • Save otmb/66a0b40510fd544e3aceaab38192728b to your computer and use it in GitHub Desktop.
Save otmb/66a0b40510fd544e3aceaab38192728b to your computer and use it in GitHub Desktop.

Build Zstd Unity(ios/mac)

wget https://github.com/facebook/zstd/archive/v1.3.5.zip
cd zstd-1.3.5/build/cmake
mkdir ios
cd ios

wget https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake

cmake .. -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64
make
mv lib/libzstd.1.3.5.dylib lib/libzstd.bundle

cmake .. -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DIOS_PLATFORM=OS
make
  • Unity Import
    • lib/libzstd.a
    • lib/libzstd.bundle

Get ZstdNet

cd ~/src
wget https://github.com/skbkontur/ZstdNet/archive/v1.3.3.0.zip
unzip v1.3.3.0.zip
cd ZstdNet-1.3.3.0
rm -rf ZstdNet/build
  • Unity import
    • ./ZstdNet

Edit ZstdNet/ExternMethods.cs

- private const string DllName = "libzstd";

+ #if UNITY_EDITOR
+     private const string DllName = "libzstd";
+ #else
+     private const string DllName = "__Internal";
+ #endif
@anders-lundgren
Copy link

Hi, looking to replicate using CMake 3.14 and XCode 10.2. The above cmake instruction fails with error ”Bundle target missing”. Any ideas what’s going wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment