CMakeLists.txt 1.5 KB
Newer Older
berenger-bramas's avatar
berenger-bramas committed
1 2 3
cmake_minimum_required (VERSION 2.6)

# Project Infos
berenger-bramas's avatar
berenger-bramas committed
4 5 6 7
project(scalfmm CXX)

# check if compiling into source directories
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
8
if(insource)
berenger-bramas's avatar
berenger-bramas committed
9
    MESSAGE(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto ./Build and tapes cmake ../")
10
endif(insource)
11

berenger-bramas's avatar
berenger-bramas committed
12
# Options
13
OPTION( FUSE_CBLAS "Set to ON to build ScaFMM with BLAS" ON )
14
OPTION( FUSE_MPI "Set to ON to build ScaFMM with MPI" OFF )
berenger-bramas's avatar
berenger-bramas committed
15 16
OPTION( BUILD_TESTS "Set to ON to build fonctionnalities Tests" ON )
OPTION( BUILD_UTESTS "Set to ON to build UTests" ON )
17

18
# Blas option
19 20
if( FUSE_CBLAS )
  OPTION( FUSE_MKL_AS_BLAS "Set to ON to use MKL CBLAS" OFF )
21
  if( FUSE_MKL_AS_BLAS )
22
     SET(CBLAS_LIBRARIES "-L$ENV{MKLROOT}/lib  -lmkl_intel_lp64 -lmkl_sequential -lmkl_core")
23
  else( FUSE_MKL_AS_BLAS ) 
24 25
      FIND_PACKAGE(BLAS)
      SET(CBLAS_LIBRARIES "-lcblas")
26 27
  endif( FUSE_MKL_AS_BLAS )
endif( FUSE_CBLAS )
28

29 30 31 32 33 34 35
# MPI option
if( FUSE_MPI )
  SET(CMAKE_CXX_COMPILER mpicxx)
endif(FUSE_MPI)


# Compile option
berenger-bramas's avatar
berenger-bramas committed
36
ADD_DEFINITIONS(-O2 -Wall -Wshadow -Wpointer-arith -Wcast-qual)
berenger-bramas's avatar
berenger-bramas committed
37

38 39
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/Sources/ScalFmmConfig.h.cmake 
		${CMAKE_BINARY_DIR}/Sources/ScalFmmConfig.h  )
40

berenger-bramas's avatar
berenger-bramas committed
41 42 43 44 45
# Build - lib
add_subdirectory(Sources)

# Build - Tests
MESSAGE( STATUS "BUILD_TESTS = ${BUILD_TESTS}" )
46
if( BUILD_TESTS )
berenger-bramas's avatar
berenger-bramas committed
47 48 49 50 51
	add_subdirectory(Tests)
endif()

# Build - UTests
MESSAGE( STATUS "BUILD_UTESTS = ${BUILD_UTESTS}" )
52
if( BUILD_UTESTS )
berenger-bramas's avatar
berenger-bramas committed
53 54
	add_subdirectory(UTests)
endif()
berenger-bramas's avatar
berenger-bramas committed
55 56 57

# Build - doc
add_subdirectory(Doc)