Browse Source

HPCC-15097 USE_NUMA missing from CMakeList.txt

Test proper flag.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 years ago
parent
commit
7fc8b8f89c
3 changed files with 11 additions and 4 deletions
  1. 4 1
      cmake_modules/commonSetup.cmake
  2. 5 1
      system/jlib/CMakeLists.txt
  3. 2 2
      system/jlib/jthread.cpp

+ 4 - 1
cmake_modules/commonSetup.cmake

@@ -40,7 +40,9 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   cmake_policy ( SET CMP0011 NEW )
   if (NOT (CMAKE_MAJOR_VERSION LESS 3))
     cmake_policy ( SET CMP0026 OLD )
-    cmake_policy ( SET CMP0054 NEW )
+    if (NOT (CMAKE_MINOR_VERSION LESS 1))
+      cmake_policy ( SET CMP0054 NEW )
+    endif()
   endif()
   option(CLIENTTOOLS "Enable the building/inclusion of a Client Tools component." ON)
   option(PLATFORM "Enable the building/inclusion of a Platform component." ON)
@@ -282,6 +284,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
 
   if (USE_NUMA)
     find_package(NUMA)
+    add_definitions (-D_USE_NUMA)
     if (NOT NUMA_FOUND)
       message(FATAL_ERROR "Support for numa not found")
     endif()

+ 5 - 1
system/jlib/CMakeLists.txt

@@ -206,7 +206,11 @@ if (WIN32)
  target_link_libraries ( jlib ws2_32 mpr.lib Winmm.lib psapi.lib )
 elseif (("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" ))
 else ()
- target_link_libraries ( jlib rt numa)
+ target_link_libraries ( jlib rt )
+endif ()
+
+if (USE_NUMA)
+ target_link_libraries ( jlib numa )
 endif ()
 
 if (NOT PLUGIN)

+ 2 - 2
system/jlib/jthread.cpp

@@ -33,7 +33,7 @@
 #include <sys/syscall.h>
 #include <sys/types.h>
 #include <sys/resource.h>
-#ifndef __APPLE__
+#ifdef _USE_NUMA
 #include <numa.h>
 #endif
 #endif
@@ -2426,7 +2426,7 @@ void setProcessAffinity(const char * cpuList)
 
 void setAutoAffinity(unsigned curProcess, unsigned processPerMachine, const char * optNodes)
 {
-#if defined(CPU_ZERO) && !defined(__APPLE__)
+#if defined(CPU_ZERO) && defined(_USE_NUMA)
     if (processPerMachine <= 1)
         return;