###
#
# PastixDefinitions: set definitions
#
###
add_definitions("-DCHOL_SOPALIN")
add_definitions("-DDOF_CONSTANT")
if(NOT PASTIX_WITH_MPI)
  add_definitions("-DFORCE_NOMPI")
  configure_file(common/src/nompi.h ${CMAKE_BINARY_DIR}/common/src/pastix_nompi.h)
  add_custom_target(pastix_nompi_header ALL SOURCES ${CMAKE_BINARY_DIR}/common/src/pastix_nompi.h)
  install(FILES ${CMAKE_BINARY_DIR}/common/src/pastix_nompi.h
    DESTINATION "include")
endif(NOT PASTIX_WITH_MPI)

if(NOT PASTIX_WITH_MULTITHREAD)
  add_definitions("-DFORCE_NOSMP")
endif(NOT PASTIX_WITH_MULTITHREAD)

if(PASTIX_WITH_STARPU_CUDA)
  add_definitions("-DWITH_CUDA")
endif(PASTIX_WITH_STARPU_CUDA)

if(PASTIX_WITH_STARPU)
  add_definitions("-DWITH_STARPU")
endif(PASTIX_WITH_STARPU)

if(PASTIX_WITH_STARPU_PROFILING)
  add_definitions("-DSTARPU_PROFILING")
endif(PASTIX_WITH_STARPU_PROFILING)

#if((PASTIX_WITH_PARSEC)

#if(PASTIX_DUMP_CBLK)

if(PASTIX_WITH_MEMORY_USAGE)
  add_definitions("-DMEMORY_USAGE")
endif(PASTIX_WITH_MEMORY_USAGE)
if(PASTIX_DISTRIBUTED)
  add_definitions("-DDISTRIBUTED")
endif(PASTIX_DISTRIBUTED)

if(PASTIX_THREAD_COMM)
  add_definitions("-DPASTIX_THREAD_COMM")
endif(PASTIX_THREAD_COMM)

if(PASTIX_FUNNELED)
  add_definitions("-DPASTIX_FUNNELED")
endif(PASTIX_FUNNELED)

if(PASTIX_WITH_MULTITHREAD AND PASTIX_DYNSCHED)
  add_definitions("-DPASTIX_DYNSCHED")
endif(PASTIX_WITH_MULTITHREAD AND PASTIX_DYNSCHED)

if(PASTIX_INT64)
  add_definitions("-DINTSIZE64")
  set(PASTIX_INT_KIND 8)
else(PASTIX_INT64)
  add_definitions("-DINTSIZE32")
  set(PASTIX_INT_KIND 4)
endif(PASTIX_INT64)

if (PASTIX_FLOAT_TYPE STREQUAL "Z")
  add_definitions("-DPREC_DOUBLE -DTYPE_COMPLEX")
  set(PASTIX_FLOAT_KIND 8)
  set(PASTIX_FLOAT_SIZE 16)
elseif(PASTIX_FLOAT_TYPE STREQUAL "C")
  add_definitions("-DTYPE_COMPLEX")
  set(PASTIX_FLOAT_KIND 4)
  set(PASTIX_FLOAT_SIZE 8)
elseif(PASTIX_FLOAT_TYPE STREQUAL "D")
  add_definitions("-DPREC_DOUBLE")
  set(PASTIX_FLOAT_KIND 8)
  set(PASTIX_FLOAT_SIZE 8)
elseif(NOT PASTIX_FLOAT_TYPE STREQUAL "S")
  message(FATAL "PASTIX_FLOAT_TYPE must be one of S,D,C or Z")
  set(PASTIX_FLOAT_KIND 4)
  set(PASTIX_FLOAT_SIZE 4)
endif()

# Ordering step options
if(PASTIX_ORDERING_SCOTCH)
  add_definitions("-DWITH_SCOTCH")
endif()

if(PASTIX_ORDERING_PTSCOTCH)
  add_definitions("-DWITH_SCOTCH -I${PTSCOTCH_INCLUDE_DIRS}")
endif()

if(PASTIX_ORDERING_METIS)
  add_definitions("-DWITH_METIS")
endif(PASTIX_ORDERING_METIS)

# Arch options
if (NOT PASTIX_ARCH)
  if (APPLE)
    add_definitions("-DX_ARCHi686_mac")
  elseif(WIN32)
    add_definitions("-DX_ARCHi686_pc_windows")
  else()
    add_definitions("-DX_ARCHi686_pc_linux")
  endif()
else()
  add_definitions("-DX_ARCH${PASTIX_ARCH}")
endif()

if (PASTIX_FM_NOCHANGE)
  add_definitions("-DPASTIX_FM_NOCHANGE")
endif()