Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martin-steinegger/f36ad869462c984542c5806c9ea0beee to your computer and use it in GitHub Desktop.
Save martin-steinegger/f36ad869462c984542c5806c9ea0beee to your computer and use it in GitHub Desktop.
build.sh
#!/bin/bash -e
export CC=gcc
export CXX=g++
cat <<'CPUDOC' | $CC -std=gnu99 -o "testcpu" -xc -
#include <stdio.h>
#define D(x) __builtin_cpu_supports((x))?(x)
int main(){puts(D("avx2"):D("sse4.1"):"fail");}
CPUDOC
if [ "$(./testcpu)" = "fail" ]; then
echo "CPU is not supported"
exit 1
fi
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DHAVE_TESTS=0 -DHAVE_MPI=0 -DHAVE_SSE4_1=1 -DVERSION_OVERRIDE="${PKG_VERSION}" ..
make -j 2
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment