| 1 |
# Minimum version: 3.7.1 required by CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT |
| 2 |
cmake_minimum_required (VERSION 3.7.1) |
| 3 |
|
| 4 |
message(NOTICE "Configuring build for PUNC") |
| 5 |
|
| 6 |
# CXX is included as an enabled language because the SuperLU checks require it |
| 7 |
project(punc |
| 8 |
VERSION ${FETK_VERSION} |
| 9 |
LANGUAGES C CXX |
| 10 |
) |
| 11 |
|
| 12 |
# Include the common FETK CMake utilities |
| 13 |
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") |
| 14 |
include(FETKBuildFunctions) |
| 15 |
include(FetchContent) |
| 16 |
|
| 17 |
# Set essential variables and paths for the project |
| 18 |
set_basic_vars_and_paths() |
| 19 |
set(PUNC_VERSION ${punc_VERSION}) |
| 20 |
|
| 21 |
|
| 22 |
################################################################################ |
| 23 |
# Check for necessary headers and types |
| 24 |
################################################################################ |
| 25 |
|
| 26 |
header_and_type_checks() |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
# check for libraries |
| 31 |
|
| 32 |
# check for disable vender-host-cpu triplet (?) |
| 33 |
|
| 34 |
# readline library |
| 35 |
|
| 36 |
# mpi library |
| 37 |
|
| 38 |
# [embed check to be left out] |
| 39 |
|
| 40 |
# debug compilation |
| 41 |
|
| 42 |
# ansi/pedantic compilation |
| 43 |
|
| 44 |
# profiling |
| 45 |
|
| 46 |
# electric fence library (?) |
| 47 |
|
| 48 |
################################################################################ |
| 49 |
# Here are the libraries that can be built by PUNC |
| 50 |
################################################################################ |
| 51 |
|
| 52 |
# vf2c library |
| 53 |
# We only build vf2c |
| 54 |
option(BUILD_VF2C "Flag to build VF2C" ON) |
| 55 |
if(BUILD_VF2C) |
| 56 |
message(STATUS "Will build vf2c") |
| 57 |
endif() |
| 58 |
|
| 59 |
# BLAS library |
| 60 |
# We do not optionally build BLAS |
| 61 |
set( BLA_STATIC OFF ) # don't use static linkage |
| 62 |
if(APPLE) |
| 63 |
set( BLA_VENDOR Apple ) |
| 64 |
#else() |
| 65 |
# set( BLA_VENDOR OpenBLAS ) |
| 66 |
endif() |
| 67 |
find_package( BLAS ) |
| 68 |
if(BLAS_FOUND) |
| 69 |
set(BUILD_BLAS OFF) |
| 70 |
else() |
| 71 |
option(BUILD_BLAS "Flag to build BLAS" ON) |
| 72 |
endif() |
| 73 |
if(BUILD_BLAS) |
| 74 |
message(STATUS "Will build BLAS") |
| 75 |
endif() |
| 76 |
|
| 77 |
# SuperLU library |
| 78 |
# At the moment, managed distributions of SuperLU include only the shared libraries. |
| 79 |
# Note: checked on 4/20/22; including apt on Ubuntu and Home/Linuxbrew |
| 80 |
# Therefore, we assume that we'll build SuperLU if we're not building shared libs. |
| 81 |
if(NOT FETK_STATIC_BUILD) |
| 82 |
find_package(SuperLU) |
| 83 |
endif() |
| 84 |
if(SuperLU_FOUND) |
| 85 |
set(BUILD_SUPERLU OFF) |
| 86 |
else() |
| 87 |
option(BUILD_SUPERLU "Flag to build SuperLU" ON) |
| 88 |
endif() |
| 89 |
if(BUILD_SUPERLU) |
| 90 |
message(STATUS "Will build SuperLU") |
| 91 |
endif() |
| 92 |
|
| 93 |
# ARPACK library |
| 94 |
find_package( ARPACK ) |
| 95 |
if(NOT ARPACK_FOUND) |
| 96 |
set(BUILD_ARPACK ON) |
| 97 |
else() |
| 98 |
option(BUILD_ARPACK "Flag to build ARPACK" OFF) |
| 99 |
### list(APPEND PUNC_EXT_LIBS ${ARPACK_LIBRARIES}) |
| 100 |
endif() |
| 101 |
if(BUILD_ARPACK) |
| 102 |
message(STATUS "Will build ARPACK") |
| 103 |
endif() |
| 104 |
|
| 105 |
# cgcode library |
| 106 |
# Will always build cgcode |
| 107 |
option(BUILD_CGCODE "Flag to build CGCODE" ON) |
| 108 |
if(BUILD_CGCODE) |
| 109 |
message(STATUS "Will build CGCODE") |
| 110 |
endif() |
| 111 |
|
| 112 |
# pmg library |
| 113 |
# Will always build pmg |
| 114 |
option(BUILD_PMG "Flag to build PMG" ON) |
| 115 |
if(BUILD_PMG) |
| 116 |
message(STATUS "Will build PMG") |
| 117 |
endif() |
| 118 |
|
| 119 |
################################################################################ |
| 120 |
# Ensure we have the MALOC library |
| 121 |
################################################################################ |
| 122 |
|
| 123 |
# maloc library |
| 124 |
if(NOT TARGET maloc) |
| 125 |
list(APPEND PUNC_EXT_LIBS maloc) |
| 126 |
else() |
| 127 |
list(APPEND PUNC_INT_LIBS maloc) |
| 128 |
endif() |
| 129 |
|
| 130 |
|
| 131 |
################################################################################ |
| 132 |
# Build PUNC |
| 133 |
################################################################################ |
| 134 |
|
| 135 |
add_subdirectory(src) |