cmake: support older versions

This commit is contained in:
Vitor Santos Costa 2015-10-20 08:07:42 +01:00
parent 20c87f1ab6
commit 318b2e8df2
4 changed files with 28 additions and 18 deletions

@ -178,7 +178,6 @@ ENDIF("${isSystemDir}" STREQUAL "-1")
# #
set ( YAP_MALLOC_T void *)
set ( MIN_STACKSPACE 1024*SIZEOF_INT_P ) set ( MIN_STACKSPACE 1024*SIZEOF_INT_P )
set ( MIN_HEAPSPACE 2*1024*SIZEOF_INT_P ) set ( MIN_HEAPSPACE 2*1024*SIZEOF_INT_P )
set ( MIN_TRAILSPACE 512*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} ) #set( CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBS} ${CMAKE_REQUIRED_LIBRARIES} )
#target_link_libraries(libYap ${READLINE_LIBS}) #target_link_libraries(libYap ${READLINE_LIBS})
option (YAPOR "or-p" OFF)
option (YAP_THREADS option (YAP_THREADS
"support system threads" OFF) "support system threads" OFF)
macro_optional_find_package (Threads OFF) macro_optional_find_package (Threads OFF)
@ -458,15 +459,23 @@ option (WITH_YAP_STATIC
#TODO: #TODO:
option (WITH_YAP_MALLOC option (WITH_YAP_MALLOC
"use malloc to allocate memory" ON) "use malloc to allocate memory" OFF)
if (YAP_MALLOC) # modern systems do this.
set ( MALLOC_T "void *" )
if (YAPOR)
set ( USE_DL_MALLOC 1 )
set ( USE_SYSTEM_MALLOC 0 )
else()
# use default allocator # use default allocator
set ( USE_SYSTEM_MALLOC 1 ) set ( USE_SYSTEM_MALLOC 1 )
set ( USE_DL_MALLOC 0 )
set ( USE_SYSTEM_MMAP 0 )
set ( USE_SYSTEM_SHM 0 )
endif() endif()
option(YAP_CONDOR option(WITH_YAP_CONDOR
"allow YAP to be used from condor" OFF) "allow YAP to be used from condor" OFF)
if (YAP_MALLOC) if (WITH_YAP_MALLOC)
# use default allocator # use default allocator
set ( YAP_STATIC ON ) set ( YAP_STATIC ON )
set ( YAP_DLL OFF ) set ( YAP_DLL OFF )
@ -496,6 +505,7 @@ target_link_libraries(libYap
${GMP_LIBRARIES} ${GMP_LIBRARIES}
${READLINE_LIBS} ${READLINE_LIBS}
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
m
) )
add_executable (yap-bin ${CONSOLE_SOURCES}) add_executable (yap-bin ${CONSOLE_SOURCES})

@ -252,7 +252,7 @@ check_function_exists( labs HAVE_LABS )
check_function_exists( link HAVE_LINK) check_function_exists( link HAVE_LINK)
check_function_exists( localtime HAVE_LOCALTIME ) check_function_exists( localtime HAVE_LOCALTIME )
check_function_exists( lstat HAVE_LSTAT ) 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(mbscoll HAVE_MBSCOLL)
check_function_exists(mbscasecoll HAVE_MBSCASECOLL) check_function_exists(mbscasecoll HAVE_MBSCASECOLL)
check_function_exists(mbsnrtowcs HAVE_MBSNRTOWCS) check_function_exists(mbsnrtowcs HAVE_MBSNRTOWCS)

@ -1613,17 +1613,17 @@ signal. */
/* malloc_t */ /* malloc_t */
#ifndef MALLOC_T #ifndef MALLOC_T
#cmakedefine MALLOC_T "${MALLOC_T}" #define MALLOC_T "void *"
#endif #endif
/* max number of threads, default 1 or 1024 */ /* max number of threads, default 1 or 1024 */
#ifndef MAX_THRADS #ifndef MAX_THREADS
#cmakedefine MAX_THREADS ${MAX_THREADS} #define MAX_THREADS ${MAX_THREADS}
#endif #endif
/* maximum amount of or-parallelism */ /* maximum amount of or-parallelism */
#ifndef MAX_WORKERS #ifndef MAX_WORKERS
#cmakedefine MAX_WORKERS ${MAX_WORKERS} #define MAX_WORKERS ${MAX_WORKERS}
#endif #endif
/* o not use realloc() from HP-UX 10.20 together with MPI */ /* 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 */ /* use Doug Lea's malloc for all allocation */
#ifndef USE_DL_MALLOC #ifndef USE_DL_MALLOC
#cmakedefine USE_DL_MALLOC ${USE_DL_MALLOC} #define USE_DL_MALLOC ${USE_DL_MALLOC}
#endif #endif
/* use bignums/rationals in YAP code. */ /* use bignums/rationals in YAP code. */
#ifndef USE_GMP #ifndef USE_GMP
#cmakedefine USE_GMP ${USE_GMP} #define USE_GMP ${USE_GMP}
#endif #endif
/* use Judy library for UDI indexing in YAP code. */ /* use Judy library for UDI indexing in YAP code. */
#ifndef USE_JUDY #ifndef USE_JUDY
#cmakedefine USE_JUDY ${USE_JUDY} #define USE_JUDY ${USE_JUDY}
#endif #endif
/* do not use our own locking routines */ /* do not use our own locking routines */
#ifndef USE_PTHREAD_LOCKING #ifndef USE_PTHREAD_LOCKING
#cmakedefine USE_PTHREAD_LOCKING ${USE_PTHREAD_LOCKING} #define USE_PTHREAD_LOCKING ${USE_PTHREAD_LOCKING}
#endif #endif
/* use OS malloc for all allocation */ /* use OS malloc for all allocation */
#ifndef USE_SYSTEM_MALLOC #ifndef USE_SYSTEM_MALLOC
#cmakedefine USE_SYSTEM_MALLOC ${USE_SYSTEM_MALLOC} #define USE_SYSTEM_MALLOC ${USE_SYSTEM_MALLOC}
#endif #endif
/* use mmap in or-parallel allocation */ /* use mmap in or-parallel allocation */
#ifndef USE_SYSTEM_MMAP #ifndef USE_SYSTEM_MMAP
#cmakedefine USE_SYSTEM_MMAP ${USE_SYSTEM_MMAP} #define USE_SYSTEM_MMAP ${USE_SYSTEM_MMAP}
#endif #endif
/* use shm in or-parallel allocation */ /* use shm in or-parallel allocation */
#ifndef USE_SYSTEM_SHM #ifndef USE_SYSTEM_SHM
#cmakedefine USE_SYSTEM_SHM ${USE_SYSTEM_SHM} #define USE_SYSTEM_SHM ${USE_SYSTEM_SHM}
#endif #endif
/* Whether daylight savings time offset is set via the altzone variable */ /* Whether daylight savings time offset is set via the altzone variable */

@ -1,7 +1,7 @@
option (HORUS "enable HORUS graphical model tookit" ON) 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)