Browse Source

HPCC-14902 Added FindNUMA.cmake file

Signed-off-by: Michael Gardner <michael.gardner@lexisnexis.com>
Michael Gardner 9 years ago
parent
commit
53afee8375
2 changed files with 43 additions and 0 deletions
  1. 36 0
      cmake_modules/FindNUMA.cmake
  2. 7 0
      cmake_modules/commonSetup.cmake

+ 36 - 0
cmake_modules/FindNUMA.cmake

@@ -0,0 +1,36 @@
+################################################################################
+#    HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
+#
+#    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.
+################################################################################
+
+# - Try to find the Numa library
+# Once done this will define
+#
+#  NUMA_FOUND - system has the numa library
+#  NUMA_INCLUDE_DIR - the numa include directory
+#  NUMA_LIBRARIES - The libraries needed to use numa
+
+IF (NOT NUMA_FOUND)
+  SET (numa_lib "numa")
+
+  FIND_PATH (NUMA_INCLUDE_DIR NAMES numa.h PATHS /usr/include /usr/local/include /usr/share/include)
+  FIND_LIBRARY (NUMA_LIBRARIES NAMES ${numa_lib} PATHS /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 /usr/share)
+
+  find_package_handle_standard_args(numa DEFAULT_MSG
+    NUMA_LIBRARIES
+    NUMA_INCLUDE_DIR
+  )
+
+  MARK_AS_ADVANCED(NUMA_INCLUDE_DIR NUMA_LIBRARIES)
+ENDIF()

+ 7 - 0
cmake_modules/commonSetup.cmake

@@ -270,6 +270,13 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     message(FATAL_ERROR "No threading support found")
   ENDIF()
 
+  if (NOT APPLE AND NOT WIN32)
+    find_package(NUMA)
+    if (NOT NUMA_FOUND)
+      message(FATAL_ERROR "Support for numa not found")
+    endif()
+  endif()
+
   if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set (CMAKE_COMPILER_IS_CLANGXX 1)
   endif()