CMakeLists.txt 3.05 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
2
3
4
#
# Loads static libraries mpp_src and lib_ps
#

niklas.baumgarten's avatar
niklas.baumgarten committed
5
cmake_minimum_required(VERSION 3.5.1)
niklas.baumgarten's avatar
niklas.baumgarten committed
6
project(mpp_mlmc)
niklas.baumgarten's avatar
niklas.baumgarten committed
7
8
#---------------------------------------------------------------------------------------#

niklas.baumgarten's avatar
niklas.baumgarten committed
9
10
11
12
13
## Google test (Placed here to not compile it with mpiCC)
#add_subdirectory(googletest)
#include_directories(${PROJECT_BINARY_DIR}/googletest/googletest/include)
#include_directories(${PROJECT_BINARY_DIR}/googlemock/googletest/include)
#set(GTEST_LIB gtest gtest_main)
niklas.baumgarten's avatar
niklas.baumgarten committed
14
15
16
17
18
19
20
21
22
23
24
25
26
#---------------------------------------------------------------------------------------#

# MPI
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})    #/usr/include/mpi/

set(CMAKE_C_COMPILER mpicc)                 #/usr/bin/mpicc
set(CMAKE_CXX_COMPILER mpiCC)               #/usr/bin/mpiCC

set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})

set(CMAKE_BUILD_TYPE distribution)
niklas.baumgarten's avatar
niklas.baumgarten committed
27
28
set(CMAKE_CXX_FLAGS_DISTRIBUTION "-Ofast")
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O0")
niklas.baumgarten's avatar
niklas.baumgarten committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O1")
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O2")
set(CMAKE_CXX_FLAGS "-fPIC -g -Wno-deprecated -std=gnu++11")
#---------------------------------------------------------------------------------------#

# Blas Lapack
#Cmake can't find FFTW3 for some reason but is able to link it
#find_package(FFTW3 REQUIRED)
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
#---------------------------------------------------------------------------------------#

# Manage folder structure build folder
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/vtk)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/gp)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/log)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/dual)
#---------------------------------------------------------------------------------------#

# Include directories
niklas.baumgarten's avatar
niklas.baumgarten committed
49
50
51
include_directories(${PROJECT_SOURCE_DIR}/mpp_src)
include_directories(${PROJECT_SOURCE_DIR}/mpp_src/LIB_PS)
include_directories(${PROJECT_SOURCE_DIR}/mpp_src/superlu/include)
niklas.baumgarten's avatar
niklas.baumgarten committed
52
53
54
55
56
57
58
59
60
61
62
63
include_directories(${PROJECT_SOURCE_DIR}/mlmc/src)
include_directories(${PROJECT_SOURCE_DIR}/sprng5/include)
#---------------------------------------------------------------------------------------#

# Subdirectories
add_subdirectory(mlmc/src)
#---------------------------------------------------------------------------------------#

# Executables
add_executable(MLMC-M++ mlmc/src/MLMCMain.C)

# Linking
niklas.baumgarten's avatar
niklas.baumgarten committed
64
target_link_libraries(MLMC-M++ MLMC sprng mpp_src lib_ps blas lapack ${SUPERLU} fftw3 m)
niklas.baumgarten's avatar
niklas.baumgarten committed
65
66
67
#---------------------------------------------------------------------------------------#

# Test Executables
niklas.baumgarten's avatar
niklas.baumgarten committed
68
69
#add_executable(TestCirculantEmbedding mlmc/tests/TestCirculantEmbedding.C)
#add_executable(TestRNManager mlmc/tests/TestRNManager.C)
niklas.baumgarten's avatar
niklas.baumgarten committed
70
71

# Linking
niklas.baumgarten's avatar
niklas.baumgarten committed
72
73
74
75
#target_link_libraries(TestCirculantEmbedding MLMC sprng SRC SRC_Solver
#       blas lapack ${SUPERLU} fftw3 m ${GTEST_LIB})
#target_link_libraries(TestRNManager MLMC sprng fftw3 m ${GTEST_LIB})
#set(MPI_COMMAND mpirun -np 4 )
niklas.baumgarten's avatar
niklas.baumgarten committed
76
#---------------------------------------------------------------------------------------#