forked from issp-center-dev/HPhi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·62 lines (54 loc) · 1.76 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
62
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
enable_testing()
project(HPhi++ NONE)
option(USE_SCALAPACK "Use Scalapack" OFF)
if(CONFIG)
message(STATUS "Loading configration: " ${PROJECT_SOURCE_DIR}/config/${CONFIG}.cmake)
include(${PROJECT_SOURCE_DIR}/config/${CONFIG}.cmake)
endif(CONFIG)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of build" FORCE)
endif(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(ENABLE_MPI "Enable MPI Parallelization" ON)
option(ENABLE_SCALAPACK "Use Scalapack" ON)
enable_language(CXX Fortran)
#set(CMAKE_CXX_FLAGS "-lscalapack -lgfortran -lm")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_MACOSX_RPATH 1)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
set(OMP_FLAG_Intel "-openmp")
else()
set(OMP_FLAG_Intel "-qopenmp")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OMP_FLAG_Intel}")
else()
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(OPENMP_FOUND)
endif()
if(ENABLE_MPI)
find_package(MPI)
if(MPI_FOUND)
include_directories(${MPI_CXX_INCLUDE_PATH})
add_definitions(-D__MPI)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
endif(MPI_FOUND)
endif(ENABLE_MPI)
find_package(LAPACK)
if(USE_SCALAPACK MATCHES OFF)
if(LAPACK_FOUND)
add_definitions(-D_lapack)
endif(LAPACK_FOUND)
else()
add_definitions(-D_SCALAPACK)
endif()
add_subdirectory(src)
add_subdirectory(tool)
add_subdirectory(test)