forked from issp-center-dev/mVMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (62 loc) · 2.08 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
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
project(mVMC NONE)
option(USE_SCALAPACK "Use Scalapack" OFF)
add_definitions(-D_mVMC)
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)
enable_language(C Fortran)
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_BUILD_TYPE}" MATCHES "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran} ${CMAKE_Fortran_FLAGS_RELEASE}")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
set(OMP_FLAG_Intel "-openmp")
else()
set(OMP_FLAG_Intel "-qopenmp")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OMP_FLAG_Intel}")
else()
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
endif(OPENMP_FOUND)
endif()
find_package(MPI)
if(MPI_FOUND)
include_directories(${MPI_C_INCLUDE_PATH})
add_definitions(-D_mpi_use)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_C_LINK_FLAGS}")
endif(MPI_FOUND)
find_package(LAPACK)
if(USE_SCALAPACK MATCHES OFF)
if(LAPACK_FOUND)
add_definitions(-D_lapack)
endif(LAPACK_FOUND)
endif()
add_subdirectory(src/ComplexUHF)
add_subdirectory(src/pfapack)
add_subdirectory(src/mVMC)
add_subdirectory(tool)
# Build and enable tests
# testing setup
# enable_testing() must be called in the top-level CMakeLists.txt before any add_subdirectory() is called.
option(Testing "Enable testing" OFF)
if (Testing)
enable_testing(test)
add_subdirectory(test)
endif()