AGAPROConfig.h.cmake 2.02 KB
Newer Older
1 2 3 4 5
#ifndef AGAPROCONFIG_H
#define AGAPROCONFIG_H

#cmakedefine HAS_BOOST 
#cmakedefine HAS_SKSTREAM 
6
#cmakedefine HAS_SSE
dino's avatar
dino committed
7
#cmakedefine HAS_C11
8 9 10 11 12

//////////////////////////////
////// Define OS_TYPE ////////
//////////////////////////////

13 14 15 16 17
#define OS_LINUX   1
#define OS_WINDOWS 2
#define OS_CYGWIN  3      // rather useless ==> to be removed ??
#define OS_APPLE   4      

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#define OS_TYPE @CMAKE_OS_TYPE@

/////////////////////////////////////////////////////
//////// Choose your version of the program(s) //////
/////////////////////////////////////////////////////

#define NRV_ONLINE   1
#define NRV_OFFLINE  2

#define NRV_TYPE @CMAKE_NRV_TYPE@

#if NRV_TYPE != NRV_ONLINE
# undef NRV_TYPE
# define NRV_TYPE  NRV_OFFLINE
#endif

#if NRV_TYPE == NRV_ONLINE
  #if (OS_TYPE != OS_LINUX)
    #error The online version can only be built on Linux
  #endif
#endif

dino's avatar
dino committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
//////////////////////////////////////////////
//////// Choose your version of threads //////
//////////////////////////////////////////////

#define THR_NONE    0           // no threads
#define THR_BOOST   1           // using boost  c++ libraries
#define THR_STD     2           // using std in c++11 (if supported by compiler)

// THR_TYPE should be defined in the project 
#define THR_TYPE @CMAKE_THR_TYPE@

#if THR_TYPE == THR_BOOST
  #define thrLib boost
  #define thrYield()      ( thrLib::this_thread::yield() )
  #define thrSleep(msecs) ( thrLib::this_thread::sleep(thrLib::posix_time::milliseconds(msecs)) )
  #define thrLock           thrLib::mutex::scoped_lock
#elif  THR_TYPE == THR_STD
  #define thrLib std
  #define thrYield()      ( thrLib::this_thread::yield() )
  #define thrSleep(msecs) ( thrLib::this_thread::sleep_for(thrLib::chrono::milliseconds(msecs)) )
  #define thrLock           thrLib::unique_lock<std::mutex>
#elif  THR_TYPE == THR_NONE
  #define thrLib
  #define thrYield()
  #define thrSleep(msecs)
  #define thrLock
#else
  #error THR_TYPE should be either THR_BOOST, THR_STD or THR_NONE
#endif


#endif