build.sh 953 Bytes
Newer Older
1 2
#!/bin/bash

3 4 5 6
# Fix for OSX build to hide the clang LLVM
rm -f ${BUILD_PREFIX}/bin/llvm-config
rm -rf ${BUILD_PREFIX}/lib/cmake

7 8 9 10 11 12
set -e

if [ -z "$PREFIX" ]; then
  PREFIX="$CONDA_PREFIX"
fi

13 14 15
if [ -z "$cuda" ] || [ "$cuda" == "False" ]; then
    CUDA_OPT=""
else
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
    CUDA_OPT="-DUSE_CUDA=ON -DUSE_CUBLAS=ON"
fi

if [ "$target_platform" == "osx-64" ]; then
    # macOS 64 bits
    METAL_OPT=""  # Conda can only target 10.9 for now
    TOOLCHAIN_OPT=""
else
    METAL_OPT=""
    if [ "$target_platform" == "linux-64" ]; then
        # Linux 64 bits
        TOOLCHAIN_OPT="-DCMAKE_TOOLCHAIN_FILE=${RECIPE_DIR}/../cross-linux.cmake"
    else
        # Windows (or 32 bits, which we don't support)
        METAL_OPT=""
        TOOLCHAIN_OPT=""
    fi
33 34
fi

35 36 37
rm -rf build || true
mkdir -p build
cd build
38 39
cmake $METAL_OPT $CUDA_OPT -DUSE_LLVM=ON -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" $TOOLCHAIN_OPT ..
make -j${CPU_COUNT} VERBOSE=1
40 41
make install
cd ..