Skip to content

Commit

Permalink
Allow pkg-config search for hwloc for cross-compilation (#1202)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Sep 12, 2023
1 parent e131071 commit a9d76a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ cmake_minimum_required(VERSION 3.1)

# Enable CMake policies

if (POLICY CMP0068)
# RPATH settings do not affect install_name on macOS since CMake 3.9
cmake_policy(SET CMP0068 NEW)
endif()

if (POLICY CMP0091)
# The NEW behavior for this policy is to not place MSVC runtime library flags in the default
# CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and use CMAKE_MSVC_RUNTIME_LIBRARY abstraction instead.
Expand Down Expand Up @@ -104,7 +109,7 @@ option(TBBMALLOC_BUILD "Enable tbbmalloc build" ON)
cmake_dependent_option(TBBMALLOC_PROXY_BUILD "Enable tbbmalloc_proxy build" ON "TBBMALLOC_BUILD" OFF)
option(TBB_CPF "Enable preview features of the library" OFF)
option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" OFF)
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" ${CMAKE_CROSSCOMPILING})
option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON)
option(TBB_FUZZ_TESTING "Enable fuzz testing" OFF)

Expand Down
4 changes: 1 addition & 3 deletions cmake/hwloc_detection.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,8 +46,6 @@ endforeach()
unset(HWLOC_TARGET_NAME)

if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED AND
# No hwloc auto detection for cross compilation
NOT CMAKE_CROSSCOMPILING AND
NOT TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH
)
find_package(PkgConfig QUIET)
Expand Down
10 changes: 0 additions & 10 deletions src/tbbbind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if (DEFINED CMAKE_SKIP_BUILD_RPATH)
set(CMAKE_SKIP_BUILD_RPATH_OLD_VALUE ${CMAKE_SKIP_BUILD_RPATH})
endif()
set(CMAKE_SKIP_BUILD_RPATH TRUE)

function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET)
Expand Down Expand Up @@ -106,10 +103,3 @@ else()
tbbbind_build(tbbbind_2_5 HWLOC::hwloc_2_5 )
endif()


if (DEFINED CMAKE_SKIP_BUILD_RPATH_OLD_VALUE)
set(CMAKE_SKIP_BUILD_RPATH ${CMAKE_SKIP_BUILD_RPATH_OLD_VALUE})
unset(CMAKE_SKIP_BUILD_RPATH_OLD_VALUE)
else()
unset(CMAKE_SKIP_BUILD_RPATH)
endif()

0 comments on commit a9d76a1

Please sign in to comment.