[PATCH] [OpenMP] Make default OpenMP library (the one selected with just -fopenmp) configurable in the CMake build. There shouldn't be any change in default behavior.
Daniel Jasper
djasper at google.com
Wed May 20 06:40:51 PDT 2015
Hi chandlerc, rsmith, ABataev,
http://reviews.llvm.org/D9878
Files:
CMakeLists.txt
lib/Driver/Tools.cpp
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -441,6 +441,13 @@
add_definitions(-DCLANG_ENABLE_STATIC_ANALYZER)
endif()
+set(OPENMP_DEFAULT_LIB "" CACHE STRING
+ "OpenMP library used with -fopenmp.")
+
+if( OPENMP_DEFAULT_LIB )
+ add_definitions( -DOPENMP_DEFAULT_LIB="${OPENMP_DEFAULT_LIB} " )
+endif()
+
# Clang version information
set(CLANG_EXECUTABLE_VERSION
"${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}" CACHE STRING
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -6279,16 +6279,23 @@
Args.AddAllArgs(CmdArgs, options::OPT_L);
LibOpenMP UsedOpenMPLib = LibUnknown;
- if (const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ)) {
- UsedOpenMPLib = llvm::StringSwitch<LibOpenMP>(A->getValue())
+ auto OpenMPStringToVersion = [](StringRef OpenMPString) {
+ return llvm::StringSwitch<LibOpenMP>(OpenMPString)
.Case("libgomp", LibGOMP)
.Case("libiomp5", LibIOMP5)
.Default(LibUnknown);
+ };
+ if (const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ)) {
+ UsedOpenMPLib = OpenMPStringToVersion(A->getValue());
if (UsedOpenMPLib == LibUnknown)
getToolChain().getDriver().Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << A->getValue();
} else if (Args.hasArg(options::OPT_fopenmp)) {
+#if defined(OPENMP_DEFAULT_LIB)
+ UsedOpenMPLib = OpenMPStringToVersion(OPENMP_DEFAULT_LIB);
+#else
UsedOpenMPLib = LibIOMP5;
+#endif
}
switch (UsedOpenMPLib) {
case LibGOMP:
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9878.26148.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150520/242d31d3/attachment.bin>
More information about the cfe-commits
mailing list