@@ -433,18 +433,21 @@ jobs:
433
433
mkdir build
434
434
if [[ "${cling_on}" == "ON" ]]; then
435
435
cd build
436
- cmake -DLLVM_ENABLE_PROJECTS=clang \
437
- -DLLVM_EXTERNAL_PROJECTS=cling \
438
- -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \
439
- -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
440
- -DCMAKE_BUILD_TYPE=Release \
441
- -DLLVM_ENABLE_ASSERTIONS=ON \
442
- -DLLVM_ENABLE_LLD=ON \
443
- -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
444
- -DCLANG_ENABLE_ARCMT=OFF \
445
- -DCLANG_ENABLE_FORMAT=OFF \
446
- -DCLANG_ENABLE_BOOTSTRAP=OFF \
436
+ cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
437
+ -DLLVM_EXTERNAL_PROJECTS=cling \
438
+ -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \
439
+ -DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
440
+ -DCMAKE_BUILD_TYPE=Release \
441
+ -DLLVM_ENABLE_ASSERTIONS=ON \
442
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
443
+ -DCLANG_ENABLE_ARCMT=OFF \
444
+ -DCLANG_ENABLE_FORMAT=OFF \
445
+ -DCLANG_ENABLE_BOOTSTRAP=OFF \
446
+ -DLLVM_ENABLE_ZSTD=OFF \
447
+ -DLLVM_ENABLE_TERMINFO=OFF \
448
+ -DLLVM_ENABLE_LIBXML2=OFF \
447
449
../llvm
450
+ cmake --build . --target lld --parallel ${{ env.ncpus }}
448
451
cmake --build . --target clang --parallel ${{ env.ncpus }}
449
452
cmake --build . --target cling --parallel ${{ env.ncpus }}
450
453
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
@@ -454,17 +457,19 @@ jobs:
454
457
git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
455
458
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
456
459
cd build
457
- cmake -DLLVM_ENABLE_PROJECTS=clang \
458
- -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
459
- -DCMAKE_BUILD_TYPE=Release \
460
- -DLLVM_ENABLE_ASSERTIONS=ON \
461
- -DLLVM_ENABLE_LLD=ON \
462
- -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
463
- -DCLANG_ENABLE_ARCMT=OFF \
464
- -DCLANG_ENABLE_FORMAT=OFF \
465
- -DCLANG_ENABLE_BOOTSTRAP=OFF \
460
+ cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
461
+ -DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
462
+ -DCMAKE_BUILD_TYPE=Release \
463
+ -DLLVM_ENABLE_ASSERTIONS=ON \
464
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
465
+ -DCLANG_ENABLE_ARCMT=OFF \
466
+ -DCLANG_ENABLE_FORMAT=OFF \
467
+ -DCLANG_ENABLE_BOOTSTRAP=OFF \
468
+ -DLLVM_ENABLE_ZSTD=OFF \
469
+ -DLLVM_ENABLE_TERMINFO=OFF \
470
+ -DLLVM_ENABLE_LIBXML2=OFF \
466
471
../llvm
467
- cmake --build . --target clang clang-repl --parallel ${{ env.ncpus }}
472
+ cmake --build . --target all --parallel ${{ env.ncpus }}
468
473
fi
469
474
cd ../../
470
475
@@ -907,3 +912,275 @@ jobs:
907
912
uses : mxschmitt/action-tmate@v3
908
913
# When debugging increase to a suitable value!
909
914
timeout-minutes : 30
915
+
916
+ emscripten_wasm :
917
+ name : ${{ matrix.name }}
918
+ runs-on : ${{ matrix.os }}
919
+ strategy :
920
+ fail-fast : false
921
+ matrix :
922
+ include :
923
+ - name : ubu22-x86-gcc12-clang-repl-17-emscripten_wasm
924
+ os : ubuntu-22.04
925
+ compiler : gcc-12
926
+ clang-runtime : ' 17'
927
+ cling : Off
928
+ - name : ubu22-x86-gcc12-clang-repl-16-emscripten_wasm
929
+ os : ubuntu-22.04
930
+ compiler : gcc-12
931
+ clang-runtime : ' 16'
932
+ cling : Off
933
+ - name : ubu22-x86-gcc9-clang13-cling-emscripten_wasm
934
+ os : ubuntu-22.04
935
+ compiler : gcc-9
936
+ clang-runtime : ' 13'
937
+ cling : On
938
+ cling-version : ' 1.0'
939
+ - name : osx14-arm-clang-clang-repl-17-emscripten_wasm
940
+ os : macos-14
941
+ compiler : clang
942
+ clang-runtime : ' 17'
943
+ cling : Off
944
+ - name : osx14-arm-clang-clang-repl-16-emscripten_wasm
945
+ os : macos-14
946
+ compiler : clang
947
+ clang-runtime : ' 16'
948
+ cling : Off
949
+ - name : osx14-arm-clang-clang13-cling-emscripten_wasm
950
+ os : macos-14
951
+ compiler : clang
952
+ clang-runtime : ' 13'
953
+ cling : On
954
+ cling-version : ' 1.0'
955
+ - name : osx13-x86-clang-clang-repl-17-emscripten_wasm
956
+ os : macos-13
957
+ compiler : clang
958
+ clang-runtime : ' 17'
959
+ cling : Off
960
+ - name : osx13-x86-clang-clang-repl-16-emscripten_wasm
961
+ os : macos-13
962
+ compiler : clang
963
+ clang-runtime : ' 16'
964
+ cling : Off
965
+ - name : osx13-x86-clang-clang13-cling-emscripten_wasm
966
+ os : macos-13
967
+ compiler : clang
968
+ clang-runtime : ' 13'
969
+ cling : On
970
+ cling-version : ' 1.0'
971
+
972
+ steps :
973
+ - uses : actions/checkout@v3
974
+ with :
975
+ fetch-depth : 0
976
+ - name : Set up Python
977
+ uses : actions/setup-python@v4
978
+ with :
979
+ python-version : ' 3.10'
980
+
981
+ - name : Save PR Info on Unix systems
982
+ if : ${{ runner.os != 'windows' }}
983
+ run : |
984
+ mkdir -p ./pr
985
+ echo ${{ github.event.number }} > ./pr/NR
986
+ echo ${{ github.repository }} > ./pr/REPO
987
+
988
+ cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
989
+ if [[ "$cling_on" == "ON" ]]; then
990
+ export CLING_HASH=$(git ls-remote https://github.com/root-project/cling.git refs/tags/v${{ matrix.cling-version }} | tr '\t' '-')
991
+ export LLVM_HASH=$(git ls-remote https://github.com/root-project/llvm-project.git cling-llvm${{ matrix.clang-runtime}} | tr '\t' '-')
992
+ else
993
+ export CLING_HASH="Repl"
994
+ # May need to revert back to both having same llvm_hash, as below cause llvm to be rebuilt everytime commit is made to llvm/llvm-project for release a.x
995
+ # which could be quite often for new releases
996
+ export LLVM_HASH=$(git ls-remote https://github.com/llvm/llvm-project.git refs/heads/release/${{ matrix.clang-runtime}}.x | tr '\t' '-')
997
+ fi
998
+
999
+ echo "CLING_HASH=$CLING_HASH" >> $GITHUB_ENV
1000
+ echo "LLVM_HASH=$LLVM_HASH" >> $GITHUB_ENV
1001
+
1002
+ -
uses :
nelonoel/[email protected]
1003
+
1004
+ - name : Setup default Build Type on *nux
1005
+ if : runner.os != 'windows'
1006
+ run : |
1007
+ echo "BUILD_TYPE=Release" >> $GITHUB_ENV
1008
+ echo "CODE_COVERAGE=0" >> $GITHUB_ENV
1009
+ os="${{ matrix.os }}"
1010
+ if [[ "${os}" == "macos"* ]]; then
1011
+ echo "ncpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
1012
+ else
1013
+ echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
1014
+ fi
1015
+
1016
+ - name : Install deps on Linux
1017
+ if : runner.os == 'Linux'
1018
+ run : |
1019
+ # Install deps
1020
+ sudo apt update
1021
+ sudo apt install git g++ debhelper devscripts gnupg python3 valgrind
1022
+ sudo apt autoremove
1023
+ sudo apt clean
1024
+
1025
+ - name : Install mamba
1026
+ uses : mamba-org/provision-with-micromamba@main
1027
+ with :
1028
+ environment-file : environment-wasm-build.yml
1029
+ environment-name : CppInterOp-wasm-build
1030
+
1031
+ - name : Setup emsdk
1032
+ shell : bash -l {0}
1033
+ run : |
1034
+ emsdk install 3.1.45
1035
+
1036
+ - name : Restore Cache LLVM/Clang runtime build directory
1037
+ uses : actions/cache/restore@v3
1038
+ id : cache
1039
+ with :
1040
+ path : |
1041
+ llvm-project
1042
+ ${{ matrix.cling=='On' && 'cling' || '' }}
1043
+ key : ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }}
1044
+
1045
+ - name : Build LLVM/Cling on Unix systems if the cache is invalid
1046
+ if : ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
1047
+ run : |
1048
+ cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
1049
+ if [[ "${cling_on}" == "ON" ]]; then
1050
+ git clone https://github.com/root-project/cling.git
1051
+ cd ./cling
1052
+ git checkout tags/v${{ matrix.cling-version }}
1053
+ cd ..
1054
+ git clone --depth=1 -b cling-llvm${{ matrix.clang-runtime }} https://github.com/root-project/llvm-project.git
1055
+ else # repl
1056
+ git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
1057
+ fi
1058
+ cd llvm-project
1059
+ # Build
1060
+ mkdir build
1061
+ if [[ "${cling_on}" == "ON" ]]; then
1062
+ cd build
1063
+ cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
1064
+ -DLLVM_EXTERNAL_PROJECTS=cling \
1065
+ -DLLVM_EXTERNAL_CLING_SOURCE_DIR=../../cling \
1066
+ -DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
1067
+ -DCMAKE_BUILD_TYPE=Release \
1068
+ -DLLVM_ENABLE_ASSERTIONS=ON \
1069
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
1070
+ -DCLANG_ENABLE_ARCMT=OFF \
1071
+ -DCLANG_ENABLE_FORMAT=OFF \
1072
+ -DCLANG_ENABLE_BOOTSTRAP=OFF \
1073
+ -DLLVM_ENABLE_ZSTD=OFF \
1074
+ -DLLVM_ENABLE_TERMINFO=OFF \
1075
+ -DLLVM_ENABLE_LIBXML2=OFF \
1076
+ ../llvm
1077
+ cmake --build . --target lld --parallel ${{ env.ncpus }}
1078
+ cmake --build . --target clang --parallel ${{ env.ncpus }}
1079
+ cmake --build . --target cling --parallel ${{ env.ncpus }}
1080
+ # Now build gtest.a and gtest_main for CppInterOp to run its tests.
1081
+ cmake --build . --target gtest_main --parallel ${{ env.ncpus }}
1082
+ else
1083
+ # Apply patches
1084
+ git apply -v ../patches/llvm/clang${{ matrix.clang-runtime }}-*.patch
1085
+ echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
1086
+ cd build
1087
+ cmake -DLLVM_ENABLE_PROJECTS="clang;lld" \
1088
+ -DLLVM_TARGETS_TO_BUILD="WebAssembly;host;NVPTX" \
1089
+ -DCMAKE_BUILD_TYPE=Release \
1090
+ -DLLVM_ENABLE_ASSERTIONS=ON \
1091
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \
1092
+ -DCLANG_ENABLE_ARCMT=OFF \
1093
+ -DCLANG_ENABLE_FORMAT=OFF \
1094
+ -DCLANG_ENABLE_BOOTSTRAP=OFF \
1095
+ -DLLVM_ENABLE_ZSTD=OFF \
1096
+ -DLLVM_ENABLE_TERMINFO=OFF \
1097
+ -DLLVM_ENABLE_LIBXML2=OFF \
1098
+ ../llvm
1099
+ cmake --build . --target all --parallel ${{ env.ncpus }}
1100
+ fi
1101
+ cd ../../
1102
+
1103
+ - name : Save Cache LLVM/Clang runtime build directory
1104
+ uses : actions/cache/save@v3
1105
+ if : ${{ steps.cache.outputs.cache-hit != 'true' }}
1106
+ with :
1107
+ path : |
1108
+ llvm-project
1109
+ ${{ matrix.cling=='On' && 'cling' || '' }}
1110
+ key : ${{ steps.cache.outputs.cache-primary-key }}
1111
+
1112
+ - name : Emscripten build of CppInterOp on Unix systems
1113
+ if : ${{ runner.os != 'windows' }}
1114
+ shell : bash -l {0}
1115
+ run : |
1116
+ emsdk activate 3.1.45
1117
+ source $CONDA_EMSDK_DIR/emsdk_env.sh
1118
+ micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
1119
+
1120
+ export EMPACK_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build
1121
+ #FIXME: Remove hardcoding of PREFIX path
1122
+ os="${{ matrix.os }}"
1123
+ if [[ "${os}" == "macos"* ]]; then
1124
+ export PREFIX=/Users/runner/micromamba-root/envs/CppInterOp-wasm
1125
+ else
1126
+ export PREFIX=/home/runner/micromamba-root/envs/CppInterOp-wasm
1127
+ fi
1128
+ export CMAKE_PREFIX_PATH=$PREFIX
1129
+ export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
1130
+
1131
+ LLVM_DIR="$(pwd)/llvm-project"
1132
+ LLVM_BUILD_DIR="$(pwd)/llvm-project/build"
1133
+ cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
1134
+ if [[ "${cling_on}" == "ON" ]]; then
1135
+ CLING_DIR="$(pwd)/cling"
1136
+ CLING_BUILD_DIR="$(pwd)/cling/build"
1137
+ 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"
1138
+ else
1139
+ CPLUS_INCLUDE_PATH="${LLVM_DIR}/llvm/include:${LLVM_DIR}/clang/include:${LLVM_BUILD_DIR}/include:${LLVM_BUILD_DIR}/tools/clang/include:$PWD/include"
1140
+ fi
1141
+
1142
+ # Build CppInterOp next to cling and llvm-project.
1143
+ mkdir build
1144
+ cd build
1145
+ export CPPINTEROP_BUILD_DIR=$PWD
1146
+
1147
+ if [[ "${cling_on}" == "ON" ]]; then
1148
+ emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
1149
+ -DUSE_CLING=ON \
1150
+ -DUSE_REPL=OFF \
1151
+ -DCMAKE_PREFIX_PATH=$PREFIX \
1152
+ -DCling_DIR=$LLVM_BUILD_DIR/tools/cling \
1153
+ -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
1154
+ -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
1155
+ -DBUILD_SHARED_LIBS=ON \
1156
+ -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
1157
+ -DCMAKE_INSTALL_PREFIX=$PREFIX \
1158
+ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
1159
+ -DZLIB_INCLUDE_DIR=$PREFIX/include \
1160
+ -DZLIB_LIBRARY=$PREFIX/lib/ \
1161
+ ../
1162
+ else
1163
+ emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
1164
+ -DUSE_CLING=OFF \
1165
+ -DUSE_REPL=ON \
1166
+ -DCMAKE_PREFIX_PATH="/home/runner/micromamba-root/envs/CppInterOp-wasm/" \
1167
+ -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
1168
+ -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
1169
+ -DBUILD_SHARED_LIBS=OFF \
1170
+ -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
1171
+ -DCMAKE_INSTALL_PREFIX=$PREFIX \
1172
+ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
1173
+ -DZLIB_INCLUDE_DIR=$PREFIX/include \
1174
+ -DZLIB_LIBRARY=$PREFIX/lib/ \
1175
+ ../
1176
+ fi
1177
+
1178
+ EMCC_CFLAGS='-sERROR_ON_UNDEFINED_SYMBOLS=0' emmake make -j ${{ env.ncpus }}
1179
+
1180
+ cd ..
1181
+
1182
+ echo "CB_PYTHON_DIR=$CB_PYTHON_DIR" >> $GITHUB_ENV
1183
+ echo "CPPINTEROP_BUILD_DIR=$CPPINTEROP_BUILD_DIR" >> $GITHUB_ENV
1184
+ echo "CPPINTEROP_DIR=$CPPINTEROP_DIR" >> $GITHUB_ENV
1185
+ echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV
1186
+ echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
0 commit comments