Commit ee702b88 authored by Sebastian Woelke's avatar Sebastian Woelke

Add hwloc to cmake build process

parent 2bcd98a7
...@@ -77,6 +77,10 @@ if(NOT CAF_NO_OPENCL) ...@@ -77,6 +77,10 @@ if(NOT CAF_NO_OPENCL)
set(CAF_NO_OPENCL no) set(CAF_NO_OPENCL no)
endif() endif()
if(NOT CAF_NO_HWLOC)
set(CAF_NO_HWLOC no)
endif()
if(NOT CAF_NO_PYTHON) if(NOT CAF_NO_PYTHON)
set(CAF_NO_PYTHON no) set(CAF_NO_PYTHON no)
endif() endif()
...@@ -398,7 +402,7 @@ add_custom_target(uninstall ...@@ -398,7 +402,7 @@ add_custom_target(uninstall
################################################################################ ################################################################################
# set inclue paths for subprojects # # set include paths for subprojects #
################################################################################ ################################################################################
# path to caf core & io headers # path to caf core & io headers
...@@ -500,6 +504,18 @@ if(NOT CAF_NO_OPENCL) ...@@ -500,6 +504,18 @@ if(NOT CAF_NO_OPENCL)
if(OpenCL_FOUND) if(OpenCL_FOUND)
add_optional_caf_lib(opencl) add_optional_caf_lib(opencl)
add_optional_caf_binaries(libcaf_opencl/examples) add_optional_caf_binaries(libcaf_opencl/examples)
else()
set(CAF_NO_OPENCL yes)
endif()
endif()
# load hwloc library if not told otherwise
if(NOT CAF_NO_HWLOC)
find_package(Hwloc)
if(Hwloc_FOUND)
add_optional_caf_lib(hwloc)
else()
set(CAF_NO_HWLOC yes)
endif() endif()
endif() endif()
...@@ -682,6 +698,7 @@ invertYesNo(CAF_NO_EXCEPTIONS CAF_BUILD_WITH_EXCEPTIONS) ...@@ -682,6 +698,7 @@ invertYesNo(CAF_NO_EXCEPTIONS CAF_BUILD_WITH_EXCEPTIONS)
invertYesNo(CAF_NO_MEM_MANAGEMENT CAF_BUILD_MEM_MANAGEMENT) invertYesNo(CAF_NO_MEM_MANAGEMENT CAF_BUILD_MEM_MANAGEMENT)
invertYesNo(CAF_NO_BENCHMARKS CAF_BUILD_BENCHMARKS) invertYesNo(CAF_NO_BENCHMARKS CAF_BUILD_BENCHMARKS)
invertYesNo(CAF_NO_OPENCL CAF_BUILD_OPENCL) invertYesNo(CAF_NO_OPENCL CAF_BUILD_OPENCL)
invertYesNo(CAF_NO_HWLOC CAF_BUILD_HWLOC)
invertYesNo(CAF_NO_PYTHON CAF_BUILD_PYTHON) invertYesNo(CAF_NO_PYTHON CAF_BUILD_PYTHON)
# collect all compiler flags # collect all compiler flags
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
...@@ -707,6 +724,7 @@ if(NOT CAF_NO_SUMMARY) ...@@ -707,6 +724,7 @@ if(NOT CAF_NO_SUMMARY)
"\nBuild unit tests: ${CAF_BUILD_UNIT_TESTS}" "\nBuild unit tests: ${CAF_BUILD_UNIT_TESTS}"
"\nBuild benchmarks: ${CAF_BUILD_BENCHMARKS}" "\nBuild benchmarks: ${CAF_BUILD_BENCHMARKS}"
"\nBuild opencl: ${CAF_BUILD_OPENCL}" "\nBuild opencl: ${CAF_BUILD_OPENCL}"
"\nBuild hwloc: ${CAF_BUILD_HWLOC}"
"\nBuild Python: ${CAF_BUILD_PYTHON}" "\nBuild Python: ${CAF_BUILD_PYTHON}"
"\n" "\n"
"\nCXX: ${CMAKE_CXX_COMPILER}" "\nCXX: ${CMAKE_CXX_COMPILER}"
......
# - Try to find hwloc
# Once done this will define
#
# Hwloc_FOUND - system has OpenCL
# Hwloc_INCLUDE_DIRS - the OpenCL include directory
# Hwloc_LIBRARIES - link these to use OpenCL
# Hwloc_VERSION - version
#
# WIN32 should work, but is untested
if (WIN32)
find_path(Hwloc_INCLUDE_DIRS
NAMES
hwloc.h
PATHS
ENV "PROGRAMFILES(X86)"
ENV HWLOC_ROOT
PATH_SUFFIXES
include
)
find_library(Hwloc_LIBRARY
NAMES
libhwloc.lib
PATHS
ENV "PROGRAMFILES(X86)"
ENV HWLOC_ROOT
PATH_SUFFIXES
lib
)
find_program(HWLOC_INFO_EXECUTABLE
NAMES
hwloc-info
PATHS
ENV HWLOC_ROOT
PATH_SUFFIXES
bin
)
if(HWLOC_INFO_EXECUTABLE)
execute_process(
COMMAND ${HWLOC_INFO_EXECUTABLE} "--version"
OUTPUT_VARIABLE HWLOC_VERSION_LINE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "([0-9]+.[0-9]+)$"
Hwloc_VERSION "${HWLOC_VERSION_LINE}")
unset(HWLOC_VERSION_LINE)
endif()
set(Hwloc_LIBRARIES ${Hwloc_LIBRARY})
set(Hwloc_INCLUDE_DIRS ${Hwloc_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Hwloc
FOUND_VAR Hwloc_FOUND
REQUIRED_VARS Hwloc_LIBRARY Hwloc_INCLUDE_DIR
VERSION_VAR Hwloc_VERSION
)
mark_as_advanced(
Hwloc_INCLUDE_DIR
Hwloc_LIBRARY
)
else()
find_package(PkgConfig)
pkg_check_modules(Hwloc QUIET hwloc)
if(Hwloc_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Hwloc DEFAULT_MSG Hwloc_LIBRARIES)
message(STATUS "Found hwloc version ${Hwloc_VERSION}")
endif()
endif()
...@@ -42,4 +42,8 @@ ...@@ -42,4 +42,8 @@
#define CAF_NO_EXCEPTIONS #define CAF_NO_EXCEPTIONS
#endif #endif
#if @CAF_NO_HWLOC@ != -1
#define CAF_NO_HWLOC
#endif
#endif //CAF_DETAIL_BUILD_CONFIG_HPP #endif //CAF_DETAIL_BUILD_CONFIG_HPP
...@@ -65,6 +65,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]... ...@@ -65,6 +65,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--no-curl-examples build without libcurl examples --no-curl-examples build without libcurl examples
--no-unit-tests build without unit tests --no-unit-tests build without unit tests
--no-opencl build without OpenCL module --no-opencl build without OpenCL module
--no-hwloc build without NUMA related optimizations
--no-benchmarks build without benchmarks --no-benchmarks build without benchmarks
--no-tools build without CAF tools such as caf-run --no-tools build without CAF tools such as caf-run
--no-io build without I/O module --no-io build without I/O module
...@@ -339,6 +340,9 @@ while [ $# -ne 0 ]; do ...@@ -339,6 +340,9 @@ while [ $# -ne 0 ]; do
--no-opencl) --no-opencl)
append_cache_entry CAF_NO_OPENCL BOOL yes append_cache_entry CAF_NO_OPENCL BOOL yes
;; ;;
--no-hwloc)
append_cache_entry CAF_NO_HWLOC BOOL yes
;;
--build-static) --build-static)
append_cache_entry CAF_BUILD_STATIC BOOL yes append_cache_entry CAF_BUILD_STATIC BOOL yes
;; ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment