From 0f11f5f91c3b0aeb779e634606406645fd2d4bcd Mon Sep 17 00:00:00 2001 From: Vineet Bansal Date: Thu, 5 Dec 2024 15:34:14 -0500 Subject: [PATCH] flexible cxx/cxxflags/ldflags for CI integration --- install.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index cb1886c..edbd6c5 100644 --- a/install.sh +++ b/install.sh @@ -6,22 +6,26 @@ set -e OS=$(uname -s) ARCH=$(uname -m) -if [ "${OS}" = "Linux" ]; then - alias gx1="g++ -O3 -c -fpic -fopenmp " - alias gx2="g++ -O3 -shared -fopenmp " -elif [ "${OS}" = "Darwin" ]; then - if [ "${ARCH}" = "arm64" ]; then - compiler="/opt/homebrew/opt/llvm/bin/clang++" +if [ -n "$CXX" ]; then + compiler="$CXX" +else + if [ "${OS}" = "Linux" ]; then + compiler="g++" + elif [ "${OS}" = "Darwin" ]; then + if [ "${ARCH}" = "arm64" ]; then + compiler="/opt/homebrew/opt/llvm/bin/clang++" + else + compiler="/usr/local/opt/llvm/bin/clang++" + fi else - compiler="/usr/local/opt/llvm/bin/clang++" + echo "Unsupported OS" + exit -1 fi - alias gx1="${compiler} -O3 -c -fpic -fopenmp " - alias gx2="${compiler} -O3 -shared -fopenmp " -else - echo "Unsupported OS" - exit -1 fi +alias gx1="${compiler} \$CXXFLAGS -O3 -c -fpic -fopenmp " +alias gx2="${compiler} \$LDFLAGS -O3 -shared -fopenmp " + mkdir -p ocmesher/lib gx1 -o ocmesher/lib/core.o ocmesher/source/core.cpp gx2 -o ocmesher/lib/core.so ocmesher/lib/core.o