forked from nmbader/fwi2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
61 lines (49 loc) · 1.88 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
61
#Required CMake version
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
#Name of our cmake project
project(fwi2d LANGUAGES CXX)
#Require c++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -ffast-math -fopenmp -w -no-pie")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -fopenmp -w -fPIC")
#optional openMP
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
#optional MPI
find_package(MPI)
if (MPI_FOUND)
include_directories( ${MPI_CXX_INCLUDE_PATH} )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_MPI")
endif(MPI_FOUND)
if(ENABLE_CUDA)
enable_language(CUDA)
message("CUDA enabled")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -std=c++11 -O3 -w -Xcompiler -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCUDA -fPIC")
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
endif(ENABLE_CUDA)
if(ENABLE_DOUBLE_PRECISION)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDOUBLE_PRECISION")
message("Double precision activated")
else()
message("Single precision activated")
endif()
if(ENABLE_PROFILING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") # add the flap -pg for profiling using gprof
message("Code profiling activated")
endif()
if(ENABLE_DEBUGGING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DDEBUG") # add the flap -g for debugging using gdb
message("Debug mode activated")
endif()
#Include SEPLIB directory
include_directories(./external/SEP/local/include)
#Adding path to link SEPLIB library
link_directories(./external/SEP/local/lib)
#add the rules for building the C++ code (execute the CMakelists file in the subdirectory)
add_subdirectory(src)