Skip to content

Commit

Permalink
Merge branch 'compiler-research:main' into Add-pull-request-template
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbarton authored Oct 10, 2024
2 parents 56094f8 + 0f406da commit 9d1cd59
Show file tree
Hide file tree
Showing 16 changed files with 633 additions and 134 deletions.
90 changes: 74 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ jobs:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-19
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '19'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-18
os: ubuntu-22.04
compiler: gcc-12
Expand Down Expand Up @@ -50,6 +57,12 @@ jobs:
cling-version: '1.0'
cppyy: On
coverage: true
- name: win2022-msvc-clang-repl-19
os: windows-2022
compiler: msvc
clang-runtime: '19'
cling: Off
cppyy: Off
- name: win2022-msvc-clang-repl-18
os: windows-2022
compiler: msvc
Expand All @@ -75,6 +88,12 @@ jobs:
cling: On
cling-version: '1.0'
cppyy: Off
- name: osx14-arm-clang-clang-repl-19
os: macos-14
compiler: clang
clang-runtime: '19'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-18
os: macos-14
compiler: clang
Expand All @@ -100,6 +119,12 @@ jobs:
cling: On
cling-version: '1.0'
cppyy: On
- name: osx13-x86-clang-clang-repl-19
os: macos-13
compiler: clang
clang-runtime: '19'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-18
os: macos-13
compiler: clang
Expand Down Expand Up @@ -350,7 +375,7 @@ jobs:
else
# Apply patches
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
if [[ "${llvm_vers}" != "18" ]]; then
if [[ "${llvm_vers}" == "16" ]]||[[ "${llvm_vers}" == "17" ]]; then
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
fi
Expand Down Expand Up @@ -399,10 +424,10 @@ jobs:
if ( "${{ matrix.cling }}" -imatch "On" )
{
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" `
cmake -DLLVM_ENABLE_PROJECTS="clang" `
-DLLVM_EXTERNAL_PROJECTS=cling `
-DLLVM_EXTERNAL_CLING_SOURCE_DIR="$env:CLING_DIR" `
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" `
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_ENABLE_ASSERTIONS=ON `
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
Expand All @@ -413,7 +438,6 @@ jobs:
-DLLVM_ENABLE_TERMINFO=OFF `
-DLLVM_ENABLE_LIBXML2=OFF `
..\llvm
cmake --build . --config Release --target lld --parallel ${{ env.ncpus }}
cmake --build . --config Release --target clang --parallel ${{ env.ncpus }}
cmake --build . --config Release --target cling --parallel ${{ env.ncpus }}
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
Expand All @@ -435,8 +459,8 @@ jobs:
}
cd build
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
cmake -DLLVM_ENABLE_PROJECTS="clang;lld" `
-DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" `
cmake -DLLVM_ENABLE_PROJECTS="clang" `
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_ENABLE_ASSERTIONS=ON `
-DCLANG_ENABLE_STATIC_ANALYZER=OFF `
Expand All @@ -447,7 +471,7 @@ jobs:
-DLLVM_ENABLE_TERMINFO=OFF `
-DLLVM_ENABLE_LIBXML2=OFF `
..\llvm
cmake --build . --config Release --target clang clang-repl lld --parallel ${{ env.ncpus }}
cmake --build . --config Release --target clang clang-repl --parallel ${{ env.ncpus }}
}
cd ..\
rm -r -force $(find.exe . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
Expand All @@ -470,6 +494,13 @@ jobs:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-19-cppyy
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '19'
cling: Off
cppyy: On
coverage: true
- name: ubu22-x86-gcc12-clang-repl-18-cppyy
os: ubuntu-22.04
compiler: gcc-12
Expand Down Expand Up @@ -498,6 +529,12 @@ jobs:
cppyy: On
#FIXME: Windows CppInterOp tests expected to fail
#until https://github.com/compiler-research/CppInterOp/issues/188 is solved
- name: win2022-msvc-clang-repl-19
os: windows-2022
compiler: msvc
clang-runtime: '19'
cling: Off
cppyy: Off
- name: win2022-msvc-clang-repl-18
os: windows-2022
compiler: msvc
Expand Down Expand Up @@ -542,6 +579,12 @@ jobs:
# cling: On
# cling-version: '1.0'
# cppyy: On
- name: osx14-arm-clang-clang-repl-19-cppyy
os: macos-14
compiler: clang
clang-runtime: '19'
cling: Off
cppyy: On
- name: osx14-arm-clang-clang-repl-18-cppyy
os: macos-14
compiler: clang
Expand All @@ -567,6 +610,12 @@ jobs:
cling: On
cling-version: '1.0'
cppyy: On
- name: osx13-x86-clang-clang-repl-19-cppyy
os: macos-13
compiler: clang
clang-runtime: '19'
cling: Off
cppyy: On
- name: osx13-x86-clang-clang-repl-18-cppyy
os: macos-13
compiler: clang
Expand Down Expand Up @@ -1076,6 +1125,12 @@ jobs:
fail-fast: false
matrix:
include:
- name: ubu22-x86-gcc12-clang-repl-19-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
clang-runtime: '19'
cling: Off
micromamba_shell_init: bash
- name: ubu22-x86-gcc12-clang-repl-18-emscripten_wasm
os: ubuntu-22.04
compiler: gcc-12
Expand All @@ -1101,6 +1156,12 @@ jobs:
cling: On
cling-version: '1.0'
micromamba_shell_init: bash
- name: osx14-arm-clang-clang-repl-19-emscripten_wasm
os: macos-14
compiler: clang
clang-runtime: '19'
cling: Off
micromamba_shell_init: bash
- name: osx14-arm-clang-clang-repl-18-emscripten_wasm
os: macos-14
compiler: clang
Expand All @@ -1126,6 +1187,12 @@ jobs:
cling: On
cling-version: '1.0'
micromamba_shell_init: bash
- name: osx13-x86-clang-clang-repl-19-emscripten_wasm
os: macos-13
compiler: clang
clang-runtime: '19'
cling: Off
micromamba_shell_init: bash
- name: osx13-x86-clang-clang-repl-18-emscripten_wasm
os: macos-13
compiler: clang
Expand Down Expand Up @@ -1195,15 +1262,6 @@ jobs:
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
fi
- name: Install deps on Linux
if: runner.os == 'Linux'
run: |
# Install deps
sudo apt-get update
sudo apt-get install git g++ debhelper devscripts gnupg python3 valgrind
sudo apt-get autoremove
sudo apt-get clean
- name: install mamba
uses: mamba-org/setup-micromamba@main
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
python-version: "3.11"

- name: Install LLVM and Clang
uses: KyleMayes/[email protected].2
uses: KyleMayes/[email protected].3
with:
version: "16.0.0"
version: "17.0.6"

- name: install lit
run: pip install lit
Expand All @@ -37,8 +37,11 @@ jobs:
build_dir: build
apt_packages: cmake,libxml2,libxml2-dev,libtinfo-dev,zlib1g-dev,libzstd-dev
split_workflow: true
config_file: .clang-tidy
cmake_command: >
cmake . -B build -DCMAKE_BUILD_TYPE="Release"
-DCMAKE_C_COMPILER="$GITHUB_WORKSPACE/llvm/bin/clang"
-DCMAKE_CXX_COMPILER="$GITHUB_WORKSPACE/llvm/bin/clang++"
-DUSE_CLING=OFF
-DUSE_REPL=ON
-DLLVM_DIR="$GITHUB_WORKSPACE/llvm"
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
## Define supported version of clang and llvm

set(CLANG_MIN_SUPPORTED 13.0)
set(CLANG_MAX_SUPPORTED "18.1.x")
set(CLANG_VERSION_UPPER_BOUND 19.0.0)
set(CLANG_MAX_SUPPORTED "19.1.x")
set(CLANG_VERSION_UPPER_BOUND 20.0.0)
set(LLVM_MIN_SUPPORTED 13.0)
set(LLVM_MAX_SUPPORTED "18.1.x")
set(LLVM_VERSION_UPPER_BOUND 19.0.0)
set(LLVM_MAX_SUPPORTED "19.1.x")
set(LLVM_VERSION_UPPER_BOUND 20.0.0)

## Set Cmake packages search order

Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,20 @@ git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git
```

#### Setup Clang-REPL
Clone the 17.x release of the LLVM project repository.
Clone the 18.x release of the LLVM project repository.
```
git clone --depth=1 --branch release/17.x https://github.com/llvm/llvm-project.git
git clone --depth=1 --branch release/18.x https://github.com/llvm/llvm-project.git
cd llvm-project
```
Get the following patches required for development work. To apply these patches on Linux and MacOS execute the following command

For Clang 16 & 17, the following patches required for development work. To apply these patches on Linux and MacOS execute the following command(substitute `{version}` with your clang version):
```
git apply -v ../CppInterOp/patches/llvm/clang17-*.patch
git apply -v ../CppInterOp/patches/llvm/clang{version}-*.patch
```
and
```
cp -r ..\CppInterOp\patches\llvm\clang17* .
git apply -v clang17-1-NewOperator.patch
git apply -v clang{version}-*.patch
```
on Windows.

Expand Down Expand Up @@ -211,14 +212,13 @@ cd ..\
```

#### Environment variables
Regardless of whether you are building CppInterOP with Cling or Clang-REPL you will need to define the following Envirnoment variables (as they clear for a new session, it is recommended that you also add these to your .bashrc in linux, .bash_profile if on MacOS, or profile.ps1 on Windows). On Linux and MacOS you define as follows
Regardless of whether you are building CppInterOP with Cling or Clang-REPL you will need to define the following environment variables (as they clear for a new session, it is recommended that you also add these to your .bashrc in linux, .bash_profile if on MacOS, or profile.ps1 on Windows). On Linux and MacOS you define as follows
```
export CB_PYTHON_DIR="$PWD/cppyy-backend/python"
export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend"
export CPLUS_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_DIR}/build/include:${LLVM_DIR}/build/tools/clang/include"
export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR
```
If on MacOS you will also need the following envirnoment variable defined
If on MacOS you will also need the following environment variable defined
```
export SDKROOT=`xcrun --show-sdk-path`
```
Expand All @@ -227,7 +227,6 @@ On Windows you define as follows (assumes you have defined $env:PWD_DIR= $PWD.Pa
$env:CB_PYTHON_DIR="$env:PWD_DIR\cppyy-backend\python"
$env:CPPINTEROP_DIR="$env:CB_PYTHON_DIR\cppyy_backend"
$env:CPLUS_INCLUDE_PATH="$env:CPLUS_INCLUDE_PATH;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_DIR\build\include;$env:LLVM_DIR\build\tools\clang\include"
$env:PYTHONPATH="$env:PYTHONPATH;$env:CPYCPPYY_DIR;$env:CB_PYTHON_DIR"
```

#### Build CppInterOp
Expand Down Expand Up @@ -328,13 +327,22 @@ Note down the path to the `build` directory as `CPYCPPYY_DIR`:
export CPYCPPYY_DIR=$PWD
cd ../..
```
Export the `libcppyy` path to python:

```
export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR
```
and on Windows:
```
$env:PYTHONPATH="$env:PYTHONPATH;$env:CPYCPPYY_DIR;$env:CB_PYTHON_DIR"
```

#### Install cppyy

```
git clone --depth=1 https://github.com/compiler-research/cppyy.git
cd cppyy
python -m pip install --upgrade . --no-deps
python -m pip install --upgrade . --no-deps --no-build-isolation
cd ..
```

Expand Down
5 changes: 2 additions & 3 deletions environment-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ channels:
dependencies:
- zlib
- nlohmann_json
- xeus-lite <2.0
- xeus >=3.0.5,<4.0
- xtl >=0.7,<0.8
- xeus-lite
- xeus
- cpp-argparse
- pugixml
Loading

0 comments on commit 9d1cd59

Please sign in to comment.