-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (49 loc) · 1.99 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
cmake_minimum_required (VERSION 3.3)
project (SUPERLU_DIST VERSION 4.1 LANGUAGES C Fortran)
option(BUILD_TESTS "${PROJECT_NAME} - Build tests" ON)
set(PACKAGE_CONFIG_DIR "lib/cmake" CACHE STRING "Directory for package config files (relative to CMAKE_INSTALL_PREFIX)")
set(BUILD_PRECISION dz CACHE STRING "${PROJECT_NAME} - Build precisions (d|z|dz)")
option(USE_PARMETIS "Use ParMETIS library (includes use of METIS)" ON)
option(USE_METIS "Use METIS library" OFF)
option(WITH_OPENMP "${PROJECT_NAME} - Use OpenMP" ON)
set(FORTRAN_MANGLING "Add_" CACHE STRING "${PROJECT_NAME} - Fortran mangling scheme")
# SuperLU requires the C99 standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# CMake somehow doesnt handle the case for intel compilers yet
if (CMAKE_C_COMPILER_ID MATCHES Intel)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
endif()
find_package(BLAS ${BLAS_VERSION} REQUIRED)
if (USE_PARMETIS)
find_package(PARMETIS ${PARMETIS_VERSION} REQUIRED)
elseif(USE_METIS)
find_package(METIS ${METIS_VERSION} REQUIRED)
endif()
find_package(MPI REQUIRED)
if (NOT MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format -Wno-error=format-security")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -Wall")
endif()
if (WITH_OPENMP)
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
else()
message(WARNING "OpenMP requested but not found. Skipping.")
endif()
endif()
# collecting source file defs in subdirectory
add_subdirectory(SRC)
if (USE_PARMETIS OR USE_METIS)
if (BUILD_TESTS)
enable_testing()
add_subdirectory(EXAMPLE)
endif()
add_subdirectory(FORTRAN)
else()
message(WARNING "USE_PARMETIS and USE_METIS are disabled. Not building examples as the default option is metis ordering.")
endif()