forked from ORNL-CEES/DataTransferKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
175 lines (137 loc) · 6.42 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
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
173
174
175
##---------------------------------------------------------------------------##
## DataTransferKit/CMakeLists.txt
## Stuart R. Slattery
##---------------------------------------------------------------------------##
## TriBITS package file for the DataTransferKit package
##---------------------------------------------------------------------------##
##---------------------------------------------------------------------------##
## Define the package
##---------------------------------------------------------------------------##
TRIBITS_PACKAGE(DataTransferKit)
TRIBITS_ADD_DEBUG_OPTION()
TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()
##---------------------------------------------------------------------------##
## Explicit template instantiation
##---------------------------------------------------------------------------##
# Setup the same ETI as Tpetra but do not set global ordinal types as
# additional scalar types.
# check tpetra variables are defined.
ASSERT_DEFINED(TpetraCore_ETI_SCALARS)
ASSERT_DEFINED(TpetraCore_ETI_LORDS)
ASSERT_DEFINED(TpetraCore_ETI_GORDS)
ASSERT_DEFINED(TpetraCore_ETI_NODES)
# set the eti types
SET (${PACKAGE_NAME}_ETI_SCALARS_TEMP ) # start with the empty list
FOREACH (scalarName IN LISTS TpetraCore_ETI_SCALARS)
LIST (FIND TpetraCore_ETI_GORDS ${scalarName} scalarNameIndex)
IF (-1 EQUAL scalarNameIndex) # not in the list of integer types
LIST (APPEND ${PACKAGE_NAME}_ETI_SCALARS_TEMP ${scalarName})
ENDIF ()
ENDFOREACH ()
SET(${PACKAGE_NAME}_ETI_SCALARS ${${PACKAGE_NAME}_ETI_SCALARS_TEMP})
SET(${PACKAGE_NAME}_ETI_LORDS ${TpetraCore_ETI_LORDS})
SET(${PACKAGE_NAME}_ETI_GORDS ${TpetraCore_ETI_GORDS})
SET(${PACKAGE_NAME}_ETI_NODES ${TpetraCore_ETI_NODES})
# make the eti variables globally accessible
GLOBAL_SET(${PACKAGE_NAME}_ETI_SCALARS ${${PACKAGE_NAME}_ETI_SCALARS})
GLOBAL_SET(${PACKAGE_NAME}_ETI_LORDS ${${PACKAGE_NAME}_ETI_LORDS})
GLOBAL_SET(${PACKAGE_NAME}_ETI_GORDS ${${PACKAGE_NAME}_ETI_GORDS})
GLOBAL_SET(${PACKAGE_NAME}_ETI_NODES ${${PACKAGE_NAME}_ETI_NODES})
##---------------------------------------------------------------------------##
## ETI
##---------------------------------------------------------------------------##
INCLUDE(TribitsETISupport)
TRIBITS_ADD_EXPLICIT_INSTANTIATION_OPTION()
TRIBITS_ADD_ETI_SUPPORT()
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION
HAVE_DATATRANSFERKIT_EXPLICIT_INSTANTIATION
"Enable explicit template instantiation (ETI) in DTK"
${${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION}
)
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/ETI.cmake")
##---------------------------------------------------------------------------##
## Set the path to the DTKData directory.
##---------------------------------------------------------------------------##
# Search for one of the mesh files in the DTKData directory
find_file(DTK_DATA_MESH_FILE cube_mesh.exo PATHS
${${PACKAGE_NAME}_SOURCE_DIR}/data/exodus
${${PACKAGE_NAME}_SOURCE_DIR}/DTKData/exodus
NO_DEFAULT_PATH
)
if(DTK_DATA_MESH_FILE)
# Get the location of the mesh file
get_filename_component(DTK_DATA_DIR ${DTK_DATA_MESH_FILE} DIRECTORY)
# Strip "/exodus" from the path
string(REGEX REPLACE "/exodus" "" DTK_DATA_DIR ${DTK_DATA_DIR})
message("-- DTKData found at ${DTK_DATA_DIR}")
else()
set(DTK_DATA_DIR DTK_DATA_DIR-NOTFOUND)
message("-- DTKData NOT found")
endif()
##---------------------------------------------------------------------------##
## Print the revision number to stdout
##---------------------------------------------------------------------------##
FIND_PACKAGE(Git)
IF(GIT_FOUND AND EXISTS ${${PACKAGE_NAME}_SOURCE_DIR}/.git)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} log --pretty=format:%H -n 1
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE ${PACKAGE_NAME}_GIT_COMMIT_HASH
)
ELSE()
SET(${PACKAGE_NAME}_GIT_COMMIT_HASH "Not a git repository")
ENDIF()
MESSAGE("DTK Revision = '${${PACKAGE_NAME}_GIT_COMMIT_HASH}'")
# Design-by-Contract
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_ENABLE_DBC
HAVE_DTK_DBC
"Enable Design-by-Contract checks. WARNING: use for debug checking but disable for production runs as it incurs a significant overhead."
${${PROJECT_NAME}_ENABLE_DEBUG}
)
##---------------------------------------------------------------------------##
## Set extra parameters (before calling CONFIGURE_FILE)
##---------------------------------------------------------------------------##
IF( HAVE_DATATRANSFERKIT_BOOSTORG )
GLOBAL_SET( HAVE_DTK_BOOST TRUE )
ENDIF()
# Check for netcdf so we can use it in the tests.
IF( HAVE_DATATRANSFERKIT_NETCDF )
GLOBAL_SET( HAVE_DTK_NETCDF TRUE )
ENDIF()
##---------------------------------------------------------------------------##
## Do standard postprocessing
##---------------------------------------------------------------------------##
INCLUDE(${PACKAGE_SOURCE_DIR}/Version.cmake)
TRIBITS_CONFIGURE_FILE(${PACKAGE_NAME}_config.hpp)
ADD_SUBDIRECTORY(packages)
TRIBITS_PACKAGE_POSTPROCESS()
##---------------------------------------------------------------------------##
## Check C++ code style using clang-format
##---------------------------------------------------------------------------##
IF(${PACKAGE_NAME}_ENABLE_ClangFormat)
INCLUDE(CodeFormat)
ENDIF()
##---------------------------------------------------------------------------##
## Build the documentation published on http://datatransferkit.readthedocs.org
##---------------------------------------------------------------------------##
IF(${PACKAGE_NAME}_ENABLE_ReadTheDocs)
ADD_SUBDIRECTORY(docs)
ENDIF()
##---------------------------------------------------------------------------##
## Generate the Doxygen documentation
##---------------------------------------------------------------------------##
IF(${PACKAGE_NAME}_ENABLE_Doxygen)
ADD_SUBDIRECTORY(docs/doxygen)
ENDIF()
##---------------------------------------------------------------------------##
## Generate a .ycm_extra_conf.py file for use with YouCompleteMe
##---------------------------------------------------------------------------##
IF(${PACKAGE_NAME}_ENABLE_YouCompleteMe)
INCLUDE(CodeCompletion)
ENDIF()
##---------------------------------------------------------------------------##
## end of DataTransferKit/CMakeLists.txt
##---------------------------------------------------------------------------##