blob: 635edb9b8ccde0171e4e088750234ff1fbd7f3c9 [file] [log] [blame]
Jim Cownie3b81ce62014-08-05 09:32:281#
2#//===----------------------------------------------------------------------===//
3#//
4#// The LLVM Compiler Infrastructure
5#//
6#// This file is dual licensed under the MIT and the University of Illinois Open
7#// Source Licenses. See LICENSE.txt for details.
8#//
9#//===----------------------------------------------------------------------===//
10#
Alp Toker7198f522014-06-01 18:01:3311
Jonathan Peyton227e1ae2015-06-01 03:05:1312# CMAKE libomp
Jim Cownie3b81ce62014-08-05 09:32:2813cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
Alp Toker7198f522014-06-01 18:01:3314
Jim Cownie3b81ce62014-08-05 09:32:2815# Add cmake directory to search for custom cmake functions
16set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
17
Andrey Churbanov648467e2015-05-05 20:02:5218# Standalone build or part of LLVM?
Jonathan Peyton7979a072015-05-20 22:33:2419set(LIBOMP_STANDALONE_BUILD FALSE)
Jonathan Peyton2e013352015-07-15 16:05:3020if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
Andrey Churbanov648467e2015-05-05 20:02:5221 "${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
Jonathan Peyton5b4acbd2015-07-15 16:57:1922 project(libomp C CXX)
23 set(LIBOMP_STANDALONE_BUILD TRUE)
Andrey Churbanov648467e2015-05-05 20:02:5224endif()
25
Jonathan Peytonc0225ca2015-08-28 18:42:1026# Set libomp version
27set(LIBOMP_VERSION_MAJOR 5)
28set(LIBOMP_VERSION_MINOR 0)
29
Jonathan Peyton2e013352015-07-15 16:05:3030# These include files are in the cmake/ subdirectory
31include(LibompUtils)
32include(LibompGetArchitecture)
33include(LibompHandleFlags)
34include(LibompDefinitions)
Jim Cownie3b81ce62014-08-05 09:32:2835
Jonathan Peyton2e013352015-07-15 16:05:3036# Determine the target architecture
37if(${LIBOMP_STANDALONE_BUILD})
Jonathan Peyton5b4acbd2015-07-15 16:57:1938 # If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake
39 libomp_get_architecture(LIBOMP_DETECTED_ARCH)
40 set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING
41 "The architecture to build for (x86_64/i386/arm/ppc64/ppc64le/aarch64/mic).")
42 # Allow user to choose a suffix for the installation directory.
43 set(LIBOMP_LIBDIR_SUFFIX "" CACHE STRING
44 "suffix of lib installation directory e.g., 64 => lib64")
45 # Should assertions be enabled? They are on by default.
46 set(LIBOMP_ENABLE_ASSERTIONS TRUE CACHE BOOL
47 "enable assertions?")
Chandler Carruth51451562015-07-18 03:14:0248 set(LIBOMP_ENABLE_WERROR FALSE CACHE BOOL
49 "Enable -Werror flags to turn warnings into errors for supporting compilers.")
Jonathan Peyton5b4acbd2015-07-15 16:57:1950 # CMAKE_BUILD_TYPE was not defined, set default to Release
51 if(NOT CMAKE_BUILD_TYPE)
52 set(CMAKE_BUILD_TYPE Release)
53 endif()
Jonathan Peyton2e013352015-07-15 16:05:3054else() # Part of LLVM build
Jonathan Peyton5b4acbd2015-07-15 16:57:1955 # Determine the native architecture from LLVM.
56 string(TOLOWER "${LLVM_TARGET_ARCH}" LIBOMP_NATIVE_ARCH)
57 if( LIBOMP_NATIVE_ARCH STREQUAL "host" )
58 string(REGEX MATCH "^[^-]*" LIBOMP_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
59 endif ()
60 if(LIBOMP_NATIVE_ARCH MATCHES "i[2-6]86")
61 set(LIBOMP_ARCH i386)
62 elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86")
63 set(LIBOMP_ARCH i386)
64 elseif(LIBOMP_NATIVE_ARCH STREQUAL "amd64")
65 set(LIBOMP_ARCH x86_64)
66 elseif(LIBOMP_NATIVE_ARCH STREQUAL "x86_64")
67 set(LIBOMP_ARCH x86_64)
68 elseif(LIBOMP_NATIVE_ARCH MATCHES "powerpc")
69 set(LIBOMP_ARCH ppc64)
70 elseif(LIBOMP_NATIVE_ARCH MATCHES "aarch64")
71 set(LIBOMP_ARCH aarch64)
72 elseif(LIBOMP_NATIVE_ARCH MATCHES "arm64")
73 set(LIBOMP_ARCH aarch64)
74 elseif(LIBOMP_NATIVE_ARCH MATCHES "arm")
75 set(LIBOMP_ARCH arm)
76 else()
77 # last ditch effort
78 libomp_get_architecture(LIBOMP_ARCH)
79 endif ()
80 set(LIBOMP_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
81 set(LIBOMP_ENABLE_ASSERTIONS ${LLVM_ENABLE_ASSERTIONS})
Chandler Carruth51451562015-07-18 03:14:0282 set(LIBOMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
Jim Cownie3b81ce62014-08-05 09:32:2883endif()
Jonathan Peyton2e013352015-07-15 16:05:3084libomp_check_variable(LIBOMP_ARCH 32e x86_64 32 i386 arm ppc64 ppc64le aarch64 mic)
Jim Cownie3b81ce62014-08-05 09:32:2885
Jonathan Peytonfbb15142015-05-26 17:27:0186set(LIBOMP_LIB_TYPE normal CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:1987 "Performance,Profiling,Stubs library (normal/profile/stubs)")
Jonathan Peyton2e013352015-07-15 16:05:3088libomp_check_variable(LIBOMP_LIB_TYPE normal profile stubs)
Jonathan Peyton2e013352015-07-15 16:05:3089set(LIBOMP_OMP_VERSION 41 CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:1990 "The OpenMP version (41/40/30)")
Jonathan Peyton2e013352015-07-15 16:05:3091libomp_check_variable(LIBOMP_OMP_VERSION 41 40 30)
Jonathan Peytonc0225ca2015-08-28 18:42:1092# Set the OpenMP Year and Month assiociated with version
93if(${LIBOMP_OMP_VERSION} GREATER 40 OR ${LIBOMP_OMP_VERSION} EQUAL 40)
94 set(LIBOMP_OMP_YEAR_MONTH 201307)
95elseif(${LIBOMP_OMP_VERSION} GREATER 30 OR ${LIBOMP_OMP_VERSION} EQUAL 30)
96 set(LIBOMP_OMP_YEAR_MONTH 201107)
97else()
98 set(LIBOMP_OMP_YEAR_MONTH 200505)
99endif()
Jonathan Peyton2e013352015-07-15 16:05:30100set(LIBOMP_MIC_ARCH knc CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19101 "Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) (knf/knc). Ignored if not Intel(R) MIC Architecture build.")
Jonathan Peyton2e013352015-07-15 16:05:30102if("${LIBOMP_ARCH}" STREQUAL "mic")
Jonathan Peyton5b4acbd2015-07-15 16:57:19103 libomp_check_variable(LIBOMP_MIC_ARCH knf knc)
Jonathan Peyton2e013352015-07-15 16:05:30104endif()
105set(LIBOMP_FORTRAN_MODULES FALSE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19106 "Create Fortran module files? (requires fortran compiler)")
Jim Cownie3b81ce62014-08-05 09:32:28107
Jonathan Peyton92907c22015-05-29 16:13:56108# - Support for universal fat binary builds on Mac
Jonathan Peyton2e013352015-07-15 16:05:30109# - Having this extra variable allows people to build this library as a universal library
Jonathan Peyton92907c22015-05-29 16:13:56110# without forcing a universal build of the llvm/clang compiler.
111set(LIBOMP_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19112 "For Mac builds, semicolon separated list of architectures to build for universal fat binary.")
Jonathan Peyton92907c22015-05-29 16:13:56113set(CMAKE_OSX_ARCHITECTURES ${LIBOMP_OSX_ARCHITECTURES})
114
Jonathan Peyton2e013352015-07-15 16:05:30115# User specified flags. These are appended to the configured flags.
Jonathan Peytonfbb15142015-05-26 17:27:01116set(LIBOMP_CFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19117 "Appended user specified C compiler flags.")
Jonathan Peytonfbb15142015-05-26 17:27:01118set(LIBOMP_CXXFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19119 "Appended user specified C++ compiler flags.")
Jonathan Peytonfbb15142015-05-26 17:27:01120set(LIBOMP_CPPFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19121 "Appended user specified C preprocessor flags.")
Jonathan Peytonfbb15142015-05-26 17:27:01122set(LIBOMP_ASMFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19123 "Appended user specified assembler flags.")
Jonathan Peytonfbb15142015-05-26 17:27:01124set(LIBOMP_LDFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19125 "Appended user specified linker flags.")
Jonathan Peytonfbb15142015-05-26 17:27:01126set(LIBOMP_LIBFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19127 "Appended user specified linked libs flags. (e.g., -lm)")
Jonathan Peyton2e013352015-07-15 16:05:30128set(LIBOMP_FFLAGS "" CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19129 "Appended user specified Fortran compiler flags. These are only used if LIBOMP_FORTRAN_MODULES==TRUE.")
Jim Cownie3b81ce62014-08-05 09:32:28130
Jonathan Peyton227e1ae2015-06-01 03:05:13131# Should the libomp library and generated headers be copied into the original source exports/ directory
Jonathan Peyton2e013352015-07-15 16:05:30132# Turning this to FALSE aids parallel builds to not interfere with each other.
133# Currently, the testsuite module expects the just built OpenMP library to be located inside the exports/
134# directory. TODO: have testsuite run under llvm-lit directly. We can then get rid of copying to exports/
135set(LIBOMP_COPY_EXPORTS TRUE CACHE STRING
Jonathan Peyton5b4acbd2015-07-15 16:57:19136 "Should exports be copied into source exports/ directory?")
Andrey Churbanov708fa8e2015-05-14 12:54:08137
Jonathan Peyton01dcf362015-11-30 20:02:59138# HWLOC-support
139set(LIBOMP_USE_HWLOC FALSE CACHE BOOL
140 "Use Hwloc (http://www.open-mpi.org/projects/hwloc/) library for affinity?")
141set(LIBOMP_HWLOC_INSTALL_DIR /usr/local CACHE PATH
142 "Install path for hwloc library")
143
Jim Cownie3b81ce62014-08-05 09:32:28144# Get the build number from kmp_version.c
Jonathan Peytonc0225ca2015-08-28 18:42:10145libomp_get_build_number("${CMAKE_CURRENT_SOURCE_DIR}" LIBOMP_VERSION_BUILD)
146math(EXPR LIBOMP_VERSION_BUILD_YEAR "${LIBOMP_VERSION_BUILD}/10000")
147math(EXPR LIBOMP_VERSION_BUILD_MONTH_DAY "${LIBOMP_VERSION_BUILD}%10000")
Jim Cownie3b81ce62014-08-05 09:32:28148
Jonathan Peyton2e013352015-07-15 16:05:30149# Currently don't record any timestamps
Jonathan Peytonc0225ca2015-08-28 18:42:10150set(LIBOMP_BUILD_DATE "No_Timestamp")
Jim Cownie3b81ce62014-08-05 09:32:28151
152# Architecture
153set(IA32 FALSE)
154set(INTEL64 FALSE)
155set(ARM FALSE)
Andrey Churbanovcbda8682015-01-13 14:43:35156set(AARCH64 FALSE)
Andrey Churbanovd1c55042015-01-19 18:29:35157set(PPC64BE FALSE)
158set(PPC64LE FALSE)
Jim Cownie3051f972014-08-07 10:12:54159set(PPC64 FALSE)
Jonathan Peyton2e013352015-07-15 16:05:30160set(MIC FALSE)
Jonathan Peyton5b4acbd2015-07-15 16:57:19161if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
162 set(IA32 TRUE)
Jonathan Peyton2e013352015-07-15 16:05:30163elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture
Jonathan Peyton5b4acbd2015-07-15 16:57:19164 set(INTEL64 TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24165elseif("${LIBOMP_ARCH}" STREQUAL "arm") # ARM architecture
Jonathan Peyton5b4acbd2015-07-15 16:57:19166 set(ARM TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24167elseif("${LIBOMP_ARCH}" STREQUAL "ppc64") # PPC64BE architecture
Jonathan Peyton5b4acbd2015-07-15 16:57:19168 set(PPC64BE TRUE)
169 set(PPC64 TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24170elseif("${LIBOMP_ARCH}" STREQUAL "ppc64le") # PPC64LE architecture
Jonathan Peyton5b4acbd2015-07-15 16:57:19171 set(PPC64LE TRUE)
172 set(PPC64 TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24173elseif("${LIBOMP_ARCH}" STREQUAL "aarch64") # AARCH64 architecture
Jonathan Peyton5b4acbd2015-07-15 16:57:19174 set(AARCH64 TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24175elseif("${LIBOMP_ARCH}" STREQUAL "mic") # Intel(R) Many Integrated Core Architecture
Jonathan Peyton5b4acbd2015-07-15 16:57:19176 set(MIC TRUE)
Jim Cownie3b81ce62014-08-05 09:32:28177endif()
178
179# Set some flags based on build_type
Jonathan Peytonfbb15142015-05-26 17:27:01180set(RELEASE_BUILD FALSE)
181set(DEBUG_BUILD FALSE)
Jim Cownie3b81ce62014-08-05 09:32:28182set(RELWITHDEBINFO_BUILD FALSE)
Jonathan Peyton2e013352015-07-15 16:05:30183set(MINSIZEREL_BUILD FALSE)
184string(TOLOWER "${CMAKE_BUILD_TYPE}" libomp_build_type_lowercase)
185if("${libomp_build_type_lowercase}" STREQUAL "release")
Jonathan Peyton5b4acbd2015-07-15 16:57:19186 set(RELEASE_BUILD TRUE)
Jonathan Peyton2e013352015-07-15 16:05:30187elseif("${libomp_build_type_lowercase}" STREQUAL "debug")
Jonathan Peyton5b4acbd2015-07-15 16:57:19188 set(DEBUG_BUILD TRUE)
Jonathan Peyton2e013352015-07-15 16:05:30189elseif("${libomp_build_type_lowercase}" STREQUAL "relwithdebinfo")
Jonathan Peyton5b4acbd2015-07-15 16:57:19190 set(RELWITHDEBINFO_BUILD TRUE)
Jonathan Peyton2e013352015-07-15 16:05:30191elseif("${libomp_build_type_lowercase}" STREQUAL "minsizerel")
Jonathan Peyton5b4acbd2015-07-15 16:57:19192 set(MINSIZEREL_BUILD TRUE)
Jim Cownie3b81ce62014-08-05 09:32:28193endif()
194
Jim Cownie3b81ce62014-08-05 09:32:28195# Include itt notify interface? Right now, always.
Jonathan Peyton7979a072015-05-20 22:33:24196set(LIBOMP_USE_ITT_NOTIFY TRUE)
Jim Cownie3b81ce62014-08-05 09:32:28197
198# normal, profile, stubs library.
199set(NORMAL_LIBRARY FALSE)
200set(STUBS_LIBRARY FALSE)
201set(PROFILE_LIBRARY FALSE)
Jonathan Peyton7979a072015-05-20 22:33:24202if("${LIBOMP_LIB_TYPE}" STREQUAL "normal")
Jonathan Peyton5b4acbd2015-07-15 16:57:19203 set(NORMAL_LIBRARY TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24204elseif("${LIBOMP_LIB_TYPE}" STREQUAL "profile")
Jonathan Peyton5b4acbd2015-07-15 16:57:19205 set(PROFILE_LIBRARY TRUE)
Jonathan Peyton7979a072015-05-20 22:33:24206elseif("${LIBOMP_LIB_TYPE}" STREQUAL "stubs")
Jonathan Peyton5b4acbd2015-07-15 16:57:19207 set(STUBS_LIBRARY TRUE)
Jim Cownie3b81ce62014-08-05 09:32:28208endif()
209
Jonathan Peyton2e013352015-07-15 16:05:30210# Setting directory names
211set(LIBOMP_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
212set(LIBOMP_SRC_DIR ${LIBOMP_BASE_DIR}/src)
213set(LIBOMP_TOOLS_DIR ${LIBOMP_BASE_DIR}/tools)
214set(LIBOMP_INC_DIR ${LIBOMP_SRC_DIR}/include/${LIBOMP_OMP_VERSION})
Jonathan Peyton614c7ef2015-09-21 20:41:31215set(LIBOMP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
Jim Cownie3b81ce62014-08-05 09:32:28216
Jonathan Peyton2e013352015-07-15 16:05:30217# Enabling Fortran if it is needed
Jonathan Peyton2e013352015-07-15 16:05:30218if(${LIBOMP_FORTRAN_MODULES})
Jonathan Peyton5b4acbd2015-07-15 16:57:19219 enable_language(Fortran)
Jonathan Peyton2e013352015-07-15 16:05:30220endif()
Jonathan Peyton5b4acbd2015-07-15 16:57:19221# Enable MASM Compiler if it is needed (Windows only)
Jonathan Peyton2e013352015-07-15 16:05:30222if(WIN32)
Jonathan Peyton5b4acbd2015-07-15 16:57:19223 enable_language(ASM_MASM)
Jonathan Peyton2e013352015-07-15 16:05:30224endif()
Jim Cownie3b81ce62014-08-05 09:32:28225
Jonathan Peyton2e013352015-07-15 16:05:30226# Getting legal type/arch
227libomp_get_legal_type(LIBOMP_LEGAL_TYPE)
228libomp_get_legal_arch(LIBOMP_LEGAL_ARCH)
Jim Cownie3b81ce62014-08-05 09:32:28229
Jonathan Peyton2e013352015-07-15 16:05:30230# Compiler flag checks, library checks, threading check, etc.
231include(config-ix)
Jim Cownie3b81ce62014-08-05 09:32:28232
Jonathan Peyton2e013352015-07-15 16:05:30233# Is there a quad precision data type available?
234# TODO: Make this a real feature check
235set(LIBOMP_USE_QUAD_PRECISION "${LIBOMP_HAVE_QUAD_PRECISION}" CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19236 "Should 128-bit precision entry points be built?")
Jonathan Peyton2e013352015-07-15 16:05:30237if(LIBOMP_USE_QUAD_PRECISION AND (NOT LIBOMP_HAVE_QUAD_PRECISION))
Jonathan Peyton5b4acbd2015-07-15 16:57:19238 libomp_error_say("128-bit quad precision functionality requested but not available")
Jonathan Peyton2e013352015-07-15 16:05:30239endif()
240
241# libgomp drop-in compatibility requires versioned symbols
242set(LIBOMP_USE_VERSION_SYMBOLS "${LIBOMP_HAVE_VERSION_SYMBOLS}" CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19243 "Should version symbols be used? These provide binary compatibility with libgomp.")
Jonathan Peyton2e013352015-07-15 16:05:30244if(LIBOMP_USE_VERSION_SYMBOLS AND (NOT LIBOMP_HAVE_VERSION_SYMBOLS))
Jonathan Peyton5b4acbd2015-07-15 16:57:19245 libomp_error_say("Version symbols functionality requested but not available")
Jonathan Peyton2e013352015-07-15 16:05:30246endif()
247
248# On multinode systems, larger alignment is desired to avoid false sharing
249set(LIBOMP_USE_INTERNODE_ALIGNMENT FALSE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19250 "Should larger alignment (4096 bytes) be used for some locks and data structures?")
Jim Cownie4cc4bb42014-10-07 16:25:50251
Jonathan Peyton2e013352015-07-15 16:05:30252# Build code that allows the OpenMP library to conveniently interface with debuggers
253set(LIBOMP_USE_DEBUGGER FALSE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19254 "Enable debugger interface code?")
Jonathan Peyton2e013352015-07-15 16:05:30255
256# Should we link to C++ library?
257set(LIBOMP_USE_STDCPPLIB FALSE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19258 "Should we link to C++ library?")
Jonathan Peyton2e013352015-07-15 16:05:30259
260# TSX (x86) based locks have __asm code which can be troublesome for some compilers.
261# TODO: Make this a real feature check
262set(LIBOMP_USE_ADAPTIVE_LOCKS "${LIBOMP_HAVE_ADAPTIVE_LOCKS}" CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19263 "Should TSX-based lock be compiled (adaptive lock in kmp_lock.cpp). These are x86 specific.")
Jonathan Peyton2e013352015-07-15 16:05:30264if(LIBOMP_USE_ADAPTIVE_LOCKS AND (NOT LIBOMP_HAVE_ADAPTIVE_LOCKS))
Jonathan Peyton5b4acbd2015-07-15 16:57:19265 libomp_error_say("Adaptive locks (TSX) functionality requested but not available")
Jim Cownie4cc4bb42014-10-07 16:25:50266endif()
267
Jonathan Peyton2e013352015-07-15 16:05:30268# - stats-gathering enables OpenMP stats where things like the number of
269# parallel regions, clock ticks spent in particular openmp regions are recorded.
270# TODO: Make this a real feature check
271set(LIBOMP_STATS FALSE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19272 "Stats-Gathering functionality?")
Jonathan Peyton2e013352015-07-15 16:05:30273if(LIBOMP_STATS AND (NOT LIBOMP_HAVE_STATS))
Jonathan Peyton5b4acbd2015-07-15 16:57:19274 libomp_error_say("Stats-gathering functionality requested but not available")
Jim Cownie3b81ce62014-08-05 09:32:28275endif()
Jonathan Peyton45be4502015-08-11 21:36:41276# The stats functionality requires the std c++ library
277if(LIBOMP_STATS)
278 set(LIBOMP_USE_STDCPPLIB TRUE)
279endif()
Jim Cownie3b81ce62014-08-05 09:32:28280
Jonathan Peyton2e013352015-07-15 16:05:30281# OMPT-support
Jonathan Peyton95246e72015-11-05 16:54:55282set(LIBOMP_OMPT_DEBUG FALSE CACHE BOOL
283 "Trace OMPT initialization?")
Jonathan Peyton2e013352015-07-15 16:05:30284set(LIBOMP_OMPT_SUPPORT FALSE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19285 "OMPT-support?")
Jonathan Peyton2e013352015-07-15 16:05:30286set(LIBOMP_OMPT_BLAME TRUE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19287 "OMPT-blame?")
Jonathan Peyton2e013352015-07-15 16:05:30288set(LIBOMP_OMPT_TRACE TRUE CACHE BOOL
Jonathan Peyton5b4acbd2015-07-15 16:57:19289 "OMPT-trace?")
Jonathan Peyton2e013352015-07-15 16:05:30290if(LIBOMP_OMPT_SUPPORT AND (NOT LIBOMP_HAVE_OMPT_SUPPORT))
Jonathan Peyton5b4acbd2015-07-15 16:57:19291 libomp_error_say("OpenMP Tools Interface requested but not available")
Jonathan Peytonb689ded2015-06-17 15:43:34292endif()
Jim Cownie3b81ce62014-08-05 09:32:28293
Jonathan Peyton01dcf362015-11-30 20:02:59294# Error check hwloc support after config-ix has run
295if(LIBOMP_USE_HWLOC AND (NOT LIBOMP_HAVE_HWLOC))
296 libomp_error_say("Hwloc requested but not available")
297endif()
298
Jim Cownie3b81ce62014-08-05 09:32:28299# Setting final library name
Jonathan Peyton2e013352015-07-15 16:05:30300set(LIBOMP_DEFAULT_LIB_NAME libomp)
Jim Cownie3b81ce62014-08-05 09:32:28301if(${PROFILE_LIBRARY})
Jonathan Peyton5b4acbd2015-07-15 16:57:19302 set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}prof)
Jim Cownie3b81ce62014-08-05 09:32:28303endif()
304if(${STUBS_LIBRARY})
Jonathan Peyton5b4acbd2015-07-15 16:57:19305 set(LIBOMP_DEFAULT_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME}stubs)
Jim Cownie3b81ce62014-08-05 09:32:28306endif()
Jonathan Peyton2e013352015-07-15 16:05:30307set(LIBOMP_LIB_NAME ${LIBOMP_DEFAULT_LIB_NAME} CACHE STRING "Base OMP library name")
308set(LIBOMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
Jim Cownie3b81ce62014-08-05 09:32:28309
Jim Cownie3b81ce62014-08-05 09:32:28310# Print configuration after all variables are set.
Jonathan Peyton7979a072015-05-20 22:33:24311if(${LIBOMP_STANDALONE_BUILD})
Jonathan Peyton5b4acbd2015-07-15 16:57:19312 libomp_say("Operating System -- ${CMAKE_SYSTEM_NAME}")
313 libomp_say("Target Architecture -- ${LIBOMP_ARCH}")
314 if(${MIC})
315 libomp_say("Intel(R) MIC Architecture -- ${LIBOMP_MIC_ARCH}")
316 endif()
317 libomp_say("Build Type -- ${CMAKE_BUILD_TYPE}")
318 libomp_say("OpenMP Version -- ${LIBOMP_OMP_VERSION}")
319 libomp_say("Lib Type -- ${LIBOMP_LIB_TYPE}")
320 libomp_say("Fortran Modules -- ${LIBOMP_FORTRAN_MODULES}")
321 # will say development if all zeros
Jonathan Peytonc0225ca2015-08-28 18:42:10322 if(${LIBOMP_VERSION_BUILD} STREQUAL 00000000)
Jonathan Peyton5b4acbd2015-07-15 16:57:19323 set(LIBOMP_BUILD Development)
324 else()
Jonathan Peytonc0225ca2015-08-28 18:42:10325 set(LIBOMP_BUILD ${LIBOMP_VERSION_BUILD})
Jonathan Peyton5b4acbd2015-07-15 16:57:19326 endif()
327 libomp_say("Build -- ${LIBOMP_BUILD}")
328 libomp_say("Use Stats-gathering -- ${LIBOMP_STATS}")
329 libomp_say("Use Debugger-support -- ${LIBOMP_USE_DEBUGGER}")
330 libomp_say("Use OMPT-support -- ${LIBOMP_OMPT_SUPPORT}")
331 if(${LIBOMP_OMPT_SUPPORT})
332 libomp_say("Use OMPT-blame -- ${LIBOMP_OMPT_BLAME}")
333 libomp_say("Use OMPT-trace -- ${LIBOMP_OMPT_TRACE}")
334 endif()
335 libomp_say("Use Adaptive locks -- ${LIBOMP_USE_ADAPTIVE_LOCKS}")
336 libomp_say("Use quad precision -- ${LIBOMP_USE_QUAD_PRECISION}")
Jonathan Peyton01dcf362015-11-30 20:02:59337 libomp_say("Use Hwloc library -- ${LIBOMP_USE_HWLOC}")
Jim Cownie3b81ce62014-08-05 09:32:28338endif()
Andrey Churbanov648467e2015-05-05 20:02:52339
Jonathan Peyton52158902015-06-11 17:23:57340add_subdirectory(src)
Jonathan Peyton614c7ef2015-09-21 20:41:31341add_subdirectory(test)
Jim Cownie3b81ce62014-08-05 09:32:28342