[Openmp-dev] libomp standardalone build (LIBOMP_STANDALONE_BUILD)

Yonghong Yan via Openmp-dev openmp-dev at lists.llvm.org
Mon Oct 31 05:40:50 PDT 2016


I want to include the openmp runtime source tree as a subfolder of a
top-level project that has its own CMakeList.txt which uses
"add_subdirectory(llvm-openmp)" to include the runtime in cmake.
However, the current runtime/CMakefile.txt prevented me from
configuring the runtime as standalone for that usage. Though thanks to
the LIBOMP_STANDALONE_BUILD, I can build the runtime directly if
firing cmake from either the openmp or the openmp/runtime. The
variable however is hardwired as FALSE as default. The true setting is
automatically detected.

I have a fix, but not sure whether you guys can take it to the
official to allow such usage?
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 096f222..5bd4edc 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -16,7 +16,6 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

 # Standalone build or part of LLVM?
-set(LIBOMP_STANDALONE_BUILD FALSE)
 if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
    "${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   project(libomp C CXX)

or this one, which remove the auto-checking and setting for making
LIBOMP_STANDALONE_BUILD true so user has to specify explicitly as true
if they want it to be standalone, and false is default.

diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 096f222..ae7ff0b 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -15,14 +15,6 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 # Add cmake directory to search for custom cmake functions
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

-# Standalone build or part of LLVM?
-set(LIBOMP_STANDALONE_BUILD FALSE)
-if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
-   "${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-  project(libomp C CXX)
-  set(LIBOMP_STANDALONE_BUILD TRUE)
-endif()
-
 # Set libomp version
 set(LIBOMP_VERSION_MAJOR 5)
 set(LIBOMP_VERSION_MINOR 0)

Another thing is that the openmp runtime requires llvm-lit for
testing.  as standalone building, it searches llvm-lit binary and
warns if it cannot find. To use the runtime for non-llvm installation,
can we remove that warning?

Thank you
Yonghong


More information about the Openmp-dev mailing list