Skip to content

Commit

Permalink
[workflows] Enable verbose output with -v
Browse files Browse the repository at this point in the history
For debugging purpose, add a -v option to build-flang.sh to enable verbose
output. The option sets $VERBOSE to an non-empty string which forces the
CMake-generated Makefile to print every command it runs.
  • Loading branch information
bryanpkc committed Oct 26, 2022
1 parent 49e04be commit 81bebeb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_flang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Build and install flang & libpgmath
run: |
${{ env.install_prefix }}/bin/clang --version
./build-flang.sh -t ${{ matrix.target }} -p ${{ env.install_prefix }} -n $(nproc) -c -s
./build-flang.sh -t ${{ matrix.target }} -p ${{ env.install_prefix }} -n $(nproc) -c -s -v
- name: Copy llvm-lit
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_flang_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Build and install flang & libpgmath
run: |
cd ${{ env.build_path }}/flang
./build-flang.sh -t ${{ matrix.target }} -p ${{ env.install_prefix }} -n `nproc --ignore=1`
./build-flang.sh -t ${{ matrix.target }} -p ${{ env.install_prefix }} -n `nproc --ignore=1` -v
# Copy llvm-lit
- name: Copy llvm-lit
Expand Down
17 changes: 14 additions & 3 deletions build-flang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ INSTALL_PREFIX="/usr/local"
NPROC=1
USE_CCACHE="0"
USE_SUDO="0"
VERBOSE=""

set -e # Exit the script on first error.

Expand All @@ -30,16 +31,18 @@ function print_usage {
echo " -n Number of parallel jobs. Default: 1";
echo " -c Use ccache. Default: 0 - do not use ccache";
echo " -s Use sudo to install. Default: 0 - do not use sudo";
echo " -v Enable verbose output";
}

while getopts "t:d:p:n:c?s?" opt; do
while getopts "t:d:p:n:c?s?v" opt; do
case "$opt" in
t) TARGET=$OPTARG;;
d) BUILD_TYPE=$OPTARG;;
p) INSTALL_PREFIX=$OPTARG;;
n) NPROC=$OPTARG;;
c) USE_CCACHE="1";;
s) USE_SUDO="1";;
v) VERBOSE="1";;
?) print_usage; exit 0;;
esac
done
Expand All @@ -60,8 +63,12 @@ fi
# Build and install libpgmath
cd runtime/libpgmath
mkdir -p build && cd build
if [ -n "$VERBOSE" ]; then
set -x
fi
cmake $CMAKE_OPTIONS ..
make -j$NPROC
set +x
make -j$NPROC VERBOSE=$VERBOSE
if [ $USE_SUDO == "1" ]; then
echo "Install with sudo"
sudo make install
Expand All @@ -74,14 +81,18 @@ cd ../../..

# Build and install flang
mkdir -p build && cd build
if [ -n "$VERBOSE" ]; then
set -x
fi
cmake $CMAKE_OPTIONS \
-DCMAKE_Fortran_COMPILER=$INSTALL_PREFIX/bin/flang \
-DCMAKE_Fortran_COMPILER_ID=Flang \
-DFLANG_INCLUDE_DOCS=ON \
-DFLANG_LLVM_EXTENSIONS=ON \
-DWITH_WERROR=ON \
..
make -j$NPROC
set +x
make -j$NPROC VERBOSE=$VERBOSE
if [ $USE_SUDO == "1" ]; then
echo "Install with sudo"
sudo make install
Expand Down

0 comments on commit 81bebeb

Please sign in to comment.