From 0a0332d4e3330886b92fe3df36b0299ab22d9b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 8 Jun 2016 16:55:50 +0200 Subject: [PATCH] Recognize OPM-Flowdiagnostics as an OPM Module This enables using the OPM build system in the new module opm-flowdiagnostics. --- cmake/Modules/Findopm-flowdiagnostics.cmake | 49 +++++++++++++++++++ .../Modules/opm-flowdiagnostics-prereqs.cmake | 18 +++++++ 2 files changed, 67 insertions(+) create mode 100644 cmake/Modules/Findopm-flowdiagnostics.cmake create mode 100644 cmake/Modules/opm-flowdiagnostics-prereqs.cmake diff --git a/cmake/Modules/Findopm-flowdiagnostics.cmake b/cmake/Modules/Findopm-flowdiagnostics.cmake new file mode 100644 index 000000000..3f604ba9a --- /dev/null +++ b/cmake/Modules/Findopm-flowdiagnostics.cmake @@ -0,0 +1,49 @@ +# - Find OPM Flow Diagnostics Library +# +# Defines the following variables: +# opm-flowdiagnostics_INCLUDE_DIRS Directory of header files +# opm-flowdiagnostics_LIBRARIES Directory of shared object files +# opm-flowdiagnostics_DEFINITIONS Defines that must be set to compile +# opm-flowdiagnostics_CONFIG_VARS List of defines that should be in config.h +# HAVE_OPM_FLOWDIAGNOSTICS Binary value to use in config.h + +# Copyright (C) 2012 Uni Research AS +# This code is licensed under The GNU General Public License v3.0 + +# use the generic find routine +include (opm-flowdiagnostics-prereqs) + +include (OpmPackage) + +find_opm_package ( + # module name + "opm-flowdiagnostics" + + # dependencies + "${opm-flowdiagnostics_DEPS}" + + # header to search for + "opm/flowdiagnostics/reorder/tarjan.h" + + # library to search for + "opmflowdiagnostics" + + # defines to be added to compilations + "" + + # test program +"#include +int main() { + const int ia[] = { 0, 0, 1, 2, 4 }; + const int ja[] = { 0, 0, 1, 2 }; + int vert[4] = { 0 }; + int comp[4 + 1] = { 0 }; + int ncomp = 0 ; + int work[3 * 4] = { 0 }; + + tarjan(4, ia, ja, vert, comp, &ncomp, work); +} +" + # config variables + "${opm-flowdiagnostics_CONFIG_VAR}" + ) diff --git a/cmake/Modules/opm-flowdiagnostics-prereqs.cmake b/cmake/Modules/opm-flowdiagnostics-prereqs.cmake new file mode 100644 index 000000000..dc2f64a63 --- /dev/null +++ b/cmake/Modules/opm-flowdiagnostics-prereqs.cmake @@ -0,0 +1,18 @@ +# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*- +# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap: + +# defines that must be present in config.h for our headers +set (opm-flowdiagnostics_CONFIG_VAR + ) + +# dependencies +set (opm-flowdiagnostics_DEPS + # compile with C99 support if available + "C99" + # compile with C++0x/11 support if available + "CXX11Features REQUIRED" + "Boost 1.44.0 + COMPONENTS unit_test_framework REQUIRED" + # prerequisite OPM modules + "opm-common REQUIRED" + )