]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add CMake detection for Adol-C
authorJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 11 Aug 2017 09:10:15 +0000 (03:10 -0600)
committerMatthias Maier <tamiko@43-1.org>
Sun, 13 Aug 2017 16:20:11 +0000 (11:20 -0500)
cmake/configure/configure_adolc.cmake [new file with mode: 0644]
cmake/modules/FindADOLC.cmake [new file with mode: 0644]

diff --git a/cmake/configure/configure_adolc.cmake b/cmake/configure/configure_adolc.cmake
new file mode 100644 (file)
index 0000000..2a075ea
--- /dev/null
@@ -0,0 +1,27 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2017 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# Configuration for the ADOL-C library:
+#
+
+
+MACRO(FEATURE_ADOLC_CONFIGURE_EXTERNAL)
+  SET(DEAL_II_ADOLC_WITH_ATRIG_ERF ${ADOLC_WITH_ATRIG_ERF})
+  SET(DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING ${ADOLC_WITH_ADVANCED_BRANCHING})
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(ADOLC)
diff --git a/cmake/modules/FindADOLC.cmake b/cmake/modules/FindADOLC.cmake
new file mode 100644 (file)
index 0000000..c216dc5
--- /dev/null
@@ -0,0 +1,85 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2016 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+# Note: This file is adapted from https://raw.githubusercontent.com/joaoleal/CppADCodeGen/master/cmake/FindADOLC.cmake
+
+#
+# - Try to find Adolc
+#
+# This module exports
+#
+#   ADOLC_INCLUDE_DIR
+#   ADOLC_LIBRARY
+#   ADOLC_WITH_ATRIG_ERF
+#   ADOLC_WITH_ADVANCED_BRANCHING
+#
+
+SET(ADOLC_DIR "" CACHE PATH "An optional hint to an ADOL-C installation")
+SET_IF_EMPTY(ADOLC_DIR "$ENV{ADOLC_DIR}")
+
+DEAL_II_FIND_PATH(ADOLC_INCLUDE_DIR
+  NAMES adolc/adolc.h
+  HINTS ${ADOLC_DIR}
+  PATH_SUFFIXES include
+  )
+
+DEAL_II_FIND_LIBRARY(ADOLC_LIBRARY
+  NAMES adolc
+  HINTS ${ADOLC_DIR}
+  PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
+  )
+
+#
+# Look for adolc_settings.h - we'll query it to determine supported features:
+#
+
+DEAL_II_FIND_FILE(ADOLC_SETTINGS_H adolc_settings.h
+  HINTS ${ADOLC_INCLUDE_DIR} "${ADOLC_INCLUDE_DIR}/adolc/internal"
+  NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH
+  NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH
+  )
+
+IF(EXISTS ${ADOLC_SETTINGS_H})
+  #
+  # Check whether ADOL-C is configured with extra trig functions
+  #
+  FILE(STRINGS "${ADOLC_SETTINGS_H}" ADOLC_ATRIG_ERF_STRING
+    REGEX "#define ATRIG_ERF"
+    )
+  IF(NOT "${ADOLC_ATRIG_ERF_STRING}" STREQUAL "")
+    SET(ADOLC_WITH_ATRIG_ERF TRUE)
+  ELSE()
+    SET(ADOLC_WITH_ATRIG_ERF FALSE)
+  ENDIF()
+
+  #
+  # Check whether ADOL-C is configured with advanced branching
+  #
+  FILE(STRINGS "${ADOLC_SETTINGS_H}" ADOLC_ADVANCED_BRANCHING_STRING
+    REGEX "#define ADOLC_ADVANCED_BRANCHING"
+    )
+  IF(NOT "${ADOLC_ADVANCED_BRANCHING_STRING}" STREQUAL "")
+    SET(ADOLC_WITH_ADVANCED_BRANCHING TRUE)
+  ELSE()
+    SET(ADOLC_WITH_ADVANCED_BRANCHING FALSE)
+  ENDIF()
+ENDIF()
+
+
+DEAL_II_PACKAGE_HANDLE(ADOLC
+  LIBRARIES REQUIRED ADOLC_LIBRARY
+  INCLUDE_DIRS REQUIRED ADOLC_INCLUDE_DIR
+  CLEAR ADOLC_INCLUDE_DIR ADOLC_LIBRARY ADOLC_SETTINGS_H
+  )

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.