llvm-project/openmp/runtime/CMakeLists.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

387 lines
15 KiB
CMake
Raw Normal View History

#
#//===----------------------------------------------------------------------===//
#//
#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
#// See https://llvm.org/LICENSE.txt for license information.
#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#//
#//===----------------------------------------------------------------------===//
#
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
message(FATAL_ERROR "Direct configuration not supported, please use parent directory!")
endif()
# Add cmake directory to search for custom cmake functions
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
# Set libomp version
set(LIBOMP_VERSION_MAJOR 5)
set(LIBOMP_VERSION_MINOR 0)
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
2015-07-16 00:05:30 +08:00
# These include files are in the cmake/ subdirectory
include(LibompUtils)
include(LibompGetArchitecture)
include(LibompHandleFlags)
include(LibompDefinitions)
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
2015-07-16 00:05:30 +08:00
# Determine the target architecture
if(${OPENMP_STANDALONE_BUILD})
# If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake
libomp_get_architecture(LIBOMP_DETECTED_ARCH)
set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING
"The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic/mips/mips64/riscv64).")
# Should assertions be enabled? They are on by default.
set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
"enable assertions?")
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
2015-07-16 00:05:30 +08:00
else() # Part of LLVM build
# Determine the native architecture from LLVM.
string(TOLOWER "${LLVM_TARGET_ARCH}" LIBOMP_NATIVE_ARCH)
if( LIBOMP_NATIVE_ARCH STREQUAL "host" )
string(REGEX MATCH "^[^-]*" LIBOMP_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
endif ()
if(LIBOMP_NATIVE_ARCH MATCHES "i[2-6]86")
set(LIBOMP_ARCH i386)
elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86")
set(LIBOMP_ARCH i386)
elseif(LIBOMP_NATIVE_ARCH STREQUAL "amd64")
set(LIBOMP_ARCH x86_64)
elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86_64")
set(LIBOMP_ARCH x86_64)
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc64le")
set(LIBOMP_ARCH ppc64le)
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
set(LIBOMP_ARCH ppc64)
elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64")
set(LIBOMP_ARCH aarch64)
elseif(LIBOMP_NATIVE_ARCH MATCHES "arm64")
set(LIBOMP_ARCH aarch64)
elseif(LIBOMP_NATIVE_ARCH MATCHES "arm")
set(LIBOMP_ARCH arm)
elseif(LIBOMP_NATIVE_ARCH MATCHES "riscv64")
set(LIBOMP_ARCH riscv64)
else()
# last ditch effort
libomp_get_architecture(LIBOMP_ARCH)
endif ()
set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
endif()
libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 mic mips mips64 riscv64)
set(LIBOMP_LIB_TYPE normal CACHE STRING
"Performance,Profiling,Stubs library (normal/profile/stubs)")
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
2015-07-16 00:05:30 +08:00
libomp_check_variable(LIBOMP_LIB_TYPE normal profile stubs)
# Set the OpenMP Year and Month associated with version
set(LIBOMP_OMP_YEAR_MONTH 201611)
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
2015-07-16 00:05:30 +08:00
set(LIBOMP_MIC_ARCH knc CACHE STRING
"Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) (knf/knc). Ignored if not Intel(R) MIC Architecture build.")
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
2015-07-16 00:05:30 +08:00
if("${LIBOMP_ARCH}" STREQUAL "mic")
libomp_check_variable(LIBOMP_MIC_ARCH knf knc)
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
2015-07-16 00:05:30 +08:00
endif()
set(LIBOMP_FORTRAN_MODULES FALSE CACHE BOOL
"Create Fortran module files? (requires fortran compiler)")
# - Support for universal fat binary builds on Mac
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
2015-07-16 00:05:30 +08:00
# - Having this extra variable allows people to build this library as a universal library
# without forcing a universal build of the llvm/clang compiler.
set(LIBOMP_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
"For Mac builds, semicolon separated list of architectures to build for universal fat binary.")
set(CMAKE_OSX_ARCHITECTURES ${LIBOMP_OSX_ARCHITECTURES})
# Should @rpath be used for dynamic libraries on Mac?
# The if(NOT DEFINED) is there to guard a cached value of the variable if one
# exists so there is no interference with what the user wants. Also, no cache entry
# is created so there are no inadvertant effects on other parts of LLVM.
if(NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH TRUE)
endif()
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
2015-07-16 00:05:30 +08:00
# User specified flags. These are appended to the configured flags.
set(LIBOMP_CXXFLAGS "" CACHE STRING
"Appended user specified C++ compiler flags.")
set(LIBOMP_CPPFLAGS "" CACHE STRING
"Appended user specified C preprocessor flags.")
set(LIBOMP_ASMFLAGS "" CACHE STRING
"Appended user specified assembler flags.")
set(LIBOMP_LDFLAGS "" CACHE STRING
"Appended user specified linker flags.")
set(LIBOMP_LIBFLAGS "" CACHE STRING
"Appended user specified linked libs flags. (e.g., -lm)")
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
2015-07-16 00:05:30 +08:00
set(LIBOMP_FFLAGS "" CACHE STRING
"Appended user specified Fortran compiler flags. These are only used if LIBOMP_FORTRAN_MODULES==TRUE.")
# Should the libomp library and generated headers be copied into the original source exports/ directory
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
2015-07-16 00:05:30 +08:00
# Turning this to FALSE aids parallel builds to not interfere with each other.
# Currently, the testsuite module expects the just built OpenMP library to be located inside the exports/
# directory. TODO: have testsuite run under llvm-lit directly. We can then get rid of copying to exports/
set(LIBOMP_COPY_EXPORTS FALSE CACHE STRING
"Should exports be copied into source exports/ directory?")
# HWLOC-support
set(LIBOMP_USE_HWLOC FALSE CACHE BOOL
"Use Hwloc (http://www.open-mpi.org/projects/hwloc/) library for affinity?")
set(LIBOMP_HWLOC_INSTALL_DIR /usr/local CACHE PATH
"Install path for hwloc library")
# Get the build number from kmp_version.cpp
libomp_get_build_number("${CMAKE_CURRENT_SOURCE_DIR}" LIBOMP_VERSION_BUILD)
math(EXPR LIBOMP_VERSION_BUILD_YEAR "${LIBOMP_VERSION_BUILD}/10000")
math(EXPR LIBOMP_VERSION_BUILD_MONTH_DAY "${LIBOMP_VERSION_BUILD}%10000")
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
2015-07-16 00:05:30 +08:00
# Currently don't record any timestamps
set(LIBOMP_BUILD_DATE "No_Timestamp")
# Architecture
set(IA32 FALSE)
set(INTEL64 FALSE)
set(ARM FALSE)
set(AARCH64 FALSE)
set(PPC64BE FALSE)
set(PPC64LE FALSE)
set(PPC64 FALSE)
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
2015-07-16 00:05:30 +08:00
set(MIC FALSE)
set(MIPS64 FALSE)
set(MIPS FALSE)
set(RISCV64 FALSE)
if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
set(IA32 TRUE)
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
2015-07-16 00:05:30 +08:00
elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture
set(INTEL64 TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "arm") # ARM architecture
set(ARM TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64") # PPC64BE architecture
set(PPC64BE TRUE)
set(PPC64 TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "ppc64le") # PPC64LE architecture
set(PPC64LE TRUE)
set(PPC64 TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "aarch64") # AARCH64 architecture
set(AARCH64 TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "mic") # Intel(R) Many Integrated Core Architecture
set(MIC TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "mips") # MIPS architecture
set(MIPS TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "mips64") # MIPS64 architecture
set(MIPS64 TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "riscv64") # RISCV64 architecture
set(RISCV64 TRUE)
endif()
# Set some flags based on build_type
set(RELEASE_BUILD FALSE)
set(DEBUG_BUILD FALSE)
set(RELWITHDEBINFO_BUILD FALSE)
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
2015-07-16 00:05:30 +08:00
set(MINSIZEREL_BUILD FALSE)
string(TOLOWER "${CMAKE_BUILD_TYPE}" libomp_build_type_lowercase)
if("${libomp_build_type_lowercase}" STREQUAL "release")
set(RELEASE_BUILD TRUE)
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
2015-07-16 00:05:30 +08:00
elseif("${libomp_build_type_lowercase}" STREQUAL "debug")
set(DEBUG_BUILD TRUE)
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
2015-07-16 00:05:30 +08:00
elseif("${libomp_build_type_lowercase}" STREQUAL "relwithdebinfo")
set(RELWITHDEBINFO_BUILD TRUE)
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
2015-07-16 00:05:30 +08:00
elseif("${libomp_build_type_lowercase}" STREQUAL "minsizerel")
set(MINSIZEREL_BUILD TRUE)
endif()
# Include itt notify interface?
set(LIBOMP_USE_ITT_NOTIFY TRUE CACHE BOOL
"Enable ITT notify?")
# normal, profile, stubs library.
set(NORMAL_LIBRARY FALSE)
set(STUBS_LIBRARY FALSE)
set(PROFILE_LIBRARY FALSE)
if("${LIBOMP_LIB_TYPE}" STREQUAL "normal")
set(NORMAL_LIBRARY TRUE)
elseif("${LIBOMP_LIB_TYPE}" STREQUAL "profile")
set(PROFILE_LIBRARY TRUE)
elseif("${LIBOMP_LIB_TYPE}" STREQUAL "stubs")
set(STUBS_LIBRARY TRUE)
endif()
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
2015-07-16 00:05:30 +08:00
# Setting directory names
set(LIBOMP_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LIBOMP_SRC_DIR ${LIBOMP_BASE_DIR}/src)
set(LIBOMP_TOOLS_DIR ${LIBOMP_BASE_DIR}/tools)
set(LIBOMP_INC_DIR ${LIBOMP_SRC_DIR}/include)
set(LIBOMP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
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
2015-07-16 00:05:30 +08:00
# Enabling Fortran if it is needed
if(${LIBOMP_FORTRAN_MODULES})
enable_language(Fortran)
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
2015-07-16 00:05:30 +08:00
endif()
# Enable MASM Compiler if it is needed (Windows only)
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
2015-07-16 00:05:30 +08:00
if(WIN32)
enable_language(ASM_MASM)
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
2015-07-16 00:05:30 +08:00
endif()
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
2015-07-16 00:05:30 +08:00
# Getting legal type/arch
libomp_get_legal_type(LIBOMP_LEGAL_TYPE)
libomp_get_legal_arch(LIBOMP_LEGAL_ARCH)
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
2015-07-16 00:05:30 +08:00
# Compiler flag checks, library checks, threading check, etc.
include(config-ix)
I apologise in advance for the size of this check-in. At Intel we do understand that this is not friendly, and are working to change our internal code-development to make it easier to make development features available more frequently and in finer (more functional) chunks. Unfortunately we haven't got that in place yet, and unpicking this into multiple separate check-ins would be non-trivial, so please bear with me on this one. We should be better in the future. Apologies over, what do we have here? GGC 4.9 compatibility -------------------- * We have implemented the new entrypoints used by code compiled by GCC 4.9 to implement the same functionality in gcc 4.8. Therefore code compiled with gcc 4.9 that used to work will continue to do so. However, there are some other new entrypoints (associated with task cancellation) which are not implemented. Therefore user code compiled by gcc 4.9 that uses these new features will not link against the LLVM runtime. (It remains unclear how to handle those entrypoints, since the GCC interface has potentially unpleasant performance implications for join barriers even when cancellation is not used) --- new parallel entry points --- new entry points that aren't OpenMP 4.0 related These are implemented fully :- GOMP_parallel_loop_dynamic() GOMP_parallel_loop_guided() GOMP_parallel_loop_runtime() GOMP_parallel_loop_static() GOMP_parallel_sections() GOMP_parallel() --- cancellation entry points --- Currently, these only give a runtime error if OMP_CANCELLATION is true because our plain barriers don't check for cancellation while waiting GOMP_barrier_cancel() GOMP_cancel() GOMP_cancellation_point() GOMP_loop_end_cancel() GOMP_sections_end_cancel() --- taskgroup entry points --- These are implemented fully. GOMP_taskgroup_start() GOMP_taskgroup_end() --- target entry points --- These are empty (as they are in libgomp) GOMP_target() GOMP_target_data() GOMP_target_end_data() GOMP_target_update() GOMP_teams() Improvements in Barriers and Fork/Join -------------------------------------- * Barrier and fork/join code is now in its own file (which makes it easier to understand and modify). * Wait/release code is now templated and in its own file; suspend/resume code is also templated * There's a new, hierarchical, barrier, which exploits the cache-hierarchy of the Intel(r) Xeon Phi(tm) coprocessor to improve fork/join and barrier performance. ***BEWARE*** the new source files have *not* been added to the legacy Cmake build system. If you want to use that fixes wil be required. Statistics Collection Code -------------------------- * New code has been added to collect application statistics (if this is enabled at library compile time; by default it is not). The statistics code itself is generally useful, the lightweight timing code uses the X86 rdtsc instruction, so will require changes for other architectures. The intent of this code is not for users to tune their codes but rather 1) For timing code-paths inside the runtime 2) For gathering general properties of OpenMP codes to focus attention on which OpenMP features are most used. Nested Hot Teams ---------------- * The runtime now maintains more state to reduce the overhead of creating and destroying inner parallel teams. This improves the performance of code that repeatedly uses nested parallelism with the same resource allocation. Set the new KMP_HOT_TEAMS_MAX_LEVEL envirable to a depth to enable this (and, of course, OMP_NESTED=true to enable nested parallelism at all). Improved Intel(r) VTune(Tm) Amplifier support --------------------------------------------- * The runtime provides additional information to Vtune via the itt_notify interface to allow it to display better OpenMP specific analyses of load-imbalance. Support for OpenMP Composite Statements --------------------------------------- * Implement new entrypoints required by some of the OpenMP 4.1 composite statements. Improved ifdefs --------------- * More separation of concepts ("Does this platform do X?") from platforms ("Are we compiling for platform Y?"), which should simplify future porting. ScaleMP* contribution --------------------- Stack padding to improve the performance in their environment where cross-node coherency is managed at the page level. Redesign of wait and release code --------------------------------- The code is simplified and performance improved. Bug Fixes --------- *Fixes for Windows multiple processor groups. *Fix Fortran module build on Linux: offload attribute added. *Fix entry names for distribute-parallel-loop construct to be consistent with the compiler codegen. *Fix an inconsistent error message for KMP_PLACE_THREADS environment variable. llvm-svn: 219214
2014-10-08 00:25:50 +08:00
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
2015-07-16 00:05:30 +08:00
# Is there a quad precision data type available?
# TODO: Make this a real feature check
set(LIBOMP_USE_QUAD_PRECISION "${LIBOMP_HAVE_QUAD_PRECISION}" CACHE BOOL
"Should 128-bit precision entry points be built?")
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
2015-07-16 00:05:30 +08:00
if(LIBOMP_USE_QUAD_PRECISION AND (NOT LIBOMP_HAVE_QUAD_PRECISION))
libomp_error_say("128-bit quad precision functionality requested but not available")
I apologise in advance for the size of this check-in. At Intel we do understand that this is not friendly, and are working to change our internal code-development to make it easier to make development features available more frequently and in finer (more functional) chunks. Unfortunately we haven't got that in place yet, and unpicking this into multiple separate check-ins would be non-trivial, so please bear with me on this one. We should be better in the future. Apologies over, what do we have here? GGC 4.9 compatibility -------------------- * We have implemented the new entrypoints used by code compiled by GCC 4.9 to implement the same functionality in gcc 4.8. Therefore code compiled with gcc 4.9 that used to work will continue to do so. However, there are some other new entrypoints (associated with task cancellation) which are not implemented. Therefore user code compiled by gcc 4.9 that uses these new features will not link against the LLVM runtime. (It remains unclear how to handle those entrypoints, since the GCC interface has potentially unpleasant performance implications for join barriers even when cancellation is not used) --- new parallel entry points --- new entry points that aren't OpenMP 4.0 related These are implemented fully :- GOMP_parallel_loop_dynamic() GOMP_parallel_loop_guided() GOMP_parallel_loop_runtime() GOMP_parallel_loop_static() GOMP_parallel_sections() GOMP_parallel() --- cancellation entry points --- Currently, these only give a runtime error if OMP_CANCELLATION is true because our plain barriers don't check for cancellation while waiting GOMP_barrier_cancel() GOMP_cancel() GOMP_cancellation_point() GOMP_loop_end_cancel() GOMP_sections_end_cancel() --- taskgroup entry points --- These are implemented fully. GOMP_taskgroup_start() GOMP_taskgroup_end() --- target entry points --- These are empty (as they are in libgomp) GOMP_target() GOMP_target_data() GOMP_target_end_data() GOMP_target_update() GOMP_teams() Improvements in Barriers and Fork/Join -------------------------------------- * Barrier and fork/join code is now in its own file (which makes it easier to understand and modify). * Wait/release code is now templated and in its own file; suspend/resume code is also templated * There's a new, hierarchical, barrier, which exploits the cache-hierarchy of the Intel(r) Xeon Phi(tm) coprocessor to improve fork/join and barrier performance. ***BEWARE*** the new source files have *not* been added to the legacy Cmake build system. If you want to use that fixes wil be required. Statistics Collection Code -------------------------- * New code has been added to collect application statistics (if this is enabled at library compile time; by default it is not). The statistics code itself is generally useful, the lightweight timing code uses the X86 rdtsc instruction, so will require changes for other architectures. The intent of this code is not for users to tune their codes but rather 1) For timing code-paths inside the runtime 2) For gathering general properties of OpenMP codes to focus attention on which OpenMP features are most used. Nested Hot Teams ---------------- * The runtime now maintains more state to reduce the overhead of creating and destroying inner parallel teams. This improves the performance of code that repeatedly uses nested parallelism with the same resource allocation. Set the new KMP_HOT_TEAMS_MAX_LEVEL envirable to a depth to enable this (and, of course, OMP_NESTED=true to enable nested parallelism at all). Improved Intel(r) VTune(Tm) Amplifier support --------------------------------------------- * The runtime provides additional information to Vtune via the itt_notify interface to allow it to display better OpenMP specific analyses of load-imbalance. Support for OpenMP Composite Statements --------------------------------------- * Implement new entrypoints required by some of the OpenMP 4.1 composite statements. Improved ifdefs --------------- * More separation of concepts ("Does this platform do X?") from platforms ("Are we compiling for platform Y?"), which should simplify future porting. ScaleMP* contribution --------------------- Stack padding to improve the performance in their environment where cross-node coherency is managed at the page level. Redesign of wait and release code --------------------------------- The code is simplified and performance improved. Bug Fixes --------- *Fixes for Windows multiple processor groups. *Fix Fortran module build on Linux: offload attribute added. *Fix entry names for distribute-parallel-loop construct to be consistent with the compiler codegen. *Fix an inconsistent error message for KMP_PLACE_THREADS environment variable. llvm-svn: 219214
2014-10-08 00:25:50 +08:00
endif()
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
2015-07-16 00:05:30 +08:00
# libgomp drop-in compatibility requires versioned symbols
set(LIBOMP_USE_VERSION_SYMBOLS "${LIBOMP_HAVE_VERSION_SYMBOLS}" CACHE BOOL
"Should version symbols be used? These provide binary compatibility with libgomp.")
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
2015-07-16 00:05:30 +08:00
if(LIBOMP_USE_VERSION_SYMBOLS AND (NOT LIBOMP_HAVE_VERSION_SYMBOLS))
libomp_error_say("Version symbols functionality requested but not available")
endif()
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
2015-07-16 00:05:30 +08:00
# On multinode systems, larger alignment is desired to avoid false sharing
set(LIBOMP_USE_INTERNODE_ALIGNMENT FALSE CACHE BOOL
"Should larger alignment (4096 bytes) be used for some locks and data structures?")
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
2015-07-16 00:05:30 +08:00
# Build code that allows the OpenMP library to conveniently interface with debuggers
set(LIBOMP_USE_DEBUGGER FALSE CACHE BOOL
"Enable debugger interface code?")
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
2015-07-16 00:05:30 +08:00
# Should we link to C++ library?
set(LIBOMP_USE_STDCPPLIB FALSE CACHE BOOL
"Should we link to C++ library?")
# Intel(R) Transactional Synchronization Extensions (Intel(R) TSX) based locks have
# __asm code which can be troublesome for some compilers. This feature is also x86 specific.
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
2015-07-16 00:05:30 +08:00
# TODO: Make this a real feature check
set(LIBOMP_USE_ADAPTIVE_LOCKS "${LIBOMP_HAVE_ADAPTIVE_LOCKS}" CACHE BOOL
"Should Intel(R) TSX lock be compiled (adaptive lock in kmp_lock.cpp). These are x86 specific.")
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
2015-07-16 00:05:30 +08:00
if(LIBOMP_USE_ADAPTIVE_LOCKS AND (NOT LIBOMP_HAVE_ADAPTIVE_LOCKS))
libomp_error_say("Adaptive locks (Intel(R) TSX) functionality is only supported on x86 Architecture")
endif()
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
2015-07-16 00:05:30 +08:00
# - stats-gathering enables OpenMP stats where things like the number of
# parallel regions, clock ticks spent in particular openmp regions are recorded.
set(LIBOMP_STATS FALSE CACHE BOOL
"Stats-Gathering functionality?")
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
2015-07-16 00:05:30 +08:00
if(LIBOMP_STATS AND (NOT LIBOMP_HAVE_STATS))
libomp_error_say("Stats-gathering functionality requested but not available")
endif()
# The stats functionality requires the std c++ library
if(LIBOMP_STATS)
set(LIBOMP_USE_STDCPPLIB TRUE)
endif()
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
2015-07-16 00:05:30 +08:00
# Shared library can be switched to a static library
set(LIBOMP_ENABLE_SHARED TRUE CACHE BOOL
"Shared library instead of static library?")
if(WIN32 AND NOT LIBOMP_ENABLE_SHARED)
libomp_error_say("Static libraries requested but not available on Windows")
endif()
if(LIBOMP_USE_ITT_NOTIFY AND NOT LIBOMP_ENABLE_SHARED)
message(STATUS "ITT Notify not supported for static libraries - forcing ITT Notify off")
set(LIBOMP_USE_ITT_NOTIFY FALSE)
endif()
if(LIBOMP_USE_VERSION_SYMBOLS AND (NOT LIBOMP_ENABLE_SHARED) )
message(STATUS "Version symbols not supported for static libraries - forcing Version symbols functionality off")
set (LIBOMP_USE_VERSION_SYMBOLS FALSE)
endif()
# OMPT-support defaults to ON for OpenMP 5.0+ and if the requirements in
# cmake/config-ix.cmake are fulfilled.
set(OMPT_DEFAULT FALSE)
if ((LIBOMP_HAVE_OMPT_SUPPORT) AND (NOT WIN32))
set(OMPT_DEFAULT TRUE)
endif()
set(LIBOMP_OMPT_SUPPORT ${OMPT_DEFAULT} CACHE BOOL
"OMPT-support?")
set(LIBOMP_OMPT_DEBUG FALSE CACHE BOOL
"Trace OMPT initialization?")
set(LIBOMP_OMPT_OPTIONAL TRUE CACHE BOOL
"OMPT-optional?")
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
2015-07-16 00:05:30 +08:00
if(LIBOMP_OMPT_SUPPORT AND (NOT LIBOMP_HAVE_OMPT_SUPPORT))
libomp_error_say("OpenMP Tools Interface requested but not available in this implementation")
endif()
# TSAN-support
set(LIBOMP_TSAN_SUPPORT FALSE CACHE BOOL
"TSAN-support?")
if(LIBOMP_TSAN_SUPPORT AND (NOT LIBOMP_HAVE_TSAN_SUPPORT))
libomp_error_say("TSAN functionality requested but not available")
endif()
# Error check hwloc support after config-ix has run
if(LIBOMP_USE_HWLOC AND (NOT LIBOMP_HAVE_HWLOC))
libomp_error_say("Hwloc requested but not available")
endif()
[OpenMP] Introduce hierarchical scheduling This patch introduces the logic implementing hierarchical scheduling. First and foremost, hierarchical scheduling is off by default To enable, use -DLIBOMP_USE_HIER_SCHED=On during CMake's configure stage. This work is based off if the IWOMP paper: "Workstealing and Nested Parallelism in SMP Systems" Hierarchical scheduling is the layering of OpenMP schedules for different layers of the memory hierarchy. One can have multiple layers between the threads and the global iterations space. The threads will go up the hierarchy to grab iterations, using possibly a different schedule & chunk for each layer. [ Global iteration space (0-999) ] (use static) [ L1 | L1 | L1 | L1 ] (use dynamic,1) [ T0 T1 | T2 T3 | T4 T5 | T6 T7 ] In the example shown above, there are 8 threads and 4 L1 caches begin targeted. If the topology indicates that there are two threads per core, then two consecutive threads will share the data of one L1 cache unit. This example would have the iteration space (0-999) split statically across the four L1 caches (so the first L1 would get (0-249), the second would get (250-499), etc). Then the threads will use a dynamic,1 schedule to grab iterations from the L1 cache units. There are currently four supported layers: L1, L2, L3, NUMA OMP_SCHEDULE can now read a hierarchical schedule with this syntax: OMP_SCHEDULE='EXPERIMENTAL LAYER,SCHED[,CHUNK][:LAYER,SCHED[,CHUNK]...]:SCHED,CHUNK And OMP_SCHEDULE can still read the normal SCHED,CHUNK syntax from before I've kept most of the hierarchical scheduling logic inside kmp_dispatch_hier.h to try to keep it separate from the rest of the code. Differential Revision: https://reviews.llvm.org/D47962 llvm-svn: 336571
2018-07-10 01:51:13 +08:00
# Hierarchical scheduling support
set(LIBOMP_USE_HIER_SCHED FALSE CACHE BOOL
"Hierarchical scheduling support?")
# Setting final library name
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
2015-07-16 00:05:30 +08:00
set(LIBOMP_DEFAULT_LIB_NAME libomp)
if(${PROFILE_LIBRARY})
set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}prof)
endif()
if(${STUBS_LIBRARY})
set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}stubs)
endif()
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
2015-07-16 00:05:30 +08:00
set(LIBOMP_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME} CACHE STRING "Base OMP library name")
if(${LIBOMP_ENABLE_SHARED})
set(LIBOMP_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBOMP_LIBRARY_KIND SHARED)
set(LIBOMP_INSTALL_KIND LIBRARY)
else()
set(LIBOMP_LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBOMP_LIBRARY_KIND STATIC)
set(LIBOMP_INSTALL_KIND ARCHIVE)
endif()
set(LIBOMP_LIB_FILE ${LIBOMP_LIB_NAME}${LIBOMP_LIBRARY_SUFFIX})
# Optional backwards compatibility aliases.
set(LIBOMP_INSTALL_ALIASES TRUE CACHE BOOL
"Install libgomp and libiomp5 library aliases for backwards compatibility")
# Print configuration after all variables are set.
if(${OPENMP_STANDALONE_BUILD})
libomp_say("Operating System -- ${CMAKE_SYSTEM_NAME}")
libomp_say("Target Architecture -- ${LIBOMP_ARCH}")
if(${MIC})
libomp_say("Intel(R) MIC Architecture -- ${LIBOMP_MIC_ARCH}")
endif()
libomp_say("Build Type -- ${CMAKE_BUILD_TYPE}")
libomp_say("Library Kind -- ${LIBOMP_LIBRARY_KIND}")
libomp_say("Library Type -- ${LIBOMP_LIB_TYPE}")
libomp_say("Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
# will say development if all zeros
if(${LIBOMP_VERSION_BUILD} STREQUAL 00000000)
set(LIBOMP_BUILD Development)
else()
set(LIBOMP_BUILD ${LIBOMP_VERSION_BUILD})
endif()
libomp_say("Build -- ${LIBOMP_BUILD}")
libomp_say("Use Stats-gathering -- ${LIBOMP_STATS}")
libomp_say("Use Debugger-support -- ${LIBOMP_USE_DEBUGGER}")
libomp_say("Use ITT notify -- ${LIBOMP_USE_ITT_NOTIFY}")
libomp_say("Use OMPT-support -- ${LIBOMP_OMPT_SUPPORT}")
if(${LIBOMP_OMPT_SUPPORT})
libomp_say("Use OMPT-optional -- ${LIBOMP_OMPT_OPTIONAL}")
endif()
libomp_say("Use Adaptive locks -- ${LIBOMP_USE_ADAPTIVE_LOCKS}")
libomp_say("Use quad precision -- ${LIBOMP_USE_QUAD_PRECISION}")
libomp_say("Use TSAN-support -- ${LIBOMP_TSAN_SUPPORT}")
libomp_say("Use Hwloc library -- ${LIBOMP_USE_HWLOC}")
endif()
add_subdirectory(src)
add_subdirectory(test)
# make these variables available for tools:
set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE)
set(LIBOMP_INCLUDE_DIR ${LIBOMP_INCLUDE_DIR} PARENT_SCOPE)