summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/cmake/LibompDefinitions.cmake
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-07-15 16:05:30 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-07-15 16:05:30 +0000
commit2e0133526e85e53ff67a25511b9789d2e10f17d2 (patch)
tree773e372c749314de37743dd3fc45b62f133d2f9a /openmp/runtime/cmake/LibompDefinitions.cmake
parent8da737a18a7b543e0c5b54e3e609d1a5eda8dddc (diff)
downloadbcm5719-llvm-2e0133526e85e53ff67a25511b9789d2e10f17d2.tar.gz
bcm5719-llvm-2e0133526e85e53ff67a25511b9789d2e10f17d2.zip
Large Refactor of CMake build system
This commit improves numerous functionalities of the OpenMP CMake build system to be more conducive with LLVM's build system and build philosophies. The CMake build system, as it was before this commit, was not up to LLVM's standards and did not implement the configuration stage like most CMake based build systems offer (check for compiler flags, libraries, etc.) In order to improve it dramatically in a short period of time, a large refactoring had to be done. The main changes done with this commit are as follows: * Compiler flag checks - The flags are no longer grabbed from compiler specific directories. They are checked for availability in config-ix.cmake and added accordingly inside LibompHandleFlags.cmake. * Feature checks were added in config-ix.cmake. For example, the standard CMake module FindThreads is probed for the threading model to use inside the OpenMP library. * OS detection - There is no longer a LIBOMP_OS variable, OS-specifc build logic is wrapped around the WIN32 and APPLE macros with !(WIN32 OR APPLE) meaning a Unix flavor of some sort. * Got rid of vestigial functions/macros/variables * Added new libomp_append() function which is used everywhere to conditionally or undconditionally append to a list * All targets have the libomp prefix so as not to interfere with any other project * LibompCheckLinkerFlag.cmake module was added which checks for linker flags specifically for building shared libraries. * LibompCheckFortranFlag.cmake module was added which checks for fortran flag availability. * Removed most of the cruft from the translation between the perl+Makefile based build system and this one. The remaining components that they share are perl scripts which I'm in the process of removing. There is still more left to do. The perl scripts still need to be removed, and a config.h.in file (or similarly named) needs to be added with #cmakedefine lines in it. But this is a much better first step than the previous system. Differential Revision: http://reviews.llvm.org/D10656 llvm-svn: 242298
Diffstat (limited to 'openmp/runtime/cmake/LibompDefinitions.cmake')
-rw-r--r--openmp/runtime/cmake/LibompDefinitions.cmake100
1 files changed, 100 insertions, 0 deletions
diff --git a/openmp/runtime/cmake/LibompDefinitions.cmake b/openmp/runtime/cmake/LibompDefinitions.cmake
new file mode 100644
index 00000000000..5663340e2f1
--- /dev/null
+++ b/openmp/runtime/cmake/LibompDefinitions.cmake
@@ -0,0 +1,100 @@
+#
+#//===----------------------------------------------------------------------===//
+#//
+#// The LLVM Compiler Infrastructure
+#//
+#// This file is dual licensed under the MIT and the University of Illinois Open
+#// Source Licenses. See LICENSE.txt for details.
+#//
+#//===----------------------------------------------------------------------===//
+#
+
+function(libomp_get_definitions_flags cppflags)
+ set(cppflags_local)
+ libomp_append(cppflags_local "-D USE_ITT_BUILD")
+ # yes... you need 5 backslashes...
+ libomp_append(cppflags_local "-D KMP_ARCH_STR=\"\\\\\"${LIBOMP_LEGAL_ARCH}\\\\\"\"")
+ libomp_append(cppflags_local "-D BUILD_I8")
+ libomp_append(cppflags_local "-D KMP_LIBRARY_FILE=\\\\\"${LIBOMP_LIB_FILE}\\\\\"")
+ libomp_append(cppflags_local "-D KMP_VERSION_MAJOR=${LIBOMP_VERSION}")
+ libomp_append(cppflags_local "-D KMP_NESTED_HOT_TEAMS")
+
+ # customize to 128 bytes for ppc64
+ if(${PPC64})
+ libomp_append(cppflags_local "-D CACHE_LINE=128")
+ else()
+ libomp_append(cppflags_local "-D CACHE_LINE=64")
+ endif()
+
+ libomp_append(cppflags_local "-D KMP_ADJUST_BLOCKTIME=1")
+ libomp_append(cppflags_local "-D BUILD_PARALLEL_ORDERED")
+ libomp_append(cppflags_local "-D KMP_ASM_INTRINS")
+ libomp_append(cppflags_local "-D USE_ITT_NOTIFY" IF_TRUE_1_0 LIBOMP_USE_ITT_NOTIFY)
+ libomp_append(cppflags_local "-D INTEL_NO_ITTNOTIFY_API" IF_FALSE LIBOMP_USE_ITT_NOTIFY)
+ libomp_append(cppflags_local "-D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_")
+ libomp_append(cppflags_local "-D KMP_USE_VERSION_SYMBOLS" IF_TRUE LIBOMP_USE_VERSION_SYMBOLS)
+
+ if(WIN32)
+ libomp_append(cppflags_local "-D _CRT_SECURE_NO_WARNINGS")
+ libomp_append(cppflags_local "-D _CRT_SECURE_NO_DEPRECATE")
+ libomp_append(cppflags_local "-D _WINDOWS")
+ libomp_append(cppflags_local "-D _WINNT")
+ libomp_append(cppflags_local "-D _WIN32_WINNT=0x0501")
+ libomp_append(cppflags_local "-D KMP_WIN_CDECL")
+ libomp_append(cppflags_local "-D _USRDLL")
+ libomp_append(cppflags_local "-D _ITERATOR_DEBUG_LEVEL=0" IF_TRUE DEBUG_BUILD)
+ else()
+ libomp_append(cppflags_local "-D _GNU_SOURCE")
+ libomp_append(cppflags_local "-D _REENTRANT")
+ libomp_append(cppflags_local "-D BUILD_TV")
+ libomp_append(cppflags_local "-D USE_CBLKDATA")
+ libomp_append(cppflags_local "-D KMP_GOMP_COMPAT")
+ endif()
+
+ libomp_append(cppflags_local "-D USE_LOAD_BALANCE" IF_FALSE MIC)
+ if(NOT WIN32 AND NOT APPLE)
+ libomp_append(cppflags_local "-D KMP_TDATA_GTID")
+ endif()
+ libomp_append(cppflags_local "-D KMP_USE_ASSERT" IF_TRUE LIBOMP_ENABLE_ASSERTIONS)
+ libomp_append(cppflags_local "-D KMP_DYNAMIC_LIB")
+ libomp_append(cppflags_local "-D KMP_STUB" IF_TRUE STUBS_LIBRARY)
+
+ if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD})
+ libomp_append(cppflags_local "-D KMP_DEBUG")
+ endif()
+ libomp_append(cppflags_local "-D _DEBUG" IF_TRUE DEBUG_BUILD)
+ libomp_append(cppflags_local "-D BUILD_DEBUG" IF_TRUE DEBUG_BUILD)
+ libomp_append(cppflags_local "-D KMP_STATS_ENABLED" IF_TRUE_1_0 LIBOMP_STATS)
+ libomp_append(cppflags_local "-D USE_DEBUGGER" IF_TRUE_1_0 LIBOMP_USE_DEBUGGER)
+ libomp_append(cppflags_local "-D OMPT_SUPPORT" IF_TRUE_1_0 LIBOMP_OMPT_SUPPORT)
+ libomp_append(cppflags_local "-D OMPT_BLAME" IF_TRUE_1_0 LIBOMP_OMPT_BLAME)
+ libomp_append(cppflags_local "-D OMPT_TRACE" IF_TRUE_1_0 LIBOMP_OMPT_TRACE)
+
+ # OpenMP version flags
+ set(libomp_have_omp_50 0)
+ set(libomp_have_omp_41 0)
+ set(libomp_have_omp_40 0)
+ set(libomp_have_omp_30 0)
+ if(${LIBOMP_OMP_VERSION} EQUAL 50 OR ${LIBOMP_OMP_VERSION} GREATER 50)
+ set(libomp_have_omp_50 1)
+ endif()
+ if(${LIBOMP_OMP_VERSION} EQUAL 41 OR ${LIBOMP_OMP_VERSION} GREATER 41)
+ set(libomp_have_omp_41 1)
+ endif()
+ if(${LIBOMP_OMP_VERSION} EQUAL 40 OR ${LIBOMP_OMP_VERSION} GREATER 40)
+ set(libomp_have_omp_40 1)
+ endif()
+ if(${LIBOMP_OMP_VERSION} EQUAL 30 OR ${LIBOMP_OMP_VERSION} GREATER 30)
+ set(libomp_have_omp_30 1)
+ endif()
+ libomp_append(cppflags_local "-D OMP_50_ENABLED=${libomp_have_omp_50}")
+ libomp_append(cppflags_local "-D OMP_41_ENABLED=${libomp_have_omp_41}")
+ libomp_append(cppflags_local "-D OMP_40_ENABLED=${libomp_have_omp_40}")
+ libomp_append(cppflags_local "-D OMP_30_ENABLED=${libomp_have_omp_30}")
+ libomp_append(cppflags_local "-D KMP_USE_ADAPTIVE_LOCKS" IF_TRUE_1_0 LIBOMP_USE_ADAPTIVE_LOCKS)
+ libomp_append(cppflags_local "-D KMP_DEBUG_ADAPTIVE_LOCKS=0")
+ libomp_append(cppflags_local "-D KMP_USE_INTERNODE_ALIGNMENT" IF_TRUE_1_0 LIBOMP_USE_INTERNODE_ALIGNMENT)
+ # CMake doesn't include CPPFLAGS from environment, but we will.
+ set(${cppflags} ${cppflags_local} ${LIBOMP_CPPFLAGS} $ENV{CPPFLAGS} PARENT_SCOPE)
+endfunction()
+
OpenPOWER on IntegriCloud