-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.sh
executable file
·36 lines (29 loc) · 1.07 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "configure.sh <clang dir>"
echo "ex) ./configure.sh ~/llvm-10.0-releaseassert/bin"
exit 1
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
ISYSROOT="-isysroot `xcrun --show-sdk-path`"
else
ISYSROOT=
fi
LLVMCONFIG=$1/llvm-config
CXXFLAGS=`$LLVMCONFIG --cxxflags`
SRCROOT=`$LLVMCONFIG --src-root`
CXXFLAGS="$CXXFLAGS -std=c++17 -g -I${SRCROOT}/include ${ISYSROOT}"
CXXFLAGS="$CXXFLAGS -I${SRCROOT}/utils/unittest/googletest/include"
CXXFLAGS="$CXXFLAGS -I${SRCROOT}/utils/unittest/googletest/"
CXXFLAGS="$CXXFLAGS -I./include/"
GTESTSRC="${SRCROOT}/utils/unittest/googletest/src/gtest-all.cc"
LDFLAGS=`$LLVMCONFIG --ldflags`
LIBS=`$LLVMCONFIG --libs core irreader bitreader support analysis asmparser passes --system-libs`
LDFLAGS="$LDFLAGS -Wl,-rpath,`$LLVMCONFIG --libdir`"
LDFLAGS="$LDFLAGS $LIBS -lpthread -lm -fPIC"
echo "CXX=$1/clang++" >Makefile
echo "CXXFLAGS=${CXXFLAGS}" >>Makefile
echo "LDFLAGS=${LDFLAGS}" >>Makefile
echo "GTESTSRC=${GTESTSRC}" >> Makefile
echo "FILECHECK_PATH=$1/FileCheck" >> Makefile
cat Makefile.template >>Makefile