Skip to content

Commit

Permalink
Synchronize files with the official upstream source.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdadams committed Dec 31, 2022
0 parents commit 19fe888
Show file tree
Hide file tree
Showing 207 changed files with 8,648 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .build/github/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#! /usr/bin/env bash

################################################################################

panic()
{
echo "ERROR: $*"
exit 1
}

list_files()
{
find "$1" -printf "%M %u %P\n" | sort
}

################################################################################

self_program="$(realpath "$0")" || \
panic "realpath failed"
self_dir="$(dirname "$self_program")" || \
panic "dirname failed"

top_dir="$self_dir/../.."

verbose=0
matrix_os=

while getopts vs: option; do
case "$option" in
v)
verbose=$((verbose + 1));;
s)
matrix_os="$OPTARG";;
*)
usage "invalid option $option"
break
;;
esac
done
shift $((OPTIND - 1))

case "$matrix_os" in
ubuntu-*)
export CMAKE_PREFIX_PATH="/usr/lib/llvm-15/lib/cmake/llvm:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="/usr/lib/llvm-15/lib:$LD_LIBRARY_PATH"
export CL_CLANG_INCLUDE_DIR=/usr/include/clang/15.0.6/include
export PATH="/usr/lib/llvm-15/bin:$PATH"
case "$CC" in
*clang*)
export CC="clang"
export CXX="clang++"
;;
*gcc*)
case "$matrix_os" in
*-20.04)
export CC="gcc-10"
export CXX="g++-10"
;;
esac
;;
esac
if [ ! -d "$CL_CLANG_INCLUDE_DIR" ]; then
panic "Clang include directory does not exist"
fi
;;
esac

if [ "$verbose" -ge 1 ]; then
cat <<- EOF
============================================================
CC: $CC
============================================================
CXX: $CXX
============================================================
PATH: $PATH
============================================================
LD_LIBRARY_PATH: $LD_LIBRARY_PATH
============================================================
CMAKE_PREFIX_PATH: $CMAKE_PREFIX_PATH
============================================================
CL_CLANG_INCLUDE_DIR: $CL_CLANG_INCLUDE_DIR
============================================================
Clang version:
$(clang++ --version)
$(clang --version)
============================================================
GCC version:
$(g++ --version)
$(gcc --version)
============================================================
Clang default version of C++ standard:
$(g++ -dM -E -x c++ /dev/null | grep -F __cplusplus)
============================================================
GCC default version of C++ standard:
$(clang++ -dM -E -x c++ /dev/null | grep -F __cplusplus)
============================================================
EOF
fi

"$top_dir/build" \
--verbose \
--clean \
--build \
--demo \
--verbose-makefile \
--fmt \
--debug \
--asan \
--ubsan \
|| panic "build failed"
172 changes: 172 additions & 0 deletions .build/github/prebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#! /usr/bin/env bash

################################################################################

panic()
{
echo "ERROR: $*"
exit 1
}

list_directory_recursive()
{
find "$1" -printf "%M %u %P\n" | sort
}

list_directory()
{
local options=()
while [ $# -gt 1 ]; do
options+=("$1")
shift 1
done
echo "directory: $1" || return 1
ls -l "${options[@]}" "$1" || return 1
}

################################################################################

usage()
{
echo "BAD USAGE: $*"
exit 2
}

verbose=0
matrix_os=

while getopts vs: option; do
case "$option" in
v)
verbose=$((verbose + 1));;
s)
matrix_os="$OPTARG";;
*)
usage "invalid option $option"
break
;;
esac
done
shift $((OPTIND - 1))

if [ "$verbose" -ge 2 ]; then
set -xv
fi

if [ -z "$matrix_os" ]; then
panic "GitHub Actions matrix OS not specified"
fi

echo "PREBUILD MATRIX OS: $matrix_os"

case "$matrix_os" in

ubuntu-*)

llvm_packages=(
libllvm-15-ocaml-dev
libllvm15
llvm-15
llvm-15-dev
llvm-15-doc
llvm-15-examples
llvm-15-runtime
clang-15
clang-tools-15
clang-15-doc
libclang-common-15-dev
libclang-15-dev
libclang1-15
clang-format-15
python3-clang-15
clangd-15
clang-tidy-15
libfuzzer-15-dev
lldb-15
lld-15
libc++-15-dev
libc++abi-15-dev
libomp-15-dev
libclc-15-dev
libunwind-15-dev
libmlir-15-dev
mlir-15-tools
libbolt-15-dev
bolt-15
)

case "$matrix_os" in

*-22.04)
repos=(
"deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"
)
other_packages=(
gcc-11
libboost-all-dev
python3
)
;;

*-20.04)
repos=(
"deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main"
)
other_packages=(
gcc-10
libboost-all-dev
python3
)
;;

*)
panic "invalid matrix OS value $matrix_os"
;;

esac

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | \
sudo apt-key add -

for repo in "${repos[@]}"; do
echo "Adding APT repository: $repo"
sudo add-apt-repository "$repo" || \
panic "add-apt-repository failed for $repo"
done

echo "Updating packages"
sudo apt-get update || \
panic "apt-get update failed"

echo "Installing packages: ${other_packages[*]}"
sudo apt-get install "${other_packages[@]}" "${llvm_packages[@]}" || \
panic "apt-get install failed"

case "$matrix_os" in
*-22.04)
if [ "$verbose" -ge 1 ]; then
list_directory /usr/lib64
list_directory /usr/lib
list_directory /usr/lib/cmake/clang-15
list_directory -L /usr/lib/cmake/clang-15
list_directory /lib/cmake/clang-15
list_directory -L /lib/cmake/clang-15
list_directory /usr/include/llvm-15/llvm
list_directory /usr/lib/llvm-15/lib
list_directory /usr/lib/llvm-15/lib/clang
list_directory /usr/lib/llvm-15/lib/clang/15
list_directory /usr/lib/llvm-15/lib/clang/15.0.6
list_directory /usr/lib/llvm-15/lib/cmake/llvm # CMake config
list_directory /usr/lib/llvm-15/lib/cmake/clang
fi
esac

;;

*)
panic "invalid OS $matrix_os"
;;

esac

exit 0
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ci

on: [push, pull_request]

jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
compiler: [ {cc: gcc, cxx: g++}, {cc: clang, cxx: clang++} ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
############################################################
- name: prebuild
shell: bash
run: .build/github/prebuild -v -s ${{ matrix.os }}
############################################################
- name: testing
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
shell: bash
run: .build/github/build -v -s ${{ matrix.os }}
############################################################
Loading

0 comments on commit 19fe888

Please sign in to comment.