[Openmp-dev] cmake build integration

Peyton, Jonathan L jonathan.l.peyton at intel.com
Tue Apr 28 16:11:06 PDT 2015

I forgot to address modifications to projects/CMakeLists.txt.  When it comes time, this is a one line change to this file that isn’t necessary for testing this patch because the projects/CMakeLists.txt file scans for any directory with a  CMakeLists.txt in it and tries to build it.  It would look something like this:
--- a/projects/CMakeLists.txt
+++ b/projects/CMakeLists.txt
@@ -6,6 +6,7 @@ foreach(entry ${entries})
   if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
     if((NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt) AND
        (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/dragonegg) AND
+       (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/openmp) AND
        (NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/libcxx))
@@ -20,6 +21,9 @@ if(${LLVM_BUILD_RUNTIME})
   if(NOT MSVC)
+  if(NOT MSVC)
+    add_llvm_external_project(openmp)
+  endif()

-- Johnny

From: openmp-dev-bounces at cs.uiuc.edu [mailto:openmp-dev-bounces at cs.uiuc.edu] On Behalf Of Peyton, Jonathan L
Sent: Tuesday, April 28, 2015 6:05 PM
To: Jack Howarth; openmp-dev at cs.uiuc.edu
Subject: Re: [Openmp-dev] cmake build integration

Yes, I currently have a preliminary version for this functionality.  It includes:

1) very basic top level CMakeLists.txt file which only calls add_subdirectory(runtime)
2) correct install target, which will install in $DESTDIR/$CMAKE_INSTALL_PREFIX/lib{LLVM_LIBDIR_SUFFIX} for the libray, $DESTDIR/$CMAKE_INSTALL_PREFIX/lib{LLVM_LIBDIR_SUFFIX}/clang/{CLANG_VERSION}/include for omp.h and iomp.h
3) I also have it recognize when it is a standalone build, so it knows when to ignore LLVM_ based variables, etc.

I have attached the whole thing as one patch here if you want to try it out or take a look at it.
Keep in mind that a lot of the changes are to the cmake/MicroTests.cmake file which is a refactoring job but not critical for
LLVM integration.

To try this out:
1) checkout LLVM
2) checkout clang into llvm/tools
3) checkout compiler-rt into llvm/projects
4) checkout openmp into llvm/projects
5) apply the patch to the llvm/projects/openmp
6) cd llvm/
7) mkdir build && cd build
9) make
10) make install

The final libiomp5.so should be in CMAKE_INSTALL_PREFIX/lib
And omp.h and iomp.h should be in CMAKE_INSTALL_PREFIX/lib/clang/3.x.x/include

I haven’t bothered putting the Fortran headers and modules in any install target yet but that can be done if necessary.

-- Johnny

From: openmp-dev-bounces at cs.uiuc.edu<mailto:openmp-dev-bounces at cs.uiuc.edu> [mailto:openmp-dev-bounces at cs.uiuc.edu] On Behalf Of Jack Howarth
Sent: Tuesday, April 28, 2015 5:08 PM
To: openmp-dev at cs.uiuc.edu<mailto:openmp-dev at cs.uiuc.edu>
Subject: [Openmp-dev] cmake build integration

   Is anyone working on modifications to the projects/CMakeLists.txt in llvm and the missing top-level  CMakeLists.txt file for openmp? The openmp merge seems to be making rapid progress towards passing the OpenMP3.1_Validation test suite with the recent and proposed commits so it might be about time to start implementing the missing support for building openmp within the llvm cmake build infrastructure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150428/92a93ac7/attachment.html>

More information about the Openmp-dev mailing list