[x265] [PATCH] Threadpool-fix: correctly detect 'mac' os

praveen at multicorewareinc.com praveen at multicorewareinc.com
Tue Feb 7 07:39:50 CET 2017


# HG changeset patch
# User Praveen Tiwari <praveen at multicorewareinc.com>
# Date 1486449333 -19800
#      Tue Feb 07 12:05:33 2017 +0530
# Node ID 816af3e011a6194ca62bd24f03b514feffc3493c
# Parent  20141129537b00b09d66f50082059a91b0b7e7f1
Threadpool-fix: correctly detect 'mac' os

diff -r 20141129537b -r 816af3e011a6 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Fri Feb 03 17:30:27 2017 +0530
+++ b/source/CMakeLists.txt	Tue Feb 07 12:05:33 2017 +0530
@@ -122,7 +122,7 @@
   set(XCODE 1)
 endif()
 if(APPLE)
-  add_definitions(-DMACOS)
+  add_definitions(-DMACOS=1)
 endif()
 
 if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
diff -r 20141129537b -r 816af3e011a6 source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Fri Feb 03 17:30:27 2017 +0530
+++ b/source/common/threadpool.cpp	Tue Feb 07 12:05:33 2017 +0530
@@ -57,7 +57,10 @@
 
 #endif
 
-#if MACOS
+/* TODO FIX: Macro __MACH__ ideally should be part of MACOS definition, but adding to Cmake
+   behaving is not as expected, need to fix this. */
+
+#if MACOS && __MACH__
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #endif
@@ -617,7 +620,7 @@
     return sysconf(_SC_NPROCESSORS_CONF);
 #elif __unix__
     return sysconf(_SC_NPROCESSORS_ONLN);
-#elif MACOS
+#elif MACOS && __MACH__
     int nm[2];
     size_t len = 4;
     uint32_t count;


More information about the x265-devel mailing list