1# Copyright (c) 2020-2021 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 15set(TBB_LINK_DEF_FILE_FLAG ${CMAKE_LINK_DEF_FILE_FLAG}) 16set(TBB_DEF_FILE_PREFIX win${TBB_ARCH}) 17 18# Workaround for CMake issue https://gitlab.kitware.com/cmake/cmake/issues/18317. 19# TODO: consider use of CMP0092 CMake policy. 20string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 21 22# Warning suppression C4324: structure was padded due to alignment specifier 23set(TBB_WARNING_LEVEL $<$<NOT:$<CXX_COMPILER_ID:Intel>>:/W4> $<$<BOOL:${TBB_STRICT}>:/WX>) 24set(TBB_WARNING_SUPPRESS /wd4324) 25set(TBB_TEST_COMPILE_FLAGS /bigobj) 26if (MSVC_VERSION LESS_EQUAL 1900) 27 # Warning suppression C4503 for VS2015 and earlier: 28 # decorated name length exceeded, name was truncated. 29 # More info can be found at 30 # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4503 31 set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} /wd4503) 32endif() 33set(TBB_LIB_COMPILE_FLAGS -D_CRT_SECURE_NO_WARNINGS /GS) 34set(TBB_COMMON_COMPILE_FLAGS /volatile:iso /FS) 35 36# Ignore /WX set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled. 37if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag) 38 tbb_remove_compile_flag(/WX) 39endif() 40 41if (WINDOWS_STORE OR TBB_WINDOWS_DRIVER) 42 set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /D_WIN32_WINNT=0x0A00) 43 set(TBB_COMMON_LINK_FLAGS -NODEFAULTLIB:kernel32.lib -INCREMENTAL:NO) 44 set(TBB_COMMON_LINK_LIBS OneCore.lib) 45endif() 46 47if (WINDOWS_STORE) 48 if (NOT CMAKE_SYSTEM_VERSION EQUAL 10.0) 49 message(FATAL_ERROR "CMAKE_SYSTEM_VERSION must be equal to 10.0") 50 endif() 51 52 set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /ZW /ZW:nostdlib) 53 54 # CMake define this extra lib, remove it for this build type 55 string(REGEX REPLACE "WindowsApp.lib" "" CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES}") 56 57 if (TBB_NO_APPCONTAINER) 58 set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -APPCONTAINER:NO) 59 endif() 60endif() 61 62if (TBB_WINDOWS_DRIVER) 63 # Since this is universal driver disable this variable 64 set(CMAKE_SYSTEM_PROCESSOR "") 65 66 # CMake define list additional libs, remove it for this build type 67 set(CMAKE_CXX_STANDARD_LIBRARIES "") 68 69 set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /D _UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB__) 70endif() 71 72set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/GL>) 73set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-LTCG> $<$<NOT:$<CONFIG:Debug>>:-INCREMENTAL:NO>) 74 75set(TBB_OPENMP_FLAG /openmp) 76