-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (32 loc) · 1.35 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
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(DDalphaAMG C)
include(ExternalProject)
find_package(MPI REQUIRED)
if(NOT MPI_FOUND)
message(ERROR "MPI not found. DDalphaAMG requires MPI")
endif()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${MPI_C_COMPILER_FLAGS}")
#find_package(OpenMP)
#if(OpenMP_FOUND)
# set(COMPILER_FLAGS "${COMPILER_FLAGS} ${OpenMP_C_FLAGS} -DOPENMP")
#endif()
set(EXTERNAL_INSTALL_LOCATION "${CMAKE_BINARY_DIR}" CACHE STRING "Path where to install the library")
set(LIME_PATH "" CACHE STRING "Path where to look for clime")
if(EXISTS "${LIME_PATH}/lib/liblime.so" AND EXISTS "${LIME_PATH}/include/lime.h")
set(WITH_LIME ON)
set(LIMEFLAGS "-DHAVE_LIME -I${LIME_PATH}/include")
set(LIMELIB "-L${LIME_PATH}/lib -llime")
else()
set(WITH_LIME OFF)
endif()
FILE(GLOB_RECURSE PATCHES "${CMAKE_CURRENT_SOURCE_DIR}/patches/*.patch")
ExternalProject_Add(DDalphaAMG
GIT_REPOSITORY https://github.com/sbacchio/DDalphaAMG
GIT_TAG master
PATCH_COMMAND git apply ${PATCHES} || git apply ${PATCHES} -R --check
CONFIGURE_COMMAND ""
BUILD_COMMAND make library MPI_C_COMPILER=${MPI_C_COMPILER} MPI_C_COMPILER_FLAGS=${COMPILER_FLAGS} LIMEFLAGS=${LIMEFLAGS} LIMELIB=${LIMELIB} && make -j install PREFIX=${EXTERNAL_INSTALL_LOCATION}
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
configure_file(config.py.in ${EXTERNAL_INSTALL_LOCATION}/config.py)