| 1 |
# Copyright (c) 2020-2024 Intel Corporation |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
set(TBB_LINK_DEF_FILE_FLAG -Wl,-exported_symbols_list,) |
| 16 |
set(TBB_DEF_FILE_PREFIX mac${TBB_ARCH}) |
| 17 |
set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror>) |
| 18 |
set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor) |
| 19 |
set(TBB_WARNING_SUPPRESS -Wno-parentheses -Wno-non-virtual-dtor -Wno-dangling-else) |
| 20 |
# For correct ucontext.h structures layout |
| 21 |
set(TBB_COMMON_COMPILE_FLAGS -D_XOPEN_SOURCE) |
| 22 |
|
| 23 |
# Depfile options (e.g. -MD) are inserted automatically in some cases. |
| 24 |
# Don't add -MMD to avoid conflicts in such cases. |
| 25 |
if (NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT CMAKE_CXX_DEPENDS_USE_COMPILER) |
| 26 |
set(TBB_MMD_FLAG -MMD) |
| 27 |
endif() |
| 28 |
|
| 29 |
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled. |
| 30 |
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag) |
| 31 |
tbb_remove_compile_flag(-Werror) |
| 32 |
endif() |
| 33 |
|
| 34 |
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors |
| 35 |
if (CMAKE_OSX_ARCHITECTURES) |
| 36 |
set(_tbb_target_architectures "${CMAKE_OSX_ARCHITECTURES}") |
| 37 |
else() |
| 38 |
set(_tbb_target_architectures "${CMAKE_SYSTEM_PROCESSOR}") |
| 39 |
endif() |
| 40 |
if ("${_tbb_target_architectures}" MATCHES "(x86_64|amd64|AMD64)") # OSX systems are 64-bit only |
| 41 |
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>) |
| 42 |
endif() |
| 43 |
unset(_tbb_target_architectures) |
| 44 |
|
| 45 |
if (TBB_FILE_TRIM AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10) |
| 46 |
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -ffile-prefix-map=${NATIVE_TBB_PROJECT_ROOT_DIR}/= -ffile-prefix-map=${NATIVE_TBB_RELATIVE_BIN_PATH}/=) |
| 47 |
endif () |
| 48 |
|
| 49 |
# TBB malloc settings |
| 50 |
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) |
| 51 |
|