forked from oneapi-src/oneDNN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b76a847
commit 7a140be
Showing
2 changed files
with
189 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,142 @@ | ||
# Copyright (c) 2017-2018 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
# | ||
# | ||
|
||
# TBB_FOUND should not be set explicitly. It is defined automatically by CMake. | ||
# Handling of TBB_VERSION is in TBBConfigVersion.cmake. | ||
|
||
if (NOT TBB_FIND_COMPONENTS) | ||
set(TBB_FIND_COMPONENTS "tbb;tbbmalloc;tbbmalloc_proxy") | ||
foreach (_tbb_component ${TBB_FIND_COMPONENTS}) | ||
set(TBB_FIND_REQUIRED_${_tbb_component} 1) | ||
endforeach() | ||
endif() | ||
|
||
# Add components with internal dependencies: tbbmalloc_proxy -> tbbmalloc | ||
list(FIND TBB_FIND_COMPONENTS tbbmalloc_proxy _tbbmalloc_proxy_ix) | ||
if (NOT _tbbmalloc_proxy_ix EQUAL -1) | ||
list(FIND TBB_FIND_COMPONENTS tbbmalloc _tbbmalloc_ix) | ||
if (_tbbmalloc_ix EQUAL -1) | ||
list(APPEND TBB_FIND_COMPONENTS tbbmalloc) | ||
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy}) | ||
endif() | ||
endif() | ||
|
||
# Intel MKL-DNN changes: use TBBROOT to locate Intel TBB | ||
# get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
# get_filename_component(_tbb_root "${_tbb_root}" PATH) | ||
if (NOT TBBROOT) | ||
if(DEFINED ENV{TBBROOT}) | ||
set (TBBROOT $ENV{TBBROOT}) | ||
else() | ||
message("FATAL_ERROR" "TBBROOT is unset") | ||
endif() | ||
endif() | ||
|
||
set(_tbb_root ${TBBROOT}) | ||
|
||
set(_tbb_x32_subdir ia32) | ||
set(_tbb_x64_subdir intel64) | ||
|
||
if (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(_tbb_arch_subdir ${_tbb_x64_subdir}) | ||
else() | ||
set(_tbb_arch_subdir ${_tbb_x32_subdir}) | ||
endif() | ||
|
||
if (NOT MSVC) | ||
message(FATAL_ERROR "This Intel TBB package is intended to be used only in the project with MSVC") | ||
endif() | ||
|
||
# Detect the most relevant MSVC subdirectory | ||
set(_tbb_msvc_1700_subdir vc11) | ||
set(_tbb_msvc_1800_subdir vc12) | ||
set(_tbb_msvc_1900_subdir vc14) | ||
set(_tbb_msvc_ver ${MSVC_VERSION}) | ||
if (MSVC_VERSION VERSION_LESS 1700) | ||
message(FATAL_ERROR "This Intel TBB package is intended to be used only in the project with MSVC version 1700 (vc11) or higher") | ||
elseif (MSVC_VERSION VERSION_GREATER 1900) | ||
set(_tbb_msvc_ver 1900) | ||
endif() | ||
set(_tbb_compiler_subdir ${_tbb_msvc_${_tbb_msvc_ver}_subdir}) | ||
unset(_tbb_msvc_1700_subdir) | ||
unset(_tbb_msvc_1800_subdir) | ||
unset(_tbb_msvc_1900_subdir) | ||
|
||
if (WINDOWS_STORE) | ||
set(_tbb_compiler_subdir ${_tbb_compiler_subdir}_ui) | ||
endif() | ||
|
||
#set conveniance variable to locate TBB files (these are used for a PSXE install) | ||
get_filename_component(_tbb_lib_path "${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}" ABSOLUTE) | ||
get_filename_component(_tbb_inc_path "${_tbb_root}/include/" ABSOLUTE) | ||
|
||
|
||
# we need to check the version of tbb | ||
file(READ "${_tbb_inc_path}/tbb/tbb_stddef.h" _tbb_stddef) | ||
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_tbb_stddef}") | ||
if (${TBB_INTERFACE_VERSION} VERSION_LESS 9100) | ||
message(FATAL_ERROR "MKL-DNN requires TBB version 2017 or above") | ||
endif() | ||
|
||
if (TBB_FOUND) | ||
return() | ||
endif() | ||
|
||
foreach (_tbb_component ${TBB_FIND_COMPONENTS}) | ||
set(_tbb_release_lib "${_tbb_lib_path}/${_tbb_component}.lib") | ||
set(_tbb_debug_lib "${_tbb_lib_path}/${_tbb_component}_debug.lib") | ||
|
||
if (EXISTS "${_tbb_release_lib}" AND EXISTS "${_tbb_debug_lib}") | ||
if (NOT TARGET TBB::${_tbb_component}) | ||
add_library(TBB::${_tbb_component} SHARED IMPORTED) | ||
set_target_properties(TBB::${_tbb_component} PROPERTIES | ||
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG" | ||
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}" | ||
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_inc_path}" | ||
IMPORTED_IMPLIB_RELEASE "${_tbb_release_lib}" | ||
IMPORTED_IMPLIB_DEBUG "${_tbb_debug_lib}" | ||
INTERFACE_COMPILE_DEFINITIONS "__TBB_NO_IMPLICIT_LINKAGE=1") | ||
|
||
# Intel MKL-DNN changes: set TBB_INCLUDE_DIRS to use it for include_directories() | ||
if (_tbb_component STREQUAL tbb) | ||
set(TBB_INCLUDE_DIRS "${_tbb_inc_path}") | ||
endif() | ||
|
||
# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc | ||
if (_tbb_component STREQUAL tbbmalloc_proxy) | ||
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc) | ||
endif() | ||
|
||
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component}) | ||
set(TBB_${_tbb_component}_FOUND 1) | ||
endif() | ||
elseif (TBB_FIND_REQUIRED AND TBB_FIND_REQUIRED_${_tbb_component}) | ||
message(FATAL_ERROR "Missed required Intel TBB component: ${_tbb_component}") | ||
endif() | ||
endforeach() | ||
|
||
unset(_tbb_x32_subdir) | ||
unset(_tbb_x64_subdir) | ||
unset(_tbb_arch_subdir) | ||
unset(_tbb_compiler_subdir) | ||
unset(_tbbmalloc_proxy_ix) | ||
unset(_tbbmalloc_ix) | ||
unset(_tbb_lib_path) | ||
unset(_tbb_release_lib) | ||
unset(_tbb_debug_lib) | ||
# Copyright (c) 2017-2018 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
# | ||
# | ||
|
||
# TBB_FOUND should not be set explicitly. It is defined automatically by CMake. | ||
# Handling of TBB_VERSION is in TBBConfigVersion.cmake. | ||
|
||
if (NOT TBB_FIND_COMPONENTS) | ||
set(TBB_FIND_COMPONENTS "tbb;tbbmalloc;tbbmalloc_proxy") | ||
foreach (_tbb_component ${TBB_FIND_COMPONENTS}) | ||
set(TBB_FIND_REQUIRED_${_tbb_component} 1) | ||
endforeach() | ||
endif() | ||
|
||
# Add components with internal dependencies: tbbmalloc_proxy -> tbbmalloc | ||
list(FIND TBB_FIND_COMPONENTS tbbmalloc_proxy _tbbmalloc_proxy_ix) | ||
if (NOT _tbbmalloc_proxy_ix EQUAL -1) | ||
list(FIND TBB_FIND_COMPONENTS tbbmalloc _tbbmalloc_ix) | ||
if (_tbbmalloc_ix EQUAL -1) | ||
list(APPEND TBB_FIND_COMPONENTS tbbmalloc) | ||
set(TBB_FIND_REQUIRED_tbbmalloc ${TBB_FIND_REQUIRED_tbbmalloc_proxy}) | ||
endif() | ||
endif() | ||
|
||
# Intel MKL-DNN changes: use TBBROOT to locate Intel TBB | ||
# get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
# get_filename_component(_tbb_root "${_tbb_root}" PATH) | ||
if (NOT TBBROOT) | ||
if(DEFINED ENV{TBBROOT}) | ||
set (TBBROOT $ENV{TBBROOT}) | ||
else() | ||
message("FATAL_ERROR" "TBBROOT is unset") | ||
endif() | ||
endif() | ||
|
||
set(_tbb_root ${TBBROOT}) | ||
|
||
set(_tbb_x32_subdir ia32) | ||
set(_tbb_x64_subdir intel64) | ||
|
||
if (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(_tbb_arch_subdir ${_tbb_x64_subdir}) | ||
else() | ||
set(_tbb_arch_subdir ${_tbb_x32_subdir}) | ||
endif() | ||
|
||
if (NOT MSVC) | ||
message(FATAL_ERROR "This Intel TBB package is intended to be used only in the project with MSVC") | ||
endif() | ||
|
||
# Detect the most relevant MSVC subdirectory | ||
set(_tbb_msvc_1700_subdir vc11) | ||
set(_tbb_msvc_1800_subdir vc12) | ||
set(_tbb_msvc_1900_subdir vc14) | ||
set(_tbb_msvc_ver ${MSVC_VERSION}) | ||
if (MSVC_VERSION VERSION_LESS 1700) | ||
message(FATAL_ERROR "This Intel TBB package is intended to be used only in the project with MSVC version 1700 (vc11) or higher") | ||
elseif (MSVC_VERSION VERSION_GREATER 1900) | ||
set(_tbb_msvc_ver 1900) | ||
endif() | ||
set(_tbb_compiler_subdir ${_tbb_msvc_${_tbb_msvc_ver}_subdir}) | ||
unset(_tbb_msvc_1700_subdir) | ||
unset(_tbb_msvc_1800_subdir) | ||
unset(_tbb_msvc_1900_subdir) | ||
|
||
if (WINDOWS_STORE) | ||
set(_tbb_compiler_subdir ${_tbb_compiler_subdir}_ui) | ||
endif() | ||
|
||
#set conveniance variable to locate TBB files (these are used for a PSXE install) | ||
get_filename_component(_tbb_lib_path "${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}" ABSOLUTE) | ||
get_filename_component(_tbb_inc_path "${_tbb_root}/include/" ABSOLUTE) | ||
|
||
|
||
# we need to check the version of tbb | ||
file(READ "${_tbb_inc_path}/tbb/tbb_stddef.h" _tbb_stddef) | ||
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_tbb_stddef}") | ||
if (${TBB_INTERFACE_VERSION} VERSION_LESS 9100) | ||
message(FATAL_ERROR "MKL-DNN requires TBB version 2017 or above") | ||
endif() | ||
|
||
if (TBB_FOUND) | ||
return() | ||
endif() | ||
|
||
foreach (_tbb_component ${TBB_FIND_COMPONENTS}) | ||
set(_tbb_release_lib "${_tbb_lib_path}/${_tbb_component}.lib") | ||
set(_tbb_debug_lib "${_tbb_lib_path}/${_tbb_component}_debug.lib") | ||
|
||
if (EXISTS "${_tbb_release_lib}" AND EXISTS "${_tbb_debug_lib}") | ||
if (NOT TARGET TBB::${_tbb_component}) | ||
add_library(TBB::${_tbb_component} SHARED IMPORTED) | ||
set_target_properties(TBB::${_tbb_component} PROPERTIES | ||
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG" | ||
IMPORTED_LOCATION_RELEASE "${_tbb_release_lib}" | ||
IMPORTED_LOCATION_DEBUG "${_tbb_debug_lib}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${_tbb_inc_path}" | ||
IMPORTED_IMPLIB_RELEASE "${_tbb_release_lib}" | ||
IMPORTED_IMPLIB_DEBUG "${_tbb_debug_lib}" | ||
INTERFACE_COMPILE_DEFINITIONS "__TBB_NO_IMPLICIT_LINKAGE=1") | ||
|
||
# Intel MKL-DNN changes: set TBB_INCLUDE_DIRS to use it for include_directories() | ||
if (_tbb_component STREQUAL tbb) | ||
set(TBB_INCLUDE_DIRS "${_tbb_inc_path}") | ||
endif() | ||
|
||
# Add internal dependencies for imported targets: TBB::tbbmalloc_proxy -> TBB::tbbmalloc | ||
if (_tbb_component STREQUAL tbbmalloc_proxy) | ||
set_target_properties(TBB::tbbmalloc_proxy PROPERTIES INTERFACE_LINK_LIBRARIES TBB::tbbmalloc) | ||
endif() | ||
|
||
list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component}) | ||
set(TBB_${_tbb_component}_FOUND 1) | ||
endif() | ||
elseif (TBB_FIND_REQUIRED AND TBB_FIND_REQUIRED_${_tbb_component}) | ||
message(FATAL_ERROR "Missed required Intel TBB component: ${_tbb_component}") | ||
endif() | ||
endforeach() | ||
|
||
unset(_tbb_x32_subdir) | ||
unset(_tbb_x64_subdir) | ||
unset(_tbb_arch_subdir) | ||
unset(_tbb_compiler_subdir) | ||
unset(_tbbmalloc_proxy_ix) | ||
unset(_tbbmalloc_ix) | ||
unset(_tbb_lib_path) | ||
unset(_tbb_release_lib) | ||
unset(_tbb_debug_lib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
Copyright (c) 2007 MITSUNARI Shigeo | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
Neither the name of the copyright owner nor the names of its contributors may | ||
be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. | ||
----------------------------------------------------------------------------- | ||
ソースコード形式かバイナリ形式か、変更するかしないかを問わず、以下の条件を満た | ||
す場合に限り、再頒布および使用が許可されます。 | ||
ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、および下記免責条項 | ||
を含めること。 | ||
バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の資料に、上記の著作 | ||
権表示、本条件一覧、および下記免責条項を含めること。 | ||
書面による特別の許可なしに、本ソフトウェアから派生した製品の宣伝または販売促進 | ||
に、著作権者の名前またはコントリビューターの名前を使用してはならない。 | ||
本ソフトウェアは、著作権者およびコントリビューターによって「現状のまま」提供さ | ||
れており、明示黙示を問わず、商業的な使用可能性、および特定の目的に対する適合性 | ||
に関する暗黙の保証も含め、またそれに限定されない、いかなる保証もありません。 | ||
著作権者もコントリビューターも、事由のいかんを問わず、 損害発生の原因いかんを | ||
問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その他の)不法行為で | ||
あるかを問わず、仮にそのような損害が発生する可能性を知らされていたとしても、 | ||
本ソフトウェアの使用によって発生した(代替品または代用サービスの調達、使用の | ||
喪失、データの喪失、利益の喪失、業務の中断も含め、またそれに限定されない)直接 | ||
損害、間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害について、 | ||
一切責任を負わないものとします。 | ||
|
||
Copyright (c) 2007 MITSUNARI Shigeo | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
Neither the name of the copyright owner nor the names of its contributors may | ||
be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. | ||
----------------------------------------------------------------------------- | ||
ソースコード形式かバイナリ形式か、変更するかしないかを問わず、以下の条件を満た | ||
す場合に限り、再頒布および使用が許可されます。 | ||
|
||
ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、および下記免責条項 | ||
を含めること。 | ||
バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の資料に、上記の著作 | ||
権表示、本条件一覧、および下記免責条項を含めること。 | ||
書面による特別の許可なしに、本ソフトウェアから派生した製品の宣伝または販売促進 | ||
に、著作権者の名前またはコントリビューターの名前を使用してはならない。 | ||
本ソフトウェアは、著作権者およびコントリビューターによって「現状のまま」提供さ | ||
れており、明示黙示を問わず、商業的な使用可能性、および特定の目的に対する適合性 | ||
に関する暗黙の保証も含め、またそれに限定されない、いかなる保証もありません。 | ||
著作権者もコントリビューターも、事由のいかんを問わず、 損害発生の原因いかんを | ||
問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その他の)不法行為で | ||
あるかを問わず、仮にそのような損害が発生する可能性を知らされていたとしても、 | ||
本ソフトウェアの使用によって発生した(代替品または代用サービスの調達、使用の | ||
喪失、データの喪失、利益の喪失、業務の中断も含め、またそれに限定されない)直接 | ||
損害、間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害について、 | ||
一切責任を負わないものとします。 |