From 318b2e8df2bcd32d3b905e2a1b7a0c6de4cc9e0b Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 20 Oct 2015 08:07:42 +0100 Subject: [PATCH] cmake: support older versions --- CMakeLists.txt | 20 +++++++++++++++----- cmake/Config.cmake | 2 +- config.h.cmake | 22 +++++++++++----------- packages/CLPBN/horus/CMakeLists.txt | 2 +- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08e4cf896..e3c4b3a9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,7 +178,6 @@ ENDIF("${isSystemDir}" STREQUAL "-1") # -set ( YAP_MALLOC_T void *) set ( MIN_STACKSPACE 1024*SIZEOF_INT_P ) set ( MIN_HEAPSPACE 2*1024*SIZEOF_INT_P ) set ( MIN_TRAILSPACE 512*SIZEOF_INT_P ) @@ -314,6 +313,8 @@ endif (YAP_CALL_TRACER) #set( CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBS} ${CMAKE_REQUIRED_LIBRARIES} ) #target_link_libraries(libYap ${READLINE_LIBS}) +option (YAPOR "or-p" OFF) + option (YAP_THREADS "support system threads" OFF) macro_optional_find_package (Threads OFF) @@ -458,15 +459,23 @@ option (WITH_YAP_STATIC #TODO: option (WITH_YAP_MALLOC - "use malloc to allocate memory" ON) -if (YAP_MALLOC) + "use malloc to allocate memory" OFF) +# modern systems do this. +set ( MALLOC_T "void *" ) +if (YAPOR) + set ( USE_DL_MALLOC 1 ) + set ( USE_SYSTEM_MALLOC 0 ) +else() # use default allocator set ( USE_SYSTEM_MALLOC 1 ) + set ( USE_DL_MALLOC 0 ) + set ( USE_SYSTEM_MMAP 0 ) + set ( USE_SYSTEM_SHM 0 ) endif() -option(YAP_CONDOR +option(WITH_YAP_CONDOR "allow YAP to be used from condor" OFF) - if (YAP_MALLOC) + if (WITH_YAP_MALLOC) # use default allocator set ( YAP_STATIC ON ) set ( YAP_DLL OFF ) @@ -496,6 +505,7 @@ target_link_libraries(libYap ${GMP_LIBRARIES} ${READLINE_LIBS} ${CMAKE_DL_LIBS} + m ) add_executable (yap-bin ${CONSOLE_SOURCES}) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index bdeb9e104..b14fb245c 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -252,7 +252,7 @@ check_function_exists( labs HAVE_LABS ) check_function_exists( link HAVE_LINK) check_function_exists( localtime HAVE_LOCALTIME ) check_function_exists( lstat HAVE_LSTAT ) -check_function_exists(mallinfo HAVE_MALLINFO) +check_symbol_exists( mallinfo " malloc.h" HAVE_MALLINFO) check_function_exists(mbscoll HAVE_MBSCOLL) check_function_exists(mbscasecoll HAVE_MBSCASECOLL) check_function_exists(mbsnrtowcs HAVE_MBSNRTOWCS) diff --git a/config.h.cmake b/config.h.cmake index 37a125dd5..ab2c9e07c 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1613,17 +1613,17 @@ signal. */ /* malloc_t */ #ifndef MALLOC_T -#cmakedefine MALLOC_T "${MALLOC_T}" +#define MALLOC_T "void *" #endif /* max number of threads, default 1 or 1024 */ -#ifndef MAX_THRADS -#cmakedefine MAX_THREADS ${MAX_THREADS} +#ifndef MAX_THREADS +#define MAX_THREADS ${MAX_THREADS} #endif /* maximum amount of or-parallelism */ #ifndef MAX_WORKERS -#cmakedefine MAX_WORKERS ${MAX_WORKERS} +#define MAX_WORKERS ${MAX_WORKERS} #endif /* o not use realloc() from HP-UX 10.20 together with MPI */ @@ -1818,37 +1818,37 @@ signal. */ /* use Doug Lea's malloc for all allocation */ #ifndef USE_DL_MALLOC -#cmakedefine USE_DL_MALLOC ${USE_DL_MALLOC} +#define USE_DL_MALLOC ${USE_DL_MALLOC} #endif /* use bignums/rationals in YAP code. */ #ifndef USE_GMP -#cmakedefine USE_GMP ${USE_GMP} +#define USE_GMP ${USE_GMP} #endif /* use Judy library for UDI indexing in YAP code. */ #ifndef USE_JUDY -#cmakedefine USE_JUDY ${USE_JUDY} +#define USE_JUDY ${USE_JUDY} #endif /* do not use our own locking routines */ #ifndef USE_PTHREAD_LOCKING -#cmakedefine USE_PTHREAD_LOCKING ${USE_PTHREAD_LOCKING} +#define USE_PTHREAD_LOCKING ${USE_PTHREAD_LOCKING} #endif /* use OS malloc for all allocation */ #ifndef USE_SYSTEM_MALLOC -#cmakedefine USE_SYSTEM_MALLOC ${USE_SYSTEM_MALLOC} +#define USE_SYSTEM_MALLOC ${USE_SYSTEM_MALLOC} #endif /* use mmap in or-parallel allocation */ #ifndef USE_SYSTEM_MMAP -#cmakedefine USE_SYSTEM_MMAP ${USE_SYSTEM_MMAP} +#define USE_SYSTEM_MMAP ${USE_SYSTEM_MMAP} #endif /* use shm in or-parallel allocation */ #ifndef USE_SYSTEM_SHM -#cmakedefine USE_SYSTEM_SHM ${USE_SYSTEM_SHM} +#define USE_SYSTEM_SHM ${USE_SYSTEM_SHM} #endif /* Whether daylight savings time offset is set via the altzone variable */ diff --git a/packages/CLPBN/horus/CMakeLists.txt b/packages/CLPBN/horus/CMakeLists.txt index 937a13e5c..ec95f50e6 100644 --- a/packages/CLPBN/horus/CMakeLists.txt +++ b/packages/CLPBN/horus/CMakeLists.txt @@ -1,7 +1,7 @@ option (HORUS "enable HORUS graphical model tookit" ON) -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +#cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)