forked from exafmm/exafmm-beta
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
60 lines (54 loc) · 1.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Reject in-place build
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
MESSAGE(FATAL_ERROR "Rejecting in-place build. Please use a build directory")
ENDIF()
# Project header
PROJECT(exaFMM)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# All options are set here
SET(EQUATION Laplace) # {Laplace, Helmholtz, Stokes}
SET(BASIS Cartesian) # {Cartesian, Spherical}
OPTION(USE_MPI "Use MPI" ON)
OPTION(USE_GPU "Use GPUs" OFF)
OPTION(USE_VTK "Use VTK" OFF)
# MPI
IF(USE_MPI)
FIND_PACKAGE(MPI REQUIRED)
MESSAGE(STATUS "Enabling MPI")
SET(CMAKE_CXX_COMPILER ${MPI_COMPILER})
ENDIF()
# CUDA
IF(USE_GPU)
SET(DEVICE GPU)
FIND_PACKAGE(CUDA REQUIRED)
MESSAGE(STATUS "Enabling CUDA ${CUDA_VERSION}")
IF(CUDA_SDK_ROOT_DIR MATCHES "CUDA_SDK_ROOT_DIR-NOTFOUND")
MESSAGE(FATAL_ERROR "Could not locate CUDA SDK. Try setting environment variable NVSDKCOMPUTE_ROOT")
ENDIF()
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fopenmp --ptxas-options=-v -O3 -use_fast_math -arch=sm_13)
INCLUDE_DIRECTORIES(${CUDA_SDK_ROOT_DIR}/common/inc)
ELSE()
SET(DEVICE CPU)
ENDIF()
# VTK
IF(USE_VTK)
FIND_PACKAGE(VTK REQUIRED)
MESSAGE(STATUS "Enabling VTK ${VTK_VERSION}")
ADD_DEFINITIONS(-DVTK)
INCLUDE(${VTK_USE_FILE})
LINK_LIBRARIES(vtkCommon vtkFiltering vtkGraphics vtkIO vtkRendering vtkViews vtkWidgets)
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb3 -Wall -Wextra -O3 -msse4a -ffast-math -funroll-loops -fopenmp")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
ADD_DEFINITIONS(-DEXAFMM_LAPLACE)
ADD_DEFINITIONS(-DEXAFMM_CARTESIAN)
ADD_DEFINITIONS(-DEXPANSION=4)
ADD_DEFINITIONS(-DEXAFMM_USE_SIMD)
ADD_DEFINITIONS(-DEXAFMM_WITH_TBB)
ADD_DEFINITIONS(-DEXAFMM_MASS)
ADD_DEFINITIONS(-DEXAFMM_DIRECT)
ADD_SUBDIRECTORY(kernels)
LINK_LIBRARIES(tbb)
# Unit tests
INCLUDE(CTest)
ADD_SUBDIRECTORY(examples)