Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions interpreter/CppInterOp/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ build:
tools:
python: "3.11"
apt_packages:
- clang-18
- clang-20
- cmake
- libclang-18-dev
- llvm-18-dev
- llvm-18-tools
- libclang-20-dev
- llvm-20-dev
- llvm-20-tools
17 changes: 13 additions & 4 deletions interpreter/CppInterOp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ option(CPPINTEROP_USE_CLING "Use Cling as backend" OFF)
option(CPPINTEROP_USE_REPL "Use clang-repl as backend" ON)
option(CPPINTEROP_ENABLE_TESTING "Enable the CppInterOp testing infrastructure." ON)
if(EMSCRIPTEN)
set(CPPINTEROP_EXTRA_WASM_FLAGS "-sSUPPORT_LONGJMP=wasm -fwasm-exceptions" CACHE STRING "Extra flags for wasm")
set(CPPINTEROP_EXTRA_WASM_FLAGS "-fwasm-exceptions" CACHE STRING "Extra flags for wasm")
endif()

if (CPPINTEROP_USE_CLING AND CPPINTEROP_USE_REPL)
Expand All @@ -24,6 +24,13 @@ endif()
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
project(CppInterOp)

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(WARNING "No build type selected. Defaulted CMAKE_BUILD_TYPE=Release.\n"
"Valid options are: None, Debug, Release, RelWithDebInfo, MinSizeRel.")
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif()

# LLVM/Clang/Cling default paths
if (DEFINED LLVM_DIR)
if (NOT DEFINED Clang_DIR)
Expand Down Expand Up @@ -70,13 +77,13 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
include(GNUInstallDirs)
## Define supported version of clang and llvm

set(CLANG_MIN_SUPPORTED 18.0)
set(CLANG_MIN_SUPPORTED 19.0)
set(CLANG_MAX_SUPPORTED "21.1.x")
set(CLANG_VERSION_UPPER_BOUND 22.0.0)
set(LLD_MIN_SUPPORTED 18.0)
set(LLD_MIN_SUPPORTED 19.0)
set(LLD_MAX_SUPPORTED "21.1.x")
set(LLD_VERSION_UPPER_BOUND 22.0.0)
set(LLVM_MIN_SUPPORTED 18.0)
set(LLVM_MIN_SUPPORTED 19.0)
set(LLVM_MAX_SUPPORTED "21.1.x")
set(LLVM_VERSION_UPPER_BOUND 22.0.0)

Expand Down Expand Up @@ -373,6 +380,8 @@ endif ()
# Fixes "C++ exception handler used, but unwind semantics are not enabled" warning Windows
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
# Required for clang::driver::options::OPT_ see https://github.com/llvm/llvm-project/issues/86028
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zc:preprocessor")
endif ()

if (APPLE)
Expand Down
6 changes: 1 addition & 5 deletions interpreter/CppInterOp/Emscripten-build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,6 @@ Expand-Archive -Path "$PWD\chrome-win.zip" -DestinationPath "$PWD" -Force -Verbo
Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" -OutFile "firefox-setup.exe" -Verbose
& "C:\Program Files\7-Zip\7z.exe" x "firefox-setup.exe"
$env:PATH="$PWD\core;$PWD\chrome-win;$env:PATH"
echo "PATH=$env:PATH"
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
echo "Running CppInterOpTests in Firefox"
emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" CppInterOpTests.html
echo "Running DynamicLibraryManagerTests in Firefox"
Expand Down Expand Up @@ -357,7 +355,7 @@ emcmake cmake \
-DXEUS_CPP_RESOURCE_DIR="$LLVM_BUILD_DIR/lib/clang/$LLVM_VERSION" \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions" emmake make -j $(nproc --all) install
emmake make -j $(nproc --all) install
```

and on Windows by executing
Expand All @@ -378,9 +376,7 @@ emcmake cmake `
-DXEUS_CPP_RESOURCE_DIR="$env:LLVM_BUILD_DIR/lib/clang/$env:LLVM_VERSION" `
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
..
$env:EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions"
emmake make -j $(nproc --all) install
$env:EMCC_CFLAGS=""
```

To build and test Jupyter Lite with this kernel locally on Linux/MacOS you can execute the following
Expand Down
16 changes: 4 additions & 12 deletions interpreter/CppInterOp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,8 @@ hosted under the `root-project` (see the git path below).
Use the following build instructions to build

```bash
git clone https://github.com/root-project/cling.git
cd ./cling/
git checkout tags/v1.2
git apply -v ../CppInterOp/patches/llvm/cling1.2-LookupHelper.patch
cd ..
git clone --depth=1 -b cling-llvm18 https://github.com/root-project/llvm-project.git
git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git
git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git
mkdir llvm-project/build
cd llvm-project/build
cmake -DLLVM_ENABLE_PROJECTS=clang \
Expand Down Expand Up @@ -548,12 +544,8 @@ hosted under the `root-project` (see the git path below).
Use the following build instructions to build

```powershell
git clone https://github.com/root-project/cling.git
cd .\cling\
git checkout tags/v1.2
git apply -v ..\CppInterOp\patches\llvm\cling1.2-LookupHelper.patch
cd ..
git clone --depth=1 -b cling-llvm18 https://github.com/root-project/llvm-project.git
git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git
git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git
$env:ncpus = $([Environment]::ProcessorCount)
$env:PWD_DIR= $PWD.Path
$env:CLING_DIR="$env:PWD_DIR\cling"
Expand Down
2 changes: 1 addition & 1 deletion interpreter/CppInterOp/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.0;dev
2.0.0;dev
2 changes: 1 addition & 1 deletion interpreter/CppInterOp/cppinterop-version.tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
76d06008a66cf8d2a283f2ee1daecc4b81ca7d87
039bf0423284b1139674525d097e656cb0feb783
16 changes: 4 additions & 12 deletions interpreter/CppInterOp/docs/DevelopersDocumentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,8 @@ build instructions to build on Linux and MacOS

.. code:: bash

git clone https://github.com/root-project/cling.git
cd ./cling/
git checkout tags/v1.2
git apply -v ../CppInterOp/patches/llvm/cling1.2-LookupHelper.patch
cd ..
git clone --depth=1 -b cling-llvm18 https://github.com/root-project/llvm-project.git
git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git
git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git
mkdir llvm-project/build
cd llvm-project/build
cmake -DLLVM_ENABLE_PROJECTS=clang \
Expand All @@ -173,12 +169,8 @@ Use the following build instructions to build on Windows

.. code:: powershell

git clone https://github.com/root-project/cling.git
cd .\cling\
git checkout tags/v1.2
git apply -v ..\CppInterOp\patches\llvm\cling1.2-LookupHelper.patch
cd ..
git clone --depth=1 -b cling-llvm18 https://github.com/root-project/llvm-project.git
git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git
git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git
$env:ncpus = $([Environment]::ProcessorCount)
$env:PWD_DIR= $PWD.Path
$env:CLING_DIR="$env:PWD_DIR\cling"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ by executing (replace LLVM_VERSION with the version of llvm you are building aga
-DXEUS_CPP_RESOURCE_DIR="$LLVM_BUILD_DIR/lib/clang/$LLVM_VERSION" \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions" emmake make -j $(nproc --all) install
emmake make -j $(nproc --all) install

and on Windows by executing

Expand All @@ -400,9 +400,7 @@ and on Windows by executing
-DXEUS_CPP_RESOURCE_DIR="$env:LLVM_BUILD_DIR/lib/clang/$env:LLVM_VERSION" `
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
..
$env:EMCC_CFLAGS="-sSUPPORT_LONGJMP=wasm -fwasm-exceptions"
emmake make -j $(nproc --all) install
$env:EMCC_CFLAGS=""

To build and test Jupyter Lite with this kernel locally on Linux/MacOS you can execute the following

Expand Down
16 changes: 4 additions & 12 deletions interpreter/CppInterOp/docs/InstallationAndUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,8 @@ build instructions to build on Linux and MacOS

.. code:: bash

git clone https://github.com/root-project/cling.git
cd ./cling/
git checkout tags/v1.2
git apply -v ../CppInterOp/patches/llvm/cling1.2-LookupHelper.patch
cd ..
git clone --depth=1 -b cling-llvm18 https://github.com/root-project/llvm-project.git
git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git
git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git
mkdir llvm-project/build
cd llvm-project/build
cmake -DLLVM_ENABLE_PROJECTS=clang \
Expand All @@ -173,12 +169,8 @@ Use the following build instructions to build on Windows

.. code:: powershell

git clone https://github.com/root-project/cling.git
cd .\cling\
git checkout tags/v1.2
git apply -v ..\CppInterOp\patches\llvm\cling1.2-LookupHelper.patch
cd ..
git clone --depth=1 -b cling-llvm18 https://github.com/root-project/llvm-project.git
git clone --depth=1 --branch v1.3 https://github.com/root-project/cling.git
git clone --depth=1 -b cling-llvm20-20260119-01 https://github.com/root-project/llvm-project.git
$env:ncpus = $([Environment]::ProcessorCount)
$env:PWD_DIR= $PWD.Path
$env:CLING_DIR="$env:PWD_DIR\cling"
Expand Down
11 changes: 5 additions & 6 deletions interpreter/CppInterOp/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Introduction

This document contains the release notes for the language interoperability
library CppInterOp, release 1.9.0. CppInterOp is built on top of
library CppInterOp, release 2.0.0. CppInterOp is built on top of
[Clang](http://clang.llvm.org) and [LLVM](http://llvm.org%3E) compiler
infrastructure. Here we describe the status of CppInterOp in some detail,
including major improvements from the previous release and new feature work.
Expand All @@ -16,16 +16,15 @@ interoperability on the fly. In such scenarios CppInterOp can be used to provide
the necessary introspection information to the other side helping the language
cross talk.

## What's New in CppInterOp 1.9.0?
## What's New in CppInterOp 2.0.0?

Some of the major new features and improvements to CppInterOp are listed here.
Generic improvements to CppInterOp as a whole or to its underlying
infrastructure are described first.

## External Dependencies

- CppInterOp now works with:
- llvm21
- CppInterOp v2.0.0 supports llvm 19-21

## Introspection

Expand All @@ -48,7 +47,7 @@ infrastructure are described first.
[XXX](https://github.com/compiler-research/CppInterOp/issues/XXX)

<!---Get release bugs
git log v1.8.0..main | grep 'Fixes|Closes'
git log v1.9.0..main | grep 'Fixes|Closes'
--->

## Special Kudos
Expand All @@ -61,6 +60,6 @@ FirstName LastName (#commits)
A B (N)

<!---Find contributor list for this release
git log --pretty=format:"%an" v1.8.0...main | sort | uniq -c | sort -rn |\
git log --pretty=format:"%an" v1.9.0...main | sort | uniq -c | sort -rn |\
sed -E 's,^ *([0-9]+) (.*)$,\2 \(\1\),'
--->
4 changes: 2 additions & 2 deletions interpreter/CppInterOp/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
"tex": {"packages": {"[+]": ["physics"]}},
}

import os

Check failure on line 48 in interpreter/CppInterOp/docs/conf.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

interpreter/CppInterOp/docs/conf.py:48:1: I001 Import block is un-sorted or un-formatted help: Organize imports

Check failure on line 48 in interpreter/CppInterOp/docs/conf.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E402)

interpreter/CppInterOp/docs/conf.py:48:1: E402 Module level import not at top of file
CPPINTEROP_ROOT = os.path.abspath('..')
html_extra_path = [CPPINTEROP_ROOT + '/build/docs/']

import subprocess

Check failure on line 52 in interpreter/CppInterOp/docs/conf.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

interpreter/CppInterOp/docs/conf.py:52:1: I001 Import block is un-sorted or un-formatted help: Organize imports

Check failure on line 52 in interpreter/CppInterOp/docs/conf.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E402)

interpreter/CppInterOp/docs/conf.py:52:1: E402 Module level import not at top of file
command = 'mkdir {0}/build; cd {0}/build; cmake ../ -DClang_DIR=/usr/lib/llvm-16/build/lib/cmake/clang\
-DLLVM_DIR=/usr/lib/llvm-16/build/lib/cmake/llvm -DCPPINTEROP_ENABLE_DOXYGEN=ON\
command = 'mkdir {0}/build; cd {0}/build; cmake ../ -DClang_DIR=/usr/lib/llvm-20/build/lib/cmake/clang\
-DLLVM_DIR=/usr/lib/llvm-20/build/lib/cmake/llvm -DCPPINTEROP_ENABLE_DOXYGEN=ON\
-DCPPINTEROP_INCLUDE_DOCS=ON'.format(CPPINTEROP_ROOT)
subprocess.call(command, shell=True)
subprocess.call('doxygen {0}/build/docs/doxygen.cfg'.format(CPPINTEROP_ROOT), shell=True)
70 changes: 70 additions & 0 deletions interpreter/CppInterOp/include/CppInterOp/CppInterOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,69 @@ enum QualKind : unsigned char {
Restrict = 1 << 2
};

/// Enum modelling programming languages.
enum class InterpreterLanguage : unsigned char {
Unknown,
Asm,
CIR,
LLVM_IR,
C,
CPlusPlus,
ObjC,
ObjCPlusPlus,
OpenCL,
OpenCLCXX,
CUDA,
HIP,
HLSL
};

/// Enum modelling language standards.
enum class InterpreterLanguageStandard : unsigned char {
c89,
c94,
gnu89,
c99,
gnu99,
c11,
gnu11,
c17,
gnu17,
c23,
gnu23,
c2y,
gnu2y,
cxx98,
gnucxx98,
cxx11,
gnucxx11,
cxx14,
gnucxx14,
cxx17,
gnucxx17,
cxx20,
gnucxx20,
cxx23,
gnucxx23,
cxx26,
gnucxx26,
opencl10,
opencl11,
opencl12,
opencl20,
opencl30,
openclcpp10,
openclcpp2021,
hlsl,
hlsl2015,
hlsl2016,
hlsl2017,
hlsl2018,
hlsl2021,
hlsl202x,
hlsl202y,
lang_unspecified
};
inline QualKind operator|(QualKind a, QualKind b) {
return static_cast<QualKind>(static_cast<unsigned char>(a) |
static_cast<unsigned char>(b));
Expand Down Expand Up @@ -728,6 +791,13 @@ CPPINTEROP_API bool ActivateInterpreter(TInterp_t I);
///\returns the current interpreter instance, if any.
CPPINTEROP_API TInterp_t GetInterpreter();

/// Returns the programming language of the interpreter.
CPPINTEROP_API InterpreterLanguage GetLanguage(TInterp_t I = nullptr);

/// Returns the language standard of the interpreter.
CPPINTEROP_API InterpreterLanguageStandard
GetLanguageStandard(TInterp_t I = nullptr);

/// Sets the Interpreter instance with an external interpreter, meant to
/// be called by an external library that manages it's own interpreter.
/// Sets a flag signifying CppInterOp does not have ownership of the
Expand Down
Loading
Loading