add OPENCL_INCLUDE_DIR to pickup OCL headers from repo before opencl is installed.
@@ -100,7 +100,11 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
rm -rf $BUILD_DIR/build/vdi
fi
- MYCMAKEOPTS="$AOMP_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DUSE_COMGR_LIBRARY=yes -DOPENCL_DIR=$AOMP_REPOS/$AOMP_OCL_REPO_NAME -DLLVM_INCLUDES=$AOMP/include -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR;$AOMP_INSTALL_DIR/include"
+ # VDI needs opencl headers but vdi is built before opencl because opencl needs vdi.
+ # The vdi cmake file hardcodes finding opencl headers in /opt/rocm/opencl but We don't want
+ # to find them there for standalone builds that may not install rocm opencl.
+ # We set OPENCL_INCLUDE_DIR to find the headers from the AOMP opencl repository.
+ MYCMAKEOPTS="$AOMP_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DUSE_COMGR_LIBRARY=yes -DOPENCL_DIR=$AOMP_REPOS/$AOMP_OCL_REPO_NAME -DLLVM_INCLUDES=$AOMP_INSTALL_DIR/include -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR;$AOMP_INSTALL_DIR/include -DOPENCL_INCLUDE_DIR=$AOMP_REPOS/$AOMP_OCL_REPO_NAME/khronos/headers/opencl2.2 "
mkdir -p $BUILD_DIR/build/vdi
cd $BUILD_DIR/build/vdi
