forked from febiosoftware/FEBio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindDependencies.cmake
172 lines (152 loc) · 6.02 KB
/
FindDependencies.cmake
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# MKL - On Unix the compilervars.sh should be run to find the MKL libraries.
if(DEFINED ENV{MKLROOT})
set(MKLROOT $ENV{MKLROOT} CACHE PATH "MKL root directory")
else()
if(WIN32)
set(MKLPATHS $ENV{ProgramFiles\(x86\)}/IntelSWTools $ENV{PROGRAMFILES}/Intel* $ENV{SystemDrive} $ENV{SystemDrive}/Intel*)
set(MKLSUFFIXES "compilers_and_libraries/windows" "oneapi")
elseif(APPLE)
set(MKLPATHS /opt/intel /intel /usr/local/intel /usr/local/opt/intel)
set(MKLSUFFIXES "compilers_and_libraries/mac" "oneapi")
else()
set(MKLPATHS /opt/intel /intel /usr/local/intel /usr/local/opt/intel $ENV{HOME}/intel $ENV{HOME}/*/intel)
set(MKLSUFFIXES "compilers_and_libraries/linux" "oneapi")
endif()
find_file(MKLROOT mkl
PATHS ${MKLPATHS}
PATH_SUFFIXES ${MKLSUFFIXES}
DOC "MKL root directory")
endif()
if(MKLROOT)
if(${MKLROOT} MATCHES "oneapi")
find_path(MKL_INC mkl.h
PATHS ${MKLROOT}/latest/include
DOC "MKL include directory")
find_library(MKL_CORE mkl_core
PATHS ${MKLROOT}/latest/lib
NO_DEFAULT_PATH)
find_library(MKL_OMP_LIB
NAMES iomp5 iomp5md libiomp5md.lib
PATHS ${MKLROOT}/../compiler/latest/*/compiler/lib
NO_DEFAULT_PATH
DOC "MKL OMP Library")
else()
find_path(MKL_INC mkl.h
PATHS ${MKLROOT}/include
DOC "MKL include directory")
find_library(MKL_CORE mkl_core
PATHS ${MKLROOT}/lib
PATH_SUFFIXES "intel64" "intel32"
NO_DEFAULT_PATH)
find_library(MKL_OMP_LIB
NAMES iomp5 iomp5md libiomp5md.lib
PATHS ${MKLROOT}/lib ${MKLROOT}/../lib ${MKLROOT}/../compiler/lib
PATH_SUFFIXES "intel64" "intel32"
NO_DEFAULT_PATH
DOC "MKL OMP Library")
endif()
if(MKL_CORE)
get_filename_component(MKL_TEMP ${MKL_CORE} DIRECTORY)
set(MKL_LIB_DIR ${MKL_TEMP} CACHE PATH "MKL Library directory")
unset(MKL_TEMP)
unset(MKL_CORE CACHE)
else()
set(MKL_LIB_DIR "MKL_LIB_DIR-NOTFOUND" CACHE PATH "MKL Library directory")
unset(MKL_CORE CACHE)
endif()
endif()
if(MKL_INC AND MKL_LIB_DIR AND MKL_OMP_LIB)
option(USE_MKL "Required for pardiso and iterative solvers" ON)
mark_as_advanced(MKL_INC MKL_LIB_DIR MKL_OMP_LIB)
set(OpenMP_C_FOUND true)
else()
option(USE_MKL "Required for pardiso and iterative solvers" OFF)
endif()
if(NOT USE_MKL AND NOT WIN32)
# OpenMP
find_package(OpenMP QUIET)
endif()
# HYPRE
if(WIN32)
find_path(HYPRE_INC HYPRE_IJ_mv.h
PATHS C::/Program\ Files/* $ENV{HOMEPATH}/* $ENV{HOMEPATH}/*/*
PATH_SUFFIXES "include" "include/hypre" "src" "src/include" "src/hypre/include"
DOC "HYPRE include directory")
find_library(HYPRE_LIB HYPRE
PATHS C::/Program\ Files/* $ENV{HOMEPATH}/* $ENV{HOMEPATH}/*/*
PATH_SUFFIXES "src" "src/build" "src/mbuild" "/src/vs2017/Release"
DOC "HYPRE library path")
else()
find_path(HYPRE_INC HYPRE_IJ_mv.h
PATHS /opt/hypre* $ENV{HOME}/* $ENV{HOME}/*/*
PATH_SUFFIXES "include" "include/hypre" "src" "src/include" "src/hypre/include"
DOC "HYPRE include directory")
find_library(HYPRE_LIB HYPRE
PATHS /opt/hypre* $ENV{HOME}/* $ENV{HOME}/*/*
PATH_SUFFIXES "src" "src/build" "src/cbuild"
DOC "HYPRE library path")
endif()
if(HYPRE_INC AND HYPRE_LIB)
option(USE_HYPRE "Required for HYPRE solver" ON)
mark_as_advanced(HYPRE_INC HYPRE_LIB)
else()
option(USE_HYPRE "Required for HYPRE solver" OFF)
mark_as_advanced(CLEAR HYPRE_INC HYPRE_LIB)
endif()
# MMG
if(WIN32)
find_path(MMG_INC mmg/mmg3d/libmmg3d.h
PATHS C::/Program\ Files/* $ENV{HOMEPATH}/* $ENV{HOMEPATH}/*/* $ENV{HOMEPATH}/source/repos/*
PATH_SUFFIXES "include" "include/mmg*" "src" "build" "build/include" "cmbuild/include"
DOC "MMG include directory")
find_library(MMG_LIB mmg3d
PATHS C::/Program\ Files/* $ENV{HOMEPATH}/* $ENV{HOMEPATH}/*/* $ENV{HOMEPATH}/source/repos/*
PATH_SUFFIXES "build/lib" "cmbuild/lib" "src/build/lib" "src/cmbuild/lib" "cmbuild/lib/Release"
DOC "MMG library path")
else()
find_path(MMG_INC mmg/mmg3d/libmmg3d.h
PATHS /opt/hypre* $ENV{HOME}/* $ENV{HOME}/*/*
PATH_SUFFIXES "include" "include/mmg" "build" "build/include" "cbuild" "cbuild/include" "src"
DOC "MMG include directory")
find_library(MMG_LIB mmg3d
PATHS /opt/mmg* $ENV{HOME}/* $ENV{HOME}/*/*
PATH_SUFFIXES "build/lib" "cbuild/lib" "src/build/lib" "src/cbuild/lib"
DOC "MMG library path")
endif()
if(MMG_INC AND MMG_LIB)
option(USE_MMG "Required for MMG use" ON)
mark_as_advanced(MMG_INC MMG_LIB)
else()
option(USE_MMG "Required for MMG use" OFF)
mark_as_advanced(CLEAR MMG_INC MMG_LIB)
endif()
# LEVMAR
if(WIN32)
find_path(LEVMAR_INC levmar.h PATHS C::/Program\ Files/* $ENV{HOMEPATH}/* $ENV{HOMEPATH}/*/*
DOC "Levmar include directory")
find_library(LEVMAR_LIB levmar PATHS C::/Program\ Files/* $ENV{HOMEPATH}/* $ENV{HOMEPATH}/*/*
PATH_SUFFIXES "vs2017/Release"
DOC "Levmar library path")
else()
find_path(LEVMAR_INC levmar.h PATHS /usr/local/ /opt/levmar* $ENV{HOME}/* $ENV{HOME}/*/*
DOC "Levmar include directory")
find_library(LEVMAR_LIB levmar PATHS /usr/local/ /opt/levmar* $ENV{HOME}/* $ENV{HOME}/*/*
PATH_SUFFIXES "build" "cbuild" "cmbuild"
DOC "Levmar library path")
endif()
if(LEVMAR_INC AND LEVMAR_LIB)
option(USE_LEVMAR "Required for optimization in FEBio" ON)
mark_as_advanced(LEVMAR_INC LEVMAR_LIB)
else()
option(USE_LEVMAR "Required for optimization in FEBio" OFF)
mark_as_advanced(CLEAR LEVMAR_INC LEVMAR_LIB)
endif()
# ZLIB
include(FindZLIB)
if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY_RELEASE)
option(USE_ZLIB "Required for compressing xplt files" ON)
mark_as_advanced(ZLIB_INCLUDE_DIR ZLIB_LIBRARY_RELEASE)
else()
option(USE_ZLIB "Required for compressing xplt files" OFF)
mark_as_advanced(CLEAR ZLIB_INCLUDE_DIR ZLIB_LIBRARY_RELEASE)
endif()