1
1
#
2
- # Copyright (c) 2017, Lawrence Livermore National Security, LLC.
3
- # Produced at the Lawrence Livermore National Laboratory.
4
- # Written by Slaven Peles <[email protected] >.
5
- # LLNL-CODE-718378.
6
- # All rights reserved.
2
+ # Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the
3
+ # Lawrence Livermore National Laboratory. Written by Slaven Peles
4
+ # <[email protected] >. LLNL-CODE-718378. All rights reserved.
7
5
#
8
- # This file is part of GridKit™. For details, see github.com/LLNL/GridKit
9
- # Please also read the LICENSE file.
6
+ # This file is part of GridKit™. For details, see github.com/LLNL/GridKit Please
7
+ # also read the LICENSE file.
10
8
#
11
9
# Redistribution and use in source and binary forms, with or without
12
- # modification, are permitted provided that the following conditions are met:
13
- # - Redistributions of source code must retain the above copyright notice,
14
- # this list of conditions and the disclaimer below.
15
- # - Redistributions in binary form must reproduce the above copyright notice,
16
- # this list of conditions and the disclaimer (as noted below) in the
17
- # documentation and/or other materials provided with the distribution.
18
- # - Neither the name of the LLNS/LLNL nor the names of its contributors may
19
- # be used to endorse or promote products derived from this software without
20
- # specific prior written permission.
10
+ # modification, are permitted provided that the following conditions are met: -
11
+ # Redistributions of source code must retain the above copyright notice, this
12
+ # list of conditions and the disclaimer below. - Redistributions in binary form
13
+ # must reproduce the above copyright notice, this list of conditions and the
14
+ # disclaimer (as noted below) in the documentation and/or other materials
15
+ # provided with the distribution. - Neither the name of the LLNS/LLNL nor the
16
+ # names of its contributors may be used to endorse or promote products derived
17
+ # from this software without specific prior written permission.
21
18
#
22
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23
- # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
- # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
- # DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL
27
- # SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE
28
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
29
- # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30
- # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32
- # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
- # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY
34
- # WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
35
- # THE POSSIBILITY OF SUCH DAMAGE.
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ # DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE
23
+ # U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ # NEGLIGENCE OR OTHERWISE) ARISINGIN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
30
#
37
31
# Lawrence Livermore National Laboratory is operated by Lawrence Livermore
38
- # National Security, LLC, for the U.S. Department of Energy, National
39
- # Nuclear Security Administration under Contract DE-AC52-07NA27344.
32
+ # National Security, LLC, for the U.S. Department of Energy, National Nuclear
33
+ # Security Administration under Contract DE-AC52-07NA27344.
40
34
#
41
- # This document was prepared as an account of work sponsored by an agency
42
- # of the United States government. Neither the United States government nor
43
- # Lawrence Livermore National Security, LLC, nor any of their employees
44
- # makes any warranty, expressed or implied, or assumes any legal liability
45
- # or responsibility for the accuracy, completeness, or usefulness of any
46
- # information, apparatus, product, or process disclosed, or represents that
47
- # its use would not infringe privately owned rights. Reference herein to
48
- # any specific commercial product, process, or service by trade name,
49
- # trademark, manufacturer, or otherwise does not necessarily constitute or
50
- # imply its endorsement, recommendation, or favoring by the United States
51
- # government or Lawrence Livermore National Security, LLC. The views and
52
- # opinions of authors expressed herein do not necessarily state or reflect
53
- # those of the United States government or Lawrence Livermore National
54
- # Security, LLC, and shall not be used for advertising or product
55
- # endorsement purposes.
35
+ # This document was prepared as an account of work sponsored by an agency of the
36
+ # United States government. Neither the United States government nor Lawrence
37
+ # Livermore National Security, LLC, nor any of their employees makes any
38
+ # warranty, expressed or implied, or assumes any legal liability or
39
+ # responsibility for the accuracy, completeness, or usefulness of any
40
+ # information, apparatus, product, or process disclosed, or represents that its
41
+ # use would not infringe privately owned rights. Reference herein to any
42
+ # specific commercial product, process, or service by trade name, trademark,
43
+ # manufacturer, or otherwise does not necessarily constitute or imply its
44
+ # endorsement, recommendation, or favoring by the United States government or
45
+ # Lawrence Livermore National Security, LLC. The views and opinions of authors
46
+ # expressed herein do not necessarily state or reflect those of the United
47
+ # States government or Lawrence Livermore National Security, LLC, and shall not
48
+ # be used for advertising or product endorsement purposes.
56
49
#
57
- #
58
- # [[
59
- # Author(s):
60
- # - Cameron Rutherford <[email protected] >
61
- # - Slaven Peles <[email protected] >
62
- # ]]
50
+ # [[ Author(s): - Cameron Rutherford <[email protected] > - Slaven
51
+
63
52
64
53
cmake_minimum_required (VERSION 3.12)
65
54
@@ -73,7 +62,9 @@ set(PACKAGE_VERSION_MAJOR "0")
73
62
set (PACKAGE_VERSION_MINOR "0" )
74
63
set (PACKAGE_VERSION_PATCH "7" )
75
64
76
- set (PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR} .${PACKAGE_VERSION_MINOR} .${PACKAGE_VERSION_PATCH} " )
65
+ set (PACKAGE_VERSION
66
+ "${PACKAGE_VERSION_MAJOR} .${PACKAGE_VERSION_MINOR} .${PACKAGE_VERSION_PATCH} "
67
+ )
77
68
78
69
# Ipopt support is disabled by default
79
70
option (GRIDKIT_ENABLE_IPOPT "Enable Ipopt support" OFF )
@@ -82,7 +73,8 @@ option(GRIDKIT_ENABLE_IPOPT "Enable Ipopt support" OFF)
82
73
option (GRIDKIT_ENABLE_SUNDIALS "Enable SUNDIALS support" ON )
83
74
84
75
# Enable KLU
85
- option (GRIDKIT_ENABLE_SUNDIALS_SPARSE "Enable SUNDIALS sparse linear solvers" ON )
76
+ option (GRIDKIT_ENABLE_SUNDIALS_SPARSE "Enable SUNDIALS sparse linear solvers"
77
+ ON )
86
78
87
79
# Enzyme support is disabled by default
88
80
option (GRIDKIT_ENABLE_ENZYME "Enable automatic differentiation with Enzyme" OFF )
@@ -95,23 +87,23 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
95
87
# use, i.e. don't skip the full RPATH for the build tree
96
88
set (CMAKE_SKIP_BUILD_RPATH FALSE )
97
89
98
- # when building, don't use the install RPATH already
99
- # (but later on when installing)
90
+ # when building, don't use the install RPATH already (but later on when
91
+ # installing)
100
92
set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE )
101
93
102
94
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX} /lib" )
103
95
104
- # add the automatically determined parts of the RPATH
105
- # which point to directories outside the build tree to the install RPATH
96
+ # add the automatically determined parts of the RPATH which point to directories
97
+ # outside the build tree to the install RPATH
106
98
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
107
99
108
100
# the RPATH to be used when installing, but only if it's not a system directory
109
- list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX} /lib" isSystemDir)
101
+ list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
102
+ "${CMAKE_INSTALL_PREFIX} /lib" isSystemDir)
110
103
if ("${isSystemDir} " STREQUAL "-1" )
111
- set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX} /lib" )
104
+ set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX} /lib" )
112
105
endif ("${isSystemDir} " STREQUAL "-1" )
113
106
114
-
115
107
# TODO: Probably beter to set a debug interface target
116
108
set (CMAKE_CXX_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG" )
117
109
@@ -127,9 +119,14 @@ if(GRIDKIT_ENABLE_IPOPT)
127
119
enable_language (Fortran) # Needed for linking to HSL
128
120
endif ()
129
121
if (GRIDKIT_ENABLE_SUNDIALS)
130
- find_package (SUNDIALS 7.0.0 REQUIRED CONFIG
131
- PATHS ${SUNDIALS_DIR}
132
- ${SUNDIALS_DIR} /lib/cmake/sundials)
122
+ find_package (
123
+ SUNDIALS
124
+ 7.0.0
125
+ REQUIRED
126
+ CONFIG
127
+ PATHS
128
+ ${SUNDIALS_DIR}
129
+ ${SUNDIALS_DIR} /lib/cmake/sundials)
133
130
message (STATUS "SUNDIALS configuration found: ${SUNDIALS_CONFIG} " )
134
131
endif ()
135
132
if (GRIDKIT_ENABLE_SUNDIALS_SPARSE)
@@ -151,11 +148,13 @@ add_subdirectory(src)
151
148
enable_testing ()
152
149
add_subdirectory (examples)
153
150
add_subdirectory (tests)
154
-
155
- export (EXPORT gridkit-targets FILE ${CMAKE_CURRENT_BINARY_DIR} /GridKitTargets.cmake)
151
+
152
+ export (EXPORT gridkit-targets
153
+ FILE ${CMAKE_CURRENT_BINARY_DIR} /GridKitTargets.cmake)
156
154
157
155
# Configuring exporting cmake config
158
- install (EXPORT gridkit-targets
156
+ install (
157
+ EXPORT gridkit-targets
159
158
FILE GridKitTargets.cmake
160
159
NAMESPACE GRIDKIT::
161
160
DESTINATION share/cmake/gridkit)
@@ -169,14 +168,13 @@ write_basic_package_version_file(
169
168
COMPATIBILITY SameMajorVersion)
170
169
171
170
# Generate config file that includes exports
172
- configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR} /cmake/Config.cmake.in
171
+ configure_package_config_file(
172
+ ${CMAKE_CURRENT_SOURCE_DIR} /cmake/Config.cmake.in
173
173
${CMAKE_CURRENT_BINARY_DIR} /GridKitConfig.cmake
174
174
INSTALL_DESTINATION share/cmake/gridkit
175
- NO_SET_AND_CHECK_MACRO
176
- NO_CHECK_REQUIRED_COMPONENTS_MACRO)
175
+ NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
177
176
178
177
# Install configuration file
179
- install (FILES
180
- ${CMAKE_CURRENT_BINARY_DIR} /GridKitConfig.cmake
181
- ${CMAKE_CURRENT_BINARY_DIR} /GridKitConfigVersion.cmake
182
- DESTINATION share/cmake/gridkit)
178
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} /GridKitConfig.cmake
179
+ ${CMAKE_CURRENT_BINARY_DIR} /GridKitConfigVersion.cmake
180
+ DESTINATION share/cmake/gridkit)
0 commit comments