Browse Source

create a preset for OS X and set default preset on some cases

I have copied and tweaked osx.preset from linux.preset for OS X use.
Furthermore, cmake loads now automatically presets for the following cases: (a)
osx.preset on OS X systems and (b) linux.preset on the rest of the systems when
not cross-compiling.
Ioannis Koutras 11 years ago
parent
commit
b47cf0ff2e
4 changed files with 34 additions and 1 deletions
  1. 10 1
      DefineOptions.cmake
  2. 1 0
      linux.preset
  3. 19 0
      osx.preset
  4. 4 0
      src/request_memory_mmap_osx.c

+ 10 - 1
DefineOptions.cmake

@@ -1,3 +1,12 @@
+# Load the presets
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  include(osx.preset)
+else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  if(NOT CMAKE_CROSSCOMPILING)
+    include(linux.preset)
+  endif(NOT CMAKE_CROSSCOMPILING)
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
 # Main Settings
 
 set(WITH_SYSTEM_CALLS "none" CACHE STRING "Choose what system calls can be used, options are: none, sbrk, mmap")
@@ -26,7 +35,7 @@ option(WITH_MEMALIGN "Build with memalign() support" ON)
 
 # GLIBC Hooks Settings
 
-option(WITH_GLIBC_HOOKS "Place dmmlib functions on GLIBC hooks" ON)
+option(WITH_GLIBC_HOOKS "Place dmmlib functions on GLIBC hooks" OFF)
 
 # Knobs Settings
 

+ 1 - 0
linux.preset

@@ -7,6 +7,7 @@ set(WITH_COALESCING "variable" CACHE STRING "Build with coalescing support")
 set(MAX_COAL_SIZE 60000 CACHE INTEGER "Maximum coalescing size")
 set(WITH_SPLITTING "variable" CACHE STRING "Build with splitting support")
 set(MIN_SPLIT_SIZE 64 CACHE INTEGER "Minimum splitting size")
+option(WITH_GLIBC_HOOKS "Place dmmlib functions on GLIBC hooks" OFF)
 option(WITH_KNOBS "Build with knobs support" ON)
 option(FREELIST_COALESCE_AFTER_SPLIT "Try to coalesce blocks after split" ON)
 set(STATS "none" CACHE STRING "Choose if the memory allocator keeps internally statistics per raw block or globally, options are: none, global")

+ 19 - 0
osx.preset

@@ -0,0 +1,19 @@
+set(WITH_SYSTEM_CALLS "mmap" CACHE STRING "Choose what system calls can be used, options are: none, sbrk, mmap")
+set(SYS_ALLOC_SIZE 32768 CACHE INTEGER "Choose the default system allocation size")
+option(HAVE_LOCKS "Build with POSIX locking mechanisms" ON)
+set(FITTING_POLICY "first" CACHE STRING "Choose the fitting policy in freelist-organized raw blocks, options are: best, exact, first, good")
+set(GOOD_FIT_PERCENTAGE 0.8 CACHE DOUBLE "Choose the good-fit percentage")
+set(WITH_COALESCING "none" CACHE STRING "Build with coalescing support")
+set(WITH_SPLITTING "none" CACHE STRING "Build with splitting support")
+option(WITH_KNOBS "Build with knobs support" OFF)
+option(WITH_GLIBC_HOOKS "Place dmmlib functions on GLIBC hooks" OFF)
+option(FREELIST_COALESCE_AFTER_SPLIT "Try to coalesce blocks after split" OFF)
+set(STATS "none" CACHE STRING "Choose if the memory allocator keeps internally statistics per raw block or globally, options are: none, global")
+option(REQUEST_SIZE_INFO "Keep request size information in metadata" OFF)
+option(WITH_MEM_TRACE "Support for memory traces" OFF)
+option(WITH_STATS_TRACE "Support for statistics traces" OFF)
+option(WITH_STATIC_LIB "Build a static library" OFF)
+option(WITH_SHARED_LIB "Build a shared library" ON)
+option(PARSE_ENV "Build with support to parse dmmlib environment variables" OFF)
+option(WITH_EXAMPLES "Build with examples" ON)
+option(WITH_DOC "Build with documentation" ON)

+ 4 - 0
src/request_memory_mmap_osx.c

@@ -22,6 +22,10 @@
  * \brief  Request additional memory space via mmap() in OS X.
  */
 
+#ifndef __APPLE__
+#error "This file is for use on OS X only."
+#endif /* __APPLE__ */
+
 #include "request_memory.h"
 #include <sys/mman.h>