Skip to content

Commit

Permalink
debug clang
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Aug 14, 2023
1 parent d2dec01 commit 413e2f1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
env:
INSTALL_PREFIX: "/opt/smelibs"
SUDOCMD: "sudo"
MACOSX_DEPLOYMENT_TARGET: "11"
# MACOSX_DEPLOYMENT_TARGET: "11"
OS_TARGET: "osx"
DUNE_USE_FALLBACK_FILESYSTEM: "ON"
# CXX: "g++-13"
Expand Down
71 changes: 4 additions & 67 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,10 @@

set -e -x

DEPSDIR=${INSTALL_PREFIX}
#export PATH="/usr/local/opt/llvm/bin:$PATH"

echo "SME_DEPS_COMMON_VERSION: ${SME_DEPS_COMMON_VERSION}"
echo "DUNE_COPASI_VERSION: ${DUNE_COPASI_VERSION}"
echo "PATH: $PATH"
echo "MSYSTEM: $MSYSTEM"
/usr/local/opt/llvm/bin/clang++ -o x test.cpp -std=c++20 -L/usr/local/opt/llvm/lib/c++ -static-libstdc++ -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib

which g++
which cmake
g++ --version
gcc --version
cmake --version
ls

export PATH="/usr/local/opt/llvm/bin:$PATH"

echo "Downloading static libs for OS_TARGET: $OS_TARGET"
wget "https://github.com/spatial-model-editor/sme_deps_common/releases/download/${SME_DEPS_COMMON_VERSION}/sme_deps_common_${OS_TARGET}.tgz"
tar xf sme_deps_common_${OS_TARGET}.tgz
# copy libs to desired location: workaround for tar -C / not working on windows
if [[ "$OS_TARGET" == *"win"* ]]; then
mv c/smelibs /c/
# ls /c/smelibs
else
$SUDOCMD mv opt/* /opt/
# ls /opt/smelibs
fi

# export vars for duneopts script to read
export DUNE_COPASI_USE_STATIC_DEPS=ON
export BUILD_SHARED_LIBS=FALSE
export CMAKE_INSTALL_PREFIX=$DEPSDIR
export MAKE_OPTIONS="-j2 VERBOSE=1"
export CMAKE_CXX_FLAGS="'-I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib -fvisibility=hidden -D_GLIBCXX_USE_TBB_PAR_BACKEND=0 -L/usr/local/opt/llvm/lib/c++ -static-libstdc++'"
export DUNE_PDELAB_ENABLE_TRACING=OFF
export DUNE_COPASI_USE_PARAFIELDS=OFF
export DUNE_ENABLE_PYTHONBINDINGS=OFF
export CMAKE_DISABLE_FIND_PACKAGE_MPI=ON
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
if [[ $MSYSTEM ]]; then
# on windows add flags to support large object files
# https://stackoverflow.com/questions/16596876/object-file-has-too-many-sections
export CMAKE_CXX_FLAGS='-fvisibility=hidden -Wa,-mbig-obj'
fi

# clone dune-copasi
git clone -b ${DUNE_COPASI_VERSION} --depth 1 https://gitlab.dune-project.org/copasi/dune-copasi.git
cd dune-copasi

# check opts
bash dune-copasi.opts

# build & install dune (excluding dune-copasi)
bash .ci/setup_dune $PWD/dune-copasi.opts

# build & install dune-copasi
bash .ci/install $PWD/dune-copasi.opts

cd ..

# patch DUNE to skip deprecated FindPythonLibs/FindPythonInterp cmake that breaks subsequent FindPython cmake
sed -i.bak 's|find_package(Python|#find_package(Python|' ${INSTALL_PREFIX}/share/dune/cmake/modules/DunePythonCommonMacros.cmake
# also patch out any dune_python_find_package() calls as this can crash on windows
sed -i.bak 's|dune_python_find_package(|#dune_python_find_package(|' ${INSTALL_PREFIX}/share/dune/cmake/modules/DunePythonCommonMacros.cmake
cat ${INSTALL_PREFIX}/share/dune/cmake/modules/DunePythonCommonMacros.cmake

# ls $DEPSDIR
mkdir artefacts
cd artefacts
tar -zcf sme_deps_${OS_TARGET}.tgz $DEPSDIR/*
otool -L x
9 changes: 9 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <vector>
#include <algorithm>
#include <execution>

int main(){

std::vector<double> v(6000000, 0.5);
return static_cast<int>(std::reduce(std::execution::par_unseq, v.begin(), v.end(), 0.0));
}

0 comments on commit 413e2f1

Please sign in to comment.