pmodels / bolt

Official BOLT Repository
https://www.bolt-omp.org
Other
26 stars 13 forks source link

Desire to build bolt with different install directory for omp.h #104

Open gregrodgers opened 2 years ago

gregrodgers commented 2 years ago

This simple patch allows the builder of bolt to put omp.h in a different directory. I am working with a more current LLVM omp.h than what bolt builds. With this patch, I can install bolt into the LLVM installation and not clobber omp.h.

git diff
diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt
index 042a5200..8a237805 100644
--- a/runtime/src/CMakeLists.txt
+++ b/runtime/src/CMakeLists.txt
@@ -329,7 +329,9 @@ add_dependencies(bolt-libomp-micro-tests bolt-libomp-test-deps)
 # We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib
 # We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
 if(${OPENMP_STANDALONE_BUILD})
-  set(LIBOMP_HEADERS_INSTALL_PATH include)
+  if(NOT LIBOMP_HEADERS_INSTALL_PATH)
+      set(LIBOMP_HEADERS_INSTALL_PATH include)
+  endif()
 else()
   string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
   set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")

FYI, Below are the cmake options I have in our build_bolt.sh script. The above patch allows me to not clobber omp.h. I also turn off the aliases because I want bolt to be user selectable with -fopenmp=libbolt. I have a simple LLVM patch that I want to push upstream to support -fopenmp-libbolt. This does not push the sources for bolt , it simply allows the option to be used when bolt is built as an external component.

MYCMAKEOPTS=" \ -DCMAKE_INSTALL_PREFIX=$BOLT_INSTALL_DIR \ $AOMP_ORIGIN_RPATH \ -DCMAKE_C_COMPILER=$AOMP_CC_COMPILER \ -DCMAKE_CXX_COMPILER=$AOMP_CXX_COMPILER \ -DOPENMP_TEST_C_COMPILER=$AOMP_CC_COMPILER \ -DOPENMP_TEST_CXX_COMPILER=$AOMP_CXX_COMPILER \ -DCMAKE_BUILD_TYPE=Release \ -DOPENMP_ENABLE_LIBOMPTARGET=OFF \ -DLIBOMP_HEADERS_INSTALL_PATH=include/bolt \ -DLIBOMP_INSTALL_ALIASES=OFF \ -DLIBOMP_USE_ARGOBOTS=on"