CMakeLists.txt 3.34 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
cmake_minimum_required(VERSION 3.5.1)
niklas.baumgarten's avatar
niklas.baumgarten committed
2
project(MLMC)
niklas.baumgarten's avatar
niklas.baumgarten committed
3
4
#---------------------------------------------------------------------------------------#

niklas.baumgarten's avatar
niklas.baumgarten committed
5
# Google test (Placed here to not compile it with mpiCC)
niklas.baumgarten's avatar
niklas.baumgarten committed
6
7
add_subdirectory(mpp/googletest)
include_directories(${PROJECT_BINARY_DIR}/mpp/googletest/googletest/include)
8
9
include_directories(${PROJECT_BINARY_DIR}/mpp/googletest/googlemock/include)
set(GTEST_LIB gtest gtest_main gmock gmock_main)
niklas.baumgarten's avatar
niklas.baumgarten committed
10
11
12
13
#---------------------------------------------------------------------------------------#

# MPI
find_package(MPI REQUIRED)
niklas.baumgarten's avatar
niklas.baumgarten committed
14
include_directories(${MPI_INCLUDE_PATH})
niklas.baumgarten's avatar
niklas.baumgarten committed
15

niklas.baumgarten's avatar
niklas.baumgarten committed
16
17
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
niklas.baumgarten's avatar
niklas.baumgarten committed
18
19
20
21
22

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
23
24
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-Ofast")
set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O0")
niklas.baumgarten's avatar
niklas.baumgarten committed
25
26
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O1")
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O2")
niklas.baumgarten's avatar
niklas.baumgarten committed
27
#set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")
niklas.baumgarten's avatar
niklas.baumgarten committed
28
set(CMAKE_CXX_FLAGS "-fPIC -g -Wno-deprecated -std=gnu++11")
niklas.baumgarten's avatar
niklas.baumgarten committed
29
#set(CMAKE_CXX_FLAGS "-fPIC -g -Wno-deprecated -Wall -std=gnu++11")
niklas.baumgarten's avatar
niklas.baumgarten committed
30
31
32
#---------------------------------------------------------------------------------------#

# Blas Lapack
niklas.baumgarten's avatar
niklas.baumgarten committed
33
#find_package(FFTW3 REQUIRED)   (Can't be found but still seems to link in)
niklas.baumgarten's avatar
niklas.baumgarten committed
34
35
36
37
38
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
#---------------------------------------------------------------------------------------#

# Manage folder structure build folder
39
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/dual)
niklas.baumgarten's avatar
niklas.baumgarten committed
40
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/gp)
41
42
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/py)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/data/vtk)
niklas.baumgarten's avatar
niklas.baumgarten committed
43
44
45
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/log)
#---------------------------------------------------------------------------------------#

niklas.baumgarten's avatar
niklas.baumgarten committed
46
47
# Link libraries
link_directories(${PROJECT_SOURCE_DIR}/sprng5/lib)
niklas.baumgarten's avatar
niklas.baumgarten committed
48
link_directories(${PROJECT_SOURCE_DIR}/mpp/superlu/lib)
niklas.baumgarten's avatar
niklas.baumgarten committed
49
50
51
52
53
54
55
if (UNIX AND NOT APPLE)
    set(SUPERLU superlu_4.3)
elseif (APPLE)
    set(SUPERLU superlu_4.3_mac10.10)
elseif (WIN32)
    set(SUPERLU superlu_4.3_cygwin)
endif ()
niklas.baumgarten's avatar
niklas.baumgarten committed
56
57
#---------------------------------------------------------------------------------------#

niklas.baumgarten's avatar
niklas.baumgarten committed
58
59
60
61
62
63
# Include directories
include_directories(${PROJECT_SOURCE_DIR}/sprng5/include)
include_directories(${PROJECT_SOURCE_DIR}/mlmc/src)
include_directories(${PROJECT_SOURCE_DIR}/mpp/src)
#---------------------------------------------------------------------------------------#

niklas.baumgarten's avatar
niklas.baumgarten committed
64
# Subdirectories
niklas.baumgarten's avatar
niklas.baumgarten committed
65
add_subdirectory(mpp)
niklas.baumgarten's avatar
niklas.baumgarten committed
66
67
68
69
add_subdirectory(mlmc/src)
#---------------------------------------------------------------------------------------#

# Executables
niklas.baumgarten's avatar
niklas.baumgarten committed
70
add_executable(MLMC-M++ mlmc/src/Main.C)
niklas.baumgarten's avatar
niklas.baumgarten committed
71
72

# Linking
niklas.baumgarten's avatar
niklas.baumgarten committed
73
target_link_libraries(MLMC-M++ MLMC sprng SRC LIB_PS ${SUPERLU} blas lapack fftw3 m)
niklas.baumgarten's avatar
niklas.baumgarten committed
74
75
76
#---------------------------------------------------------------------------------------#

# Test Executables
77
78
#add_executable(TestCirculantEmbedding mlmc/tests/TestCirculantEmbedding.C)
#add_executable(TestRNManager mlmc/tests/TestRNManager.C)
niklas.baumgarten's avatar
niklas.baumgarten committed
79
80

# Linking
81
82
83
#target_link_libraries(TestCirculantEmbedding MLMC sprng SRC LIB_PS ${SUPERLU}
#        blas lapack fftw3 m ${GTEST_LIB})
#target_link_libraries(TestRNManager MLMC sprng fftw3 m ${GTEST_LIB})
niklas.baumgarten's avatar
niklas.baumgarten committed
84
#---------------------------------------------------------------------------------------#