From cf1b668e52144a98a9e3531d96bd465a0969c1f2 Mon Sep 17 00:00:00 2001 From: mcbarton Date: Wed, 28 May 2025 18:39:15 +0100 Subject: [PATCH] Fix bugs in documentation relating to cling based build --- README.md | 28 +++++++++++++++++++++++++++- docs/DevelopersDocumentation.rst | 28 +++++++++++++++++++++++++++- docs/InstallationAndUsage.rst | 30 +++++++++++++++++++++++++++++- 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8d3e9b45e..871bb6c06 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ cd .\cling\ git checkout tags/v1.0 cd .. git clone --depth=1 -b cling-llvm13 https://github.com/root-project/llvm-project.git -$env:ncpus = %NUMBER_OF_PROCESSORS% +$env:ncpus = $([Environment]::ProcessorCount) $env:PWD_DIR= $PWD.Path $env:CLING_DIR="$env:PWD_DIR\cling" mkdir llvm-project\build @@ -263,9 +263,22 @@ Regardless of whether you are building CppInterOP with Cling or Clang-REPL you w ```bash export CB_PYTHON_DIR="$PWD/cppyy-backend/python" export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend" +``` + +If building CppInterOp against clang-repl you will need to define the following + +```bash 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" ``` +and if building against cling you will need to define the following + +```bash +export CLING_DIR="$(pwd)/cling" +export CLING_BUILD_DIR="$(pwd)/cling/build" +export CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include" +``` + If on MacOS you will also need the following environment variable defined ```bash @@ -277,9 +290,22 @@ On Windows you define as follows (assumes you have defined $env:PWD_DIR= $PWD.Pa ```powershell $env:CB_PYTHON_DIR="$env:PWD_DIR\cppyy-backend\python" $env:CPPINTEROP_DIR="$env:CB_PYTHON_DIR\cppyy_backend" +``` + +If building against clang-repl you will have the following defined + +```powershell $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" ``` +and if building against cling + +```powershell +$env:CLING_DIR="$env:PWD_DIR\cling" +$env:CLING_BUILD_DIR="$env:PWD_DIR\cling\build" +$env:CPLUS_INCLUDE_PATH="$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;" +``` + #### Build CppInterOp Now CppInterOp can be installed. On Linux and MacOS execute diff --git a/docs/DevelopersDocumentation.rst b/docs/DevelopersDocumentation.rst index 7ece53747..a387c93fe 100644 --- a/docs/DevelopersDocumentation.rst +++ b/docs/DevelopersDocumentation.rst @@ -158,7 +158,7 @@ Use the following build instructions to build on Windows git checkout tags/v1.0 cd .. git clone --depth=1 -b cling-llvm13 https://github.com/root-project/llvm-project.git - $env:ncpus = %NUMBER_OF_PROCESSORS% + $env:ncpus = $([Environment]::ProcessorCount) $env:PWD_DIR= $PWD.Path $env:CLING_DIR="$env:PWD_DIR\cling" mkdir llvm-project\build @@ -209,8 +209,21 @@ define as follows export CB_PYTHON_DIR="$PWD/cppyy-backend/python" export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend" + +If building CppInterOp against clang-repl you will need to define the following + +.. code:: bash + 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" +and if building against cling you will need to define the following + +.. code:: bash + + export CLING_DIR="$(pwd)/cling" + export CLING_BUILD_DIR="$(pwd)/cling/build" + export CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include" + If on MacOS you will also need the following environment variable defined .. code:: bash @@ -224,8 +237,21 @@ $PWD.Path ) $env:CB_PYTHON_DIR="$env:PWD_DIR\cppyy-backend\python" $env:CPPINTEROP_DIR="$env:CB_PYTHON_DIR\cppyy_backend" + +If building against clang-repl you will have the following defined + +.. code:: powershell + $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" +and if building against cling + +.. code:: powershell + + $env:CLING_DIR="$env:PWD_DIR\cling" + $env:CLING_BUILD_DIR="$env:PWD_DIR\cling\build" + $env:CPLUS_INCLUDE_PATH="$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;" + ****************** Build CppInterOp ****************** diff --git a/docs/InstallationAndUsage.rst b/docs/InstallationAndUsage.rst index 72ddff1a6..a23ff8801 100644 --- a/docs/InstallationAndUsage.rst +++ b/docs/InstallationAndUsage.rst @@ -158,7 +158,7 @@ Use the following build instructions to build on Windows git checkout tags/v1.0 cd .. git clone --depth=1 -b cling-llvm13 https://github.com/root-project/llvm-project.git - $env:ncpus = %NUMBER_OF_PROCESSORS% + $env:ncpus = $([Environment]::ProcessorCount) $env:PWD_DIR= $PWD.Path $env:CLING_DIR="$env:PWD_DIR\cling" mkdir llvm-project\build @@ -209,8 +209,21 @@ define as follows export CB_PYTHON_DIR="$PWD/cppyy-backend/python" export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend" + +If building CppInterOp against clang-repl you will need to define the following + +.. code:: bash + 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" +and if building against cling you will need to define the following + +.. code:: bash + + export CLING_DIR="$(pwd)/cling" + export CLING_BUILD_DIR="$(pwd)/cling/build" + export CPLUS_INCLUDE_PATH="${CLING_DIR}/tools/cling/include:${CLING_BUILD_DIR}/include:${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include" + If on MacOS you will also need the following environment variable defined .. code:: bash @@ -224,8 +237,23 @@ $PWD.Path ) $env:CB_PYTHON_DIR="$env:PWD_DIR\cppyy-backend\python" $env:CPPINTEROP_DIR="$env:CB_PYTHON_DIR\cppyy_backend" + + +If building against clang-repl you will have the following defined + +.. code:: powershell + $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" +and if building against cling + +.. code:: powershell + + $env:CLING_DIR="$env:PWD_DIR\cling" + $env:CLING_BUILD_DIR="$env:PWD_DIR\cling\build" + $env:CPLUS_INCLUDE_PATH="$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;" + + ****************** Build CppInterOp ******************