-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
139 lines (114 loc) · 4.69 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
#
# A) Define the package
#
TRIBITS_PACKAGE(TriKota DISABLE_STRONG_WARNINGS)
#
# B) Set up package-specific options
#
#TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DEBUG
# TRIKOTA_DEBUG
# "Build with Debug mode."
# OFF )
# If TriBITS is disabling the install of libraries, we need
IF (NOT ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS AND NOT BUILD_SHARED_LIBS)
SET(DAKOTA_SKIP_LIB_AND_HEADER_INSTALLS TRUE)
ENDIF()
#
# C) Add the libraries, tests, and examples
#
# We build Dakota with CMake. This works by making Dakota appear as a
# subdirectory of TriKota (as TriKota/Dakota/). This gives you
# complete control of the Dakota configure through your Trilinos
# configure scripts, makes it much easier to rebuild Dakota after
# updates, and is much faster.
#
# Currently Dakota does its own checking for libraries such as blas,
# lapack, boost, mpi, etc... which ultimately we would want to pass in.
# Check for Dakota source
IF (NOT EXISTS ${PACKAGE_SOURCE_DIR}/Dakota/CMakeLists.txt)
MESSAGE(FATAL_ERROR "\nTriKota Fatal Error: Dakota needs to
be untarred into TriKota/Dakota before running cmake!")
ENDIF()
# DAKOTA should follow Trilinos MPI configuration
IF(TPL_ENABLE_MPI)
SET(DAKOTA_HAVE_MPI ON CACHE BOOL "DAKOTA MPI set by Trilinos")
ENDIF()
# Tell DAKOTA (and all sub-packages) to use PROJECT_NAME, e.g.,
# Trilinos or VERA for export targets. For a non TriBITS system
# would instead want CMAKE_PROJECT_NAME
SET(ExportTarget ${PACKAGE_NAME} CACHE STRING
"Name for the export target for ${PACKAGE_NAME}"
)
message(STATUS "TriKota setting ExportTarget=${ExportTarget}")
# Tell Dakota it is building inside Trilinos
# (affects use of Teuchos and exported lists of includes and libs)
SET(BUILD_IN_TRILINOS ON)
# Work around what appears to be a limitation in FindBoost.cmake and
# minimize chance Trilinos and DAKOTA pick up different Boost versions
# (Boost_INCLUDE_DIRS doesn't seem to work as expected)
# This may fail is Boost_INCLUDE_DIRS contains a list of DIRS!
# Could consider mapping BoostLib_LIBRARY_DIRS to Boost_LIBRARY_DIRS as well
IF(TPL_ENABLE_Boost)
IF(Boost_INCLUDE_DIRS)
SET(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIRS} CACHE FILEPATH
"Boost include directory set by TriKota")
ENDIF()
ENDIF()
# Convey BLAS/LAPACK settings from TriBITS to Dakota.
# This may not suffice if other link directories are also needed.
IF(TPL_BLAS_LIBRARIES)
SET(BLAS_LIBS "${TPL_BLAS_LIBRARIES}")
ENDIF()
IF(TPL_LAPACK_LIBRARIES)
SET(LAPACK_LIBS "${TPL_LAPACK_LIBRARIES}")
ENDIF()
# Turn off a bunch of Dakota non-TriBITS-compliant tests when building
# Dakota under Trilinos/TriKota. Until these tests can be prefixed with
# TriKota_ and given the correct label there is no reason to enable them
# because they will not be run in automated testing. However, allow users
# to enable them if they would really like.
SET(DAKOTA_ENABLE_TESTS OFF CACHE BOOL "")
SET(DAKOTA_ENABLE_TPL_TESTS OFF CACHE BOOL "")
# The following packages likely need to be disabled via
# -D HAVE_X=OFF, where X is:
# ACRO, HOPSPACK, AMPL
# ACRO requires boost_signals library component.
# HOPSPACK may not link correctly in static builds.
# Turning AMPL on caused very strange runtime errors.
# I don't know how to turn these off by default.
SET(HAVE_ACRO OFF CACHE BOOL "")
SET(HAVE_AMPL OFF CACHE BOOL "")
SET(HAVE_HOPSPACK OFF CACHE BOOL "")
SET(HAVE_ROL OFF CACHE BOOL
"TriKota/Dakota/ROL disabled due to circular dependence.")
SET(HAVE_X_GRAPHICS OFF CACHE BOOL "") # explicit default
# Instruct DAKOTA to install its non-standard content to alternate locations
# (These are explicit defaults with Dakota 6.8 and newer)
SET(DAKOTA_EXAMPLES_INSTALL share/dakota CACHE FILEPATH
"Installation destination for DAKOTA examples/ dir")
SET(DAKOTA_TEST_INSTALL share/dakota CACHE FILEPATH
"Installation destination for DAKOTA test/ dir")
SET(DAKOTA_TOPFILES_INSTALL share/dakota CACHE FILEPATH
"Installation destination for DAKOTA top-level files")
SET(DAKOTA_INSTALL_DYNAMIC_DEPS FALSE CACHE BOOL
"TriKota: not installing Dakota dynamic dependencies")
# Configure Dakota and its packages
MESSAGE("-->TriKota: Configuring Dakota using CMake")
ADD_SUBDIRECTORY(Dakota)
MESSAGE("<--TriKota: Finished Dakota configure.")
# Put all of Dakota's compile line defines in TriKota_config.h which
# expands @DAKOTA_DEFINES@
GET_PROPERTY(DAKOTA_DEFS DIRECTORY Dakota/src PROPERTY COMPILE_DEFINITIONS)
SET(DAKOTA_DEFINES "")
FOREACH(DAKOTA_DEF IN LISTS DAKOTA_DEFS)
IF(DAKOTA_DEF)
SET(DAKOTA_DEFINES "${DAKOTA_DEFINES}#define ${DAKOTA_DEF}\n")
ENDIF()
ENDFOREACH()
ADD_SUBDIRECTORY(src)
TRIBITS_ADD_TEST_DIRECTORIES(test)
#TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)
#
# D) Do standard postprocessing
#
TRIBITS_PACKAGE_POSTPROCESS()