forked from nomad-coe/greenX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
97 lines (79 loc) · 3.18 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# This file is distributed under the terms of the APACHE2 License.
# GreenX Top-level CMakeLists.txt
#
# CMake Variable Descriptions
# PROJECT_BINARY_DIR: Build directory of the most-recent project() command
# CMAKE_BINARY_DIR: Full path to the top level of the current CMake build tree
cmake_minimum_required(VERSION 3.15.0)
project(greenX
LANGUAGES Fortran
VERSION 0.0.1
)
#To use the Intel MKL implementation of BLAS, a project must enable at least one of the C or CXX languages.
enable_language(CXX)
# Set folder structure for build directory
set(CMAKE_Fortran_BIN_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_Fortran_LIB_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
# Note, this will put modules of each library in <BUILD_DIR>/modules
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/modules)
# Define GNU standard installation directories
include(GNUInstallDirs)
# CMake module directory
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Defines build type
include(cmake/StandardProjectSettings.cmake)
# Compiler flags
include(cmake/CompilerFlags.cmake)
# Compiler warnings
include(cmake/CompilerWarnings.cmake)
# External libraries
# Note, for Blas and Lapack, this is also able to find vendor-specific versions:
# https://cmake.org/cmake/help/v3.15/module/FindBLAS.html
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
# Python required for application testing
include(cmake/python3.cmake)
find_package(Python3 3.7 COMPONENTS Interpreter Development)
if(Python3_FOUND)
message("-- Python 3 interpreter version: " ${Python3_VERSION})
else()
message("-- Python 3 interpreter not found")
endif()
# Enable ctest
enable_testing()
# Application test python module
# Note, pygreenx dependencies should be handled pygreenx
# pygreenx version specified in its setup.cfg
find_python_module(pygreenx VERSION 0.0.1)
if (NOT pygreenx_FOUND)
message("-- pygreenx is required for application testing. To install it, cd <PROJECTROOT>/python and run `pip install -e .`")
endif ()
# Optional unit testing lib
option(ENABLE_UNITTESTS "Enable GreenX Unit Testing" OFF)
if (${ENABLE_UNITTESTS})
# Function for generating unit test executables (assumes Zofu)
include(cmake/unit_test_functions.cmake)
# Calling find_package is equivalent to: include(cmake/Findzofu.cmake)
find_package(zofu REQUIRED)
endif()
# Our library directories
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
add_subdirectory(GX-AnalyticContinuation)
add_subdirectory(GX-common)
add_subdirectory(GX-TimeFrequency)
# Documentation
option(ENABLE_DOCS "Enable documentation" OFF)
if (${ENABLE_DOCS})
find_program(DOXYGEN doxygen REQUIRED)
message("-- Doxygen documentation support enabled.")
set(doxy_output "documentation")
file(MAKE_DIRECTORY ${doxy_output})
add_custom_target(docs COMMAND ${DOXYGEN} ${PROJECT_SOURCE_DIR}/Doxyfile)
endif ()
# Set installation location
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(default_install_prefix "${PROJECT_SOURCE_DIR}/install")
set(CMAKE_INSTALL_PREFIX ${default_install_prefix}
CACHE STRING "Choose the installation directory. Default location is ${default_install_prefix}"
FORCE)
endif()