When using
set(var "Example")
if (${var})
CMake will first resolve the if-argument to
if (Example)
And what then happens depends on the existance of a variable with the
name "Example":
1. If instead of "Example", a truth constant is used ("TRUE", "FALSE",
"ON", "OFF", "", "-NOTFOUND" ...), it is prioritized
(https://cmake.org/cmake/help/latest/command/if.html#constant)
2. If a variable with the name "Example" exists: Use the truthiness of
its content
(https://cmake.org/cmake/help/latest/command/if.html#variable)
3. Otherwise, it is false-y
That is, the the result of the conditional does not only depend on the
content of `var`, but also some other variable. This is usually
unintended and leads to problems such as addressed with #154537. The
only case where this is intended is when passing an expression to be
evaluated such as with `pythonize_bool`, `append_if` and
`libomp_append`. In all other cases, using `${var}` without quotes is a
pattern to be avoided.
Remark:
If `${var}` is not one of the values considered a [truthiness
constant](https://cmake.org/cmake/help/latest/command/if.html#constant),
the result of `if (var)` and `if ("${var}")` is different:
* `if (var)` is true-ish
(https://cmake.org/cmake/help/latest/command/if.html#variable)
* `if ("Example")` and therefore `if ("${var}")` are false-y
(https://cmake.org/cmake/help/latest/command/if.html#string)
In this PR I am preferring `if (var)` over `if ("${var}")` because has
less clutter, resembles Python's behaviour, and problably what most
users are expecting, even though `if (${var})` in most cases would
evaluate to false-y because a variable does not exist. This ambiguity
does not exist for STREQUAL and MATCHES.
431 lines
16 KiB
CMake
431 lines
16 KiB
CMake
#
|
|
#//===----------------------------------------------------------------------===//
|
|
#//
|
|
#// 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})
|
|
|
|
# These include files are in the cmake/ subdirectory
|
|
include(LibompGetArchitecture)
|
|
include(LibompDefinitions)
|
|
|
|
# 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 "powerpc64")
|
|
set(LIBOMP_ARCH ppc64)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
|
|
set(LIBOMP_ARCH ppc)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64_32")
|
|
set(LIBOMP_ARCH aarch64_32)
|
|
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)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "loongarch64")
|
|
set(LIBOMP_ARCH loongarch64)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "ve")
|
|
set(LIBOMP_ARCH ve)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "s390x")
|
|
set(LIBOMP_ARCH s390x)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "sparcv9")
|
|
set(LIBOMP_ARCH sparcv9)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "sparc")
|
|
set(LIBOMP_ARCH sparc)
|
|
elseif(LIBOMP_NATIVE_ARCH MATCHES "wasm")
|
|
set(LIBOMP_ARCH wasm32)
|
|
else()
|
|
# last ditch effort
|
|
libomp_get_architecture(LIBOMP_ARCH)
|
|
endif ()
|
|
set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
|
|
|
|
# Time profiling support
|
|
set(LIBOMP_PROFILING_SUPPORT ${OPENMP_ENABLE_LIBOMP_PROFILING})
|
|
|
|
# FUJITSU A64FX is a special processor because its cache line size is 256.
|
|
# We need to pass this information into kmp_config.h.
|
|
if(LIBOMP_ARCH STREQUAL "aarch64")
|
|
libomp_is_aarch64_a64fx(LIBOMP_DETECT_AARCH64_A64FX)
|
|
if (LIBOMP_DETECT_AARCH64_A64FX)
|
|
set(LIBOMP_ARCH "aarch64_a64fx")
|
|
set(LIBOMP_ARCH_AARCH64_A64FX TRUE)
|
|
endif()
|
|
endif()
|
|
|
|
libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc ppc64 ppc64le aarch64 aarch64_32 aarch64_a64fx mic mips mips64 riscv64 loongarch64 ve s390x sparc sparcv9 wasm32)
|
|
|
|
set(LIBOMP_LIB_TYPE normal CACHE STRING
|
|
"Performance,Profiling,Stubs library (normal/profile/stubs)")
|
|
libomp_check_variable(LIBOMP_LIB_TYPE normal profile stubs)
|
|
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.")
|
|
if("${LIBOMP_ARCH}" STREQUAL "mic")
|
|
libomp_check_variable(LIBOMP_MIC_ARCH knf knc)
|
|
endif()
|
|
|
|
|
|
# - Support for universal fat binary builds on Mac
|
|
# - 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()
|
|
|
|
# Remove any cmake-automatic linking of the standard C++ library.
|
|
# We neither need (nor want) the standard C++ library dependency even though we compile C++ files.
|
|
if(NOT LIBOMP_USE_STDCPPLIB)
|
|
set(LIBOMP_LINKER_LANGUAGE C)
|
|
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
|
|
else()
|
|
set(LIBOMP_LINKER_LANGUAGE CXX)
|
|
endif()
|
|
|
|
if(UNIX)
|
|
set(LIBOMP_DL_LIBS ${CMAKE_DL_LIBS})
|
|
endif()
|
|
|
|
# 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.")
|
|
if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
|
|
set(LIBOMP_LIBFLAGS "-lperfstat" CACHE STRING
|
|
"Appended user specified linked libs flags. (e.g., -lm)")
|
|
if("${LIBOMP_ARCH}" STREQUAL "ppc")
|
|
# PPC (32-bit) on AIX needs libatomic for __atomic_load_8, etc.
|
|
set(LIBOMP_LIBFLAGS "${LIBOMP_LIBFLAGS} -latomic")
|
|
endif()
|
|
else()
|
|
set(LIBOMP_LIBFLAGS "" CACHE STRING
|
|
"Appended user specified linked libs flags. (e.g., -lm)")
|
|
endif()
|
|
|
|
if("${LIBOMP_ARCH}" STREQUAL "mips" OR "${LIBOMP_ARCH}" STREQUAL "mips64")
|
|
set(LIBOMP_LIBFLAGS "${LIBOMP_LIBFLAGS} -latomic")
|
|
endif()
|
|
|
|
# Should the libomp library and generated headers be copied into the original source exports/ directory
|
|
# 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")
|
|
|
|
# Architecture
|
|
set(IA32 FALSE)
|
|
set(INTEL64 FALSE)
|
|
set(ARM FALSE)
|
|
set(AARCH64 FALSE)
|
|
set(AARCH64_32 FALSE)
|
|
set(AARCH64_A64FX FALSE)
|
|
set(PPC64BE FALSE)
|
|
set(PPC64LE FALSE)
|
|
set(PPC64 FALSE)
|
|
set(MIC FALSE)
|
|
set(MIPS64 FALSE)
|
|
set(MIPS FALSE)
|
|
set(RISCV64 FALSE)
|
|
set(LOONGARCH64 FALSE)
|
|
set(VE FALSE)
|
|
set(S390X FALSE)
|
|
set(WASM FALSE)
|
|
set(PPC FALSE)
|
|
set(SPARC FALSE)
|
|
set(SPARCV9 FALSE)
|
|
if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
|
|
set(IA32 TRUE)
|
|
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 "ppc") # PPC32 architecture
|
|
set(PPC 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 "aarch64_32") # AARCH64_32 architecture
|
|
set(AARCH64_32 TRUE)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "aarch64_a64fx") # AARCH64_A64FX architecture
|
|
set(AARCH64_A64FX 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)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "loongarch64") # LoongArch64 architecture
|
|
set(LOONGARCH64 TRUE)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "ve") # VE architecture
|
|
set(VE TRUE)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "s390x") # S390x (Z) architecture
|
|
set(S390X TRUE)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "wasm32") # WebAssembly architecture
|
|
set(WASM TRUE)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "sparc") # SPARC architecture
|
|
set(SPARC TRUE)
|
|
elseif("${LIBOMP_ARCH}" STREQUAL "sparcv9") # SPARC V9 architecture
|
|
set(SPARCV9 TRUE)
|
|
endif()
|
|
|
|
# Set some flags based on build_type
|
|
set(RELEASE_BUILD FALSE)
|
|
set(DEBUG_BUILD FALSE)
|
|
set(RELWITHDEBINFO_BUILD FALSE)
|
|
set(MINSIZEREL_BUILD FALSE)
|
|
if("${uppercase_CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
|
set(RELEASE_BUILD TRUE)
|
|
elseif("${uppercase_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
|
|
set(DEBUG_BUILD TRUE)
|
|
elseif("${uppercase_CMAKE_BUILD_TYPE}" STREQUAL "RELWITHDEBINFO")
|
|
set(RELWITHDEBINFO_BUILD TRUE)
|
|
elseif("${uppercase_CMAKE_BUILD_TYPE}" 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()
|
|
|
|
# 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})
|
|
|
|
# Enable MASM Compiler if it is needed (Windows only)
|
|
if(WIN32)
|
|
enable_language(ASM_MASM)
|
|
endif()
|
|
|
|
# Getting legal type/arch
|
|
libomp_get_legal_type(LIBOMP_LEGAL_TYPE)
|
|
libomp_get_legal_arch(LIBOMP_LEGAL_ARCH)
|
|
|
|
# Compiler flag checks, library checks, threading check, etc.
|
|
include(config-ix)
|
|
|
|
# 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?")
|
|
if(LIBOMP_USE_QUAD_PRECISION AND (NOT LIBOMP_HAVE_QUAD_PRECISION))
|
|
libomp_error_say("128-bit quad precision functionality requested but not available")
|
|
endif()
|
|
|
|
# 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.")
|
|
if(LIBOMP_USE_VERSION_SYMBOLS AND (NOT LIBOMP_HAVE_VERSION_SYMBOLS))
|
|
libomp_error_say("Version symbols functionality requested but not available")
|
|
endif()
|
|
|
|
# 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?")
|
|
|
|
# Build code that allows the OpenMP library to conveniently interface with debuggers
|
|
set(LIBOMP_USE_DEBUGGER FALSE CACHE BOOL
|
|
"Enable debugger interface code?")
|
|
|
|
# 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.
|
|
# 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.")
|
|
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()
|
|
|
|
# - 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?")
|
|
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()
|
|
|
|
# Shared library can be switched to a static library
|
|
set(LIBOMP_ENABLE_SHARED TRUE CACHE BOOL
|
|
"Shared library instead of static library?")
|
|
|
|
if(WASM)
|
|
libomp_warning_say("The WebAssembly build currently only supports static libraries; forcing LIBOMP_ENABLE_SHARED to false")
|
|
set(LIBOMP_ENABLE_SHARED FALSE)
|
|
endif()
|
|
|
|
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?")
|
|
if(LIBOMP_OMPT_SUPPORT AND (NOT LIBOMP_HAVE_OMPT_SUPPORT))
|
|
libomp_error_say("OpenMP Tools Interface requested but not available in this implementation")
|
|
endif()
|
|
|
|
# OMPD-support
|
|
# Enable if OMPT SUPPORT is ON
|
|
set(OMPD_DEFAULT FALSE)
|
|
if (LIBOMP_HAVE_OMPT_SUPPORT AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"))
|
|
set(OMPD_DEFAULT TRUE)
|
|
endif()
|
|
|
|
set(LIBOMP_OMPD_SUPPORT ${OMPD_DEFAULT} CACHE BOOL
|
|
"OMPD-support?")
|
|
|
|
if(LIBOMP_OMPD_SUPPORT AND ((NOT LIBOMP_OMPT_SUPPORT) OR (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")))
|
|
libomp_warning_say("OpenMP Debug Interface(OMPD) requested but not available in this implementation")
|
|
set(LIBOMP_OMPD_SUPPORT FALSE)
|
|
endif()
|
|
|
|
# OMPX Taskgraph support
|
|
# Whether to build with OMPX Taskgraph (e.g. task record & replay)
|
|
set(LIBOMP_OMPX_TASKGRAPH FALSE CACHE BOOL "OMPX-taskgraph (task record & replay)?")
|
|
|
|
# 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()
|
|
|
|
# Hierarchical scheduling support
|
|
set(LIBOMP_USE_HIER_SCHED FALSE CACHE BOOL
|
|
"Hierarchical scheduling support?")
|
|
|
|
# Setting final library name
|
|
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()
|
|
set(LIBOMP_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME} CACHE STRING "Base OMP library name")
|
|
if (OPENMP_MSVC_NAME_SCHEME)
|
|
# MSVC_TOOLS_VERSION corresponds to the version of the VC++ toolset.
|
|
set(MSVC_TOOLS_VERSION 140)
|
|
set(LIBOMP_LIB_NAME ${LIBOMP_LIB_NAME}${MSVC_TOOLS_VERSION}.${LIBOMP_ARCH})
|
|
endif()
|
|
|
|
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")
|
|
|
|
add_subdirectory(src)
|
|
add_subdirectory(test)
|
|
add_subdirectory(unittests)
|
|
|
|
# make these variables available for tools:
|
|
set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE)
|
|
set(LIBOMP_INCLUDE_DIR ${LIBOMP_INCLUDE_DIR} PARENT_SCOPE)
|
|
set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE)
|
|
# make these variables available for tools/libompd:
|
|
set(LIBOMP_SRC_DIR ${LIBOMP_SRC_DIR} PARENT_SCOPE)
|
|
set(LIBOMP_OMPD_SUPPORT ${LIBOMP_OMPD_SUPPORT} PARENT_SCOPE)
|