mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1371 Removed opm-common and opm-parser
This commit is contained in:
parent
e1ca217422
commit
d038ea7581
27
ThirdParty/custom-opm-common/CMakeLists.txt
vendored
27
ThirdParty/custom-opm-common/CMakeLists.txt
vendored
@ -1,27 +0,0 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
project (custom-opm-common)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opm-common
|
||||
)
|
||||
|
||||
#include(opm-common/CMakeLists_files.cmake)
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
opm-common/opm/common/data/SimulationDataContainer.cpp
|
||||
opm-common/opm/common/OpmLog/CounterLog.cpp
|
||||
opm-common/opm/common/OpmLog/EclipsePRTLog.cpp
|
||||
opm-common/opm/common/OpmLog/LogBackend.cpp
|
||||
opm-common/opm/common/OpmLog/Logger.cpp
|
||||
opm-common/opm/common/OpmLog/LogUtil.cpp
|
||||
opm-common/opm/common/OpmLog/OpmLog.cpp
|
||||
opm-common/opm/common/OpmLog/StreamLog.cpp
|
||||
opm-common/opm/common/OpmLog/TimerLog.cpp
|
||||
)
|
||||
|
||||
add_library( ${PROJECT_NAME}
|
||||
STATIC
|
||||
${MAIN_SOURCE_FILES}
|
||||
)
|
||||
|
@ -1,46 +0,0 @@
|
||||
# editor backup files
|
||||
*~
|
||||
.\#*
|
||||
\#*\#
|
||||
.\#*\#
|
||||
|
||||
# compiler output
|
||||
*.o
|
||||
*.mod
|
||||
|
||||
# libtool compatible files
|
||||
*.lo
|
||||
*.la
|
||||
|
||||
# Eclipse project settings
|
||||
.cproject
|
||||
.project
|
||||
.settings/*
|
||||
|
||||
# QtCreator project settings
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# in-tree build with CMake
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
cmake_install.cmake
|
||||
config.h
|
||||
opm-core-config.cmake
|
||||
opm-core-config-version.cmake
|
||||
opm-core-install.cmake
|
||||
Makefile
|
||||
bin/
|
||||
lib/
|
||||
Doxyfile
|
||||
Documentation/html
|
||||
dune.module
|
||||
*.pc
|
||||
install_manifest.txt
|
||||
|
||||
# testing framework
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
Testing/
|
||||
|
||||
# Build directory in source.
|
||||
build/
|
@ -1,30 +0,0 @@
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- boost-latest
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- libboost1.55-all-dev
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- gfortran-4.8
|
||||
- liblapack-dev
|
||||
- libgmp3-dev
|
||||
- libsuitesparse-dev
|
||||
- libeigen3-dev
|
||||
|
||||
before_script:
|
||||
- export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8"
|
||||
- cd ..
|
||||
- opm-common/travis/build-prereqs.sh
|
||||
- opm-common/travis/clone-opm.sh opm-common
|
||||
|
||||
|
||||
script: opm-common/travis/build-and-test.sh opm-common
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
||||
set(OPM_MACROS_ROOT ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# not the same location as most of the other projects; this hook overrides
|
||||
macro (dir_hook)
|
||||
endmacro (dir_hook)
|
||||
|
||||
# We need to define this variable in the installed cmake config file.
|
||||
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "set(OPM_MACROS_ROOT ${CMAKE_INSTALL_PREFIX}/share/opm)
|
||||
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)")
|
||||
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "set(OPM_MACROS_ROOT ${OPM_COMMON_ROOT})
|
||||
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)")
|
||||
|
||||
# project information is in dune.module. Read this file and set variables.
|
||||
# we cannot generate dune.module since it is read by dunecontrol before
|
||||
# the build starts, so it makes sense to keep the data there then.
|
||||
include (OpmInit)
|
||||
|
||||
# list of prerequisites for this particular project; this is in a
|
||||
# separate file (in cmake/Modules sub-directory) because it is shared
|
||||
# with the find module
|
||||
include (${project}-prereqs)
|
||||
|
||||
# read the list of components from this file (in the project directory);
|
||||
# it should set various lists with the names of the files to include
|
||||
include (CMakeLists_files.cmake)
|
||||
|
||||
macro (config_hook)
|
||||
endmacro (config_hook)
|
||||
|
||||
macro (prereqs_hook)
|
||||
endmacro (prereqs_hook)
|
||||
|
||||
macro (sources_hook)
|
||||
endmacro (sources_hook)
|
||||
|
||||
macro (fortran_hook)
|
||||
endmacro (fortran_hook)
|
||||
|
||||
macro (files_hook)
|
||||
endmacro (files_hook)
|
||||
|
||||
macro (tests_hook)
|
||||
endmacro (tests_hook)
|
||||
|
||||
# all setup common to the OPM library modules is done here
|
||||
include (OpmLibMain)
|
||||
|
||||
# Install build system files
|
||||
install(DIRECTORY cmake DESTINATION share/opm)
|
@ -1,70 +0,0 @@
|
||||
# This file sets up five lists:
|
||||
# MAIN_SOURCE_FILES List of compilation units which will be included in
|
||||
# the library. If it isn't on this list, it won't be
|
||||
# part of the library. Please try to keep it sorted to
|
||||
# maintain sanity.
|
||||
#
|
||||
# TEST_SOURCE_FILES List of programs that will be run as unit tests.
|
||||
#
|
||||
# TEST_DATA_FILES Files from the source three that should be made
|
||||
# available in the corresponding location in the build
|
||||
# tree in order to run tests there.
|
||||
#
|
||||
# EXAMPLE_SOURCE_FILES Other programs that will be compiled as part of the
|
||||
# build, but which is not part of the library nor is
|
||||
# run as tests.
|
||||
#
|
||||
# PUBLIC_HEADER_FILES List of public header files that should be
|
||||
# distributed together with the library. The source
|
||||
# files can of course include other files than these;
|
||||
# you should only add to this list if the *user* of
|
||||
# the library needs it.
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
opm/common/data/SimulationDataContainer.cpp
|
||||
opm/common/OpmLog/CounterLog.cpp
|
||||
opm/common/OpmLog/EclipsePRTLog.cpp
|
||||
opm/common/OpmLog/LogBackend.cpp
|
||||
opm/common/OpmLog/Logger.cpp
|
||||
opm/common/OpmLog/LogUtil.cpp
|
||||
opm/common/OpmLog/OpmLog.cpp
|
||||
opm/common/OpmLog/StreamLog.cpp
|
||||
opm/common/OpmLog/TimerLog.cpp
|
||||
)
|
||||
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_SimulationDataContainer.cpp
|
||||
tests/test_cmp.cpp
|
||||
tests/test_OpmLog.cpp
|
||||
tests/test_messagelimiter.cpp
|
||||
)
|
||||
|
||||
list (APPEND TEST_DATA_FILES
|
||||
)
|
||||
|
||||
list (APPEND EXAMPLE_SOURCE_FILES
|
||||
)
|
||||
|
||||
# programs listed here will not only be compiled, but also marked for
|
||||
# installation
|
||||
list (APPEND PROGRAM_SOURCE_FILES
|
||||
)
|
||||
|
||||
|
||||
list( APPEND PUBLIC_HEADER_FILES
|
||||
opm/common/ErrorMacros.hpp
|
||||
opm/common/Exceptions.hpp
|
||||
opm/common/data/SimulationDataContainer.hpp
|
||||
opm/common/OpmLog/CounterLog.hpp
|
||||
opm/common/OpmLog/EclipsePRTLog.hpp
|
||||
opm/common/OpmLog/LogBackend.hpp
|
||||
opm/common/OpmLog/Logger.hpp
|
||||
opm/common/OpmLog/LogUtil.hpp
|
||||
opm/common/OpmLog/MessageFormatter.hpp
|
||||
opm/common/OpmLog/MessageLimiter.hpp
|
||||
opm/common/OpmLog/OpmLog.hpp
|
||||
opm/common/OpmLog/StreamLog.hpp
|
||||
opm/common/OpmLog/TimerLog.hpp
|
||||
opm/common/util/numeric/cmp.hpp
|
||||
opm/common/utility/platform_dependent/disable_warnings.h
|
||||
opm/common/utility/platform_dependent/reenable_warnings.h)
|
675
ThirdParty/custom-opm-common/opm-common/LICENSE
vendored
675
ThirdParty/custom-opm-common/opm-common/LICENSE
vendored
@ -1,675 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
@ -1,3 +0,0 @@
|
||||
# opm-common 
|
||||
Contains common components used throughout all of OPM,
|
||||
in particular CMake modules for the build system.
|
@ -1,102 +0,0 @@
|
||||
# - Add options without repeating them on the command line
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# add_options (lang build opts)
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# lang Name of the language whose compiler should receive the
|
||||
# options, e.g. CXX. If a comma-separated list is received
|
||||
# then the option is added for all those languages. Use the
|
||||
# special value ALL_LANGUAGES for these languages: CXX, C
|
||||
# and Fortran
|
||||
#
|
||||
# build Kind of build to which this options should apply,
|
||||
# such as DEBUG and RELEASE. This can also be a comma-
|
||||
# separated list. Use the special value ALL_BUILDS to apply
|
||||
# to all builds.
|
||||
#
|
||||
# opts List of options to add. Each should be quoted.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall")
|
||||
|
||||
function (add_options langs builds)
|
||||
# special handling of empty language specification
|
||||
if ("${langs}" STREQUAL "ALL_LANGUAGES")
|
||||
set (langs CXX C Fortran)
|
||||
endif ("${langs}" STREQUAL "ALL_LANGUAGES")
|
||||
foreach (lang IN LISTS langs)
|
||||
# prepend underscore if necessary
|
||||
foreach (build IN LISTS builds)
|
||||
if (NOT ("${build}" STREQUAL "ALL_BUILDS"))
|
||||
set (_bld "_${build}")
|
||||
string (TOUPPER "${_bld}" _bld)
|
||||
else (NOT ("${build}" STREQUAL "ALL_BUILDS"))
|
||||
set (_bld "")
|
||||
endif (NOT ("${build}" STREQUAL "ALL_BUILDS"))
|
||||
# if we want everything in the "global" flag, then simply
|
||||
# ignore the build type here and go add everything to that one
|
||||
if (CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
set (_bld "")
|
||||
endif ()
|
||||
foreach (_opt IN LISTS ARGN)
|
||||
set (_var "CMAKE_${lang}_FLAGS${_bld}")
|
||||
#message (STATUS "Adding \"${_opt}\" to \${${_var}}")
|
||||
# remove it first
|
||||
string (REPLACE "${_opt}" "" _without "${${_var}}")
|
||||
string (STRIP "${_without}" _without)
|
||||
# we need to strip this one as well, so they are comparable
|
||||
string (STRIP "${${_var}}" _stripped)
|
||||
# if it wasn't there, then add it at the end
|
||||
if ("${_without}" STREQUAL "${_stripped}")
|
||||
# don't add any extra spaces if no options yet are set
|
||||
if (NOT ${_stripped} STREQUAL "")
|
||||
set (${_var} "${_stripped} ${_opt}")
|
||||
else (NOT ${_stripped} STREQUAL "")
|
||||
set (${_var} "${_opt}")
|
||||
endif (NOT ${_stripped} STREQUAL "")
|
||||
set (${_var} "${${_var}}" PARENT_SCOPE)
|
||||
endif ("${_without}" STREQUAL "${_stripped}")
|
||||
endforeach (_opt)
|
||||
endforeach (build)
|
||||
endforeach (lang)
|
||||
endfunction (add_options lang build)
|
||||
|
||||
# set varname to flag unless user has specified something that matches regex
|
||||
function (set_default_option lang varname flag regex)
|
||||
# lang is either C, CXX or Fortran
|
||||
if ("${lang}" STREQUAL "Fortran")
|
||||
set (letter "F")
|
||||
else ()
|
||||
set (letter "${lang}")
|
||||
endif ()
|
||||
string (TOUPPER "${CMAKE_BUILD_TYPE}" _build)
|
||||
if ((NOT ("$ENV{${letter}FLAGS}" MATCHES "${regex}"))
|
||||
AND (NOT ("${CMAKE_${lang}_FLAGS}" MATCHES "${regex}"))
|
||||
AND (NOT ("${CMAKE_${lang}_FLAGS_${_build}}" MATCHES "${regex}")))
|
||||
set (${varname} ${flag} PARENT_SCOPE)
|
||||
else ()
|
||||
set (${varname} PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction (set_default_option)
|
||||
|
||||
# clear default options as a proxy for not using any default options
|
||||
# at all. there is one *huge* problem with this: CMake runs the platform
|
||||
# initialization before executing any line at all in the project and
|
||||
# there seems to be no way to disable that behaviour, so we cannot really
|
||||
# distinguish between a platform default and something that the user has
|
||||
# passed on the command line. the best thing we can do is to all user-
|
||||
# defined setting if they are something other than the platform default.
|
||||
macro (no_default_options)
|
||||
foreach (lang IN ITEMS C CXX Fortran)
|
||||
foreach (build IN ITEMS DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
|
||||
if ("${CMAKE_${lang}_FLAGS_${build}}" STREQUAL "${CMAKE_${lang}_FLAGS_${build}_INIT}")
|
||||
# for some strange reason we cannot clear this flag, only set it to empty
|
||||
set (CMAKE_${lang}_FLAGS_${build} "")
|
||||
endif ()
|
||||
endforeach (build)
|
||||
endforeach (lang)
|
||||
endmacro (no_default_options)
|
@ -1,110 +0,0 @@
|
||||
# - Create config.h based on a list of variables
|
||||
#
|
||||
# Synopsis:
|
||||
# configure_vars (FILE syntax filename verb varlist)
|
||||
# where
|
||||
# syntax CXX or CMAKE, depending on target
|
||||
# filename Full path (including name) of config.h
|
||||
# verb WRITE or APPEND if truncating or not
|
||||
# varlist List of variable names that has been defined
|
||||
#
|
||||
# In addition, this function will define HAVE_CONFIG_H for the
|
||||
# following compilations, (only) if the filename is "config.h".
|
||||
#
|
||||
# Example:
|
||||
# list (APPEND FOO_CONFIG_VARS
|
||||
# "/* bar library */"
|
||||
# "HAVE_BAR"
|
||||
# "HAVE_BAR_VERSION_2"
|
||||
# )
|
||||
# configure_vars (
|
||||
# FILE CXX ${PROJECT_BINARY_DIR}/config.h
|
||||
# WRITE ${FOO_CONFIG_VARS}
|
||||
# )
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
function (configure_vars obj syntax filename verb)
|
||||
# this is just to make the syntax look like the build-in commands
|
||||
if (NOT ("X Y Z ${obj}" STREQUAL "X Y Z FILE" AND
|
||||
(("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND"))))
|
||||
message (FATAL_ERROR "Syntax error in argument list")
|
||||
endif ()
|
||||
if (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE")))
|
||||
message (FATAL_ERROR "Invalid target syntax \"${syntax}\"")
|
||||
endif (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE")))
|
||||
|
||||
# truncate the file if the verb was "WRITE"
|
||||
if (verb STREQUAL "WRITE")
|
||||
file (WRITE "${filename}" "")
|
||||
endif (verb STREQUAL "WRITE")
|
||||
|
||||
# whenever we use this, we also signal to the header files that we
|
||||
# have "config.h". add this before any other files (known till now)
|
||||
# to avoid confusion from other configuration files.
|
||||
get_filename_component (_config_path "${filename}" PATH)
|
||||
get_filename_component (_config_file "${filename}" NAME)
|
||||
if ("${_config_file}" MATCHES "config\\.h(\\..+)?")
|
||||
add_definitions (-DHAVE_CONFIG_H=1)
|
||||
include_directories (BEFORE "${_config_path}")
|
||||
endif ("${_config_file}" MATCHES "config\\.h(\\..+)?")
|
||||
|
||||
# only write the current value of each variable once
|
||||
set (_args ${ARGN})
|
||||
if (_args)
|
||||
list (REMOVE_DUPLICATES _args)
|
||||
endif (_args)
|
||||
|
||||
# process each variable
|
||||
set (_prev_verbatim TRUE)
|
||||
foreach (_var IN LISTS _args)
|
||||
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\\n\\t\\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\\n\\t\\ ]+$" "" _var "${_var}")
|
||||
|
||||
# if the name of a variable has the syntax of a comments, write it
|
||||
# verbatim to the file; this can be used to create headings
|
||||
if ("X Y Z ${_var}" MATCHES "^X Y Z /[/*]")
|
||||
if (NOT _prev_verbatim)
|
||||
file (APPEND "${filename}" "\n")
|
||||
endif (NOT _prev_verbatim)
|
||||
file (APPEND "${filename}" "${_var}\n")
|
||||
set (_prev_verbatim TRUE)
|
||||
|
||||
else ()
|
||||
|
||||
# write a CMake statements that warns if the value has changed
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
set (_db "\${") # to avoid parsing problems
|
||||
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT \"${_db}${_var}}\" STREQUAL \"${${_var}}\")\n")
|
||||
file (APPEND "${filename}" "\tmessage (WARNING \"Incompatible value \\\"${_db}${_var}}\\\" of variable \\\"${_var}\\\"\")\n")
|
||||
file (APPEND "${filename}" "endif ()\n")
|
||||
endif ()
|
||||
|
||||
# check for empty variable; variables that are explicitly set to false
|
||||
# is not included in this clause
|
||||
if ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "set (${_var})\n")
|
||||
else ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "/* #undef ${_var} */\n")
|
||||
endif ("${syntax}" STREQUAL "CMAKE")
|
||||
else ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
|
||||
# write to file using the correct syntax
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
# escape backslash and double quote characters
|
||||
string (REPLACE "\\" "\\\\" _quoted "${${_var}}")
|
||||
string (REPLACE "\"" "\\\"" _quoted "${_quoted}")
|
||||
|
||||
file (APPEND "${filename}" "set (${_var} \"${_quoted}\")\n")
|
||||
else ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "#define ${_var} ${${_var}}\n")
|
||||
endif ("${syntax}" STREQUAL "CMAKE")
|
||||
|
||||
endif ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
|
||||
set (_prev_verbatim FALSE)
|
||||
endif ()
|
||||
endforeach(_var)
|
||||
endfunction (configure_vars obj syntax filename verb)
|
@ -1,47 +0,0 @@
|
||||
# - Dunecontrol compatibility
|
||||
#
|
||||
# Enables this build to be a part of a dunecontrol chain. The
|
||||
# DUNE_CHECK_MODULES macro greps the top-level Makefile for the
|
||||
# presence of the abs_top_srcdir variable (!) and uses that as
|
||||
# the include directory of a module. Also, the contents are not
|
||||
# checked so if the variable is not present, it generates an
|
||||
# invalid command line (-I without argument) which causes the
|
||||
# autoconf probe to fail. This module patches our Makefile (!!)
|
||||
# so the necessary string will be there; in itself this string
|
||||
# has no use for us, it is solemnly to satisfy the M4 scripts.
|
||||
|
||||
if (CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
# we need an up-to-date, patched Makefile. this is always checked when
|
||||
# the makefile is run, thus the need for a marker file to keep a
|
||||
# timestamp to see when it was last patched (by us)
|
||||
# amazingly, nothing depends on the generated Makefile, so this can be
|
||||
# run whenever in the build without trigging a compile of e.g. config.h
|
||||
add_custom_target (dune-compat ALL
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY} -P ${OPM_MACROS_ROOT}/cmake/Scripts/DuneCompat2.cmake
|
||||
COMMENT "Patching Makefile to be DUNE compatible"
|
||||
)
|
||||
endif (CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
|
||||
# dunecontrol refuses to use a build tree as module directory unless
|
||||
# there is a dune.module in it. however, if we are in a sub-dir. of
|
||||
# the source, we are probably using dunecontrol with a --build-dir
|
||||
# argument, and won't call dunecontrol from the parent (which is the
|
||||
# source dir and most likely doesn't contain other projects) anyway,
|
||||
# i.e. we only copy if we are truly out-of-source
|
||||
string (LENGTH "${PROJECT_SOURCE_DIR}/" _src_dir_len)
|
||||
string (LENGTH "${PROJECT_BINARY_DIR}/" _bin_dir_len)
|
||||
if (_src_dir_len GREATER _bin_dir_len)
|
||||
set (_not_substring TRUE)
|
||||
else (_src_dir_len GREATER _bin_dir_len)
|
||||
string (SUBSTRING "${PROJECT_BINARY_DIR}/" 0 ${_src_dir_len} _proj_prefix)
|
||||
if ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
set (_not_substring FALSE)
|
||||
else ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
set (_not_substring TRUE)
|
||||
endif ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
endif (_src_dir_len GREATER _bin_dir_len)
|
||||
if (_not_substring)
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/dune.module ${PROJECT_BINARY_DIR}/dune.module
|
||||
)
|
||||
endif (_not_substring)
|
@ -1,38 +0,0 @@
|
||||
# - Remove duplicate library declarations
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# remove_duplicate_libraries (module)
|
||||
#
|
||||
# where
|
||||
# module Name of the module whose libraries should be pruned
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
# libraries should always be trimmed from the beginning, so that also
|
||||
# missing functions in those later in the list will be resolved
|
||||
macro (remove_duplicate_libraries module)
|
||||
if (DEFINED ${module}_LIBRARIES)
|
||||
list (REVERSE ${module}_LIBRARIES)
|
||||
list (REMOVE_DUPLICATES ${module}_LIBRARIES)
|
||||
list (REVERSE ${module}_LIBRARIES)
|
||||
endif (DEFINED ${module}_LIBRARIES)
|
||||
endmacro (remove_duplicate_libraries module)
|
||||
|
||||
# headers can be trimmed from the end, since adding a directory to
|
||||
# the list is an idempotent action
|
||||
macro (remove_duplicate_var module suffix)
|
||||
if (DEFINED ${module}_${suffix})
|
||||
list (REMOVE_DUPLICATES ${module}_${suffix})
|
||||
endif (DEFINED ${module}_${suffix})
|
||||
endmacro (remove_duplicate_var module suffix)
|
||||
|
||||
# fix up both headers and libraries, in case two dependencies have
|
||||
# included the same second-level library independently
|
||||
macro (remove_dup_deps module)
|
||||
remove_duplicate_var (${module} INCLUDE_DIRS)
|
||||
remove_duplicate_var (${module} LINKER_FLAGS)
|
||||
remove_duplicate_var (${module} CONFIG_VARS)
|
||||
remove_duplicate_libraries (${module})
|
||||
endmacro (remove_dup_deps module)
|
@ -1,25 +0,0 @@
|
||||
# - Module that checks for supported C99 features.
|
||||
|
||||
# macro to only add option once
|
||||
include (AddOptions)
|
||||
|
||||
# try to use compiler flag -std=c99
|
||||
set (C_STD99_FLAGS "-std=c99")
|
||||
|
||||
# incidently, the C++ test is so simple that it can be used to compile C as well
|
||||
include (CheckCCompilerFlag)
|
||||
check_c_compiler_flag (${C_STD99_FLAGS} HAVE_C99)
|
||||
|
||||
# add option if we are capable
|
||||
if (HAVE_C99)
|
||||
add_options (C ALL_BUILDS "${C_STD99_FLAGS}")
|
||||
else (HAVE_C99)
|
||||
set (C_STD99_FLAGS)
|
||||
endif (HAVE_C99)
|
||||
|
||||
# handle quiet and required
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (C99
|
||||
DEFAULT_MSG
|
||||
C_STD99_FLAGS
|
||||
)
|
@ -1,444 +0,0 @@
|
||||
#
|
||||
# Module that checks for supported C++11 (former C++0x) features.
|
||||
#
|
||||
# Sets the follwing variable:
|
||||
#
|
||||
# HAVE_FINAL True if the compiler supports the "final" quantifier
|
||||
# HAVE_TYPE_TRAITS True if the <type_traits> header is available and implements sufficient functionality
|
||||
# HAVE_SHARED_PTR True if std::shared_ptr is available
|
||||
# HAVE_UNIQUE_PTR True if std::unique_ptr is available
|
||||
# HAVE_NULLPTR True if nullptr is available
|
||||
# HAVE_ARRAY True if header <array> and fill() are available
|
||||
# HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported
|
||||
# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported
|
||||
# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported
|
||||
# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported
|
||||
# HAVE_CONSTEXPR True if constexpr attribute is available
|
||||
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
|
||||
# HAVE_STATIC_ASSERT True if static_assert is available
|
||||
# HAVE_AUTO True if the compiler supports the auto keyword
|
||||
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supported
|
||||
# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
|
||||
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
|
||||
# HAVE_TUPLE True if std::tuple is available
|
||||
# HAVE_TR1_TUPLE True if std::tr1::tuple is available
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckCXXSourceRuns)
|
||||
|
||||
# test for C++11 flags
|
||||
include(TestCXXAcceptsFlag)
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
# macro to only add option once
|
||||
include(AddOptions)
|
||||
|
||||
if(NOT MSVC)
|
||||
# try to use compiler flag -std=c++11
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
|
||||
if(CXX_FLAG_CXX11)
|
||||
add_options (CXX ALL_BUILDS "-std=c++11")
|
||||
set(CXX_STD0X_FLAGS "-std=c++11")
|
||||
else()
|
||||
# try to use compiler flag -std=c++0x for older compilers
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
|
||||
if(CXX_FLAG_CXX0X)
|
||||
add_options (CXX ALL_BUILDS "-std=c++0x")
|
||||
set(CXX_STD0X_FLAGS "-std=c++0x")
|
||||
endif(CXX_FLAG_CXX0X)
|
||||
endif(CXX_FLAG_CXX11)
|
||||
endif(NOT MSVC)
|
||||
|
||||
# if we are building with an Apple toolchain in MacOS X,
|
||||
# we cannot use the old GCC 4.2 fork, but must use the
|
||||
# new runtime library
|
||||
set (CXX_STDLIB_FLAGS)
|
||||
string (TOUPPER "${CMAKE_CXX_COMPILER_ID}" _comp_id)
|
||||
if (APPLE AND (_comp_id MATCHES "CLANG"))
|
||||
CHECK_CXX_ACCEPTS_FLAG ("-stdlib=libc++" CXX_FLAG_STDLIB_LIBCXX)
|
||||
if (CXX_FLAG_STDLIB_LIBCXX)
|
||||
add_options (CXX ALL_BUILDS "-stdlib=libc++")
|
||||
set (CXX_STDLIB_FLAGS "-stdlib=libc++")
|
||||
endif (CXX_FLAG_STDLIB_LIBCXX)
|
||||
endif (APPLE AND (_comp_id MATCHES "CLANG"))
|
||||
|
||||
# to format the command-line options pretty, we have an optional space
|
||||
if (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
|
||||
set (CXX_SPACE " ")
|
||||
else (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
|
||||
set (CXX_SPACE)
|
||||
endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
|
||||
|
||||
# perform tests
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# the "final" method specifier
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
struct Base {
|
||||
virtual void foo() = 0;
|
||||
};
|
||||
struct Derived : public Base {
|
||||
virtual void foo() final {};
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
" HAVE_FINAL
|
||||
)
|
||||
|
||||
# std::is_convertible, std::is_base_of
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <type_traits>
|
||||
|
||||
class Base {};
|
||||
class Derived : public Base {};
|
||||
|
||||
int main()
|
||||
{
|
||||
bool foo = std::is_convertible<int, double>::value;
|
||||
bool bar = std::is_base_of<Base, Derived>::value;
|
||||
bool foobar = std::is_integral<double>::value;
|
||||
return 0;
|
||||
}
|
||||
" HAVE_TYPE_TRAITS
|
||||
)
|
||||
|
||||
# nullptr
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <memory>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
std::shared_ptr<int> foo(new int(123));
|
||||
return 0;
|
||||
}
|
||||
" HAVE_SHARED_PTR
|
||||
)
|
||||
|
||||
# this is required by dune-common to avoid linker errors. "fun"!
|
||||
if (HAVE_SHARED_PTR)
|
||||
set(HAVE_MAKE_SHARED 1)
|
||||
set(SHARED_PTR_HEADER "<memory>")
|
||||
set(SHARED_PTR_NAMESPACE "std")
|
||||
endif()
|
||||
|
||||
# nullptr
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <memory>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
std::unique_ptr<int> foo(new int(123));
|
||||
return 0;
|
||||
}
|
||||
" HAVE_UNIQUE_PTR
|
||||
)
|
||||
|
||||
# nullptr
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
char* ch = nullptr;
|
||||
return 0;
|
||||
}
|
||||
" HAVE_NULLPTR
|
||||
)
|
||||
|
||||
# constexpr
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
template <class T>
|
||||
inline constexpr int foo(T bar) { return bar*2; }
|
||||
int main(void)
|
||||
{
|
||||
constexpr int foobar = foo(100);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_CONSTEXPR
|
||||
)
|
||||
|
||||
# array and fill
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <array>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
std::array<int,2> a;
|
||||
a.fill(9);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_ARRAY
|
||||
)
|
||||
|
||||
# Check whether if std::integral_constant< T, v > is supported and casts into T
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <type_traits>
|
||||
void f( int ){}
|
||||
|
||||
int main(void){
|
||||
f( std::integral_constant< int, 42 >() );
|
||||
}
|
||||
" HAVE_INTEGRAL_CONSTANT
|
||||
)
|
||||
|
||||
# Check whether if <tuple> is available
|
||||
check_include_file_cxx("tuple" HAVE_TUPLE)
|
||||
|
||||
# Check whether if <tr1/tuple> is available
|
||||
check_include_file_cxx("tr1/tuple" HAVE_TR1_TUPLE)
|
||||
|
||||
# __attribute__((always_inline))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
void __attribute__((always_inline)) foo(void) {}
|
||||
int main(void)
|
||||
{
|
||||
foo();
|
||||
return 0;
|
||||
};
|
||||
" HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
)
|
||||
|
||||
# __attribute__((unused))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
int __attribute__((unused)) foo;
|
||||
return 0;
|
||||
};
|
||||
" HAS_ATTRIBUTE_UNUSED
|
||||
)
|
||||
|
||||
# __attribute__((deprecated))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#define DEP __attribute__((deprecated))
|
||||
class bar
|
||||
{
|
||||
bar() DEP;
|
||||
};
|
||||
|
||||
class peng { } DEP;
|
||||
|
||||
template <class T>
|
||||
class t_bar
|
||||
{
|
||||
t_bar() DEP;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class t_peng {
|
||||
t_peng() {};
|
||||
} DEP;
|
||||
|
||||
void foo() DEP;
|
||||
|
||||
void foo() {};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
" HAS_ATTRIBUTE_DEPRECATED
|
||||
)
|
||||
|
||||
# __attribute__((deprecated("msg")))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#define DEP __attribute__((deprecated(\"message\")))
|
||||
class bar {
|
||||
bar() DEP;
|
||||
};
|
||||
|
||||
class peng { } DEP;
|
||||
|
||||
template <class T>
|
||||
class t_bar
|
||||
{
|
||||
t_bar() DEP;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class t_peng
|
||||
{
|
||||
t_peng() {};
|
||||
} DEP;
|
||||
|
||||
void foo() DEP;
|
||||
|
||||
void foo() {};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
" HAS_ATTRIBUTE_DEPRECATED_MSG
|
||||
)
|
||||
|
||||
# static assert
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
static_assert(true,\"MSG\");
|
||||
return 0;
|
||||
}
|
||||
" HAVE_STATIC_ASSERT
|
||||
)
|
||||
|
||||
# auto keyword
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
auto foo = 1.23;
|
||||
return 0;
|
||||
}
|
||||
" HAVE_AUTO
|
||||
)
|
||||
|
||||
# variadic template support
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <cassert>
|
||||
|
||||
template<typename... T>
|
||||
int addints(T... x);
|
||||
|
||||
int add_ints()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T1, typename... T>
|
||||
int add_ints(T1 t1, T... t)
|
||||
{
|
||||
return t1 + add_ints(t...);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
assert( 5 == add_ints(9,3,-5,-2) );
|
||||
return 0;
|
||||
}
|
||||
" HAVE_VARIADIC_TEMPLATES
|
||||
)
|
||||
|
||||
# SFINAE on variadic template constructors within template classes
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <functional>
|
||||
|
||||
template<typename... U>
|
||||
struct A
|
||||
{
|
||||
template<typename... T,
|
||||
typename = typename std::enable_if<(sizeof...(T) < 2)>::type
|
||||
>
|
||||
A(T... t)
|
||||
: i(1)
|
||||
{}
|
||||
|
||||
template<typename... T,
|
||||
typename = typename std::enable_if<(sizeof...(T) >= 2)>::type,
|
||||
typename = void
|
||||
>
|
||||
A(T... t)
|
||||
: i(-1)
|
||||
{}
|
||||
|
||||
A()
|
||||
: i(1)
|
||||
{}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return (A<int>().i + A<int>(2).i + A<int>(\"foo\",3.4).i + A<int>(8,'a',A<int>()).i == 0 ? 0 : 1);
|
||||
}
|
||||
" HAVE_VARIADIC_CONSTRUCTOR_SFINAE
|
||||
)
|
||||
|
||||
# rvalue references
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
int foo(int&& x) { return 1; }
|
||||
int foo(const int& x) { return -1; }
|
||||
|
||||
template<typename T>
|
||||
int forward(T&& x)
|
||||
{
|
||||
return foo(std::forward<T>(x));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i = 0;
|
||||
assert( forward(i) + forward(int(2)) == 0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_RVALUE_REFERENCES
|
||||
)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFileCXX)
|
||||
# Search for some tr1 headers
|
||||
foreach(_HEADER tuple tr1/tuple type_traits tr1/type_traits)
|
||||
string(REPLACE "/" "_" _HEADER_VAR ${_HEADER})
|
||||
string(TOUPPER ${_HEADER_VAR} _HEADER_VAR )
|
||||
check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}")
|
||||
endforeach(_HEADER tuple tr1/tuple tr1/type_traits)
|
||||
|
||||
# make sure that the C++-11 features implemented by the compiler are a
|
||||
# superset of those provided by GCC 4.4. This makes the test fail on
|
||||
# all GCC compilers before 4.4.
|
||||
set(CXX_FEATURES_MISSING "")
|
||||
if (NOT HAVE_TYPE_TRAITS)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Sufficiently conformant type traits (defined by the 'type_traits' header file)\n")
|
||||
endif()
|
||||
if (NOT HAVE_SHARED_PTR)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Shared pointers (the std::shared_ptr class)\n")
|
||||
endif()
|
||||
if (NOT HAVE_UNIQUE_PTR)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Unique pointers (the std::unique_ptr class)\n")
|
||||
endif()
|
||||
if (NOT HAVE_ARRAY)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Statically sized arrays (the std::array class)\n")
|
||||
endif()
|
||||
if (NOT HAVE_STATIC_ASSERT)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Static assertations (the static_assert() mechanism)\n")
|
||||
endif()
|
||||
if (NOT HAVE_AUTO)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Automatically typed variables (the 'auto' keyword)\n")
|
||||
endif()
|
||||
if (NOT HAVE_VARIADIC_TEMPLATES)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Variable number of template arguments\n")
|
||||
endif()
|
||||
if (NOT HAVE_VARIADIC_CONSTRUCTOR_SFINAE)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Constructors with variable number of template arguments obeying the SFINAE (specialization failure is not an error) rule\n")
|
||||
endif()
|
||||
if (NOT HAVE_RVALUE_REFERENCES)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - References to rvalue objects\n")
|
||||
endif()
|
||||
if (NOT HAVE_TUPLE)
|
||||
set(CXX_FEATURES_MISSING
|
||||
"${CXX_FEATURES_MISSING} - Tuples (the std::tuple class)\n")
|
||||
endif()
|
||||
|
||||
if(CXX_FEATURES_MISSING)
|
||||
set (CXX11FEATURES_FOUND FALSE)
|
||||
if (CXX11Features_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"Your C++ compiler does not support the minimum set of C++-2011 features required. "
|
||||
"Make sure to use a compiler which implements all C++-2011 features provided by GCC 4.4. "
|
||||
"Your compiler does not seem to implement the following features:\n"
|
||||
"${CXX_FEATURES_MISSING}")
|
||||
endif()
|
||||
else ()
|
||||
set (CXX11FEATURES_FOUND TRUE)
|
||||
endif()
|
@ -1,49 +0,0 @@
|
||||
# Find the Python wrappers for module cwrap from ert
|
||||
#
|
||||
# Set the cache variable CWRAP_PYTHON_PATH to the install location of the root
|
||||
# ert package.
|
||||
|
||||
find_package(PythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
|
||||
# We try to find the cwrap Python distribution. This is done by running Python
|
||||
# code which tries to 'import cwrap' and prints out the path to the module if
|
||||
# the import succeeds.
|
||||
#
|
||||
# The normal Python import machinery is employed, so if you have installed cwrap
|
||||
# python in a default location, or alternatively set the PYTHONPATH variable the
|
||||
# cwrap Python distribution will eventually be found there, independently of the
|
||||
# alternatives which are tested with the ${PATH_LIST} variable.
|
||||
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set( PYTHON_PACKAGE_PATH "dist-packages")
|
||||
else()
|
||||
set( PYTHON_PACKAGE_PATH "site-packages")
|
||||
endif()
|
||||
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
|
||||
|
||||
set(PATH_LIST)
|
||||
if (ERT_ROOT)
|
||||
list(APPEND PATH_LIST ${ERT_ROOT})
|
||||
endif()
|
||||
list(APPEND PATH_LIST ${CMAKE_PREFIX_PATH})
|
||||
|
||||
# Add various popular sibling alternatives.
|
||||
list(APPEND PATH_LIST "${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build")
|
||||
|
||||
foreach( PATH ${PATH_LIST})
|
||||
set( python_code "import sys; sys.path.insert(0 , '${PATH}/${PYTHON_INSTALL_PREFIX}'); import os.path; import inspect; import cwrap; print os.path.dirname(os.path.dirname(inspect.getfile(cwrap)))")
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
|
||||
RESULT_VARIABLE import_result
|
||||
OUTPUT_VARIABLE stdout_output
|
||||
ERROR_VARIABLE stderr_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if (${import_result} EQUAL 0)
|
||||
set( CWRAP_PYTHON_PATH ${stdout_output} CACHE PATH "Python path for cwrap" )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
find_package_handle_standard_args("Cwrap" DEFAULT_MSG CWRAP_PYTHON_PATH)
|
@ -1,23 +0,0 @@
|
||||
# Module that checks whether the compiler supports the
|
||||
# abi::__cxa_demangle function required to
|
||||
# make the type names returned by typeid() human-readable
|
||||
#
|
||||
# Sets the following variable:
|
||||
# HAVE_CXA_DEMANGLE
|
||||
#
|
||||
# perform tests
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <cxxabi.h>
|
||||
int main(void){
|
||||
int foobar = 0;
|
||||
const char *foo = typeid(foobar).name();
|
||||
int status;
|
||||
char *demangled = abi::__cxa_demangle( foo, 0, 0, &status );
|
||||
}" HAVE_CXA_DEMANGLE)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
# prevent useless message from being displayed
|
||||
set (FIND_PACKAGE_MESSAGE_DETAILS_CxaDemangle "[1][v()]"
|
||||
CACHE INTERNAL "Details about finding CxaDemangle")
|
||||
find_package_handle_standard_args (CxaDemangle DEFAULT_MSG HAVE_CXA_DEMANGLE)
|
@ -1,268 +0,0 @@
|
||||
# - Find the Ensemble-based Reservoir Tool (ERT)
|
||||
#
|
||||
# Set the cache variable ERT_ROOT to the install location of the ERT
|
||||
# libraries and header files.
|
||||
#
|
||||
# If found, it sets these variables:
|
||||
#
|
||||
# ERT_INCLUDE_DIRS Header file directories
|
||||
# ERT_LIBRARIES Archives and shared objects
|
||||
# ERT_CONFIG_VARS Definitions that goes in config.h
|
||||
# ERT_LINKER_FLAGS Options that must be passed to linker
|
||||
#
|
||||
# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to
|
||||
# link with the ERT libraries.
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (ERT_QUIET "QUIET")
|
||||
else (FIND_QUIETLY)
|
||||
set (ERT_QUIET "")
|
||||
endif (FIND_QUIETLY)
|
||||
|
||||
# if a directory has been specified by the user, then don't go look
|
||||
# in the system directories as well
|
||||
if (ERT_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
else (ERT_ROOT)
|
||||
set (_no_default_path "")
|
||||
endif (ERT_ROOT)
|
||||
|
||||
# ERT doesn't have any config-mode file, so we need to specify the root
|
||||
# directory in its own variable
|
||||
find_path (ERT_ECL_INCLUDE_DIR
|
||||
NAMES "ert/ecl/ecl_util.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libecl/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_ECL_WELL_INCLUDE_DIR
|
||||
NAMES "ert/ecl_well/well_const.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libecl_well/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_ECLXX_INCLUDE_DIR
|
||||
NAMES "ert/ecl/EclKW.hpp"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libeclxx/include/" "include"
|
||||
DOC "Path to ERT Eclipse C++ library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_UTIL_INCLUDE_DIR
|
||||
NAMES "ert/util/stringlist.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_util/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_UTILXX_INCLUDE_DIR
|
||||
NAMES "ert/util/ert_unique_ptr.hpp"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_utilxx/include/" "include"
|
||||
DOC "Path to ERT Eclipse C++ library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_GEN_INCLUDE_DIR
|
||||
NAMES "ert/util/int_vector.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_util/include"
|
||||
"include" "build/libert_util/include" "build/libert_util/include"
|
||||
DOC "Path to ERT generated library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
|
||||
# need all of these libraries
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
find_library (ERT_LIBRARY_ECL
|
||||
NAMES "ecl"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_ECLXX
|
||||
NAMES "eclxx"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse C++ library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_ECL_WELL
|
||||
NAMES "ecl_well"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_GEOMETRY
|
||||
NAMES "ert_geometry"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Geometry library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_UTIL
|
||||
NAMES "ert_util"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Utilities library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_UTILXX
|
||||
NAMES "ert_utilxx"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Utilities library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
# the "library" found here is actually a list of several files
|
||||
list (APPEND ERT_INCLUDE_DIR
|
||||
${ERT_ECL_INCLUDE_DIR}
|
||||
${ERT_ECL_WELL_INCLUDE_DIR}
|
||||
${ERT_ECLXX_INCLUDE_DIR}
|
||||
${ERT_UTIL_INCLUDE_DIR}
|
||||
${ERT_UTILXX_INCLUDE_DIR}
|
||||
${ERT_GEN_INCLUDE_DIR}
|
||||
)
|
||||
list (APPEND ERT_LIBRARY
|
||||
${ERT_LIBRARY_ECL}
|
||||
${ERT_LIBRARY_ECLXX}
|
||||
${ERT_LIBRARY_ECL_WELL}
|
||||
${ERT_LIBRARY_GEOMETRY}
|
||||
${ERT_LIBRARY_UTIL}
|
||||
${ERT_LIBRARY_UTILXX}
|
||||
)
|
||||
list (APPEND ERT_LIBRARIES ${ERT_LIBRARY})
|
||||
list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR})
|
||||
|
||||
# if we didn't find any files, then don't proceed through the entire dependency list
|
||||
include (FindPackageHandleStandardArgs)
|
||||
if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
|
||||
find_package_handle_standard_args (ERT
|
||||
DEFAULT_MSG
|
||||
ERT_INCLUDE_DIR ERT_LIBRARY
|
||||
)
|
||||
# clear the cache so the find probe is attempted again if files becomes
|
||||
# available (only upon a unsuccessful *compile* should we disable further
|
||||
# probing)
|
||||
set (HAVE_ERT)
|
||||
unset (HAVE_ERT CACHE)
|
||||
return ()
|
||||
endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
|
||||
|
||||
|
||||
# dependencies
|
||||
|
||||
# parallel programming
|
||||
include (UseOpenMP)
|
||||
find_openmp (ERT)
|
||||
|
||||
# compression library
|
||||
find_package (ZLIB ${ERT_QUIET})
|
||||
if (ZLIB_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif (ZLIB_FOUND)
|
||||
|
||||
# numerics
|
||||
find_package (BLAS ${ERT_QUIET})
|
||||
if (BLAS_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES})
|
||||
list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||
endif (BLAS_FOUND)
|
||||
|
||||
find_package (LAPACK ${ERT_QUIET})
|
||||
if (LAPACK_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES})
|
||||
list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS})
|
||||
endif (LAPACK_FOUND)
|
||||
|
||||
# math library (should exist on all unices; automatically linked on Windows)
|
||||
if (UNIX)
|
||||
find_library (MATH_LIBRARY
|
||||
NAMES "m"
|
||||
)
|
||||
list (APPEND ERT_LIBRARIES ${MATH_LIBRARY})
|
||||
endif (UNIX)
|
||||
|
||||
# if shared libraries are disabled on linux, explcitly linking to the
|
||||
# pthreads library is required by ERT
|
||||
find_package(Threads ${ERT_QUIET})
|
||||
if (CMAKE_THREAD_LIBS_INIT)
|
||||
list (APPEND ERT_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
# Platform specific library where dlopen with friends lives
|
||||
list (APPEND ERT_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
|
||||
# since OpenMP often implies pthreads, we need to tidy up
|
||||
# (last instance of library must be left standing, thus reversing that
|
||||
# list before removing duplicates)
|
||||
include (Duplicates)
|
||||
remove_dup_deps (ERT)
|
||||
|
||||
# see if we can compile a minimum example
|
||||
# CMake logical test doesn't handle lists (sic)
|
||||
if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
|
||||
check_cxx_source_compiles (
|
||||
"#include <ert/ecl/EclKW.hpp>
|
||||
int main ( ) {
|
||||
ERT::EclKW< int > kw( ecl_kw_alloc( \"SATNUM\", 0, ECL_INT_TYPE ) );
|
||||
return 0;
|
||||
}" HAVE_ERT)
|
||||
cmake_pop_check_state ()
|
||||
else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
# clear the cache so the find probe is attempted again if files becomes
|
||||
# available (only upon a unsuccessful *compile* should we disable further
|
||||
# probing)
|
||||
set (HAVE_ERT)
|
||||
unset (HAVE_ERT CACHE)
|
||||
endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
|
||||
# if the test program didn't compile, but was required to do so, bail
|
||||
# out now and display an error; otherwise limp on
|
||||
find_package_handle_standard_args (ERT
|
||||
DEFAULT_MSG
|
||||
ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
# - Find the Python wrappers for Ensemble-based Reservoir Tool (ERT)
|
||||
#
|
||||
# Set the cache variable ERT_PYTHON_PATH to the install location of
|
||||
# the root ert package.
|
||||
|
||||
find_package(PythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
|
||||
# We try to find the ert Python distribution. This is done by running
|
||||
# Python code which tries to 'import ert' and prints out the path to
|
||||
# the module if the import succeeds.
|
||||
#
|
||||
# The normal Python import machinery is employed, so if you have
|
||||
# installed ert python in a default location, or alternatively set the
|
||||
# PYTHONPATH variable the ert Python distribution will eventually be
|
||||
# found there, independently of the alternatives which are tested with
|
||||
# the ${PATH_LIST} variable.
|
||||
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set( PYTHON_PACKAGE_PATH "dist-packages")
|
||||
else()
|
||||
set( PYTHON_PACKAGE_PATH "site-packages")
|
||||
endif()
|
||||
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
|
||||
|
||||
set(PATH_LIST)
|
||||
if (ERT_ROOT)
|
||||
list(APPEND PATH_LIST ${ERT_ROOT})
|
||||
endif()
|
||||
list(APPEND PATH_LIST ${CMAKE_PREFIX_PATH})
|
||||
|
||||
# Add various popular sibling alternatives.
|
||||
list(APPEND PATH_LIST "${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build")
|
||||
|
||||
foreach( PATH ${PATH_LIST})
|
||||
set( python_code "import sys; sys.path.insert(0 , '${PATH}/${PYTHON_INSTALL_PREFIX}'); import os.path; import inspect; import ert; print os.path.dirname(os.path.dirname(inspect.getfile(ert))); from ert.ecl import EclSum")
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
|
||||
RESULT_VARIABLE import_result
|
||||
OUTPUT_VARIABLE stdout_output
|
||||
ERROR_VARIABLE stderr_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if (${import_result} EQUAL 0)
|
||||
set( ERT_PYTHON_PATH ${stdout_output} CACHE PATH "Python path for ERT Python" )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
find_package_handle_standard_args("ERTPython" DEFAULT_MSG ERT_PYTHON_PATH)
|
||||
|
||||
|
||||
|
@ -1,125 +0,0 @@
|
||||
# - Try to find Eigen3 lib
|
||||
#
|
||||
# This module supports requiring a minimum version, e.g. you can do
|
||||
# find_package(Eigen3 3.1.2)
|
||||
# to require version 3.1.2 or newer of Eigen3.
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# EIGEN3_FOUND - system has eigen lib with correct version
|
||||
# EIGEN3_INCLUDE_DIR - the eigen include directory
|
||||
# EIGEN3_VERSION - eigen version
|
||||
|
||||
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
|
||||
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
|
||||
|
||||
if(NOT Eigen3_FIND_VERSION)
|
||||
if(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||
set(Eigen3_FIND_VERSION_MAJOR 2)
|
||||
endif(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||
if(NOT Eigen3_FIND_VERSION_MINOR)
|
||||
set(Eigen3_FIND_VERSION_MINOR 91)
|
||||
endif(NOT Eigen3_FIND_VERSION_MINOR)
|
||||
if(NOT Eigen3_FIND_VERSION_PATCH)
|
||||
set(Eigen3_FIND_VERSION_PATCH 0)
|
||||
endif(NOT Eigen3_FIND_VERSION_PATCH)
|
||||
|
||||
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
|
||||
endif(NOT Eigen3_FIND_VERSION)
|
||||
|
||||
macro(_eigen3_check_version)
|
||||
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
|
||||
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
|
||||
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||
|
||||
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
|
||||
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||
set(EIGEN3_VERSION_OK FALSE)
|
||||
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||
set(EIGEN3_VERSION_OK TRUE)
|
||||
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||
|
||||
if(NOT EIGEN3_VERSION_OK)
|
||||
|
||||
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
|
||||
"but at least version ${Eigen3_FIND_VERSION} is required")
|
||||
endif(NOT EIGEN3_VERSION_OK)
|
||||
endmacro(_eigen3_check_version)
|
||||
|
||||
# only probe if we haven't a path in our cache
|
||||
if (NOT EIGEN3_INCLUDE_DIR)
|
||||
|
||||
# allow Eigen3_ROOT to be used in addition to EIGEN3_ROOT
|
||||
if (Eigen3_ROOT)
|
||||
set (EIGEN3_ROOT "${Eigen3_ROOT}")
|
||||
endif (Eigen3_ROOT)
|
||||
|
||||
# if the _ROOT is specified, then look *only* there; don't allow any
|
||||
# other version to be swapped in to substitute; if not specified, then
|
||||
# go search usual locations
|
||||
if (EIGEN3_ROOT)
|
||||
# if we are given the path to a "build" tree (meaning somewhere Eigen3
|
||||
# has been configured), then use the eigen3.pc file to figure out the
|
||||
# name of the *real* root directory
|
||||
if (EXISTS "${EIGEN3_ROOT}/CMakeCache.txt")
|
||||
# get the cache entry that tells use the source tree location
|
||||
set (_regex "Eigen_SOURCE_DIR:STATIC=\(.*\)")
|
||||
file (STRINGS
|
||||
"${EIGEN3_ROOT}/CMakeCache.txt"
|
||||
EIGEN3_SOURCE_TREE
|
||||
REGEX "${_regex}"
|
||||
)
|
||||
# trim away the key definition, be left with the value
|
||||
if (EIGEN3_SOURCE_TREE)
|
||||
string (REGEX REPLACE
|
||||
"${_regex}"
|
||||
"\\1"
|
||||
EIGEN3_SOURCE_TREE
|
||||
"${EIGEN3_SOURCE_TREE}"
|
||||
)
|
||||
# if something doesn't look as expected, abort and search in _ROOT
|
||||
else ()
|
||||
set (EIGEN3_SOURCE_TREE "${EIGEN3_ROOT}")
|
||||
endif ()
|
||||
else ()
|
||||
set (EIGEN3_SOURCE_TREE "${EIGEN3_ROOT}")
|
||||
endif ()
|
||||
|
||||
find_path (EIGEN3_INCLUDE_DIR
|
||||
NAMES signature_of_eigen3_matrix_library
|
||||
PATHS ${EIGEN3_SOURCE_TREE}
|
||||
PATH_SUFFIXES eigen3 include/eigen3 eigen include/eigen
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
else (EIGEN3_ROOT)
|
||||
# assume that if there is a sibling directory to our project which
|
||||
# is called eigen3, there is a newer version located there, or that
|
||||
# it may have been checked out next to the build directory
|
||||
find_path(EIGEN3_INCLUDE_DIR
|
||||
NAMES signature_of_eigen3_matrix_library
|
||||
HINTS ${CMAKE_SOURCE_DIR}/../
|
||||
${PROJECT_SOURCE_DIR}/../
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${KDE4_INCLUDE_DIR}
|
||||
PATH_SUFFIXES eigen3 eigen
|
||||
)
|
||||
endif (EIGEN3_ROOT)
|
||||
endif (NOT EIGEN3_INCLUDE_DIR)
|
||||
|
||||
if(EIGEN3_INCLUDE_DIR)
|
||||
_eigen3_check_version()
|
||||
endif(EIGEN3_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
|
||||
|
||||
mark_as_advanced(EIGEN3_INCLUDE_DIR)
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
# -*-cmake-*-
|
||||
#
|
||||
# Try to find the libMETIS graph partioning library
|
||||
#
|
||||
# Once done, this will define:
|
||||
#
|
||||
# METIS_FOUND - system has the libMETIS graph partioning library
|
||||
# HAVE_METIS - like METIS_FOUND, but for the inclusion in config.h
|
||||
# METIS_INCLUDE_DIRS - incude paths to use libMETIS
|
||||
# METIS_LIBRARIES - Link these to use libMETIS
|
||||
|
||||
set(METIS_SEARCH_PATH "/usr" "/usr/local" "/opt" "/opt/local")
|
||||
set(METIS_NO_DEFAULT_PATH "")
|
||||
if(METIS_ROOT)
|
||||
set(METIS_SEARCH_PATH "${METIS_ROOT}")
|
||||
set(METIS_NO_DEFAULT_PATH "NO_DEFAULT_PATH")
|
||||
endif()
|
||||
|
||||
# search for files which implements this module
|
||||
find_path (METIS_INCLUDE_DIRS
|
||||
NAMES "metis.h"
|
||||
PATHS ${METIS_SEARCH_PATH}
|
||||
PATH_SUFFIXES "include" "METISLib" "include/metis"
|
||||
${METIS_NO_DEFAULT_PATH})
|
||||
|
||||
# only search in architecture-relevant directory
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
find_library(METIS_LIBRARIES
|
||||
NAMES "metis"
|
||||
PATHS ${METIS_SEARCH_PATH}
|
||||
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${METIS_NO_DEFAULT_PATH})
|
||||
|
||||
set (METIS_FOUND FALSE)
|
||||
if (METIS_INCLUDE_DIRS OR METIS_LIBRARIES)
|
||||
set(METIS_FOUND TRUE)
|
||||
set(HAVE_METIS TRUE)
|
||||
endif()
|
||||
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(METIS
|
||||
DEFAULT_MSG
|
||||
METIS_LIBRARIES
|
||||
METIS_INCLUDE_DIRS
|
||||
)
|
@ -1,161 +0,0 @@
|
||||
# - Try to find Petsc lib
|
||||
#
|
||||
# This module supports requiring a minimum version, e.g. you can do
|
||||
# find_package(Petsc)
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# PETSC_FOUND - system has Petsc lib with correct version
|
||||
# PETSC_INCLUDE_DIRS - the Petsc include directory
|
||||
# PETSC_LIBRARIES - the Petsc library.
|
||||
|
||||
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
|
||||
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
|
||||
|
||||
# find out the size of a pointer. this is required to only search for
|
||||
# libraries in the directories relevant for the architecture
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# if PETSC_ROOT is set, then this is the only place searched for petsc headers
|
||||
# and includes
|
||||
set(_no_default_path "")
|
||||
if(PETSC_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif()
|
||||
|
||||
# look for a system-wide BLAS library
|
||||
set(PETSC_BLAS_LIBRARY "")
|
||||
find_package(BLAS QUIET)
|
||||
list(APPEND PETSC_BLAS_LIBRARY "${BLAS_LIBRARIES}")
|
||||
|
||||
# if BLAS wasn't found, look for it in PETSC_ROOT. Won't search if
|
||||
# PETSC_BLAS_LIBRARY is set.
|
||||
find_library(PETSC_BLAS_LIBRARY
|
||||
NAME "blas"
|
||||
PATH ${PETSC_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# print message if there was still no blas found!
|
||||
if(NOT BLAS_FOUND AND NOT PETSC_BLAS_LIBRARY)
|
||||
message(STATUS "BLAS not found but required for PETSc")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(PETSC_LAPACK_LIBRARY "")
|
||||
find_package(LAPACK QUIET)
|
||||
list(APPEND PETSC_LAPACK_LIBRARY "${LAPACK_LIBRARIES}")
|
||||
|
||||
# if LAPACK wasn't found, look for it in PETSC_ROOT
|
||||
find_library(PETSC_LAPACK_LIBRARY
|
||||
NAME "lapack"
|
||||
PATH ${PETSC_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# print message if there was still no blas found!
|
||||
if(NOT LAPACK_FOUND AND NOT PETSC_LAPACK_LIBRARY)
|
||||
message(STATUS "LAPACK not found but required for PETSc")
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(X11 QUIET)
|
||||
if (X11_FOUND)
|
||||
list(APPEND PETSC_X11_LIBRARY "${X11_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# these variables must exist. Since not finding MPI, both the header and the
|
||||
# object file , may not be an error, we want the option of concatenating the
|
||||
# empty variable onto the PETSC_LIBRARIES/INCLUDE_DIRS lists
|
||||
set(PETSC_MPI_LIBRARY "")
|
||||
set(PETSC_MPI_INCLUDE_DIRS "")
|
||||
|
||||
find_package(MPI)
|
||||
if(MPI_FOUND)
|
||||
list(APPEND PETSC_MPI_LIBRARY "${MPI_LIBRARIES}")
|
||||
set(PETSC_MPI_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
|
||||
|
||||
else(MPI_FOUND)
|
||||
# if a system MPI wasn't found, look for PETSc's serial implementation. This
|
||||
# won't be available if PETSc was compiled with --with-mpi=0, so not finding
|
||||
# this won't be an error. This only needs to find the header, as the MPI
|
||||
# implementation should be already be compiled into PETSc.
|
||||
message(STATUS "Could not find a system provided MPI. Searching for PETSc provided mpiuni fallback implementation.")
|
||||
find_path(PETSC_MPI_INCLUDE_DIRS
|
||||
NAMES "mpi.h"
|
||||
PATHS ${PETSC_ROOT}/include
|
||||
PATH_SUFFIXES "mpiuni"
|
||||
${_no_default_path}
|
||||
)
|
||||
endif(MPI_FOUND)
|
||||
|
||||
if(NOT PETSC_MPI_INCLUDE_DIRS)
|
||||
message(WARNING "Could not find any MPI implementation. If PETSc is compiled with --with-mpi=0 this is ok. Otherwise you will get linker errors or (possibly subtle) runtime errors. Continuing.")
|
||||
if(NOT USE_MPI)
|
||||
message("To build with MPI support, pass -DUSE_MPI=ON to CMake.")
|
||||
endif(NOT USE_MPI)
|
||||
endif(NOT PETSC_MPI_INCLUDE_DIRS)
|
||||
|
||||
# only probe if we haven't a path in our cache
|
||||
if (Petsc_ROOT)
|
||||
set (PETSC_ROOT "${Petsc_ROOT}")
|
||||
endif (Petsc_ROOT)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
set(OLD_PKG $ENV{PKG_CONFIG_PATH})
|
||||
set(ENV{PKG_CONFIG_PATH} $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig)
|
||||
pkg_check_modules(PETSC PETSc>=3.4.0)
|
||||
set(ENV{PKG_CONFIG_PATH} ${OLD_PKG})
|
||||
set(PETSC_LIBRARIES ${PETSC_STATIC_LDFLAGS})
|
||||
set(PETSC_LIBRARY ${PETSC_LIBRARIES})
|
||||
set(PETSC_INCLUDE_DIR ${PETSC_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(NOT PETSC_FOUND)
|
||||
find_path (PETSC_NORMAL_INCLUDE_DIR
|
||||
NAMES "petsc.h"
|
||||
PATHS ${PETSC_ROOT}
|
||||
PATH_SUFFIXES "include" "petsc"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
list(APPEND PETSC_INCLUDE_DIR ${PETSC_NORMAL_INCLUDE_DIR})
|
||||
|
||||
# look for actual Petsc library
|
||||
find_library(PETSC_LIBRARY
|
||||
NAMES "petsc-3.4.3" "petsc-3.4.4" "petsc"
|
||||
PATHS ${PETSC_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT PETSC_LIBRARY)
|
||||
message(STATUS "Could not find the PETSc library")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Petsc DEFAULT_MSG PETSC_INCLUDE_DIR PETSC_LIBRARY)
|
||||
mark_as_advanced(PETSC_INCLUDE_DIR PETSC_LIBRARY)
|
||||
|
||||
# if both headers and library are found, store results
|
||||
if(PETSC_FOUND)
|
||||
set(PETSC_INCLUDE_DIRS ${PETSC_INCLUDE_DIR})
|
||||
list(APPEND PETSC_INCLUDE_DIRS ${PETSC_MPI_INCLUDE_DIRS})
|
||||
|
||||
set(PETSC_LIBRARIES ${PETSC_LIBRARY})
|
||||
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_BLAS_LIBRARY})
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_LAPACK_LIBRARY})
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_X11_LIBRARY})
|
||||
list(APPEND PETSC_LIBRARIES ${PETSC_MPI_LIBRARY})
|
||||
endif()
|
@ -1,80 +0,0 @@
|
||||
# Module that checks whether PT-Scotch is available.
|
||||
#
|
||||
# Accepts the following variables:
|
||||
#
|
||||
# PTSCOTCH_ROOT: Prefix where PT-Scotch is installed.
|
||||
# PTSCOTCH_SUFFIX: Scotch might be compiled using different
|
||||
# integer sizes (int32, int32, long). When
|
||||
# this is is set the headers and libaries
|
||||
# are search under the suffix
|
||||
# include/scotch-${PTSCOTCH_SUFFIX, and
|
||||
# lib/scotch-${PTSCOTCH_SUFFIX}, respectively.
|
||||
# Sets the following variables:
|
||||
# PTSCOTCH_INCLUDE_DIRS: All include directories needed to compile PT-Scotch programs.
|
||||
# PTSCOTCH_LIBRARIES: Alle libraries needed to link PT-Scotch programs.
|
||||
# PTSCOTCH_FOUND: True if PT-Scotch was found.
|
||||
#
|
||||
# Provides the following macros:
|
||||
#
|
||||
# find_package(PTScotch)
|
||||
|
||||
find_package(MPI)
|
||||
macro(_search_pt_lib libvar libname doc)
|
||||
find_library(${libvar} ${libname}
|
||||
PATHS ${PTSCOTCH_ROOT} ${PTSCOTCH_ROOT}/lib PATH_SUFFIXES ${PATH_SUFFIXES}
|
||||
NO_DEFAULT_PATH
|
||||
DOC "${doc}")
|
||||
find_library(${libvar} ${libname})
|
||||
endmacro(_search_pt_lib)
|
||||
|
||||
if(PTSCOTCH_SUFFIX)
|
||||
set(PATH_SUFFIXES "scotch-${PTSCOTCH_SUFFIX}")
|
||||
else(PTSCOTCH_SUFFIX)
|
||||
set(PATH_SUFFIXES "scotch")
|
||||
endif(PTSCOTCH_SUFFIX)
|
||||
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state() # Save variables
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_DUNE_INCLUDE_PATH})
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_DUNE_COMPILE_FLAGS}")
|
||||
|
||||
find_path(PTSCOTCH_INCLUDE_DIR ptscotch.h
|
||||
PATHS ${PTSCOTCH_ROOT} ${PTSCOTCH_ROOT}/include
|
||||
PATH_SUFFIXES ${PATH_SUFFIXES}
|
||||
NO_DEFAULT_PATH
|
||||
DOC "Include directory of PT-Scotch")
|
||||
find_path(PTSCOTCH_INCLUDE_DIR ptscotch.h
|
||||
PATH_SUFFIXES ${PATH_SUFFIXES})
|
||||
|
||||
_search_pt_lib(SCOTCH_LIBRARY scotch "The main Scotch library.")
|
||||
_search_pt_lib(PTSCOTCH_LIBRARY ptscotch "The main PT-Scotch library.")
|
||||
_search_pt_lib(PTSCOTCHERR_LIBRARY ptscotcherr "The PT-Scotch error library.")
|
||||
|
||||
# behave like a CMake module is supposed to behave
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
"PTScotch"
|
||||
DEFAULT_MSG
|
||||
PTSCOTCH_INCLUDE_DIR
|
||||
SCOTCH_LIBRARY
|
||||
PTSCOTCH_LIBRARY
|
||||
PTSCOTCHERR_LIBRARY
|
||||
)
|
||||
#restore old values
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(PTSCOTCH_FOUND)
|
||||
set(PTSCOTCH_INCLUDE_DIRS ${PTSCOTCH_INCLUDE_DIR})
|
||||
set(PTSCOTCH_LIBRARIES ${SCOTCH_LIBRARY} ${PTSCOTCH_LIBRARY} ${PTSCOTCHERR_LIBRARY} ${MPI_DUNE_LIBRARIES}
|
||||
CACHE FILEPATH "All libraries needed to link programs using PT-Scotch")
|
||||
set(PTSCOCH_LINK_FLAGS "${DUNE_MPI_LINK_FLAGS}"
|
||||
CACHE STRING "PT-Scotch link flags")
|
||||
set(HAVE_PTSCOTCH 1)
|
||||
# log result
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determing location of PT-Scotch succeded:\n"
|
||||
"Include directory: ${PTSCOTCH_INCLUDE_DIRS}\n"
|
||||
"Library directory: ${PTSCOTCH_LIBRARIES}\n\n")
|
||||
endif(PTSCOTCH_FOUND)
|
||||
|
||||
mark_as_advanced(PTSCOTCH_INCLUDE_DIRS PTSCOTCH_LIBRARIES HAVE_PTSCOTCH)
|
@ -1,96 +0,0 @@
|
||||
# Module that checks whether ParMETIS or the ParMETIS interface of PT-Scotch
|
||||
# is available.
|
||||
#
|
||||
# Accepts the following variables:
|
||||
#
|
||||
# PARMETIS_ROOT: Prefix where ParMETIS is installed.
|
||||
# PARMETIS_SUFFIX: Scotch might be compiled using different
|
||||
# integer sizes (int32, int32, long). When
|
||||
# this is is set the headers and libaries
|
||||
# are search under the suffix
|
||||
# include/parmetis-${PARMETIS_SUFFIX}, and
|
||||
# lib/parmetis-${PARMETIS_SUFFIX}, respectively.
|
||||
# Sets the following variables:
|
||||
# PARMETIS_INCLUDE_DIRS: All include directories needed to compile ParMETIS programs.
|
||||
# PARMETIS_LIBRARIES: Alle libraries needed to link ParMETIS programs.
|
||||
# PARMETIS_FOUND: True if ParMETIS was found.
|
||||
#
|
||||
# Provides the following macros:
|
||||
#
|
||||
# find_package(ParMETIS)
|
||||
|
||||
find_package(MPI)
|
||||
|
||||
if(MPI_C_FOUND)
|
||||
macro(_search_parmetis_lib libvar libname doc)
|
||||
find_library(${libvar} ${libname}
|
||||
PATHS ${PARMETIS_ROOT} ${PARMETIS_ROOT}/lib PATH_SUFFIXES ${PATH_SUFFIXES}
|
||||
NO_DEFAULT_PATH
|
||||
DOC "${doc}")
|
||||
find_library(${libvar} ${libname})
|
||||
endmacro(_search_parmetis_lib)
|
||||
|
||||
if(PARMETIS_SUFFIX)
|
||||
set(PATH_SUFFIXES "-${PARMETIS_SUFFIX}")
|
||||
else(PARMETIS_SUFFIX)
|
||||
set(PATH_SUFFIXES "")
|
||||
endif(PARMETIS_SUFFIX)
|
||||
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state() # Save variables
|
||||
|
||||
find_path(PARMETIS_INCLUDE_DIR parmetis.h
|
||||
PATHS ${PARMETIS_ROOT} ${PARMETIS_ROOT}/include
|
||||
PATH_SUFFIXES parmetis${PATH_SUFFIXES}
|
||||
NO_DEFAULT_PATH
|
||||
DOC "Include directory of ParMETIS")
|
||||
find_path(PARMETIS_INCLUDE_DIR parmetis.h
|
||||
PATH_SUFFIXES parmetis${PATH_SUFFIXES})
|
||||
|
||||
# find the serial version of METIS
|
||||
find_package(METIS)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH} )
|
||||
if(PARMETIS_INCLUDE_DIR)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PARMETIS_INCLUDE_DIR})
|
||||
if(METIS_INCLUDE_DIRS)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${METIS_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
|
||||
|
||||
check_include_file(parmetis.h PARMETIS_FOUND)
|
||||
_search_parmetis_lib(PARMETIS_LIBRARY parmetis "The main ParMETIS library.")
|
||||
|
||||
# behave like a CMake module is supposed to behave
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
"ParMETIS"
|
||||
DEFAULT_MSG
|
||||
PARMETIS_INCLUDE_DIR
|
||||
PARMETIS_LIBRARY
|
||||
METIS_LIBRARIES
|
||||
PARMETIS_FOUND
|
||||
METIS_FOUND
|
||||
)
|
||||
#restore old values
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(PARMETIS_FOUND)
|
||||
set(PARMETIS_INCLUDE_DIRS ${PARMETIS_INCLUDE_DIR})
|
||||
set(PARMETIS_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARIES} ${MPI_C_LIBRARIES}
|
||||
CACHE FILEPATH "All libraries needed to link programs using ParMETIS")
|
||||
set(PARMETIS_LINK_FLAGS "${DUNE_C_LINK_FLAGS}"
|
||||
CACHE STRING "ParMETIS link flags")
|
||||
set(HAVE_PARMETIS 1)
|
||||
# log result
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining location of ParMETIS succeded:\n"
|
||||
"Include directory: ${PARMETIS_INCLUDE_DIRS}\n"
|
||||
"Library directory: ${PARMETIS_LIBRARIES}\n\n")
|
||||
|
||||
endif(PARMETIS_FOUND)
|
||||
|
||||
mark_as_advanced(PARMETIS_INCLUDE_DIRS PARMETIS_LIBRARIES HAVE_PARMETIS)
|
||||
else(MPI_C_FOUND)
|
||||
message(WARNING "MPI not found ==> ParMETIS disabled! Plase make sure -DUSE_MPI=ON was set if you need ParMETIS.")
|
||||
endif(MPI_C_FOUND)
|
@ -1,49 +0,0 @@
|
||||
# Module that checks whether the compiler supports the
|
||||
# quadruple precision floating point math
|
||||
#
|
||||
# Sets the following variables:
|
||||
# HAVE_QUAD
|
||||
# QUADMATH_LIBRARIES
|
||||
#
|
||||
# perform tests
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if(NOT DEFINED USE_QUADMATH OR USE_QUADMATH)
|
||||
if(NOT DEFINED HAVE_EXTENDED_NUMERIC_LITERALS)
|
||||
check_cxx_compiler_flag("-Werror -fext-numeric-literals" HAVE_EXTENDED_NUMERIC_LITERALS)
|
||||
endif()
|
||||
|
||||
if (HAVE_EXTENDED_NUMERIC_LITERALS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
|
||||
endif()
|
||||
|
||||
cmake_push_check_state(RESET)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <quadmath.h>
|
||||
|
||||
int main(void){
|
||||
__float128 foo = sqrtq(123.456);
|
||||
foo = FLT128_MIN;
|
||||
}" QUADMATH_FOUND)
|
||||
cmake_pop_check_state()
|
||||
|
||||
if (QUADMATH_FOUND)
|
||||
set(QUADMATH_LIBRARIES "quadmath")
|
||||
set(HAVE_QUAD "${QUADMATH_FOUND}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (USE_QUADMATH AND NOT QUADMATH_FOUND)
|
||||
message(FATAL_ERROR "Quadruple precision math support was explicitly requested but is unavailable!")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Quadmath
|
||||
DEFAULT_MSG
|
||||
QUADMATH_LIBRARIES
|
||||
HAVE_QUAD
|
||||
)
|
@ -1,294 +0,0 @@
|
||||
# - Find Tim Davis' SuiteSparse collection of sparse matrix libraries
|
||||
#
|
||||
# Synopsis:
|
||||
# find_package (SuiteSparse COMPONENTS <list-of-components>)
|
||||
#
|
||||
# Components are:
|
||||
# amd Approximate Minimum Degree ordering
|
||||
# camd Constrained Approximate Minimum Degree ordering
|
||||
# colamd COLumn Approximate Minimum Degree ordering
|
||||
# ccolamd Constrained COLumn Approximate Minimum Degree ordering
|
||||
# cholmod Supernodal sparse Cholesky factorization and update
|
||||
# umfpack Unsymmetric MultiFrontal sparse LU factorization
|
||||
#
|
||||
# The following variables will be set:
|
||||
#
|
||||
# SuiteSparse_FOUND True if all dependencies are satisfied
|
||||
# SuiteSparse_Xxx_FOUND True if module Xxx is found
|
||||
# HAVE_SUITESPARSE_Xxx_H Binary value indicating presence of header
|
||||
# SuiteSparse_INCLUDE_DIRS Paths containing the SuiteSparse header files
|
||||
# SuiteSparse_LIBRARIES Name of the libraries which must be linked
|
||||
# SuiteSparse_DEFINITIONS Defines that must be passed to the compiler
|
||||
# SuiteSparse_LINKER_FLAGS Options that must be passed when linking
|
||||
#
|
||||
# The following options can be set to configure the module:
|
||||
#
|
||||
# SUITESPARSE_USE_STATIC Link with a static library, even if a
|
||||
# dynamic library is also present. Note that
|
||||
# setting this to OFF does not ensure that a
|
||||
# shared library will be used.
|
||||
#
|
||||
# See <http://www.cise.ufl.edu/research/sparse/SuiteSparse>.
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
function (try_compile_umfpack varname)
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${UMFPACK_INCLUDE_DIRS})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${UMFPACK_LIBRARY} ${ARGN} ${SuiteSparse_EXTRA_LIBS})
|
||||
check_c_source_compiles (
|
||||
"#include <umfpack.h>
|
||||
int main (void) {
|
||||
void *Symbolic, *Numeric;
|
||||
double Info[UMFPACK_INFO], Control[UMFPACK_CONTROL];
|
||||
umfpack_dl_defaults(Control);
|
||||
umfpack_dl_symbolic(0, 0, 0, 0, 0,
|
||||
&Symbolic, Control, Info);
|
||||
umfpack_dl_numeric (0, 0, 0,
|
||||
Symbolic, &Numeric, Control, Info);
|
||||
umfpack_dl_free_symbolic(&Symbolic);
|
||||
umfpack_dl_solve(UMFPACK_A, 0, 0, 0, 0, 0,
|
||||
Numeric, Control, Info);
|
||||
umfpack_dl_free_numeric(&Numeric);
|
||||
umfpack_timer ();
|
||||
return 0;
|
||||
}" ${varname})
|
||||
cmake_pop_check_state ()
|
||||
set (${varname} "${${varname}}" PARENT_SCOPE)
|
||||
endfunction (try_compile_umfpack varname)
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (SuiteSparse_QUIET "QUIET")
|
||||
else (FIND_QUIETLY)
|
||||
set (SuiteSparse_QUIET "")
|
||||
endif (FIND_QUIETLY)
|
||||
|
||||
# we need to link to BLAS and LAPACK
|
||||
if (NOT BLAS_FOUND)
|
||||
find_package (BLAS ${SuiteSparse_QUIET} REQUIRED)
|
||||
endif (NOT BLAS_FOUND)
|
||||
if (NOT LAPACK_FOUND)
|
||||
find_package (LAPACK ${SuiteSparse_QUIET} REQUIRED)
|
||||
endif (NOT LAPACK_FOUND)
|
||||
|
||||
# we also need the math part of the runtime library
|
||||
find_library (MATH_LIBRARY NAMES "m")
|
||||
set (SuiteSparse_EXTRA_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MATH_LIBRARY})
|
||||
|
||||
# if we don't get any further clues about where to look, then start
|
||||
# roaming around the system
|
||||
set (_no_default_path "")
|
||||
|
||||
# search system directories by default
|
||||
set (SuiteSparse_SEARCH_PATH)
|
||||
|
||||
# pick up paths from the environment if specified there; these replace the
|
||||
# pre-defined paths so that we don't accidentially pick up old stuff
|
||||
if (NOT $ENV{SuiteSparse_DIR} STREQUAL "")
|
||||
set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_DIR}")
|
||||
endif (NOT $ENV{SuiteSparse_DIR} STREQUAL "")
|
||||
if (SuiteSparse_DIR)
|
||||
set (SuiteSparse_SEARCH_PATH "${SuiteSparse_DIR}")
|
||||
endif (SuiteSparse_DIR)
|
||||
# CMake uses _DIR suffix as default for config-mode files; it is unlikely
|
||||
# that we are building SuiteSparse ourselves; use _ROOT suffix to specify
|
||||
# location to pre-canned binaries
|
||||
if (NOT $ENV{SuiteSparse_ROOT} STREQUAL "")
|
||||
set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_ROOT}")
|
||||
endif (NOT $ENV{SuiteSparse_ROOT} STREQUAL "")
|
||||
if (SuiteSparse_ROOT)
|
||||
set (SuiteSparse_SEARCH_PATH "${SuiteSparse_ROOT}")
|
||||
endif (SuiteSparse_ROOT)
|
||||
# most commonly, we use the uppercase version of this variable
|
||||
if (SUITESPARSE_ROOT)
|
||||
set (SuiteSparse_SEARCH_PATH "${SUITESPARSE_ROOT}")
|
||||
endif (SUITESPARSE_ROOT)
|
||||
|
||||
# if we have specified a search path, then confine ourselves to that
|
||||
if (SuiteSparse_SEARCH_PATH)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif (SuiteSparse_SEARCH_PATH)
|
||||
|
||||
# transitive closure of dependencies; after this SuiteSparse_MODULES is the
|
||||
# full list of modules that must be found to satisfy the user's link demands
|
||||
set (SuiteSparse_MODULES ${SuiteSparse_FIND_COMPONENTS})
|
||||
list (FIND SuiteSparse_MODULES "umfpack" UMFPACK_DESIRED)
|
||||
if (NOT UMFPACK_DESIRED EQUAL -1)
|
||||
list (APPEND SuiteSparse_MODULES amd cholmod)
|
||||
endif (NOT UMFPACK_DESIRED EQUAL -1)
|
||||
list (FIND SuiteSparse_MODULES "cholmod" CHOLMOD_DESIRED)
|
||||
if (NOT CHOLMOD_DESIRED EQUAL -1)
|
||||
list (APPEND SuiteSparse_MODULES amd camd colamd)
|
||||
endif (NOT CHOLMOD_DESIRED EQUAL -1)
|
||||
if (SuiteSparse_MODULES)
|
||||
list (REMOVE_DUPLICATES SuiteSparse_MODULES)
|
||||
endif (SuiteSparse_MODULES)
|
||||
|
||||
# if someone else already have found all the packages for us, then don't do anything
|
||||
set (SuiteSparse_EVERYTHING_FOUND TRUE)
|
||||
foreach (module IN LISTS SuiteSparse_MODULES)
|
||||
string (TOUPPER ${module} MODULE)
|
||||
if (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
set (SuiteSparse_EVERYTHING_FOUND FALSE)
|
||||
break ()
|
||||
endif (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
endforeach (module)
|
||||
if (SuiteSparse_EVERYTHING_FOUND)
|
||||
return ()
|
||||
endif (SuiteSparse_EVERYTHING_FOUND)
|
||||
|
||||
# only search in architecture-relevant directory
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# if we are told to link SuiteSparse statically, add these parts
|
||||
# to the name so we always match only that particular type of lib
|
||||
option (SUITESPARSE_USE_STATIC "Link SuiteSparse statically" OFF)
|
||||
mark_as_advanced (SUITESPARSE_USE_STATIC)
|
||||
if (SUITESPARSE_USE_STATIC)
|
||||
set (_pref_ "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
set (_suff_ "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
else (SUITESPARSE_USE_STATIC)
|
||||
set (_pref_ "")
|
||||
set (_suff_ "")
|
||||
endif (SUITESPARSE_USE_STATIC)
|
||||
|
||||
# if SuiteSparse >= 4.0 we must also link with libsuitesparseconfig
|
||||
# assume that this is the case if we find the library; otherwise just
|
||||
# ignore it (older versions don't have a file named like this)
|
||||
find_library (config_LIBRARY
|
||||
NAMES "${_pref_}suitesparseconfig${_suff_}"
|
||||
PATHS ${SuiteSparse_SEARCH_PATH}
|
||||
PATH_SUFFIXES ".libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse"
|
||||
${_no_default_path}
|
||||
)
|
||||
if (config_LIBRARY)
|
||||
list (APPEND SuiteSparse_EXTRA_LIBS ${config_LIBRARY})
|
||||
# POSIX.1-2001 REALTIME portion require us to link this library too for
|
||||
# clock_gettime() which is used by suitesparseconfig
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
list (APPEND SuiteSparse_EXTRA_LIBS "-lrt")
|
||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
endif (config_LIBRARY)
|
||||
|
||||
# search filesystem for each of the module individually
|
||||
foreach (module IN LISTS SuiteSparse_MODULES)
|
||||
string (TOUPPER ${module} MODULE)
|
||||
# search for files which implements this module
|
||||
find_path (${MODULE}_INCLUDE_DIR
|
||||
NAMES ${module}.h
|
||||
PATHS ${SuiteSparse_SEARCH_PATH}
|
||||
PATH_SUFFIXES "include" "include/suitesparse" "include/ufsparse" "${MODULE}/Include"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
find_library (${MODULE}_LIBRARY
|
||||
NAMES "${_pref_}${module}${_suff_}"
|
||||
PATHS ${SuiteSparse_SEARCH_PATH}
|
||||
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" "${MODULE}/Lib"
|
||||
${_no_default_path}
|
||||
)
|
||||
# start out by including the module itself; other dependencies will be added later
|
||||
set (${MODULE}_INCLUDE_DIRS ${${MODULE}_INCLUDE_DIR})
|
||||
set (${MODULE}_LIBRARIES ${${MODULE}_LIBRARY})
|
||||
endforeach (module)
|
||||
|
||||
# insert any inter-modular dependencies here
|
||||
if (CHOLMOD_LIBRARY)
|
||||
list (APPEND CHOLMOD_LIBRARIES ${AMD_LIBRARIES} ${COLAMD_LIBRARIES})
|
||||
# optional libraries; don't insert any -NOT_FOUND paths
|
||||
if (CAMD_LIBRARY)
|
||||
list (APPEND CHOLMOD_LIBRARIES ${CAMD_LIBRARIES})
|
||||
endif (CAMD_LIBRARY)
|
||||
if (CCOLAMD_LIBRARY)
|
||||
list (APPEND CHOLMOD_LIBRARIES ${CCOLAMD_LIBRARIES})
|
||||
endif (CCOLAMD_LIBRARY)
|
||||
list (REVERSE CHOLMOD_LIBRARIES)
|
||||
# always remove the *first* library from the list
|
||||
list (REMOVE_DUPLICATES CHOLMOD_LIBRARIES)
|
||||
list (REVERSE CHOLMOD_LIBRARIES)
|
||||
endif (CHOLMOD_LIBRARY)
|
||||
if (UMFPACK_LIBRARY)
|
||||
set (UMFPACK_EXTRA_LIBS)
|
||||
# test if umfpack is usable with only amd and not cholmod
|
||||
try_compile_umfpack (HAVE_UMFPACK_WITHOUT_CHOLMOD ${AMD_LIBRARIES})
|
||||
if (HAVE_UMFPACK_WITHOUT_CHOLMOD)
|
||||
list (APPEND UMFPACK_EXTRA_LIBS ${AMD_LIBRARIES})
|
||||
else (HAVE_UMFPACK_WITHOUT_CHOLMOD)
|
||||
if (CHOLMOD_LIBRARIES)
|
||||
try_compile_umfpack (HAVE_UMFPACK_WITH_CHOLMOD ${CHOLMOD_LIBRARIES})
|
||||
if (HAVE_UMFPACK_WITH_CHOLMOD)
|
||||
list (APPEND UMFPACK_EXTRA_LIBS ${CHOLMOD_LIBRARIES})
|
||||
else (HAVE_UMFPACK_WITH_CHOLMOD)
|
||||
set (UMFPACK_EXTRA_LIBS "-NOTFOUND")
|
||||
endif (HAVE_UMFPACK_WITH_CHOLMOD)
|
||||
else (CHOLMOD_LIBRARIES)
|
||||
# if we don't have cholmod, then we certainly cannot have umfpack with cholmod
|
||||
set (UMFPACK_EXTRA_LIBS "-NOTFOUND")
|
||||
endif (CHOLMOD_LIBRARIES)
|
||||
endif (HAVE_UMFPACK_WITHOUT_CHOLMOD)
|
||||
list (APPEND UMFPACK_LIBRARIES ${UMFPACK_EXTRA_LIBS})
|
||||
list (REVERSE UMFPACK_LIBRARIES)
|
||||
list (REMOVE_DUPLICATES UMFPACK_LIBRARIES)
|
||||
list (REVERSE UMFPACK_LIBRARIES)
|
||||
endif (UMFPACK_LIBRARY)
|
||||
|
||||
# don't reset these sets; if two packages request SuiteSparse with
|
||||
# different modules, we want the sets to be merged
|
||||
#set (SuiteSparse_LIBRARIES "")
|
||||
#set (SuiteSparse_INCLUDE_DIRS "")
|
||||
|
||||
# determine which modules were found based on whether all dependencies
|
||||
# were satisfied; create a list of ALL modules (specified) that was found
|
||||
# (to be included in one swoop in CMakeLists.txt)
|
||||
set (SuiteSparse_FOUND TRUE)
|
||||
foreach (module IN LISTS SuiteSparse_FIND_COMPONENTS)
|
||||
string (TOUPPER ${module} MODULE)
|
||||
set (SuiteSparse_${MODULE}_FOUND TRUE)
|
||||
foreach (file IN LISTS ${MODULE}_INCLUDE_DIRS ${MODULE}_LIBRARIES)
|
||||
if (NOT EXISTS ${file})
|
||||
set (SuiteSparse_${MODULE}_FOUND FALSE)
|
||||
endif (NOT EXISTS ${file})
|
||||
endforeach (file)
|
||||
if (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
set (SuiteSparse_FOUND FALSE)
|
||||
# use empty string instead of zero, so it can be tested with #ifdef
|
||||
# as well as #if in the source code
|
||||
set (HAVE_SUITESPARSE_${MODULE}_H "" CACHE INT "Is ${module} header present?")
|
||||
else (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
set (HAVE_SUITESPARSE_${MODULE}_H 1 CACHE INT "Is ${module} header present?")
|
||||
list (APPEND SuiteSparse_LIBRARIES "${${MODULE}_LIBRARIES}")
|
||||
list (APPEND SuiteSparse_LINKER_FLAGS "${${MODULE}_LINKER_FLAGS}")
|
||||
list (APPEND SuiteSparse_INCLUDE_DIRS "${${MODULE}_INCLUDE_DIRS}")
|
||||
endif (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
mark_as_advanced (HAVE_SUITESPARSE_${MODULE}_H)
|
||||
mark_as_advanced (${MODULE}_INCLUDE_DIR)
|
||||
mark_as_advanced (${MODULE}_LIBRARY)
|
||||
endforeach (module)
|
||||
|
||||
if (SuiteSparse_INCLUDE_DIRS)
|
||||
list (REMOVE_DUPLICATES SuiteSparse_INCLUDE_DIRS)
|
||||
endif (SuiteSparse_INCLUDE_DIRS)
|
||||
if (SuiteSparse_LIBRARIES)
|
||||
list (REVERSE SuiteSparse_LIBRARIES)
|
||||
list (REMOVE_DUPLICATES SuiteSparse_LIBRARIES)
|
||||
list (REVERSE SuiteSparse_LIBRARIES)
|
||||
endif (SuiteSparse_LIBRARIES)
|
||||
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (SuiteSparse
|
||||
DEFAULT_MSG
|
||||
SuiteSparse_LIBRARIES
|
||||
SuiteSparse_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
# add these after checking to not pollute the message output (checking for
|
||||
# BLAS and LAPACK is REQUIRED so if they are not found, we'll have failed
|
||||
# already; suitesparseconfig is "optional" anyway)
|
||||
list (APPEND SuiteSparse_LIBRARIES ${SuiteSparse_EXTRA_LIBS})
|
@ -1,151 +0,0 @@
|
||||
#
|
||||
# Module that checks whether SuperLU is available and usable.
|
||||
# SuperLU must be a version released after the year 2005.
|
||||
#
|
||||
# Variables used by this module which you may want to set:
|
||||
# SUPERLU_ROOT Path list to search for SuperLU
|
||||
#
|
||||
# Sets the follwing variable:
|
||||
#
|
||||
# SUPERLU_FOUND True if SuperLU available and usable.
|
||||
# SUPERLU_MIN_VERSION_4_3 True if SuperLU version >= 4.3.
|
||||
# SUPERLU_POST_2005_VERSION True if SuperLU is from post-2005
|
||||
# SUPERLU_WITH_VERSION Human readable string containing version information.
|
||||
# SUPERLU_INCLUDE_DIRS Path to the SuperLU include dirs.
|
||||
# SUPERLU_LIBRARIES Name to the SuperLU library.
|
||||
#
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
include(CMakePushCheckState)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
cmake_push_check_state()
|
||||
|
||||
set(SUPERLU_FOUND "FALSE")
|
||||
|
||||
# find out the size of a pointer. this is required to only search for
|
||||
# libraries in the directories relevant for the architecture
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# look for files only at the positions given by the user if
|
||||
# an explicit path is specified
|
||||
if(SUPERLU_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
else()
|
||||
set (_no_default_path "")
|
||||
endif()
|
||||
|
||||
# look for a system-wide BLAS library
|
||||
find_package(BLAS QUIET)
|
||||
|
||||
# look for the internal SuperLU blas library (but only if no
|
||||
# system-wide library was found and a path to the superLU library was
|
||||
# specified)
|
||||
set(SUPERLU_BLAS_LIBRARY "")
|
||||
if (BLAS_FOUND)
|
||||
list(APPEND SUPERLU_BLAS_LIBRARY "${BLAS_LIBRARIES}")
|
||||
elseif(SUPERLU_ROOT)
|
||||
find_library(SUPERLU_BLAS_LIBRARY
|
||||
NAMES "blas"
|
||||
PATHS ${SUPERLU_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
# print message if there was still no blas found!
|
||||
if(NOT BLAS_FOUND AND NOT SUPERLU_BLAS_LIBRARY)
|
||||
message(STATUS "BLAS not found but required for SuperLU")
|
||||
return()
|
||||
endif()
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${SUPERLU_BLAS_LIBRARY}")
|
||||
|
||||
# find the directory containing the SuperLU include files
|
||||
if (NOT SUPERLU_INCLUDE_DIR)
|
||||
find_path(SUPERLU_INCLUDE_DIR
|
||||
NAMES "supermatrix.h"
|
||||
PATHS ${SUPERLU_ROOT}
|
||||
PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC"
|
||||
${_no_default_path}
|
||||
)
|
||||
endif()
|
||||
if(NOT SUPERLU_INCLUDE_DIR)
|
||||
message(STATUS "Directory with the SuperLU include files not found")
|
||||
return()
|
||||
endif()
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${SUPERLU_INCLUDE_DIR}")
|
||||
|
||||
# look for actual SuperLU library
|
||||
if (NOT SUPERLU_LIBRARY)
|
||||
find_library(SUPERLU_LIBRARY
|
||||
NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
|
||||
PATHS ${SUPERLU_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
endif()
|
||||
if(NOT SUPERLU_LIBRARY)
|
||||
message(STATUS "Directory with the SuperLU library not found")
|
||||
return()
|
||||
endif()
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${SUPERLU_LIBRARY}")
|
||||
|
||||
# check whether "mem_usage_t.expansions" was found in "slu_ddefs.h"
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <slu_ddefs.h>
|
||||
int main(void)
|
||||
{
|
||||
mem_usage_t mem;
|
||||
return mem.expansions;
|
||||
}"
|
||||
HAVE_MEM_USAGE_T_EXPANSIONS)
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <slu_ddefs.h>
|
||||
int main(void)
|
||||
{
|
||||
return SLU_DOUBLE;
|
||||
}"
|
||||
SUPERLU_MIN_VERSION_4_3)
|
||||
|
||||
# check whether version is at least post-2005
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <slu_ddefs.h>
|
||||
int main(void)
|
||||
{
|
||||
GlobalLU_t g;
|
||||
return 0;
|
||||
}"
|
||||
SUPERLU_POST_2005_VERSION)
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(SUPERLU_MIN_VERSION_4_3)
|
||||
set(SUPERLU_WITH_VERSION "SuperLU >= 4.3" CACHE STRING
|
||||
"Human readable string containing SuperLU version information.")
|
||||
else()
|
||||
set(SUPERLU_WITH_VERSION "SuperLU <= 4.2, post 2005" CACHE STRING
|
||||
"Human readable string containing SuperLU version information.")
|
||||
endif()
|
||||
|
||||
# behave like a CMake module is supposed to behave
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
"SuperLU"
|
||||
DEFAULT_MSG
|
||||
SUPERLU_INCLUDE_DIR
|
||||
SUPERLU_LIBRARY)
|
||||
|
||||
mark_as_advanced(SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY)
|
||||
|
||||
# if both headers and library are found, store results
|
||||
if(SUPERLU_FOUND)
|
||||
set(SUPERLU_INCLUDE_DIRS ${SUPERLU_INCLUDE_DIR})
|
||||
set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARY})
|
||||
|
||||
if (SUPERLU_BLAS_LIBRARY)
|
||||
list(APPEND SUPERLU_LIBRARIES ${SUPERLU_BLAS_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cmake_pop_check_state()
|
@ -1,37 +0,0 @@
|
||||
# - Find TinyXML library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# TinyXML_INCLUDE_DIRS Directory of header files
|
||||
# TinyXML_LIBRARIES Directory of shared object files
|
||||
# TinyXML_DEFINITIONS Defines that must be set to compile
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"TinyXML"
|
||||
|
||||
# dependencies
|
||||
""
|
||||
|
||||
# header to search for
|
||||
"tinyxml.h"
|
||||
|
||||
# library to search for
|
||||
"tinyxml"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <tinyxml.h>
|
||||
int main (void) {
|
||||
TiXmlDocument doc;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"")
|
@ -1,112 +0,0 @@
|
||||
#
|
||||
# This module first tests for UG and then sets the necessary flags
|
||||
# and config.h defines. If UG is found UG_FOUND will be true.
|
||||
#
|
||||
|
||||
# this function is required in order not to pollute the global
|
||||
# namespace with the macros defined in ug-config*.cmake
|
||||
function(opmFindUg)
|
||||
if(NOT UG_ROOT)
|
||||
# check whether UG is in /usr/local
|
||||
if(EXISTS "/usr/local/include/ug")
|
||||
set(UG_ROOT "/usr/local")
|
||||
|
||||
# check whether UG is in /usr
|
||||
elseif(EXISTS "/usr/include/ug")
|
||||
set(UG_ROOT "/usr")
|
||||
|
||||
# oops
|
||||
else()
|
||||
message(STATUS "Could not find UG. It seems to be not installed.")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UG_ROOT AND NOT UG_DIR)
|
||||
# define the directory where the config file resides
|
||||
if(EXISTS "${UG_ROOT}/lib/cmake/ug/ug-config.cmake")
|
||||
set(UG_DIR ${UG_ROOT}/lib/cmake/ug)
|
||||
elseif(EXISTS "${UG_ROOT}/lib64/cmake/ug/ug-config.cmake")
|
||||
set(UG_DIR ${UG_ROOT}/lib64/cmake/ug)
|
||||
else()
|
||||
message(WARNING "Could not find file ug-config.cmake relative to given UG_ROOT")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# include the config mode files kindly provided by UG...
|
||||
include(${UG_DIR}/ug-config-version.cmake)
|
||||
include(${UG_DIR}/ug-config.cmake)
|
||||
|
||||
set(UG_FOUND "1")
|
||||
if(NOT UG_FOR_DUNE STREQUAL "yes")
|
||||
set(UG_FOUND "0")
|
||||
message(WARNING "UG was not configured for DUNE. Did pass --enable-dune to its configure?")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(HAVE_UG ${UG_FOUND})
|
||||
|
||||
# parse version
|
||||
string(REGEX REPLACE "([0-9]*)\\.[0-9]*\\..*" "\\1" UG_VERSION_MAJOR "${PACKAGE_VERSION}")
|
||||
string(REGEX REPLACE "[0-9]*\\.([0-9]*)\\..*" "\\1" UG_VERSION_MINOR "${PACKAGE_VERSION}")
|
||||
string(REGEX REPLACE "[0-9]*\\.[0-9]*\\.([0-9]*).*" "\\1" UG_VERSION_REVISION "${PACKAGE_VERSION}")
|
||||
|
||||
string(REGEX REPLACE ".*-patch([0-9]*)" "\\1" TMP "${PACKAGE_VERSION}")
|
||||
if(TMP STREQUAL "${PACKAGE_VERSION}")
|
||||
set(UG_VERSION_PATCHLEVEL "")
|
||||
else()
|
||||
set(UG_VERSION_PATCHLEVEL "${TMP}")
|
||||
endif()
|
||||
|
||||
# Adjust compiler/linker arguments
|
||||
set(UG_LIBRARY_DIR "${libdir}")
|
||||
|
||||
foreach (UG_RAW_LIB "-lugS2" "-lugS3" "-ldevS")
|
||||
string(REGEX REPLACE "-l(.*)" "\\1" UG_LIB "${UG_RAW_LIB}")
|
||||
set(UG_LIB_FILE "${UG_LIBRARY_DIR}/lib${UG_LIB}.a")
|
||||
if (EXISTS "${UG_LIB_FILE}")
|
||||
set(UG_LIBS "${UG_LIBS}" ${UG_LIB_FILE})
|
||||
else()
|
||||
set(UG_LIBS "${UG_LIBS}" ${UG_LIB})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(UG_LIBRARIES "${UG_LIBS}")
|
||||
|
||||
# export all variables which need to be seen globally
|
||||
set(UG_FOUND "${UG_FOUND}" PARENT_SCOPE)
|
||||
set(HAVE_UG "${HAVE_UG}" PARENT_SCOPE)
|
||||
set(UG_INCLUDE_DIRS "${UG_INCLUDES}" PARENT_SCOPE)
|
||||
set(UG_LIBRARIES "${UG_LIBRARIES}" PARENT_SCOPE)
|
||||
set(UG_VERSION_MAJOR "${UG_VERSION_MAJOR}" PARENT_SCOPE)
|
||||
set(UG_VERSION_MINOR "${UG_VERSION_MINOR}" PARENT_SCOPE)
|
||||
set(UG_VERSION_REVISION "${UG_VERSION_REVISION}" PARENT_SCOPE)
|
||||
set(UG_VERSION_PATCHLEVEL "${UG_VERSION_PATCHLEVEL}" PARENT_SCOPE)
|
||||
|
||||
set(UG_DEFINITIONS "${UG_COMPILE_FLAGS}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if (NOT HAVE_UG)
|
||||
opmFindUg()
|
||||
|
||||
set(HAVE_UG "${HAVE_UG}" CACHE BOOL "UG library is available")
|
||||
set(UG_INCLUDE_DIRS "${UG_INCLUDE_DIRS}" CACHE STRING "Directory containing the headers of the UG library")
|
||||
set(UG_LIBRARIES "${UG_LIBRARIES}" CACHE STRING "The libraries which need to be linked to be able to use the UG library")
|
||||
set(UG_DEFINITIONS "${UG_DEFINITIONS}" CACHE STRING "The compiler flags for the UG library")
|
||||
set(UG_VERSION_MAJOR "${UG_VERSION_MAJOR}" CACHE INT "Major version of the UG release")
|
||||
set(UG_VERSION_MINOR "${UG_VERSION_MINOR}" CACHE INT "Minor version of the UG release")
|
||||
set(UG_VERSION_REVISION "${UG_VERSION_REVISION}" CACHE INT "Revision of the UG release")
|
||||
set(UG_VERSION_PATCHLEVEL "${UG_VERSION_PATCHLEVEL}" CACHE INT "Patchlevel of the UG release")
|
||||
|
||||
mark_as_advanced(HAVE_UG)
|
||||
mark_as_advanced(UG_INCLUDE_DIRS)
|
||||
mark_as_advanced(UG_LIBRARIES)
|
||||
mark_as_advanced(UG_DEFINITIONS)
|
||||
mark_as_advanced(UG_VERSION_MAJOR)
|
||||
mark_as_advanced(UG_VERSION_MINOR)
|
||||
mark_as_advanced(UG_VERSION_REVISION)
|
||||
mark_as_advanced(UG_VERSION_PATCHLEVEL)
|
||||
else()
|
||||
set(UG_FOUND "0")
|
||||
endif()
|
@ -1,25 +0,0 @@
|
||||
# Find Valgrind.
|
||||
#
|
||||
# This module defines:
|
||||
# VALGRIND_INCLUDE_DIR, where to find valgrind/memcheck.h, etc.
|
||||
# VALGRIND_PROGRAM, the valgrind executable.
|
||||
# VALGRIND_FOUND, If false, do not try to use valgrind.
|
||||
#
|
||||
# If you have valgrind installed in a non-standard place, you can define
|
||||
# VALGRIND_ROOT to tell cmake where it is.
|
||||
if (VALGRIND_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_path(VALGRIND_INCLUDE_DIR valgrind/memcheck.h
|
||||
/usr/include /usr/local/include ${VALGRIND_ROOT}/include)
|
||||
|
||||
# if VALGRIND_ROOT is empty, we explicitly add /bin to the search
|
||||
# path, but this does not hurt...
|
||||
find_program(VALGRIND_PROGRAM NAMES valgrind PATH ${VALGRIND_ROOT}/bin)
|
||||
|
||||
find_package_handle_standard_args(VALGRIND DEFAULT_MSG
|
||||
VALGRIND_INCLUDE_DIR
|
||||
VALGRIND_PROGRAM)
|
||||
|
||||
mark_as_advanced(VALGRIND_ROOT VALGRIND_INCLUDE_DIR VALGRIND_PROGRAM)
|
@ -1,58 +0,0 @@
|
||||
# -*-cmake-*-
|
||||
#
|
||||
# Try to find the libzoltan graph partioning library
|
||||
#
|
||||
# Once done, this will define:
|
||||
#
|
||||
# ZOLTAN_FOUND - system has the libzoltan graph partioning library
|
||||
# HAVE_ZOLTAN - like ZOLTAN_FOUND, but for the inclusion in config.h
|
||||
# ZOLTAN_INCLUDE_DIR - incude paths to use libzoltan
|
||||
# ZOLTAN_LIBRARIES - Link these to use libzoltan
|
||||
|
||||
set(ZOLTAN_SEARCH_PATH "/usr" "/usr/local" "/opt" "/opt/local")
|
||||
set(ZOLTAN_NO_DEFAULT_PATH "")
|
||||
if(ZOLTAN_ROOT)
|
||||
set(ZOLTAN_SEARCH_PATH "${ZOLTAN_ROOT}")
|
||||
set(ZOLTAN_NO_DEFAULT_PATH "NO_DEFAULT_PATH")
|
||||
endif()
|
||||
|
||||
# Make sure we have checked for the underlying partitioners.
|
||||
find_package(PTScotch)
|
||||
#find_package(ParMETIS)
|
||||
|
||||
# search for files which implements this module
|
||||
find_path (ZOLTAN_INCLUDE_DIRS
|
||||
NAMES "zoltan.h"
|
||||
PATHS ${ZOLTAN_SEARCH_PATH}
|
||||
PATH_SUFFIXES include trilinos
|
||||
${ZOLTAN_NO_DEFAULT_PATH})
|
||||
|
||||
# only search in architecture-relevant directory
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
find_library(ZOLTAN_LIBRARIES
|
||||
NAMES zoltan trilinos_zoltan
|
||||
PATHS ${ZOLTAN_SEARCH_PATH}
|
||||
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${ZOLTAN_NO_DEFAULT_PATH})
|
||||
|
||||
set (ZOLTAN_FOUND FALSE)
|
||||
if (ZOLTAN_INCLUDE_DIRS OR ZOLTAN_LIBRARIES)
|
||||
set(ZOLTAN_FOUND TRUE)
|
||||
set(HAVE_ZOLTAN 1)
|
||||
set(ZOLTAN_LIBRARIES ${ZOLTAN_LIBRARIES} ${PARMETIS_LIBRARIES} ${PTSCOTCH_LIBRARIES})
|
||||
set(ZOLTAN_INCLUDE_DIRS ${ZOLTAN_INCLUDE_DIRS} ${PARMETIS_INCLUDE_DIRS}
|
||||
${PTSCOTCH_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
set (ZOLTAN_CONFIG_VAR HAVE_ZOLTAN)
|
||||
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZOLTAN
|
||||
DEFAULT_MSG
|
||||
ZOLTAN_LIBRARIES
|
||||
ZOLTAN_INCLUDE_DIRS
|
||||
)
|
@ -1,90 +0,0 @@
|
||||
# Look for the cjson library; will probably newer be found.
|
||||
# If found, it sets these variables:
|
||||
#
|
||||
# CJSON_INCLUDE_DIRS Header file directories
|
||||
# CJSON_LIBRARIES Archive/shared objects
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
if ((NOT CJSON_ROOT) AND OPM_PARSER_ROOT)
|
||||
set( CJSON_ROOT ${OPM_PARSER_ROOT})
|
||||
endif()
|
||||
|
||||
if (CJSON_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
else (CJSON_ROOT)
|
||||
set (_no_default_path "")
|
||||
endif (CJSON_ROOT)
|
||||
|
||||
|
||||
find_path (CJSON_INCLUDE_DIR
|
||||
NAMES "cjson/cJSON.h"
|
||||
HINTS "${CJSON_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../opm-parser"
|
||||
PATH_SUFFIXES "include" "opm/json"
|
||||
DOC "Path to cjson library header files"
|
||||
${_no_default_path} )
|
||||
|
||||
# find out the size of a pointer. this is required to only search for
|
||||
# libraries in the directories relevant for the architecture
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
|
||||
|
||||
find_library (CJSON_LIBRARY
|
||||
NAMES "cjson"
|
||||
HINTS "${CJSON_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../opm-parser"
|
||||
"${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
|
||||
"${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}"
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
"opm/json"
|
||||
DOC "Path to cjson library archive/shared object files"
|
||||
${_no_default_path} )
|
||||
|
||||
# setup list of all required libraries to link with cjson
|
||||
set (CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR})
|
||||
set (CJSON_LIBRARIES ${CJSON_LIBRARY})
|
||||
|
||||
# math library (should exist on all unices; automatically linked on Windows)
|
||||
if (UNIX)
|
||||
find_library (MATH_LIBRARY NAMES "m")
|
||||
list (APPEND CJSON_LIBRARIES ${MATH_LIBRARY})
|
||||
endif (UNIX)
|
||||
|
||||
# see if we can compile a minimum example
|
||||
# CMake logical test doesn't handle lists (sic)
|
||||
if (NOT (CJSON_INCLUDE_DIRS MATCHES "-NOTFOUND" OR CJSON_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${CJSON_INCLUDE_DIRS})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${CJSON_LIBRARIES})
|
||||
|
||||
check_c_source_compiles (
|
||||
"#include <stdlib.h>
|
||||
#include <cjson/cJSON.h>
|
||||
int main (void) {
|
||||
cJSON root;
|
||||
return 0;
|
||||
}" HAVE_CJSON)
|
||||
cmake_pop_check_state ()
|
||||
else ()
|
||||
# clear the cache so the find probe is attempted again if files becomes
|
||||
# available (only upon a unsuccessful *compile* should we disable further
|
||||
# probing)
|
||||
set (HAVE_CJSON)
|
||||
unset (HAVE_CJSON CACHE)
|
||||
endif ()
|
||||
|
||||
# if the test program didn't compile, but was required to do so, bail
|
||||
# out now and display an error; otherwise limp on
|
||||
set (CJSON_FIND_REQUIRED ${cjson_FIND_REQUIRED})
|
||||
set (CJSON_FIND_QUIETLY ${cjson_FIND_QUIETLY})
|
||||
find_package_handle_standard_args (CJSON
|
||||
DEFAULT_MSG
|
||||
CJSON_INCLUDE_DIRS CJSON_LIBRARIES HAVE_CJSON
|
||||
)
|
||||
set (cjson_FOUND ${CJSON_FOUND})
|
@ -1,86 +0,0 @@
|
||||
# - Find DUNE ALUgrid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-alugrid_INCLUDE_DIRS Directory of header files
|
||||
# dune-alugrid_LIBRARIES Directory of shared object files
|
||||
# dune-alugrid_DEFINITIONS Defines that must be set to compile
|
||||
# dune-alugrid_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_ALUGRID Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
# find dune-alugrid when build with autotools (deprecated in dune 2.4 and removed after dune 3.0
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-alugrid"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
ZLIB;
|
||||
ZOLTAN;
|
||||
METIS
|
||||
"
|
||||
# header to search for
|
||||
"dune/alugrid/grid.hh"
|
||||
|
||||
# library to search for
|
||||
"dunealugrid;alugrid_parallel;alugrid_serial"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/alugrid/common/interfaces.hh>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_DUNE_ALUGRID
|
||||
")
|
||||
|
||||
# find dune-alugrid when build with cmake
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-alugrid"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
ZLIB;
|
||||
ZOLTAN;
|
||||
METIS
|
||||
"
|
||||
# header to search for
|
||||
"dune/alugrid/grid.hh"
|
||||
|
||||
# library to search for
|
||||
"dunealugrid"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/alugrid/common/interfaces.hh>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_DUNE_ALUGRID
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-grid")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "alugrid")
|
@ -1,83 +0,0 @@
|
||||
# - Find DUNE common library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-common_INCLUDE_DIRS Directory of header files
|
||||
# dune-common_LIBRARIES Directory of shared object files
|
||||
# dune-common_DEFINITIONS Defines that must be set to compile
|
||||
# dune-common_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_COMMON 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
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-common"
|
||||
|
||||
# dependencies
|
||||
"CXX11Features REQUIRED;
|
||||
BLAS REQUIRED;
|
||||
LAPACK REQUIRED;
|
||||
CxaDemangle;
|
||||
MPI
|
||||
"
|
||||
# header to search for
|
||||
"dune/common/fvector.hh"
|
||||
|
||||
# library to search for
|
||||
"dunecommon"
|
||||
|
||||
# defines to be added to compilations
|
||||
"DUNE_COMMON_FIELDVECTOR_SIZE_IS_METHOD=1"
|
||||
|
||||
# test program
|
||||
"#include <dune/common/fvector.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
int main (void) {
|
||||
Dune::FieldVector<double,1> v;
|
||||
Dune::FieldMatrix<double,1,1> m;
|
||||
m[0][0] = 1.0;
|
||||
v[0] = 1.0;
|
||||
Dune::FieldVector<double,1> w = m*v;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAS_ATTRIBUTE_UNUSED;
|
||||
HAS_ATTRIBUTE_DEPRECATED;
|
||||
HAS_ATTRIBUTE_DEPRECATED_MSG;
|
||||
HAVE_ARRAY;
|
||||
HAVE_BOOST_MAKE_SHARED_HPP;
|
||||
HAVE_BOOST_SHARED_PTR_HPP;
|
||||
HAVE_DUNE_BOOST;
|
||||
HAVE_GMP;
|
||||
HAVE_MAKE_SHARED;
|
||||
HAVE_MPI;
|
||||
HAVE_NULLPTR;
|
||||
HAVE_STATIC_ASSERT;
|
||||
HAVE_SHARED_PTR;
|
||||
MPI_2;
|
||||
SHARED_PTR_HEADER;
|
||||
SHARED_PTR_NAMESPACE;
|
||||
HAVE_TYPE_TRAITS;
|
||||
HAVE_TR1_TUPLE;
|
||||
HAVE_TUPLE;
|
||||
HAVE_CXA_DEMANGLE
|
||||
")
|
||||
#debug_find_vars ("dune-common")
|
||||
|
||||
if(MPI_C_FOUND)
|
||||
# check for MPI version 2
|
||||
include(CMakePushCheckState)
|
||||
include(CheckFunctionExists)
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDES})
|
||||
check_function_exists(MPI_Finalized MPI_2)
|
||||
cmake_pop_check_state()
|
||||
endif(MPI_C_FOUND)
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "common")
|
@ -1,57 +0,0 @@
|
||||
# - Find DUNE Fem library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-alugrid_INCLUDE_DIRS Directory of header files
|
||||
# dune-alugrid_LIBRARIES Directory of shared object files
|
||||
# dune-alugrid_DEFINITIONS Defines that must be set to compile
|
||||
# dune-alugrid_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_FEM Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2015 IRIS AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-fem"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features REQUIRED;
|
||||
dune-common REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
dune-alugrid;
|
||||
ZLIB;
|
||||
ZOLTAN;
|
||||
METIS
|
||||
"
|
||||
# header to search for
|
||||
"dune/fem/space/shapefunctionset/legendre.hh"
|
||||
|
||||
# library to search for
|
||||
"dunefem"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/fem/space/shapefunctionset/legendre.hh>
|
||||
int main (void) {
|
||||
//Dune::Fem::LegendrePolynomials::weight();
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_DUNE_FEM;
|
||||
HAVE_METIS;
|
||||
HAVE_ZLIB;
|
||||
HAVE_ZOLTAN
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-grid")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "fem")
|
@ -1,51 +0,0 @@
|
||||
# - Find DUNE geometry library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-geometry_INCLUDE_DIRS Directory of header files
|
||||
# dune-geometry_LIBRARIES Directory of shared object files
|
||||
# dune-geometry_DEFINITIONS Defines that must be set to compile
|
||||
# dune-geometry_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_GEOMETRY Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-geometry"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features REQUIRED;
|
||||
dune-common REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"dune/geometry/quadraturerules.hh"
|
||||
|
||||
# library to search for
|
||||
"dunegeometry"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/geometry/quadraturerules.hh>
|
||||
int main (void) {
|
||||
Dune::GeometryType gt;
|
||||
gt.makeQuadrilateral();
|
||||
Dune::QuadratureRules<double, 2>::rule(gt, 2).size();
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_ALGLIB
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-geometry")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "geometry")
|
@ -1,64 +0,0 @@
|
||||
# - Find DUNE grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-grid_INCLUDE_DIRS Directory of header files
|
||||
# dune-grid_LIBRARIES Directory of shared object files
|
||||
# dune-grid_DEFINITIONS Defines that must be set to compile
|
||||
# dune-grid_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_GRID Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
|
||||
set(DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS 1)
|
||||
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-grid"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features REQUIRED;
|
||||
dune-common REQUIRED;
|
||||
dune-geometry REQUIRED;
|
||||
MPI;
|
||||
UG
|
||||
"
|
||||
# header to search for
|
||||
"dune/grid/onedgrid.hh"
|
||||
|
||||
# library to search for
|
||||
"dunegrid"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/grid/onedgrid.hh>
|
||||
int main (void) {
|
||||
Dune::OneDGrid grid(1, 0., 1.);
|
||||
return grid.lbegin<0>(0) == grid.lend<0>(0);
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_MPI;
|
||||
HAVE_UG;
|
||||
HAVE_DUNE_FEM;
|
||||
HAVE_GRIDTYPE;
|
||||
HAVE_GRAPE;
|
||||
HAVE_PSURFACE;
|
||||
HAVE_AMIRAMESH;
|
||||
HAVE_ALBERTA;
|
||||
HAVE_STDINT_H;
|
||||
DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-grid")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "grid")
|
@ -1,62 +0,0 @@
|
||||
# - Find DUNE ISTL library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-istl_INCLUDE_DIRS Directory of header files
|
||||
# dune-istl_LIBRARIES Directory of shared object files
|
||||
# dune-istl_DEFINITIONS Defines that must be set to compile
|
||||
# dune-istl_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_ISTL 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
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-istl"
|
||||
|
||||
# required dependencies
|
||||
"dune-common REQUIRED;
|
||||
ParMETIS;
|
||||
SuperLU;
|
||||
SuiteSparse COMPONENTS umfpack
|
||||
"
|
||||
# header to search for
|
||||
"dune/istl/bcrsmatrix.hh"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/common/deprecated.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
|
||||
int main (void) {
|
||||
typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > Matrix;
|
||||
Matrix matrix( 3, 3, Matrix::random );
|
||||
for (int i = 0; i < 3; ++i) matrix.setrowsize(i, 2);
|
||||
matrix.endrowsizes();
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_BOOST_FUSION;
|
||||
HAVE_MEM_USAGE_T_EXPANSIONS;
|
||||
HAVE_PARDISO;
|
||||
HAVE_BOOST;
|
||||
HAVE_MPI;
|
||||
HAVE_PARMETIS;
|
||||
HAVE_SUPERLU;
|
||||
HAVE_UMFPACK;
|
||||
SUPERLU_MIN_VERSION_4_3;
|
||||
SUPERLU_POST_2005_VERSION
|
||||
")
|
||||
#debug_find_vars ("dune-istl")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "istl")
|
@ -1,42 +0,0 @@
|
||||
# - Find DUNE localfunctions library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-localfunctions_INCLUDE_DIRS Directory of header files
|
||||
# dune-localfunctions_LIBRARIES Directory of shared object files
|
||||
# dune-localfunctions_DEFINITIONS Defines that must be set to compile
|
||||
# dune-localfunctions_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_LOCALFUNCTIONS 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
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-localfunctions"
|
||||
|
||||
# required dependencies
|
||||
"dune-common REQUIRED"
|
||||
# header to search for
|
||||
"dune/localfunctions/common/localbasis.hh"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/localfunctions/common/localbasis.hh>
|
||||
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"")
|
||||
#debug_find_vars ("dune-localfunctions")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "localfunctions")
|
@ -1,42 +0,0 @@
|
||||
# - Find OPM eWoms module
|
||||
#
|
||||
# Defines the following variables:
|
||||
# ewoms_INCLUDE_DIRS Directory of header files
|
||||
# ewoms_LIBRARIES Directory of shared object files
|
||||
# ewoms_DEFINITIONS Defines that must be set to compile
|
||||
# ewoms_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_EWOMS 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 (ewoms-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"ewoms"
|
||||
|
||||
# dependencies
|
||||
"${ewoms_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"ewoms/common/start.hh"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <ewoms/common/start.hh>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${ewoms_CONFIG_VAR}"
|
||||
)
|
||||
#include (UseDynamicBoost)
|
||||
#debug_find_vars ("ewoms")
|
@ -1,51 +0,0 @@
|
||||
# Module that makes the clock_gettime() function available
|
||||
#
|
||||
# Sets the following variables:
|
||||
# HAVE_LIBRT
|
||||
# LIBRT_LIBRARIES
|
||||
#
|
||||
# perform tests
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
# first check if we need to add anything at all to be able to use
|
||||
# clock_gettime()
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <time.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
timespec time1;
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
|
||||
};
|
||||
" HAVE_LIBRT)
|
||||
cmake_pop_check_state()
|
||||
|
||||
if (HAVE_LIBRT)
|
||||
# if this worked, we're already happy
|
||||
set(LIBRT_LIBRARIES "")
|
||||
else()
|
||||
# if not, let's try the same program with linking to librt (required
|
||||
# on some systems)
|
||||
cmake_push_check_state()
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "rt")
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <time.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
timespec time1;
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
|
||||
};
|
||||
" HAVE_LIBRT2)
|
||||
cmake_pop_check_state()
|
||||
set(HAVE_LIBRT "${HAVE_LIBRT2}")
|
||||
if (HAVE_LIBRT)
|
||||
set(LIBRT_LIBRARIES "rt")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LibRT
|
||||
DEFAULT_MSG
|
||||
HAVE_LIBRT
|
||||
)
|
@ -1,43 +0,0 @@
|
||||
# - Find the opm-common module
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-common_INCLUDE_DIRS Directory of header files
|
||||
# opm-common_LIBRARIES Directory of shared object files
|
||||
# opm-common_DEFINITIONS Defines that must be set to compile
|
||||
# opm-common_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_COMMON Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-common-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-common"
|
||||
|
||||
# dependencies
|
||||
"${opm-common_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/common/utility/platform_dependent/disable_warnings.h"
|
||||
|
||||
# library to search for
|
||||
"opmcommon"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/common/utility/platform_dependent/disable_warnings.h>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
|
||||
# config variables
|
||||
"${opm-common_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-common")
|
@ -1,45 +0,0 @@
|
||||
# - Find OPM core library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-core_INCLUDE_DIRS Directory of header files
|
||||
# opm-core_LIBRARIES Directory of shared object files
|
||||
# opm-core_DEFINITIONS Defines that must be set to compile
|
||||
# opm-core_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_CORE 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-core-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-core"
|
||||
|
||||
# dependencies
|
||||
"${opm-core_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/core/grid.h"
|
||||
|
||||
# library to search for
|
||||
"opmcore"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/core/grid.h>
|
||||
int main (void) {
|
||||
struct UnstructuredGrid *g;
|
||||
g = create_grid_empty ();
|
||||
destroy_grid (g);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-core_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-core")
|
@ -1,24 +0,0 @@
|
||||
# This module searches for the opm-data repository. Since the opm-data
|
||||
# has no libraries or header files the find implementation is quite
|
||||
# naive.
|
||||
#
|
||||
# If the opm-data repository is found, the following variables are set:
|
||||
#
|
||||
# HAVE_OPM_DATA
|
||||
# OPM_DATA_ROOT
|
||||
|
||||
if (OPM_DATA_ROOT)
|
||||
set( _opm_data_root ${OPM_DATA_ROOT})
|
||||
else()
|
||||
set( _opm_data_root "${PROJECT_SOURCE_DIR}/../opm-data")
|
||||
endif()
|
||||
|
||||
|
||||
if (EXISTS "${_opm_data_root}/norne/NORNE_ATW2013.DATA")
|
||||
set( HAVE_OPM_DATA True )
|
||||
set( OPM_DATA_ROOT ${_opm_data_root} )
|
||||
message( "-- Setting OPM_DATA_ROOT: ${OPM_DATA_ROOT}")
|
||||
else()
|
||||
set( HAVE_OPM_DATA False )
|
||||
message( "opm-data not found - integration tests using opm-data will be skipped.")
|
||||
endif()
|
@ -1,48 +0,0 @@
|
||||
# - 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/Toolbox.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmflowdiagnostics"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/flowdiagnostics/Toolbox.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
using FDT = Opm::FlowDiagnostics::Toolbox;
|
||||
|
||||
const auto pv = std::vector<double>(10, 0.3);
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-flowdiagnostics_CONFIG_VAR}"
|
||||
)
|
@ -1,42 +0,0 @@
|
||||
# - Find OPM corner-point grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-grid_INCLUDE_DIRS Directory of header files
|
||||
# opm-grid_LIBRARIES Directory of shared object files
|
||||
# opm-grid_DEFINITIONS Defines that must be set to compile
|
||||
# opm-grid_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_GRID Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (opm-grid-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-grid"
|
||||
|
||||
# dependencies
|
||||
"${opm-grid_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"dune/grid/CpGrid.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmgrid"
|
||||
|
||||
# defines to be added to compilations
|
||||
"HAVE_OPM_GRID"
|
||||
|
||||
# test program
|
||||
"#include <dune/grid/CpGrid.hpp>
|
||||
int main (void) {
|
||||
Dune::CpGrid g;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-grid_CONFIG_VAR}"
|
||||
)
|
||||
|
||||
#debug_find_vars ("opm-grid")
|
@ -1,43 +0,0 @@
|
||||
# - Find OPM materials library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-material_INCLUDE_DIRS Directory of header files
|
||||
# opm-material_LIBRARIES Directory of shared object files
|
||||
# opm-material_DEFINITIONS Defines that must be set to compile
|
||||
# opm-material_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_MATERIAL Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-material-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-material"
|
||||
|
||||
# dependencies
|
||||
"${opm-material_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/material/Constants.hpp"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/material/Constants.hpp>
|
||||
int main (void) {
|
||||
double c = Opm::Constants<double>::c;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-material_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-material")
|
@ -1,55 +0,0 @@
|
||||
# - Find OPM output library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-output_INCLUDE_DIRS Directory of header files
|
||||
# opm-output_LIBRARIES Directory of shared object files
|
||||
# opm-output_DEFINITIONS Defines that must be set to compile
|
||||
# opm-output_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_OUTPUT 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-output-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-output"
|
||||
|
||||
# dependencies
|
||||
"${opm-output_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/output/OutputWriter.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmoutput"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/output/eclipse/Summary.hpp>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-output_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-output")
|
||||
|
||||
|
||||
if(OPM_OUTPUT_FOUND)
|
||||
get_filename_component(opm-output_PREFIX_DIR ${opm-output_LIBRARY} PATH)
|
||||
find_program(COMPARE_SUMMARY_COMMAND compareSummary
|
||||
PATHS ${opm-output_PREFIX_DIR}/../bin
|
||||
${opm-output_PREFIX_DIR}/../../bin)
|
||||
find_program(COMPARE_ECL_COMMAND compareECL
|
||||
PATHS ${opm-output_PREFIX_DIR}/../bin
|
||||
${opm-output_PREFIX_DIR}/../../bin)
|
||||
|
||||
endif()
|
||||
|
@ -1,169 +0,0 @@
|
||||
# Find the OPM Eclipse input parser.
|
||||
#
|
||||
# Set the cache variable OPM_PARSER_ROOT to the install location of the
|
||||
# library, or OPM_ROOT to the parent directory of the build tree.
|
||||
#
|
||||
# If found, it sets these variables:
|
||||
#
|
||||
# HAVE_OPM_PARSER Defined if a test program compiled
|
||||
# OPM_PARSER_INCLUDE_DIRS Header file directories
|
||||
# OPM_PARSER_LIBRARIES Archives and shared objects
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (OPM_PARSER_QUIET "QUIET")
|
||||
else ()
|
||||
set (OPM_PARSER_QUIET "")
|
||||
endif ()
|
||||
|
||||
# use lowercase versions of the variables if those are set
|
||||
if (opm-parser_ROOT)
|
||||
set (OPM_PARSER_ROOT ${opm-parser_ROOT})
|
||||
endif ()
|
||||
if (opm_ROOT)
|
||||
set (OPM_ROOT ${opm_ROOT})
|
||||
endif ()
|
||||
|
||||
# inherit "suite" root if not specifically set for this library
|
||||
if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT)
|
||||
set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser")
|
||||
endif ()
|
||||
|
||||
# Detect the build dir suffix or subdirectory
|
||||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
|
||||
|
||||
# if a root is specified, then don't search in system directories
|
||||
# or in relative directories to this one
|
||||
if (OPM_PARSER_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
set (_opm_parser_source "")
|
||||
set (_opm_parser_build "")
|
||||
else ()
|
||||
set (_no_default_path "")
|
||||
set (_opm_parser_source
|
||||
"${PROJECT_SOURCE_DIR}/../opm-parser")
|
||||
set (_opm_parser_build
|
||||
"${PROJECT_BINARY_DIR}/../opm-parser"
|
||||
"${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
|
||||
"${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}")
|
||||
endif ()
|
||||
|
||||
# use this header as signature
|
||||
find_path (OPM_PARSER_INCLUDE_DIR
|
||||
NAMES "opm/parser/eclipse/Parser/Parser.hpp"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_source}
|
||||
PATH_SUFFIXES "include"
|
||||
DOC "Path to OPM parser header files"
|
||||
${_no_default_path} )
|
||||
|
||||
find_path (OPM_PARSER_GEN_INCLUDE_DIR
|
||||
NAMES "opm/parser/eclipse/Parser/ParserKeywords.hpp"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_build}
|
||||
PATH_SUFFIXES "generated-source/include" "include"
|
||||
DOC "Path to OPM parser generated header files"
|
||||
${_no_default_path} )
|
||||
|
||||
|
||||
# backup: if we didn't find any headers there, but a CMakeCache.txt,
|
||||
# then it is probably a build directory; read the CMake cache of
|
||||
# opm-parser to figure out where the source directory is
|
||||
if ((NOT OPM_PARSER_INCLUDE_DIR) AND
|
||||
(OPM_PARSER_ROOT AND (EXISTS "${OPM_PARSER_ROOT}/CMakeCache.txt")))
|
||||
set (_regex "^OPMParser_SOURCE_DIR:STATIC=\(.*\)$")
|
||||
file (STRINGS
|
||||
"${OPM_PARSER_ROOT}/CMakeCache.txt"
|
||||
_cache_entry
|
||||
REGEX "${_regex}")
|
||||
string(REGEX REPLACE "${_regex}" "\\1"
|
||||
OPM_PARSER_INCLUDE_DIR
|
||||
"${_cache_entry}")
|
||||
if (OPM_PARSER_INCLUDE_DIR)
|
||||
set (OPM_PARSER_INCLUDE_DIR "${OPM_PARSER_INCLUDE_DIR}"
|
||||
CACHE PATH "Path to OPM parser header files" FORCE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# find out the size of a pointer. this is required to only search for
|
||||
# libraries in the directories relevant for the architecture
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif ()
|
||||
|
||||
# these libraries constitute the parser core
|
||||
find_library (OPM_PARSER_LIBRARY
|
||||
NAMES "opmparser"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_build}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
"opm/parser/eclipse"
|
||||
DOC "Path to OPM parser library archive/shared object files"
|
||||
${_no_default_path} )
|
||||
|
||||
# find the OPM-parser wrapper library around cJSON
|
||||
find_library (OPM_JSON_LIBRARY
|
||||
NAMES "opmjson"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_build}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
"opm/json"
|
||||
DOC "Path to OPM JSON library archive/shared object files"
|
||||
${_no_default_path} )
|
||||
|
||||
# get the prerequisite ERT libraries
|
||||
if (NOT ERT_FOUND)
|
||||
find_package(ERT ${OPM_PARSER_QUIET})
|
||||
endif ()
|
||||
|
||||
# get the prerequisite Boost libraries
|
||||
find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex ${OPM_PARSER_QUIET})
|
||||
|
||||
if (ERT_FOUND AND Boost_FOUND AND
|
||||
OPM_PARSER_LIBRARY AND OPM_JSON_LIBRARY AND OPM_PARSER_INCLUDE_DIR)
|
||||
# setup list of all required libraries to link with opm-parser. notice that
|
||||
# we use the plural form to get *all* the libraries needed by cjson
|
||||
set (opm-parser_INCLUDE_DIRS
|
||||
${OPM_PARSER_INCLUDE_DIR}
|
||||
${OPM_PARSER_GEN_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ERT_INCLUDE_DIRS})
|
||||
|
||||
set (opm-parser_LIBRARIES
|
||||
${OPM_PARSER_LIBRARY}
|
||||
${OPM_JSON_LIBRARY}
|
||||
${Boost_LIBRARIES}
|
||||
${ERT_LIBRARIES})
|
||||
|
||||
# see if we can compile a minimum example
|
||||
# CMake logical test doesn't handle lists (sic)
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${opm-parser_INCLUDE_DIRS})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${opm-parser_LIBRARIES})
|
||||
|
||||
check_cxx_source_compiles (
|
||||
"#include <cstdlib>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
int main (void) {
|
||||
return EXIT_SUCCESS;
|
||||
}" HAVE_OPM_PARSER)
|
||||
cmake_pop_check_state ()
|
||||
endif()
|
||||
|
||||
# if the test program didn't compile, but was required to do so, bail
|
||||
# out now and display an error; otherwise limp on
|
||||
set (OPM_PARSER_FIND_REQUIRED ${opm-parser_FIND_REQUIRED})
|
||||
find_package_handle_standard_args (opm-parser
|
||||
DEFAULT_MSG
|
||||
opm-parser_INCLUDE_DIRS opm-parser_LIBRARIES HAVE_OPM_PARSER
|
||||
)
|
||||
|
||||
set (opm-parser_CONFIG_VARS "HAVE_OPM_PARSER;HAVE_REGEX")
|
||||
set (opm-parser_FOUND ${OPM-PARSER_FOUND})
|
||||
|
||||
mark_as_advanced(opm-parser_LIBRARIES opm-parser_INCLUDE_DIRS OPM-PARSER_FOUND)
|
@ -1,44 +0,0 @@
|
||||
# - Find OPM automatic differentiation library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-simulators_INCLUDE_DIRS Directory of header files
|
||||
# opm-simulators_LIBRARIES Directory of shared object files
|
||||
# opm-simulators_DEFINITIONS Defines that must be set to compile
|
||||
# opm-simulators_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_SIMULATORS 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-simulators-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-simulators"
|
||||
|
||||
# dependencies
|
||||
"${opm-simulators_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/autodiff/AutoDiff.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmsimulators"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/autodiff/AutoDiff.hpp>
|
||||
int main (void) {
|
||||
Opm::AutoDiff<double> x = Opm::AutoDiff<double>::constant(42.);
|
||||
(void) x;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-simulators_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-simulators")
|
@ -1,41 +0,0 @@
|
||||
# - Find OPM upscaling grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-upscaling_INCLUDE_DIRS Directory of header files
|
||||
# opm-upscaling_LIBRARIES Directory of shared object files
|
||||
# opm-upscaling_DEFINITIONS Defines that must be set to compile
|
||||
# opm-upscaling_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_UPSCALING Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (opm-upscaling-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-upscaling"
|
||||
|
||||
# dependencies
|
||||
"${opm-upscaling_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/upscaling/SinglePhaseUpscaler.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmupscaling"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/upscaling/SinglePhaseUpscaler.hpp>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-upscaling_CONFIG_VAR}"
|
||||
)
|
||||
|
||||
#debug_find_vars ("opm-upscaling")
|
@ -1,41 +0,0 @@
|
||||
# - Find OPM vertical equilibrium library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-verteq_INCLUDE_DIRS Directory of header files
|
||||
# opm-verteq_LIBRARIES Directory of shared object files
|
||||
# opm-verteq_DEFINITIONS Defines that must be set to compile
|
||||
# opm-verteq_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_VERTEQ Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-verteq-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-verteq"
|
||||
|
||||
# dependencies
|
||||
"${opm-verteq_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/verteq/verteq.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmverteq"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/verteq/verteq.hpp>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"")
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-verteq")
|
@ -1,169 +0,0 @@
|
||||
# translate a list of libraries into a command-line that can be passed to the
|
||||
# compiler/linker. first parameter is the name of the variable that will
|
||||
# receive this list, the rest is considered the list of libraries
|
||||
function (linker_cmdline what INTO outvar FROM)
|
||||
if (NOT (UNIX OR MSYS OR MINGW))
|
||||
return ()
|
||||
endif (NOT (UNIX OR MSYS OR MINGW))
|
||||
|
||||
# if we are going to put these in regexps, we must escape period
|
||||
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
|
||||
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
string (REPLACE "." "\\." esc_ar_pref "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
string (REPLACE "." "\\." esc_ar_suff "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
|
||||
# CMake loves absolute paths, whereas libtool won't have any of it!
|
||||
# (you get an error message about argument not parsed). translate each
|
||||
# of the libraries into a linker option
|
||||
set (deplib_list "")
|
||||
foreach (deplib IN LISTS ARGN)
|
||||
# starts with a hyphen already? then just add it
|
||||
string (SUBSTRING ${deplib} 0 1 dash)
|
||||
if (${dash} STREQUAL "-")
|
||||
list (APPEND deplib_list ${deplib})
|
||||
else (${dash} STREQUAL "-")
|
||||
# otherwise, parse the name into a directory and a name
|
||||
get_filename_component (deplib_dir ${deplib} PATH)
|
||||
get_filename_component (deplib_orig ${deplib} NAME)
|
||||
string (REGEX REPLACE
|
||||
"^${esc_dl_pref}(.*)${esc_dl_suff}$"
|
||||
"\\1"
|
||||
deplib_name
|
||||
${deplib_orig}
|
||||
)
|
||||
string (REGEX REPLACE
|
||||
"^${esc_ar_pref}(.*)${esc_ar_suff}$"
|
||||
"\\1"
|
||||
deplib_name
|
||||
${deplib_name}
|
||||
)
|
||||
# directory and name each on their own; this is somewhat
|
||||
# unsatisfactory because it may be that a system dir is specified
|
||||
# by an earlier directory and you start picking up libraries from
|
||||
# there instead of the "closest" path here. also, the soversion
|
||||
# is more or less lost. remove system default path, to lessen the
|
||||
# chance that we pick the wrong library
|
||||
if (NOT ((deplib_dir STREQUAL "/usr/lib") OR
|
||||
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}")))
|
||||
list (APPEND deplib_list "-L${deplib_dir}")
|
||||
endif (NOT ((deplib_dir STREQUAL "/usr/lib") OR
|
||||
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}")))
|
||||
# if there was no translation of the name, the library is named
|
||||
# unconventionally (.so.3gf, I'm looking at you), so pass this
|
||||
# name unmodified to the linker switch
|
||||
if (deplib_orig STREQUAL deplib_name)
|
||||
list (APPEND deplib_list "-l:${deplib_orig}")
|
||||
else (deplib_orig STREQUAL deplib_name)
|
||||
list (APPEND deplib_list "-l${deplib_name}")
|
||||
endif (deplib_orig STREQUAL deplib_name)
|
||||
endif (${dash} STREQUAL "-")
|
||||
endforeach (deplib)
|
||||
# caller determines whether we want it returned as a list or a string
|
||||
if ("${what}" STREQUAL "LIST")
|
||||
set (${outvar} ${deplib_list})
|
||||
else ("${what}" STREQUAL "LIST")
|
||||
set (${outvar} "${deplib_list}")
|
||||
string (REPLACE ";" " " ${outvar} "${${outvar}}")
|
||||
endif ("${what}" STREQUAL "LIST")
|
||||
set (${outvar} "${${outvar}}" PARENT_SCOPE)
|
||||
endfunction (linker_cmdline what INTO outvar FROM)
|
||||
|
||||
function (configure_la name target)
|
||||
if (NOT (UNIX OR MSYS OR MINGW))
|
||||
return ()
|
||||
endif (NOT (UNIX OR MSYS OR MINGW))
|
||||
|
||||
# these generic variables are initialized from the project info
|
||||
set (current "${${name}_VERSION_MAJOR}")
|
||||
set (age "${${name}_VERSION_MINOR}")
|
||||
set (inherited_linker_flags "${${name}_LINKER_FLAGS}")
|
||||
set (dependency_libs "${${name}_LIBRARIES}")
|
||||
|
||||
# translate list of libraries to command line
|
||||
linker_cmdline (LIST INTO dependency_libs FROM ${dependency_libs})
|
||||
|
||||
# convert from CMake list (i.e. semi-colon separated)
|
||||
string (REPLACE ";" " " inherited_linker_flags "${inherited_linker_flags}")
|
||||
string (REPLACE ";" " " dependency_libs "${dependency_libs}")
|
||||
|
||||
# this is the preferred installation path
|
||||
set (libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
# ${name}_LIBRARY_TYPE is either SHARED or STATIC
|
||||
if (${name}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
set (libprefix "${CMAKE_SHARED_LIBRARY_PREFIX}")
|
||||
set (libsuffix "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (libname "${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
# only Unix has soversion in library names
|
||||
if (UNIX)
|
||||
set (dlname "${libname}.${current}")
|
||||
set (library_names "${libname}.${current}.${age} ${libname}.${current} ${libname}")
|
||||
else (UNIX)
|
||||
set (dlname "${libname}")
|
||||
set (library_names "${libname}")
|
||||
endif (UNIX)
|
||||
set (old_library "")
|
||||
else (${name}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
set (dlname "")
|
||||
set (library_names "")
|
||||
set (old_library "${CMAKE_STATIC_LIBRARY_PREFIX}${target}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif (${name}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
|
||||
# get the version of libtool installed on the system; this is
|
||||
# necessary because libtool checks that the file contains its own
|
||||
# signature(!)
|
||||
if (NOT libtool_MAIN)
|
||||
find_file (
|
||||
libtool_MAIN
|
||||
ltmain.sh
|
||||
PATHS /usr
|
||||
PATH_SUFFIXES share/libtool/config/
|
||||
DOC "Location of libtool"
|
||||
)
|
||||
mark_as_advanced (libtool_MAIN)
|
||||
# notify the user if it not found after we explicitly searched
|
||||
if (NOT libtool_MAIN)
|
||||
message (STATUS "Libtool not found!")
|
||||
endif (NOT libtool_MAIN)
|
||||
endif (NOT libtool_MAIN)
|
||||
if (libtool_MAIN)
|
||||
file (STRINGS
|
||||
${libtool_MAIN}
|
||||
ltversion_STRING
|
||||
REGEX "^VERSION=\".*\""
|
||||
)
|
||||
endif (libtool_MAIN)
|
||||
if (ltversion_STRING)
|
||||
string (REGEX REPLACE
|
||||
"^VERSION=\"?(.*)\"?"
|
||||
"\\1"
|
||||
ltversion
|
||||
${ltversion_STRING}
|
||||
)
|
||||
endif (ltversion_STRING)
|
||||
|
||||
# assume that we are in cmake/Modules, and that the template have been
|
||||
# put in cmake/Templates. we cannot use CMAKE_CURRENT_LIST_DIR because
|
||||
# this is in a function, and we cannot know who's calling us
|
||||
set (templ_dir "${OPM_MACROS_ROOT}/cmake/Templates")
|
||||
|
||||
|
||||
# only write an .la if libtool is found; otherwise we have no use
|
||||
# for it.
|
||||
if (ltversion)
|
||||
set (la_file "lib${target}.la")
|
||||
message (STATUS "Writing libtool archive for ${target}")
|
||||
configure_file (
|
||||
${templ_dir}/la.in
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${la_file}
|
||||
@ONLY@
|
||||
)
|
||||
else (ltversion)
|
||||
set (la_file "")
|
||||
endif (ltversion)
|
||||
|
||||
# return this variable to the caller
|
||||
if (ARGV2)
|
||||
set (${ARGV2} "${la_file}" PARENT_SCOPE)
|
||||
endif (ARGV2)
|
||||
endfunction (configure_la target)
|
@ -1,26 +0,0 @@
|
||||
# - Alias probed variables for compatibility with DUNE buildsystem
|
||||
#
|
||||
# DUNE build system sets some variables which have different names
|
||||
# in the CMake modules we are using; this module set those variable
|
||||
# so they can be exported to config.h visible to DUNE headers
|
||||
|
||||
function (set_aliases)
|
||||
# hardcoded list of "dune-var opm-var" pairs, where the components
|
||||
# are separated by space
|
||||
set (aliases
|
||||
"HAVE_UMFPACK HAVE_SUITESPARSE_UMFPACK_H"
|
||||
"HAVE_DUNE_BOOST HAVE_BOOST"
|
||||
)
|
||||
foreach (alias IN LISTS aliases)
|
||||
# convert entry "X Y" into a list "X;Y", then pick apart
|
||||
string (REGEX REPLACE "\ +" ";" tuple "${alias}")
|
||||
list (GET tuple 0 var)
|
||||
list (GET tuple 1 name)
|
||||
|
||||
# write this alias to cache
|
||||
set (${var} ${${name}} PARENT_SCOPE)
|
||||
endforeach (alias)
|
||||
endfunction (set_aliases)
|
||||
|
||||
# always call this when the module is imported
|
||||
set_aliases ()
|
@ -1,72 +0,0 @@
|
||||
# - Compile main library target
|
||||
|
||||
option (STRIP_DEBUGGING_SYMBOLS "use separate files for the executable code and the debugging symbols" OFF)
|
||||
|
||||
macro (opm_compile opm)
|
||||
# some CMake properties do not do list expansion
|
||||
string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}")
|
||||
|
||||
# name of the library should not contain dashes, as CMake will
|
||||
# define a symbol with that name, and those cannot contain dashes
|
||||
string (REPLACE "-" "" ${opm}_TARGET "${${opm}_NAME}")
|
||||
|
||||
# all public header files are together with the source. prepend our own
|
||||
# source path to the one of the dependencies so that our version of any
|
||||
# ambigious paths are used.
|
||||
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
|
||||
|
||||
# create this library, if there are any compilation units
|
||||
include_directories (${${opm}_INCLUDE_DIRS})
|
||||
link_directories (${${opm}_LIBRARY_DIRS})
|
||||
add_definitions (${${opm}_DEFINITIONS})
|
||||
set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}")
|
||||
if (${opm}_SOURCES)
|
||||
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
|
||||
set_target_properties (${${opm}_TARGET} PROPERTIES
|
||||
SOVERSION ${${opm}_VERSION_MAJOR}
|
||||
VERSION ${${opm}_VERSION}
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
)
|
||||
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
|
||||
|
||||
if (STRIP_DEBUGGING_SYMBOLS)
|
||||
# queue this executable to be stripped
|
||||
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
|
||||
endif()
|
||||
else (${opm}_SOURCES)
|
||||
# unset this variable to signal that no library is generated
|
||||
set (${opm}_TARGET)
|
||||
endif (${opm}_SOURCES)
|
||||
|
||||
# pre-compile common headers; this is setup *after* the library to pick
|
||||
# up extra options set there
|
||||
if (PRECOMPILE_HEADERS)
|
||||
# if we have no library, then use the static setting as this will
|
||||
# build the same way as any test programs (no -fPIC option)
|
||||
if (${opm}_TARGET)
|
||||
get_target_property (_type ${${opm}_TARGET} TYPE)
|
||||
else ()
|
||||
set (_type "STATIC")
|
||||
endif ()
|
||||
precompile_header (CXX ${_type}
|
||||
HEADER "${${opm}_PRECOMP_CXX_HEADER}"
|
||||
TARGET ${opm}_CXX_pch
|
||||
FLAGS ${opm}_PRECOMP_CXX_FLAGS
|
||||
)
|
||||
# must set property on source files instead of entire target, because
|
||||
# it only applies to C++ modules (and cannot be used for C)
|
||||
set_source_files_properties (${${opm}_CXX_SOURCES} PROPERTIES
|
||||
OBJECT_DEPENDS "${${opm}_CXX_pch}"
|
||||
COMPILE_FLAGS "${${opm}_PRECOMP_CXX_FLAGS}"
|
||||
)
|
||||
message (STATUS "Precompiled headers: ${${opm}_CXX_pch}")
|
||||
endif (PRECOMPILE_HEADERS)
|
||||
|
||||
# we need to know the name of the library which is generated
|
||||
if (${opm}_TARGET)
|
||||
get_target_property (${opm}_LIBRARY ${${opm}_TARGET} LOCATION)
|
||||
endif (${opm}_TARGET)
|
||||
|
||||
endmacro (opm_compile opm)
|
@ -1,99 +0,0 @@
|
||||
# - Default settings for the build
|
||||
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
include(TestCXXAcceptsFlag)
|
||||
|
||||
macro (opm_defaults opm)
|
||||
# if we are installing a development version (default when checking out of
|
||||
# VCS), then remember which directories were used when configuring. package
|
||||
# distribution should disable this option.
|
||||
option (USE_RUNPATH "Embed original dependency paths in installed library" ON)
|
||||
if (USE_RUNPATH)
|
||||
if (CXX_COMPAT_GCC)
|
||||
check_cxx_accepts_flag ("-Wl,--enable-new-dtags" HAVE_RUNPATH)
|
||||
if (HAVE_RUNPATH)
|
||||
list (APPEND ${opm}_LINKER_FLAGS "-Wl,--enable-new-dtags")
|
||||
endif (HAVE_RUNPATH)
|
||||
endif ()
|
||||
# set this to avoid CMake stripping it off again
|
||||
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif (USE_RUNPATH)
|
||||
|
||||
# build release by default
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE "Release")
|
||||
endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# default to building a static library, but let user override
|
||||
if (DEFINED BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (${opm}_LIBRARY_TYPE SHARED)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
set (${opm}_LIBRARY_TYPE STATIC)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
else (DEFINED BUILD_SHARED_LIBS)
|
||||
set (${opm}_LIBRARY_TYPE STATIC)
|
||||
endif (DEFINED BUILD_SHARED_LIBS)
|
||||
|
||||
# precompile standard headers to speed up compilation
|
||||
# unfortunately, this functionality is buggy and tends to segfault at
|
||||
# least up to version 4.7.2, so it should be disabled by default there
|
||||
set (_precomp_def OFF)
|
||||
option (PRECOMPILE_HEADERS "Precompile common headers for speed." ${_precomp_def})
|
||||
mark_as_advanced (PRECOMPILE_HEADERS)
|
||||
if (NOT PRECOMPILE_HEADERS)
|
||||
message (STATUS "Precompiled headers: disabled")
|
||||
endif(NOT PRECOMPILE_HEADERS)
|
||||
|
||||
# Use of OpenMP is considered experimental
|
||||
set (USE_OPENMP_DEFAULT OFF)
|
||||
|
||||
# if we are on a system where CMake 2.6 is the default (Hi RHEL 6!),
|
||||
# the configuration files for Boost will trip up the library paths
|
||||
# (look for /usr/lib64/lib64/ in the log) when used with FindBoost
|
||||
# module bundled with CMake 2.8. this can be circumvented by turning
|
||||
# off config mode probing if we have not explicitly specified a
|
||||
# directory to look for it. for more details, see
|
||||
# <http://stackoverflow.com/questions/9948375/cmake-find-package-succeeds-but-returns-wrong-path>
|
||||
if (NOT BOOST_ROOT)
|
||||
set (Boost_NO_BOOST_CMAKE ON)
|
||||
endif (NOT BOOST_ROOT)
|
||||
endmacro (opm_defaults opm)
|
||||
|
||||
# overwrite a cache entry's value, but keep docstring and type
|
||||
# if not already in cache, then does nothing
|
||||
function (update_cache name)
|
||||
get_property (_help CACHE "${name}" PROPERTY HELPSTRING)
|
||||
get_property (_type CACHE "${name}" PROPERTY TYPE)
|
||||
if (NOT "${_type}" STREQUAL "")
|
||||
#message ("Setting ${name} to \"${${name}}\" in cache.")
|
||||
set ("${name}" "${${name}}" CACHE ${_type} "${_help}" FORCE)
|
||||
endif ()
|
||||
endfunction (update_cache name)
|
||||
|
||||
# put all compiler options currently set back into the cache, so that
|
||||
# they can be queried from there (using ccmake for instance)
|
||||
function (write_back_options)
|
||||
# build type
|
||||
update_cache (CMAKE_BUILD_TYPE)
|
||||
|
||||
# compilers
|
||||
set (languages C CXX Fortran)
|
||||
foreach (language IN LISTS _languages)
|
||||
if (CMAKE_${language}_COMPILER)
|
||||
update_cache (CMAKE_${language}_COMPILER)
|
||||
endif ()
|
||||
endforeach (language)
|
||||
|
||||
# flags (notice use of IN LISTS to get the empty variant)
|
||||
set (buildtypes "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO")
|
||||
set (processors "C" "CXX" "Fortran" "EXE_LINKER" "MODULE_LINKER" "SHARED_LINKER")
|
||||
foreach (processor IN LISTS processors)
|
||||
foreach (buildtype IN LISTS buildtypes)
|
||||
if (CMAKE_${processor}_FLAGS${buildtype})
|
||||
update_cache (CMAKE_${processor}_FLAGS${buildtype})
|
||||
endif ()
|
||||
endforeach (buildtype)
|
||||
endforeach (processor)
|
||||
endfunction (write_back_options)
|
@ -1,89 +0,0 @@
|
||||
# - Cleanup configuration files
|
||||
#
|
||||
# Remove files generated by the configuration (not by the build); the
|
||||
# purpose is to get back a clean directory with no build artifacts
|
||||
# (some empty directories may be left behind, though)
|
||||
#
|
||||
# The following suffices are supported:
|
||||
# _NAME Name of the project
|
||||
# _STYLESHEET_COPIED Stylesheet that was copied for the documentation
|
||||
# _LIBTOOL_ARCHIVE Libtool archive file generated for library
|
||||
# _DEBUG Debug information extracted from library
|
||||
|
||||
macro (opm_dist_clean opm)
|
||||
# which generator have we been using
|
||||
string (TOUPPER "${CMAKE_GENERATOR}" _gen)
|
||||
if (_gen MATCHES "UNIX MAKEFILES")
|
||||
set (_gen_is_makefiles TRUE)
|
||||
set (_gen_is_ninja FALSE)
|
||||
elseif (_gen MATCHES "NINJA")
|
||||
set (_gen_is_makefiles FALSE)
|
||||
set (_gen_is_ninja TRUE)
|
||||
else ()
|
||||
set (_gen_is_makefiles FALSE)
|
||||
set (_gen_is_ninja FALSE)
|
||||
endif ()
|
||||
|
||||
set (DISTCLEAN_FILES
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
config.h
|
||||
config.h.tmp
|
||||
${${opm}_NAME}-config.cmake
|
||||
${${opm}_NAME}-config-version.cmake
|
||||
${${opm}_NAME}-install.cmake
|
||||
${${opm}_NAME}.pc
|
||||
${${opm}_NAME}-install.pc
|
||||
${doxy_dir}/Doxyfile
|
||||
${doxy_dir}/Doxyfile.in
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
lib/${${opm}_LIBTOOL_ARCHIVE}
|
||||
${${opm}_DEBUG}
|
||||
${tests_DEBUG}
|
||||
${examples_DEBUG}
|
||||
${tutorial_DEBUG}
|
||||
install_manifest.txt
|
||||
${${opm}_STYLESHEET_COPIED}
|
||||
${tests_INPUT_FILES}
|
||||
project-version.h
|
||||
project-version.tmp
|
||||
)
|
||||
if (_gen_is_makefiles)
|
||||
list (APPEND DISTCLEAN_FILES
|
||||
Makefile)
|
||||
endif ()
|
||||
if (_gen_is_ninja)
|
||||
list (APPEND DISTCLEAN_FILES
|
||||
build.ninja
|
||||
rules.ninja
|
||||
)
|
||||
endif ()
|
||||
|
||||
# only remove these files if they were actually copied
|
||||
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
list (APPEND DISTCLEAN_FILES
|
||||
dune.module
|
||||
dunemod.tmp
|
||||
)
|
||||
endif (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
# script to remove empty directories (can't believe this isn't included!)
|
||||
set (rmdir "${OPM_MACROS_ROOT}/cmake/Scripts/RemoveEmptyDir.cmake")
|
||||
add_custom_target (distclean
|
||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} -- clean
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${DISTCLEAN_FILES}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles/
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory Testing/
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -P ${rmdir}
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -P ${rmdir}
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR:LOCATION=${doxy_dir} -P ${rmdir}
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR:LOCATION=${tests_DIR} -P ${rmdir}
|
||||
# cannot depend on clean because it is only defined in the master Makefile
|
||||
# not in CMakeFiles/Makefile where this target will end up
|
||||
# DEPENDS clean
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
COMMENT Removing CMake-generated files
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
endmacro (opm_dist_clean opm)
|
@ -1,91 +0,0 @@
|
||||
# - Setup documentation
|
||||
#
|
||||
# Assumes that a Doxyfile template is located in the project root
|
||||
# directory, and that all documentation is going to be generated
|
||||
# into its own Documentation/ directory. It will also generate an
|
||||
# installation target for the documentation (not built by default)
|
||||
#
|
||||
# Requires the following variables to be set:
|
||||
# ${opm}_NAME Name of the project
|
||||
#
|
||||
# Output the following variables:
|
||||
# ${opm}_STYLESHEET_COPIED Location of stylesheet to be removed in distclean
|
||||
|
||||
macro (opm_doc opm doxy_dir)
|
||||
# combine the template with local customization
|
||||
file (READ ${OPM_MACROS_ROOT}/cmake/Templates/Doxyfile _doxy_templ)
|
||||
string (REPLACE ";" "\\;" _doxy_templ "${_doxy_templ}")
|
||||
if (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal)
|
||||
file (READ ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal _doxy_local)
|
||||
string (REPLACE ";" "\\;" _doxy_local "${_doxy_local}")
|
||||
else (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal)
|
||||
set (_doxy_local)
|
||||
endif (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal)
|
||||
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir})
|
||||
file (WRITE ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile.in ${_doxy_templ} ${_doxy_local})
|
||||
# set this generically named variable so even the custom file can be shared
|
||||
set (src_DIR "${${opm}_DIR}")
|
||||
|
||||
# copy the doxygen layout XML file to the build directorie's doxygen
|
||||
# directory. if the source module ships with such a file it takes
|
||||
# precedence over the one shipped with the build system.
|
||||
if (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/DoxygenLayout.xml)
|
||||
file(COPY ${PROJECT_SOURCE_DIR}/${doxy_dir}/DoxygenLayout.xml DESTINATION ${PROJECT_BINARY_DIR}/${doxy_dir})
|
||||
else()
|
||||
file(COPY ${OPM_MACROS_ROOT}/cmake/Templates/DoxygenLayout.xml DESTINATION ${PROJECT_BINARY_DIR}/${doxy_dir})
|
||||
endif()
|
||||
|
||||
# replace variables in this combined file
|
||||
configure_file (
|
||||
${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile.in
|
||||
${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile
|
||||
@ONLY
|
||||
)
|
||||
find_package (Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
add_custom_target (doc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile
|
||||
SOURCES ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM
|
||||
)
|
||||
# distributions have various naming conventions; this enables the packager
|
||||
# to direct where the install target should put the documentation. the names
|
||||
# here are taken from GNUInstallDirs.cmake
|
||||
set (CMAKE_INSTALL_DATAROOTDIR "share" CACHE STRING "Read-only arch.-indep. data root")
|
||||
set (CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc${${opm}_VER_DIR}/${${opm}_NAME}" CACHE STRING "Documentation root")
|
||||
set (_formats html)
|
||||
foreach (format IN LISTS _formats)
|
||||
string (TOUPPER ${format} FORMAT)
|
||||
install (
|
||||
DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}/${format}
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||
COMPONENT ${format}
|
||||
OPTIONAL
|
||||
)
|
||||
# target to install just HTML documentation
|
||||
add_custom_target (install-${format}
|
||||
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${format} -P cmake_install.cmake
|
||||
COMMENT Installing ${FORMAT} documentation
|
||||
VERBATIM
|
||||
)
|
||||
# since the documentation is optional, it is not automatically built
|
||||
add_dependencies (install-${format} doc)
|
||||
endforeach (format)
|
||||
endif (DOXYGEN_FOUND)
|
||||
|
||||
# stylesheets must be specified with relative path in Doxyfile, or the
|
||||
# full path (to the source directory!) will be put in the output HTML.
|
||||
# thus, we'll need to copy the stylesheet to this path relative to where
|
||||
# Doxygen will be run (in the output tree)
|
||||
if ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css
|
||||
DESTINATION ${PROJECT_BINARY_DIR}/${doxy_dir}
|
||||
)
|
||||
set (${opm}_STYLESHEET_COPIED "${doxy_dir}/style.css")
|
||||
else ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
set (${opm}_STYLESHEET_COPIED "")
|
||||
endif ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
|
||||
endmacro (opm_doc opm)
|
@ -1,104 +0,0 @@
|
||||
# - Identify source code
|
||||
|
||||
macro (opm_out_dirs)
|
||||
# put libraries in lib/ (no multi-arch support in build tree)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
set (CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles")
|
||||
endmacro (opm_out_dirs)
|
||||
|
||||
# support for some of the variables that are used in Autotools
|
||||
# template files
|
||||
macro (opm_auto_dirs)
|
||||
set (abs_top_builddir "${PROJECT_BINARY_DIR}")
|
||||
set (abs_top_srcdir "${PROJECT_SOURCE_DIR}")
|
||||
endmacro (opm_auto_dirs)
|
||||
|
||||
macro (opm_sources opm)
|
||||
# this is necessary to set so that we know where we are going to
|
||||
# execute the test programs (and make datafiles available)
|
||||
set (tests_DIR "tests")
|
||||
|
||||
# how to retrieve the "fancy" name from the filename
|
||||
set (tests_REGEXP
|
||||
"^test_([^/]*)$"
|
||||
"^([^/]*)_test$"
|
||||
)
|
||||
|
||||
# these are the lists that must be defined in CMakeLists_files
|
||||
# - MAIN_SOURCE_FILES
|
||||
# - EXAMPLE_SOURCE_FILES
|
||||
# - TEST_SOURCE_FILES
|
||||
# - TEST_DATA_FILES
|
||||
# - PUBLIC_HEADER_FILES
|
||||
# - PROGRAM_SOURCE_FILES
|
||||
# - ADDITIONAL_SOURCE_FILES
|
||||
|
||||
# rename from "friendly" names to ones that fit the "almost-structural"
|
||||
# scheme used in the .cmake modules, converting them to absolute file
|
||||
# names in the process
|
||||
foreach (_file IN LISTS MAIN_SOURCE_FILES)
|
||||
list (APPEND ${opm}_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
# further classify into language if some other modules need to add props
|
||||
if (_file MATCHES ".*\\.[cC][a-zA-Z]*$")
|
||||
if (_file MATCHES ".*\\.c$")
|
||||
list (APPEND ${opm}_C_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
else (_file MATCHES ".*\\.c$")
|
||||
list (APPEND ${opm}_CXX_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endif (_file MATCHES ".*\\.c$")
|
||||
elseif (_file MATCHES ".*\\.[fF][a-zA-Z]*$")
|
||||
list (APPEND ${opm}_Fortran_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endif (_file MATCHES ".*\\.[cC][a-zA-Z]*$")
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS PUBLIC_HEADER_FILES)
|
||||
list (APPEND ${opm}_HEADERS ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS TEST_SOURCE_FILES)
|
||||
list (APPEND tests_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS TEST_DATA_FILES)
|
||||
list (APPEND tests_DATA ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS EXAMPLE_SOURCE_FILES)
|
||||
list (APPEND examples_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS ADDITIONAL_SOURCE_FILES)
|
||||
list (APPEND additionals_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS PROGRAM_SOURCE_FILES)
|
||||
list (APPEND examples_SOURCES_DIST ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS ATTIC_FILES)
|
||||
list (APPEND attic_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
|
||||
# identify pre-compile header; if the project is called opm-foobar,
|
||||
# then it should be in opm/foobar/opm-foobar-pch.hpp
|
||||
string (REPLACE "-" "/" opm_NAME_AS_DIR ${${opm}_NAME})
|
||||
set (${opm}_PRECOMP_CXX_HEADER "${opm_NAME_AS_DIR}/${${opm}_NAME}-pch.hpp")
|
||||
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER})
|
||||
set (${opm}_PRECOMP_CXX_HEADER "")
|
||||
endif (NOT EXISTS ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER})
|
||||
endmacro (opm_sources opm)
|
||||
|
||||
# disable an entire directory from sources
|
||||
macro (opm_disable_source opm)
|
||||
foreach (_exp IN ITEMS ${ARGN})
|
||||
# regexp or directory?
|
||||
if (IS_ABSOLUTE "${_exp}")
|
||||
set (_prefix "")
|
||||
else (IS_ABSOLUTE "${_exp}")
|
||||
set (_prefix "${PROJECT_SOURCE_DIR}/")
|
||||
endif (IS_ABSOLUTE "${_exp}")
|
||||
if (IS_DIRECTORY "${_prefix}${_exp}")
|
||||
set (_glob "/*")
|
||||
else (IS_DIRECTORY "${_prefix}${_exp}")
|
||||
set (_glob "")
|
||||
endif (IS_DIRECTORY "${_prefix}${_exp}")
|
||||
file (GLOB_RECURSE _disabled RELATIVE ${PROJECT_SOURCE_DIR} "${_prefix}${_exp}${_glob}")
|
||||
foreach (_file IN ITEMS ${_disabled})
|
||||
list (REMOVE_ITEM ${opm}_SOURCES "${PROJECT_SOURCE_DIR}/${_file}")
|
||||
endforeach (_file)
|
||||
endforeach (_exp)
|
||||
endmacro (opm_disable_source opm reldir)
|
@ -1,218 +0,0 @@
|
||||
# - Generic inclusion of packages
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_and_append_package (name args)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# name Name of the package, e.g. Boost
|
||||
# args Other arguments, e.g. COMPONENTS, REQUIRED, QUIET etc.
|
||||
#
|
||||
# This macro will append the list of standard variables found by the
|
||||
# package to this project's standard variables
|
||||
#
|
||||
########################################################################
|
||||
#
|
||||
# - Generic inclusion of a list of packages
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_and_append_package_list (args)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# args List of package strings. Each string must be quoted if
|
||||
# it contains more than one word.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# find_and_append_package_list (
|
||||
# "Boost COMPONENTS filesystem REQUIRED"
|
||||
# SUPERLU
|
||||
# )
|
||||
|
||||
include (Duplicates)
|
||||
|
||||
# list of suffixes for all the project variables
|
||||
set (_opm_proj_vars
|
||||
SOURCES
|
||||
LINKER_FLAGS
|
||||
LIBRARIES
|
||||
DEFINITIONS
|
||||
INCLUDE_DIRS
|
||||
LIBRARY_DIRS
|
||||
CONFIG_VARS
|
||||
CONFIG_IMPL_VARS
|
||||
)
|
||||
|
||||
# ensure that they are at least the empty list after we're done
|
||||
foreach (name IN LISTS _opm_proj_vars)
|
||||
if (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
|
||||
set (${CMAKE_PROJECT_NAME}_${name} "")
|
||||
endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
|
||||
endforeach (name)
|
||||
|
||||
# these dependencies must always be handled by the find module
|
||||
set (_opm_proj_exemptions
|
||||
dune-common
|
||||
dune-istl
|
||||
dune-grid
|
||||
dune-geometry
|
||||
opm-parser
|
||||
)
|
||||
|
||||
# although a DUNE module, it is delivered in the OPM suite
|
||||
set (opm-core_SUITE "opm")
|
||||
set (ewoms_SUITE "opm")
|
||||
|
||||
# insert this boilerplate whenever we are going to find a new package
|
||||
macro (find_and_append_package_to prefix name)
|
||||
# special handling for Boost to avoid inadvertedly picking up system
|
||||
# libraries when we want our own version. this is done here because
|
||||
# having a custom Boost is common, but the logic to search only there
|
||||
# does not follow any particular convention.
|
||||
if (BOOST_ROOT AND NOT DEFINED Boost_NO_SYSTEM_PATHS)
|
||||
set (Boost_NO_SYSTEM_PATHS TRUE)
|
||||
endif (BOOST_ROOT AND NOT DEFINED Boost_NO_SYSTEM_PATHS)
|
||||
|
||||
# if we have specified a directory, don't revert to searching the
|
||||
# system default paths afterwards
|
||||
string (TOUPPER "${name}" NAME)
|
||||
string (REPLACE "-" "_" NAME "${NAME}")
|
||||
|
||||
# only use suite if module-specific variable is not set. this allows
|
||||
# us to override one dir in a suite
|
||||
if (NOT (${name}_DIR OR ${name}_ROOT OR ${NAME}_ROOT))
|
||||
# module is part of a suite if it has name with the pattern xxx-yyy
|
||||
if (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
|
||||
# allow to override if the module doesn't quite fit the convention
|
||||
# e.g. dune-cornerpoint (since renamed to opm-grid)
|
||||
if (NOT DEFINED ${name}_SUITE)
|
||||
# extract suite name from module
|
||||
string (REGEX REPLACE "([^-]+)-.+" "\\1" ${name}_SUITE "${name}")
|
||||
endif (NOT DEFINED ${name}_SUITE)
|
||||
# assume that each module has its own subdir directly under suite dir
|
||||
string (TOUPPER "${${name}_SUITE}" ${name}_SUITE_UPPER)
|
||||
if (DEFINED ${${name}_SUITE_UPPER}_ROOT)
|
||||
set (${NAME}_ROOT ${${${name}_SUITE_UPPER}_ROOT}/${name})
|
||||
endif (DEFINED ${${name}_SUITE_UPPER}_ROOT)
|
||||
endif (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
|
||||
endif (NOT (${name}_DIR OR ${name}_ROOT OR ${NAME}_ROOT))
|
||||
|
||||
# the documentation says that if *-config.cmake files are not found,
|
||||
# find_package will revert to doing a full search, but that is not
|
||||
# true, so unconditionally setting ${name}_DIR is not safe. however,
|
||||
# if the directory given to us contains a config file, then copy the
|
||||
# value over to this variable to switch to config mode (CMake will
|
||||
# always use config mode if *_DIR is defined)
|
||||
if (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT))
|
||||
if (EXISTS ${${name}_ROOT}/${name}-config.cmake OR EXISTS ${${name}_ROOT}/${name}Config.cmake)
|
||||
set (${name}_DIR "${${name}_ROOT}")
|
||||
endif (EXISTS ${${name}_ROOT}/${name}-config.cmake OR EXISTS ${${name}_ROOT}/${name}Config.cmake)
|
||||
if (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake)
|
||||
set (${name}_DIR "${${NAME}_ROOT}")
|
||||
endif (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake)
|
||||
endif (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT))
|
||||
|
||||
# these libraries need special handling which is not provided in
|
||||
# the -config.cmake file, but which must be provided by this project,
|
||||
# something which is done in our find module
|
||||
list (FIND _opm_proj_exemptions "${name}" _${name}_exempted)
|
||||
if ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
|
||||
set (${name}_ROOT "${${name}_DIR}")
|
||||
# store this for later, in case we reconfigure
|
||||
set (${name}_ROOT "${${name}_ROOT}" CACHE LOCATION "Path to ${name}")
|
||||
# clear this to not use config mode
|
||||
unset (${name}_DIR)
|
||||
# variables that are given on the command-line is also put in the cache
|
||||
# removing the local copy only "unshadows" this one
|
||||
unset (${name}_DIR CACHE)
|
||||
endif ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
|
||||
|
||||
# if we're told not to look for the package, pretend it was never found
|
||||
if (CMAKE_DISABLE_FIND_PACKAGE_${name})
|
||||
set (${name}_FOUND FALSE)
|
||||
set (${NAME}_FOUND FALSE)
|
||||
else ()
|
||||
# using config mode is better than using module (aka. find) mode
|
||||
# because then the package has already done all its probes and
|
||||
# stored them in the config file for us
|
||||
if (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND)
|
||||
if (${name}_DIR)
|
||||
message (STATUS "Finding package ${name} using config mode")
|
||||
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||
else ()
|
||||
message (STATUS "Finding package ${name} using module mode")
|
||||
find_package (${name} ${ARGN})
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT DEFINED ${name}_FOUND)
|
||||
set (${name}_FOUND "${${NAME}_FOUND}")
|
||||
endif ()
|
||||
if (NOT DEFINED ${NAME}_FOUND)
|
||||
set (${NAME}_FOUND "${${name}_FOUND}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# the variable "NAME" may be replaced during find_package (as this is
|
||||
# now a macro, and not a function anymore), so we must reinitialize
|
||||
string (TOUPPER "${name}" NAME)
|
||||
string (REPLACE "-" "_" NAME "${NAME}")
|
||||
|
||||
if (${name}_FOUND OR ${NAME}_FOUND)
|
||||
foreach (var IN LISTS _opm_proj_vars)
|
||||
if (DEFINED ${name}_${var})
|
||||
list (APPEND ${prefix}_${var} ${${name}_${var}})
|
||||
# some packages define an uppercase version of their own name
|
||||
elseif (DEFINED ${NAME}_${var})
|
||||
list (APPEND ${prefix}_${var} ${${NAME}_${var}})
|
||||
endif (DEFINED ${name}_${var})
|
||||
# some packages define _PATH instead of _DIRS (Hi, MPI!)
|
||||
if ("${var}" STREQUAL "INCLUDE_DIRS")
|
||||
if (DEFINED ${name}_INCLUDE_PATH)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${name}_INCLUDE_PATH})
|
||||
elseif (DEFINED ${NAME}_INCLUDE_PATH)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${NAME}_INCLUDE_PATH})
|
||||
endif (DEFINED ${name}_INCLUDE_PATH)
|
||||
# some packages define only _DIR and not _DIRS (Hi, Eigen3!)
|
||||
if (DEFINED ${name}_INCLUDE_DIR)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${name}_INCLUDE_DIR})
|
||||
elseif (DEFINED ${NAME}_INCLUDE_DIR)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${NAME}_INCLUDE_DIR})
|
||||
endif (DEFINED ${name}_INCLUDE_DIR)
|
||||
endif ("${var}" STREQUAL "INCLUDE_DIRS")
|
||||
# cleanup lists
|
||||
if ("${var}" STREQUAL "LIBRARIES")
|
||||
remove_duplicate_libraries (${prefix})
|
||||
else ("${var}" STREQUAL "LIBRARIES")
|
||||
remove_duplicate_var (${prefix} ${var})
|
||||
endif ("${var}" STREQUAL "LIBRARIES")
|
||||
endforeach (var)
|
||||
# some libraries only define xxx_FOUND and not a corresponding HAVE_xxx
|
||||
if (NOT DEFINED HAVE_${NAME})
|
||||
set (HAVE_${NAME} 1)
|
||||
endif (NOT DEFINED HAVE_${NAME})
|
||||
endif (${name}_FOUND OR ${NAME}_FOUND)
|
||||
endmacro (find_and_append_package_to prefix name)
|
||||
|
||||
# append to the list of variables associated with the project
|
||||
macro (find_and_append_package name)
|
||||
find_and_append_package_to (${CMAKE_PROJECT_NAME} ${name} ${ARGN})
|
||||
endmacro (find_and_append_package name)
|
||||
|
||||
# find a list of dependencies, adding each one of them
|
||||
macro (find_and_append_package_list_to prefix)
|
||||
# setting and separating is necessary to work around apparent bugs
|
||||
# in CMake's parser (sic)
|
||||
set (_deps ${ARGN})
|
||||
foreach (_dep IN LISTS _deps)
|
||||
separate_arguments (_args UNIX_COMMAND ${_dep})
|
||||
find_and_append_package_to (${prefix} ${_args})
|
||||
endforeach (_dep)
|
||||
endmacro (find_and_append_package_list_to prefix)
|
||||
|
||||
# convenience method to supply the project name as prefix
|
||||
macro (find_and_append_package_list)
|
||||
find_and_append_package_list_to (${CMAKE_PROJECT_NAME} ${ARGN})
|
||||
endmacro (find_and_append_package_list)
|
@ -1,81 +0,0 @@
|
||||
# - Recreate grid selection macros from DUNE
|
||||
#
|
||||
# If anyone requires Dune::GridSelector::GridType, they must call this
|
||||
# macro in *their* project, to add this information to config.h. (In
|
||||
# the autotools version, dunecontrol will automatically include m4
|
||||
# scripts that does this).
|
||||
#
|
||||
# Example:
|
||||
# opm_cornerpoint_grid (${CONFIG_H})
|
||||
|
||||
include (CMakeParseArguments)
|
||||
function (opm_grid_type)
|
||||
cmake_parse_arguments (a "" "FILENAME;SYMBOL;TYPE;CONDITION" "HEADERS" ${ARGN})
|
||||
|
||||
# write prelude of a condition to use this particular grid, an inclusion guard,
|
||||
# and checks to see if the number of dimensions fits for this type of grid
|
||||
file (APPEND ${a_FILENAME}
|
||||
"/* add GRIDTYPE typedef for grid implementation ${a_TYPE}:
|
||||
defining ${a_SYMBOL} during compilation typedefs this grid implementation as GridType
|
||||
in namespace Dune::GridSelector;
|
||||
also integer constants dimgrid and dimworld are set in this namespace.
|
||||
The required headers for this grid implementation are also included.
|
||||
*/
|
||||
#if defined ${a_SYMBOL} && ! defined USED_${a_SYMBOL}_GRIDTYPE
|
||||
/* someone else has already defined a gridtype */
|
||||
#if HAVE_GRIDTYPE
|
||||
#error \"Ambigious definition of GRIDTYPE\"
|
||||
#endif
|
||||
|
||||
#ifndef WORLDDIM
|
||||
#define WORLDDIM GRIDDIM
|
||||
#endif
|
||||
#if not (WORLDDIM >= GRIDDIM)
|
||||
#error \"WORLDDIM < GRIDDIM does not make sense.\"
|
||||
#endif
|
||||
|
||||
#if ! (${a_CONDITION})
|
||||
#error \"Preprocessor assertion ${a_CONDITION} failed.\"
|
||||
#endif
|
||||
|
||||
")
|
||||
|
||||
# write headers which are capable of defining the type. this should
|
||||
# really just have consisted of a forward declaration, but the damage
|
||||
# is done: clients expect to just pull in config.h and have the
|
||||
# proper type available.
|
||||
foreach (header IN LISTS a_HEADERS)
|
||||
file (APPEND ${a_FILENAME}
|
||||
"#include <${header}>\n"
|
||||
)
|
||||
endforeach (header)
|
||||
|
||||
# main part which does the typedef and then a postlude which marks
|
||||
# the grid as "taken" and make sure that no one else does the same
|
||||
file (APPEND ${a_FILENAME}
|
||||
"
|
||||
namespace Dune {
|
||||
namespace GridSelector {
|
||||
const int dimgrid = GRIDDIM;
|
||||
const int worldgrid = WORLDDIM;
|
||||
typedef ${a_TYPE} GridType;
|
||||
}
|
||||
}
|
||||
|
||||
#define HAVE_GRIDTYPE 1
|
||||
#define USED_${a_SYMBOL}_GRIDTYPE 1
|
||||
#endif
|
||||
")
|
||||
|
||||
endfunction (opm_grid_type)
|
||||
|
||||
# write the grid type for opm-grid
|
||||
function (opm_cornerpoint_grid config_h)
|
||||
opm_grid_type (
|
||||
FILENAME ${CONFIG_H}
|
||||
SYMBOL CPGRID
|
||||
HEADERS "dune/grid/CpGrid.hpp" "dune/grid/cpgrid/dgfparser.hh"
|
||||
TYPE Dune::CpGrid
|
||||
CONDITION "(GRIDDIM == 3) && (WORLDDIM == 3)"
|
||||
)
|
||||
endfunction (opm_cornerpoint_grid config_h)
|
@ -1,73 +0,0 @@
|
||||
# - Initialize project-specific variables
|
||||
#
|
||||
# This will read the dune.module file for project information and
|
||||
# set the following variables:
|
||||
#
|
||||
# project From the Module: field
|
||||
# ${project}_NAME Same as above
|
||||
# ${project}_DESCRIPTION From the Description: field
|
||||
# ${project}_VERSION_MAJOR From the Version: field
|
||||
# ${project}_VERSION_MINOR From the Version: field also
|
||||
#
|
||||
# This module should be the first to be included in the project,
|
||||
# because most of the others (OpmXxx.cmake) use these variables.
|
||||
|
||||
# helper macro to retrieve a single field of a dune.module file
|
||||
macro(OpmGetDuneModuleDirective field variable contents)
|
||||
string (REGEX MATCH ".*${field}:[ ]*([^\n]+).*" ${variable} "${contents}")
|
||||
string (REGEX REPLACE ".*${field}:[ ]*([^\n]+).*" "\\1" "${variable}" "${${variable}}")
|
||||
string (STRIP "${${variable}}" ${variable})
|
||||
endmacro()
|
||||
|
||||
function (OpmInitProjVars)
|
||||
# locate the "dune.module" file
|
||||
set (DUNE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dune.module")
|
||||
|
||||
# read this file into a variable
|
||||
file (READ "${DUNE_MODULE_PATH}" DUNE_MODULE)
|
||||
|
||||
# read fields from the file
|
||||
OpmGetDuneModuleDirective ("Module" project "${DUNE_MODULE}")
|
||||
OpmGetDuneModuleDirective ("Description" description "${DUNE_MODULE}")
|
||||
OpmGetDuneModuleDirective ("Version" version "${DUNE_MODULE}")
|
||||
OpmGetDuneModuleDirective ("Label" label "${DUNE_MODULE}")
|
||||
|
||||
# parse the version number
|
||||
set (verno_regex "^([0-9]*)\\.([0-9]*).*\$")
|
||||
string (REGEX REPLACE "${verno_regex}" "\\1" major "${version}")
|
||||
string (REGEX REPLACE "${verno_regex}" "\\2" minor "${version}")
|
||||
|
||||
# return these variables
|
||||
set (project "${project}" PARENT_SCOPE)
|
||||
set (${project}_NAME "${project}" PARENT_SCOPE)
|
||||
set (${project}_DESCRIPTION "${description}" PARENT_SCOPE)
|
||||
set (${project}_VERSION_MAJOR "${major}" PARENT_SCOPE)
|
||||
set (${project}_VERSION_MINOR "${minor}" PARENT_SCOPE)
|
||||
set (${project}_LABEL "${label}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
macro (OpmInitDirVars)
|
||||
# these are the most common (and desired locations)
|
||||
set (${project}_DIR "opm")
|
||||
set (doxy_dir "doc/doxygen")
|
||||
|
||||
# but for backward compatibility we can override it
|
||||
if (COMMAND dir_hook)
|
||||
dir_hook ()
|
||||
endif (COMMAND dir_hook)
|
||||
endmacro ()
|
||||
|
||||
OpmInitProjVars ()
|
||||
OpmInitDirVars ()
|
||||
|
||||
# if we are backporting this release to a system which already have an
|
||||
# earlier version, set this flag to have everything scoped into a directory
|
||||
# which incorporates the label of the release. this is done by interjecting
|
||||
# the ${project}_VER_DIR into the installation path.
|
||||
option (USE_VERSIONED_DIR "Put files in release-specific directories" OFF)
|
||||
set (${project}_SUITE "opm")
|
||||
if (USE_VERSIONED_DIR)
|
||||
set (${project}_VER_DIR "/${${project}_SUITE}-${${project}_LABEL}")
|
||||
else ()
|
||||
set (${project}_VER_DIR "")
|
||||
endif ()
|
@ -1,64 +0,0 @@
|
||||
# - Installation macro
|
||||
#
|
||||
# Set up installation targets for the binary library. The following
|
||||
# suffices must be defined for the prefix passed as parameter:
|
||||
#
|
||||
# _NAME Name of the library
|
||||
# _HEADERS List of header files to install
|
||||
# _TARGET CMake target which builds the library
|
||||
# _LIBRARY_TYPE Static or shared library
|
||||
# _DEBUG File containing debug symbols
|
||||
include (UseMultiArch)
|
||||
|
||||
macro (opm_install opm)
|
||||
foreach (_hdr IN LISTS ${opm}_HEADERS)
|
||||
get_filename_component (_dir ${_hdr} PATH)
|
||||
file (RELATIVE_PATH _rel_dir "${PROJECT_SOURCE_DIR}" "${_dir}")
|
||||
install (
|
||||
FILES ${_hdr}
|
||||
DESTINATION include${${opm}_VER_DIR}/${_rel_dir}
|
||||
)
|
||||
endforeach (_hdr)
|
||||
install (
|
||||
TARGETS ${${opm}_TARGET}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
)
|
||||
# only /usr/lib/debug seems to be searched for debug info; if we have
|
||||
# write access to that directory (package installation), then default
|
||||
# to use it; otherwise put the debug files together with the library
|
||||
# (local installation). everything can be overridden by the option.
|
||||
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
set (_sys_dbg_def ON)
|
||||
else (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
set (_sys_dbg_def OFF)
|
||||
endif (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
option (SYSTEM_DEBUG "Put .debug files in GDB debug file directory" ${_sys_dbg_def})
|
||||
set (DEBUG_FILE_DIRECTORY /usr/lib/debug CACHE LOCATION "GDB debug file directory")
|
||||
mark_as_advanced (DEBUG_FILE_DIRECTORY)
|
||||
if (SYSTEM_DEBUG AND NOT APPLE)
|
||||
set (_dbg_prefix "${DEBUG_FILE_DIRECTORY}/")
|
||||
else (SYSTEM_DEBUG AND NOT APPLE)
|
||||
set (_dbg_prefix "")
|
||||
endif (SYSTEM_DEBUG AND NOT APPLE)
|
||||
# static libraries don't have their debug info stripped, so there is
|
||||
# only a separate file when we are building shared objects
|
||||
if (${opm}_LIBRARY_TYPE STREQUAL "SHARED" AND ${opm}_TARGET AND ${opm}_DEBUG)
|
||||
# on MacOS X, debug files are actually bundles (directories)
|
||||
if (APPLE)
|
||||
set (_dbg_type DIRECTORY)
|
||||
else ()
|
||||
set (_dbg_type FILES)
|
||||
endif ()
|
||||
install (
|
||||
${_dbg_type} ${PROJECT_BINARY_DIR}/${${opm}_DEBUG}
|
||||
DESTINATION ${_dbg_prefix}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
)
|
||||
endif (${opm}_LIBRARY_TYPE STREQUAL "SHARED" AND ${opm}_TARGET AND ${opm}_DEBUG)
|
||||
# note that the DUNE parts that looks for dune.module is currently (2013-09) not
|
||||
# multiarch-aware and will thus put in lib64/ on RHEL and lib/ on Debian
|
||||
install (
|
||||
FILES ${PROJECT_SOURCE_DIR}/dune.module
|
||||
DESTINATION ${LIBDIR_MULTIARCH_UNAWARE}${${opm}_VER_DIR}/dunecontrol/${${opm}_NAME}
|
||||
)
|
||||
endmacro (opm_install opm)
|
@ -1,58 +0,0 @@
|
||||
# -*- 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:
|
||||
|
||||
# features that may be used by some packages (Fortran wrappers
|
||||
# for instance), and this set options for, but which is included
|
||||
# conditionally and thus does not exist in other packages
|
||||
set (FEATURE_VARS
|
||||
USE_UNDERSCORING
|
||||
)
|
||||
|
||||
# emulate the with-xxx feature of autotools to not give warnings
|
||||
# if we specify the directories of packages that are known to the
|
||||
# family but not necessarily used
|
||||
|
||||
# pick package names from these; opm-xxx, dune-xxx
|
||||
set (KNOWN_FAMILIES
|
||||
opm
|
||||
dune
|
||||
)
|
||||
|
||||
# variables to test; xxx_DIR, xxx_ROOT
|
||||
set (KNOWN_VARS
|
||||
DIR
|
||||
ROOT
|
||||
)
|
||||
|
||||
set (KNOWN_opm_PKGS
|
||||
common
|
||||
parser
|
||||
material
|
||||
core
|
||||
grid
|
||||
output
|
||||
simulators
|
||||
upscaling
|
||||
verteq
|
||||
)
|
||||
|
||||
set (KNOWN_dune_PKGS
|
||||
common
|
||||
geometry
|
||||
grid
|
||||
istl
|
||||
localfunctions
|
||||
)
|
||||
|
||||
foreach (family IN ITEMS ${KNOWN_FAMILIES})
|
||||
foreach (package IN ITEMS ${KNOWN_${family}_PKGS})
|
||||
foreach (var IN ITEMS ${KNOWN_VARS})
|
||||
# just "use" the variable, so we don't get warnings
|
||||
set (_dummy ${${family}-${package}_${var}})
|
||||
endforeach (var)
|
||||
endforeach (package)
|
||||
endforeach (family)
|
||||
|
||||
foreach (feature IN ITEMS ${FEATURE_VARS})
|
||||
set (_dummy ${${feature}})
|
||||
endforeach (feature)
|
@ -1,311 +0,0 @@
|
||||
# -*- 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:
|
||||
|
||||
# - Build an OPM library module
|
||||
#
|
||||
# This macro assumes that ${project} contains the name of the project,
|
||||
# e.g. "opm-core", and that various variables that configures the module
|
||||
# has been setup in advance.
|
||||
#
|
||||
# Customize the module configuration by defining these "callback" macros:
|
||||
#
|
||||
# prereqs_hook Do special processing before prerequisites are found
|
||||
# fortran_hook Determine whether Fortran support is necessary or not
|
||||
# sources_hook Do special processing before sources are compiled
|
||||
# tests_hook Do special processing before tests are compiled
|
||||
# files_hook Do special processing before final targets are added
|
||||
|
||||
# for CMake >= 3.0, we need to change a few policies:
|
||||
#
|
||||
# - CMP0026 to allow access to the LOCATION target property
|
||||
# - CMP0048 to indicate that we want to deal with the *VERSION*
|
||||
# variables ourselves
|
||||
if (POLICY CMP0026)
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 OLD)
|
||||
endif()
|
||||
|
||||
# set the behavior of the policy 0054 to NEW. (i.e. do not implicitly
|
||||
# expand variables in if statements)
|
||||
if (POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
# include special
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
message (STATUS "Enabling compatibility modules for CMake 2.8.3")
|
||||
list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.3")
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.5")
|
||||
message (STATUS "Enabling compatibility modules for CMake 2.8.5")
|
||||
list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.5")
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.5")
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.7")
|
||||
message (STATUS "Enabling compatibility modules for CMake 2.8.7")
|
||||
list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules/compat-2.8.7")
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.7")
|
||||
|
||||
# don't write default flags into the cache, preserve that for user set values
|
||||
include (AddOptions)
|
||||
no_default_options ()
|
||||
|
||||
# C++ project
|
||||
project (${${project}_NAME})
|
||||
enable_language (C)
|
||||
enable_language (CXX)
|
||||
|
||||
# print system information to better pinpoint issues from log alone
|
||||
include (UseSystemInfo)
|
||||
system_info ()
|
||||
|
||||
# very early try to print repo id (to pinpoint version if something goes wrong)
|
||||
include (UseVCSInfo)
|
||||
vcs_info ()
|
||||
|
||||
# print toolchain information to identify compilers with potential bugs
|
||||
include (UseCompVer)
|
||||
compiler_info ()
|
||||
linker_info ()
|
||||
|
||||
# default settings: build static debug library
|
||||
include (OpmDefaults)
|
||||
opm_defaults (${project})
|
||||
message (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# use tricks to do faster builds
|
||||
include (UseFastBuilds)
|
||||
|
||||
# precompiled headers
|
||||
include (UsePrecompHeaders)
|
||||
|
||||
# optimize full if we're not doing a debug build
|
||||
include (UseOptimization)
|
||||
|
||||
# turn on all warnings; this must be done before adding any
|
||||
# dependencies, in case they alter the list of warnings
|
||||
include (UseWarnings)
|
||||
|
||||
# parallel computing must be explicitly enabled
|
||||
option (USE_MPI "Use Message Passing Interface for parallel computing" OFF)
|
||||
if (NOT USE_MPI)
|
||||
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
|
||||
endif (NOT USE_MPI)
|
||||
|
||||
# parallel programming
|
||||
include (UseOpenMP)
|
||||
find_openmp (${project})
|
||||
include (UseThreads)
|
||||
find_threads (${project})
|
||||
|
||||
# callback hook to setup additional dependencies
|
||||
if (COMMAND prereqs_hook)
|
||||
prereqs_hook ()
|
||||
endif (COMMAND prereqs_hook)
|
||||
|
||||
# macro to set standard variables (INCLUDE_DIRS, LIBRARIES etc.)
|
||||
include (OpmFind)
|
||||
find_and_append_package_list_to (${project} ${${project}_DEPS})
|
||||
|
||||
# set aliases to probed variables
|
||||
include (OpmAliases)
|
||||
|
||||
# remove the dependency on the testing framework from the main library;
|
||||
# it is not possible to query for Boost twice with different components.
|
||||
list (REMOVE_ITEM "${project}_LIBRARIES" "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
|
||||
|
||||
# don't import more libraries than we need to
|
||||
include (UseOnlyNeeded)
|
||||
|
||||
# put debug information into every executable
|
||||
include (UseDebugSymbols)
|
||||
|
||||
# detect if Boost is in a shared library
|
||||
include (UseDynamicBoost)
|
||||
|
||||
# needed for Debian installation scheme
|
||||
include (UseMultiArch)
|
||||
|
||||
# Run conditional file hook
|
||||
files_hook()
|
||||
|
||||
# this module contains code to figure out which files is where
|
||||
include (OpmFiles)
|
||||
opm_auto_dirs ()
|
||||
|
||||
# put libraries in lib/
|
||||
opm_out_dirs ()
|
||||
|
||||
# identify the compilation units in the library; sources in opm/,
|
||||
# tests files in tests/, examples in tutorials/ and examples/
|
||||
opm_sources (${project})
|
||||
|
||||
# processing after base sources have been identified
|
||||
if (COMMAND sources_hook)
|
||||
sources_hook ()
|
||||
endif (COMMAND sources_hook)
|
||||
|
||||
# convenience macro to add version of another suite, e.g. dune-common
|
||||
macro (opm_need_version_of what)
|
||||
string (TOUPPER "${what}" _WHAT)
|
||||
string (REPLACE "-" "_" _WHAT "${_WHAT}")
|
||||
list (APPEND ${project}_CONFIG_IMPL_VARS
|
||||
${_WHAT}_VERSION_MAJOR ${_WHAT}_VERSION_MINOR ${_WHAT}_VERSION_REVISION
|
||||
)
|
||||
endmacro (opm_need_version_of suite module)
|
||||
|
||||
# use this hook to add version macros before we write to config.h
|
||||
if (COMMAND config_hook)
|
||||
config_hook ()
|
||||
endif (COMMAND config_hook)
|
||||
|
||||
# create configuration header which describes available features
|
||||
# necessary to compile this library. singular version is the names that
|
||||
# is required by this project alone, plural version transitively
|
||||
# includes the necessary defines by the dependencies
|
||||
include (ConfigVars)
|
||||
list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR})
|
||||
|
||||
# write configuration variables to this file. note that it is a temporary.
|
||||
# _CONFIG_IMPL_VARS are defines that are only written to config.h internal
|
||||
# to this project; they are not exported to any installed files.
|
||||
# TESTING_CONFIG_VARS is what's required by the unit tests, and is therefore
|
||||
# added in an ad-hoc manner to avoid putting dependencies to it in the module
|
||||
# requirement file. (it should be added if there is .h code that needs it)
|
||||
message (STATUS "Writing config file \"${PROJECT_BINARY_DIR}/config.h\"...")
|
||||
set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h.tmp")
|
||||
configure_vars (
|
||||
FILE CXX ${CONFIG_H}
|
||||
WRITE ${${project}_CONFIG_VARS}
|
||||
${${project}_CONFIG_IMPL_VARS}
|
||||
${TESTING_CONFIG_VARS}
|
||||
)
|
||||
|
||||
# call this hook to let it setup necessary conditions for Fortran support
|
||||
if (COMMAND fortran_hook)
|
||||
fortran_hook ()
|
||||
endif (COMMAND fortran_hook)
|
||||
|
||||
if (${project}_FORTRAN_IF)
|
||||
include (UseFortranWrappers)
|
||||
define_fc_func (
|
||||
APPEND ${CONFIG_H}
|
||||
IF ${${project}_FORTRAN_IF}
|
||||
)
|
||||
endif (${project}_FORTRAN_IF)
|
||||
|
||||
# overwrite the config.h that is used by the code only if we have some
|
||||
# real changes. thus, we don't have to recompile if a reconfigure is run
|
||||
# due to some files being added, for instance
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different ${CONFIG_H} ${PROJECT_BINARY_DIR}/config.h
|
||||
)
|
||||
|
||||
# compile main library; pull in all required includes and libraries
|
||||
include (OpmCompile)
|
||||
opm_compile (${project})
|
||||
|
||||
# installation target: copy the library together with debug and
|
||||
# configuration files to system directories
|
||||
include (OpmInstall)
|
||||
if (COMMAND install_hook)
|
||||
install_hook ()
|
||||
endif (COMMAND install_hook)
|
||||
opm_install (${project})
|
||||
message (STATUS "This build defaults to installing in ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# installation of CMake modules to help user programs locate the library
|
||||
include (OpmProject)
|
||||
opm_cmake_config (${project})
|
||||
|
||||
# routines to build satellites such as tests, tutorials and samples
|
||||
include (OpmSatellites)
|
||||
|
||||
# example programs are found in the tutorials/ and examples/ directory
|
||||
option (BUILD_EXAMPLES "Build the examples/ tree" ON)
|
||||
if (BUILD_EXAMPLES)
|
||||
opm_compile_satellites (${project} examples "" "")
|
||||
endif (BUILD_EXAMPLES)
|
||||
|
||||
opm_compile_satellites (${project} additionals EXCLUDE_FROM_ALL "")
|
||||
|
||||
# attic are programs which are not quite abandoned yet; however, they
|
||||
# are not actively maintained, so they should not be a part of the
|
||||
# default compile
|
||||
opm_compile_satellites (${project} attic EXCLUDE_FROM_ALL "")
|
||||
|
||||
# infrastructure for testing
|
||||
enable_testing ()
|
||||
include (CTest)
|
||||
|
||||
# conditionally disable tests when features aren't available
|
||||
macro (cond_disable_test name)
|
||||
if ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name}))
|
||||
message (STATUS "${name} test disabled, since ${name} is not found.")
|
||||
string (TOLOWER "${name}" name_lower)
|
||||
get_filename_component (test_${name}_FILE "tests/test_${name_lower}.cpp" ABSOLUTE)
|
||||
list (REMOVE_ITEM tests_SOURCES "${test_${name}_FILE}")
|
||||
endif ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name}))
|
||||
endmacro (cond_disable_test name)
|
||||
|
||||
# use this target to run all tests
|
||||
add_custom_target (check
|
||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
DEPENDS test-suite
|
||||
COMMENT "Checking if library is functional"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# special processing for tests
|
||||
if (COMMAND tests_hook)
|
||||
tests_hook ()
|
||||
endif (COMMAND tests_hook)
|
||||
|
||||
# make datafiles necessary for tests available in output directory
|
||||
if (BUILD_TESTING)
|
||||
opm_data (tests datafiles "${tests_DIR}")
|
||||
opm_compile_satellites (${project} tests "" "${tests_REGEXP}")
|
||||
endif (BUILD_TESTING)
|
||||
|
||||
# use this target to check local git commits
|
||||
add_custom_target(check-commits
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
|
||||
-DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
|
||||
-P ${OPM_MACROS_ROOT}/cmake/Scripts/CheckCommits.cmake)
|
||||
|
||||
# generate documentation from source code with Doxygen;
|
||||
# setup install target for this documentation
|
||||
include (OpmDoc)
|
||||
opm_doc (${project} ${doxy_dir})
|
||||
|
||||
# provide compatibility with using this build in dunecontrol
|
||||
include (DuneCompat)
|
||||
include (LibtoolArchives)
|
||||
if (${project}_TARGET)
|
||||
configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
|
||||
endif ()
|
||||
|
||||
### clean in-source builds ###
|
||||
include (OpmDistClean)
|
||||
opm_dist_clean (${project})
|
||||
|
||||
### emulate the with-xxx feature of autotools;
|
||||
include (OpmKnown)
|
||||
|
||||
# make sure we rebuild if dune.module changes
|
||||
configure_file (
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/dune.module"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/dunemod.tmp"
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
# make sure updated version information is available in the source code
|
||||
include (UseVersion)
|
||||
|
||||
# update the cache for next run
|
||||
write_back_options ()
|
@ -1,417 +0,0 @@
|
||||
# - Find routine for OPM-like modules
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_opm_package (module deps header lib defs prog conf)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# module Name of the module, e.g. "dune-common"; this will be the
|
||||
# stem of all variables defined (see below).
|
||||
# deps Semi-colon-separated list of dependent modules which must
|
||||
# be present; those that are required must be marked as such
|
||||
# explicitly. Quote if more than one word is necessary to
|
||||
# describe the dependency.
|
||||
# header Name of the header file to probe for, e.g.
|
||||
# "dune/common/fvector.hh". Note that you should have to same
|
||||
# relative path here as is used in the header files.
|
||||
# lib Name of the library to probe for, e.g. "dunecommon"
|
||||
# defs Symbols that should be passed to compilations
|
||||
# prog Program that should compile if library is present
|
||||
# conf Symbols that should be present in config.h
|
||||
#
|
||||
# It will provide these standard Find-module variables:
|
||||
#
|
||||
# ${module}_INCLUDE_DIRS Directory of header files
|
||||
# ${module}_LIBRARIES Directory of shared object files
|
||||
# ${module}_DEFINITIONS Defines that must be set to compile
|
||||
# ${module}_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_${MODULE} Binary value to use in config.h
|
||||
#
|
||||
# Note: Arguments should be quoted, otherwise a list will spill into the
|
||||
# next argument!
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
|
||||
|
||||
include (OpmFind)
|
||||
|
||||
option (SIBLING_SEARCH "Search sibling directories before system paths" ON)
|
||||
mark_as_advanced (SIBLING_SEARCH)
|
||||
|
||||
# append all items from src into dst; both must be *names* of lists
|
||||
macro (append_found src dst)
|
||||
foreach (_item IN LISTS ${src})
|
||||
if (NOT "${_item}" MATCHES "-NOTFOUND$")
|
||||
list (APPEND ${dst} ${_item})
|
||||
endif (NOT "${_item}" MATCHES "-NOTFOUND$")
|
||||
endforeach (_item)
|
||||
endmacro (append_found src dst)
|
||||
|
||||
macro (find_opm_package module deps header lib defs prog conf)
|
||||
# in addition to accepting mod-ule_ROOT, we also accept the somewhat
|
||||
# more idiomatic MOD_ULE_ROOT variant
|
||||
string (TOUPPER "${module}" MODULE_UPPER)
|
||||
string (REPLACE "-" "_" MODULE "${MODULE_UPPER}")
|
||||
|
||||
# if someone else has included this test, don't do it again
|
||||
if (${MODULE}_FOUND OR ${module}_FOUND)
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (${module}_FIND_QUIETLY)
|
||||
set (_${module}_quiet "QUIET")
|
||||
else (${module}_FIND_QUIETLY)
|
||||
set (_${module}_quiet "")
|
||||
endif (${module}_FIND_QUIETLY)
|
||||
if (${module}_FIND_REQUIRED)
|
||||
set (_${module}_required "REQUIRED")
|
||||
else (${module}_FIND_REQUIRED)
|
||||
set (_${module}_required "")
|
||||
endif (${module}_FIND_REQUIRED)
|
||||
|
||||
# see if there is a pkg-config entry for this package, and use those
|
||||
# settings as a starting point
|
||||
find_package (PkgConfig)
|
||||
pkg_check_modules (PkgConf_${module} QUIET ${module})
|
||||
|
||||
# these variables have non-standard names in FindPkgConfig (sic)
|
||||
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
||||
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
||||
|
||||
# try to figure out whether we are in a subdir build tree, and attempt
|
||||
# to put the same name as the appropriate build tree for the module
|
||||
get_filename_component (_build_dir "${CMAKE_CURRENT_BINARY_DIR}" NAME)
|
||||
|
||||
# don't bother if we are in a project specific directory already
|
||||
# (assuming no-one wants to name the build dir after another module!)
|
||||
if ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
|
||||
set (_build_dir "")
|
||||
endif ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
|
||||
|
||||
# if the user hasn't specified any location, and it isn't found
|
||||
# in standard system locations either, then start to wander
|
||||
# about and look for it in proximity to ourself. Qt Creator likes
|
||||
# to put the build-directories as siblings to the source trees,
|
||||
# but with a -build suffix, DUNE likes to have the the build tree
|
||||
# in a "build-cmake" sub-directory of each module
|
||||
set(workaround_cmake_bug 0)
|
||||
if(${module}_DIR})
|
||||
set(workaround_cmake_bug 1)
|
||||
endif()
|
||||
if(${module}_ROOT})
|
||||
set(workaround_cmake_bug 1)
|
||||
endif()
|
||||
if(${MODULE}_ROOT})
|
||||
set(workaround_cmake_bug 1)
|
||||
endif()
|
||||
if (NOT workaround_cmake_bug)
|
||||
string (TOLOWER "${module}" _module_lower)
|
||||
set (_guess
|
||||
"../${module}"
|
||||
"../${_module_lower}"
|
||||
)
|
||||
set (_guess_bin_only
|
||||
"../${module}-build"
|
||||
"../${_module_lower}-build"
|
||||
)
|
||||
|
||||
# look in similar dirs for the other module
|
||||
if (_build_dir)
|
||||
list (APPEND _guess_bin_only
|
||||
"../../${module}/${_build_dir}"
|
||||
"../../${_module_lower}/${_build_dir}"
|
||||
)
|
||||
endif (_build_dir)
|
||||
|
||||
# generate items that are in the build, not source dir
|
||||
set (_guess_bin)
|
||||
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
|
||||
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
||||
endforeach (_item)
|
||||
set (_no_system "")
|
||||
else ()
|
||||
# start looking at the paths in this order
|
||||
set (_guess_bin
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
)
|
||||
# if every package is installed directly in the "suite" directory
|
||||
# (e.g. /usr) then allow us to back-track one directory from the
|
||||
# module sub-dir that was added by OpmFind (this happens incidently
|
||||
# already for the source do to the out-of-source support)
|
||||
if ("${${MODULE}_ROOT}" MATCHES "/${module}$")
|
||||
get_filename_component (_suite_parent ${${MODULE}_ROOT} PATH)
|
||||
list (APPEND _guess_bin
|
||||
${_suite_parent}
|
||||
${_suite_parent}/${module}
|
||||
${_suite_parent}/${module}/${_build_dir}
|
||||
)
|
||||
endif ("${${MODULE}_ROOT}" MATCHES "/${module}$")
|
||||
# when we look for the source, it may be that we have been specified
|
||||
# a build directory which is a sub-dir of the source, so we look in
|
||||
# the parent also
|
||||
set (_guess
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
)
|
||||
# only add parent directories for those variants that are actually set
|
||||
# (otherwise, we'll inadvertedly add the root directory (=all))
|
||||
if (${module}_DIR)
|
||||
list (APPEND _guess ${${module}_DIR}/..)
|
||||
endif (${module}_DIR)
|
||||
if (${module}_ROOT)
|
||||
list (APPEND _guess ${${module}_ROOT}/..)
|
||||
endif (${module}_ROOT)
|
||||
if (${MODULE}_ROOT)
|
||||
list (APPEND _guess ${${MODULE}_ROOT}/..)
|
||||
endif (${MODULE}_ROOT)
|
||||
# don't search the system paths! that would be dangerous; if there
|
||||
# is a problem in our own specified directory, we don't necessarily
|
||||
# want an old version that is left in one of the system paths!
|
||||
set (_no_system "NO_DEFAULT_PATH")
|
||||
endif ()
|
||||
|
||||
# by specifying _guess in the HINTS section, it gets searched before
|
||||
# the system locations as well. the CMake documentation has a cloudy
|
||||
# recommendation, but it ends up like this: if NO_DEFAULT_PATH is
|
||||
# specified, then PATHS is used. Otherwise, it looks in HINTS, then in
|
||||
# system paths, and the finally in PATHS (!)
|
||||
if (SIBLING_SEARCH)
|
||||
set (_guess_hints ${_guess})
|
||||
set (_guess_hints_bin ${_guess_bin})
|
||||
else (SIBLING_SEARCH)
|
||||
set (_guess_hints)
|
||||
set (_guess_hints_bin)
|
||||
endif (SIBLING_SEARCH)
|
||||
|
||||
# if an include directory is specified directly (e.g. OPM_CORE_INCLUDE_DIR=
|
||||
# /usr/include/opm-2013.03) then this overrides everything else. Notice that
|
||||
# this variable uses the fully capitalized version of the name.
|
||||
if (${MODULE}_INCLUDE_DIR)
|
||||
set (_guess "${${MODULE}_INCLUDE_DIR}")
|
||||
set (_no_system_incl "NO_DEFAULT_PATH")
|
||||
else ()
|
||||
set (_no_system_incl "${_no_system}")
|
||||
endif ()
|
||||
|
||||
# search for this include and library file to get the installation
|
||||
# directory of the package; hints are searched before the system locations,
|
||||
# paths are searched afterwards
|
||||
find_path (${module}_INCLUDE_DIR
|
||||
NAMES "${header}"
|
||||
PATHS ${_guess}
|
||||
HINTS ${PkgConf_${module}_INCLUDE_DIRS} ${_guess_hints}
|
||||
PATH_SUFFIXES "include"
|
||||
${_no_system_incl}
|
||||
)
|
||||
|
||||
# some modules are all in headers
|
||||
if (NOT "${lib}" STREQUAL "")
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# again, we may directly override the location of the library alone by
|
||||
# specifying e.g. OPM_CORE_LIB_DIR. notice that this is a *directory*
|
||||
# and not the name of the library
|
||||
if (${MODULE}_LIB_DIR)
|
||||
set (_guess_bin "${${MODULE}_LIB_DIR}")
|
||||
set (_no_system_lib "NO_DEFAULT_PATH")
|
||||
else ()
|
||||
set (_no_system_lib "${_no_system}")
|
||||
endif ()
|
||||
|
||||
# if there is more than one library, then look for all of them, putting
|
||||
# them in variables with the name of the library appended. however, the
|
||||
# first entry is assumed to be the "primary" library and will be named
|
||||
# like the module. thus, with a lib entry of "foo;bar", the first library
|
||||
# is called ${module}_LIBRARY and the second ${module}_LIBRARY_bar
|
||||
foreach (_lib IN ITEMS ${lib})
|
||||
# don't include any suffix if it is the first one
|
||||
if ("${lib}" MATCHES "^${_lib}")
|
||||
set (_which)
|
||||
else ()
|
||||
set (_which "_${_lib}")
|
||||
endif ()
|
||||
find_library (${module}_LIBRARY${_which}
|
||||
NAMES "${_lib}"
|
||||
PATHS ${_guess_bin}
|
||||
HINTS ${PkgConf_${module}_LIBRARY_DIRS} ${_guess_hints_bin}
|
||||
PATH_SUFFIXES "lib" "lib/Debug" "lib/Release" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
|
||||
${_no_system_lib}
|
||||
)
|
||||
# debug info if we didn't find the desired library
|
||||
if (NOT ${module}_LIBRARY${_which})
|
||||
message (STATUS "Failed to find library \"${_lib}\" for module ${module}")
|
||||
endif ()
|
||||
endforeach (_lib)
|
||||
else (NOT "${lib}" STREQUAL "")
|
||||
set (${module}_LIBRARY "")
|
||||
endif (NOT "${lib}" STREQUAL "")
|
||||
|
||||
# add dependencies so that our result variables are complete
|
||||
# list of necessities to build with the software
|
||||
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
|
||||
foreach (_lib IN ITEMS ${lib})
|
||||
if ("${lib}" MATCHES "^${_lib}")
|
||||
set (${module}_LIBRARIES "${${module}_LIBRARY}")
|
||||
else ()
|
||||
list (APPEND ${module}_LIBRARIES "${${module}_LIBRARY_${_lib}}")
|
||||
endif ()
|
||||
endforeach (_lib)
|
||||
# period because it should be something that evaluates to true
|
||||
# in find_package_handle_standard_args
|
||||
set (${module}_ALL_PREREQS ".")
|
||||
foreach (_dep IN ITEMS ${deps})
|
||||
separate_arguments (_${module}_args UNIX_COMMAND ${_dep})
|
||||
if (_${module}_args)
|
||||
# keep REQUIRED in the arguments only if we were required ourself
|
||||
# "required-ness" is not transitive as far as CMake is concerned
|
||||
# (i.e. if an optional package requests a package to be required,
|
||||
# the build will fail if it's not found)
|
||||
string (REPLACE "REQUIRED" "${_${module}_required}" _args_req "${_${module}_args}")
|
||||
find_and_append_package_to (${module} ${_args_req} ${_${module}_quiet})
|
||||
list (GET _${module}_args 0 _name_only)
|
||||
string (TOUPPER "${_name_only}" _NAME_ONLY)
|
||||
string (REPLACE "-" "_" _NAME_ONLY "${_NAME_ONLY}")
|
||||
# check manually if it was found if REQUIRED; otherwise poison the
|
||||
# dependency list which is checked later (so that it will fail)
|
||||
if (("${_${module}_args}" MATCHES "REQUIRED") AND NOT (${_name_only}_FOUND OR ${_NAME_ONLY}_FOUND))
|
||||
list (APPEND ${module}_ALL_PREREQS "${_name_only}-NOTFOUND")
|
||||
endif ()
|
||||
else ()
|
||||
message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)")
|
||||
endif ()
|
||||
endforeach (_dep)
|
||||
|
||||
# since find_and_append_package_to is a macro, this variable have
|
||||
# probably been overwritten (due to its common name); it is now
|
||||
# this module's last dependency instead of the name of the module
|
||||
# itself, so it must be restored
|
||||
string (TOUPPER "${module}" MODULE_UPPER)
|
||||
string (REPLACE "-" "_" MODULE "${MODULE_UPPER}")
|
||||
|
||||
# compile with this option to avoid avalanche of warnings
|
||||
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}")
|
||||
foreach (_def IN ITEMS ${defs})
|
||||
list (APPEND ${module}_DEFINITIONS "-D${_def}")
|
||||
endforeach (_def)
|
||||
|
||||
# tidy the lists before returning them
|
||||
remove_dup_deps (${module})
|
||||
|
||||
# these defines are used in dune/${module} headers, and should be put
|
||||
# in config.h when we include those
|
||||
foreach (_var IN ITEMS ${conf})
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
|
||||
list (APPEND ${module}_CONFIG_VARS ${_var})
|
||||
endforeach (_var)
|
||||
|
||||
# these are the defines that should be set when compiling
|
||||
# without config.h
|
||||
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
|
||||
|
||||
# check that we can compile a small test-program
|
||||
include (CMakePushCheckState)
|
||||
cmake_push_check_state ()
|
||||
include (CheckCXXSourceCompiles)
|
||||
# only add these if they are actually found; otherwise it won't
|
||||
# compile and the variable won't be set
|
||||
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
||||
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
||||
# since we don't have any config.h yet
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
||||
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
||||
cmake_pop_check_state ()
|
||||
|
||||
# write status message in the same manner as everyone else
|
||||
include (FindPackageHandleStandardArgs)
|
||||
if ("${lib}" STREQUAL "")
|
||||
set (_lib_var "")
|
||||
set (_and_lib_var)
|
||||
else ("${lib}" STREQUAL "")
|
||||
foreach (_lib IN ITEMS ${lib})
|
||||
if ("${lib}" MATCHES "^${_lib}")
|
||||
set (_lib_var "${module}_LIBRARY")
|
||||
set (_and_lib_var AND ${_lib_var})
|
||||
else ()
|
||||
list (APPEND _lib_var "${module}_LIBRARY_${_lib}")
|
||||
set (_and_lib_var ${_and_lib_var} AND "${module}_LIBRARY_${_lib}")
|
||||
endif ()
|
||||
endforeach (_lib)
|
||||
endif ("${lib}" STREQUAL "")
|
||||
# if the search is going to fail, then write these variables to
|
||||
# the console as well as a diagnostics
|
||||
if ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
||||
AND (_${module}_required OR NOT _${module}_quiet))
|
||||
if (DEFINED ${module}_DIR)
|
||||
message (STATUS "${module}_DIR = ${${module}_DIR}")
|
||||
elseif (DEFINED ${module}_ROOT)
|
||||
message (STATUS "${module}_ROOT = ${${module}_ROOT}")
|
||||
elseif (DEFINED ${MODULE}_ROOT)
|
||||
message (STATUS "${MODULE}_ROOT = ${${MODULE}_ROOT}")
|
||||
endif (DEFINED ${module}_DIR)
|
||||
endif ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
||||
AND (_${module}_required OR NOT _${module}_quiet))
|
||||
if ("${${module}_ALL_PREREQS}" MATCHES "-NOTFOUND")
|
||||
message (STATUS "${module} prereqs: ${${module}_ALL_PREREQS}")
|
||||
endif ()
|
||||
find_package_handle_standard_args (
|
||||
${module}
|
||||
DEFAULT_MSG
|
||||
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE} ${module}_ALL_PREREQS
|
||||
)
|
||||
|
||||
# allow the user to override these from user interface
|
||||
mark_as_advanced (${module}_INCLUDE_DIR)
|
||||
mark_as_advanced (${module}_LIBRARY)
|
||||
|
||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||
# that the module name should be in uppercase (?!)
|
||||
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||
set (${MODULE}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||
|
||||
# print everything out if we're asked to
|
||||
if (${module}_DEBUG)
|
||||
debug_find_vars (${module})
|
||||
endif (${module}_DEBUG)
|
||||
endmacro (find_opm_package module deps header lib defs prog conf)
|
||||
|
||||
# print all variables defined by the above macro
|
||||
function (debug_find_vars module)
|
||||
message (STATUS "${module}_FOUND = ${${module}_FOUND}")
|
||||
message (STATUS "${module}_INCLUDE_DIRS = ${${module}_INCLUDE_DIRS}")
|
||||
message (STATUS "${module}_LIBRARIES = ${${module}_LIBRARIES}")
|
||||
message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}")
|
||||
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
||||
message (STATUS "${module}_LINKER_FLAGS = ${${module}_LINKER_FLAGS}")
|
||||
string (TOUPPER ${module} MODULE)
|
||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
||||
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
||||
endfunction (debug_find_vars module)
|
||||
|
||||
# generate a command-line that can be used to pass variables before
|
||||
# config.h is available (such as probe tests). varname is the *name*
|
||||
# of the variable to receive the result, defs is a list of the *names*
|
||||
# which should be passed
|
||||
function (config_cmd_line varname defs)
|
||||
# process each variable
|
||||
foreach (_var IN LISTS ${defs})
|
||||
# only generate an entry if the define was actually set
|
||||
if ((DEFINED ${_var}) AND (NOT "${${_var}}" STREQUAL ""))
|
||||
# add command-line option to define this variable
|
||||
list (APPEND _cmdline "-D${_var}=${${_var}}")
|
||||
endif ((DEFINED ${_var}) AND (NOT "${${_var}}" STREQUAL ""))
|
||||
endforeach (_var)
|
||||
# return the resulting command-line options for defining vars
|
||||
set (${varname} "${_cmdline}" PARENT_SCOPE)
|
||||
endfunction (config_cmd_line)
|
@ -1,154 +0,0 @@
|
||||
# - Helper routines for opm-core like projects
|
||||
|
||||
include (LibtoolArchives) # linker_cmdline
|
||||
|
||||
# convert a list back to a command-line string
|
||||
function (unseparate_args var_name prefix value)
|
||||
separate_arguments (value)
|
||||
foreach (item IN LISTS value)
|
||||
set (prefixed_item "${prefix}${item}")
|
||||
if (${var_name})
|
||||
set (${var_name} "${${var_name}} ${prefixed_item}")
|
||||
else (${var_name})
|
||||
set (${var_name} "${prefixed_item}")
|
||||
endif (${var_name})
|
||||
endforeach (item)
|
||||
set (${var_name} "${${var_name}}" PARENT_SCOPE)
|
||||
endfunction (unseparate_args var_name prefix value)
|
||||
|
||||
# wrapper to set variables in pkg-config file
|
||||
function (configure_pc_file name source dest prefix libdir includedir)
|
||||
# escape set of standard strings
|
||||
unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}")
|
||||
unseparate_args (defs "" "${${name}_DEFINITIONS}")
|
||||
linker_cmdline (STRING INTO libs FROM ${${name}_LIBRARIES})
|
||||
|
||||
# necessary to make these variables visible to configure_file
|
||||
set (name "${${name}_NAME}")
|
||||
set (description "${${name}_DESCRIPTION}")
|
||||
set (major "${${name}_VERSION_MAJOR}")
|
||||
set (minor "${${name}_VERSION_MINOR}")
|
||||
set (target "${${name}_LIBRARY}")
|
||||
linker_cmdline (STRING INTO target from ${target})
|
||||
|
||||
configure_file (${source} ${dest} @ONLY)
|
||||
endfunction (configure_pc_file name source dist prefix libdir includedir)
|
||||
|
||||
function (configure_cmake_file name variant version)
|
||||
# declarative list of the variable names that are used in the template
|
||||
# and that must be defined in the project to be exported
|
||||
set (variable_suffices
|
||||
DESCRIPTION
|
||||
VERSION
|
||||
DEFINITIONS
|
||||
INCLUDE_DIRS
|
||||
LIBRARY_DIRS
|
||||
LINKER_FLAGS
|
||||
CONFIG_VARS
|
||||
LIBRARY
|
||||
LIBRARIES
|
||||
TARGET
|
||||
)
|
||||
|
||||
# set these variables temporarily (this is in a function scope) so
|
||||
# they are available to the template (only)
|
||||
foreach (suffix IN LISTS variable_suffices)
|
||||
set (opm-project_${suffix} "${${name}_${suffix}}")
|
||||
endforeach (suffix)
|
||||
set (opm-project_NAME "${${name}_NAME}")
|
||||
|
||||
# make the file substitutions
|
||||
configure_file (
|
||||
${template_dir}/opm-project-config${version}.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}-${variant}${version}.cmake
|
||||
@ONLY
|
||||
)
|
||||
endfunction (configure_cmake_file name)
|
||||
|
||||
# installation of CMake modules to help user programs locate the library
|
||||
function (opm_cmake_config name)
|
||||
# assume that the template is located in cmake/Templates (cannot use
|
||||
# the current directory since this is in a function and the directory
|
||||
# at runtime not at definition will be used
|
||||
set (template_dir "${OPM_MACROS_ROOT}/cmake/Templates")
|
||||
|
||||
# write configuration file to locate library
|
||||
set(OPM_PROJECT_EXTRA_CODE ${OPM_PROJECT_EXTRA_CODE_INTREE})
|
||||
configure_cmake_file (${name} "config" "")
|
||||
configure_cmake_file (${name} "config" "-version")
|
||||
configure_vars (
|
||||
FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-config.cmake"
|
||||
APPEND "${${name}_CONFIG_VARS}"
|
||||
)
|
||||
|
||||
# config-mode .pc file; use this to find the build tree
|
||||
configure_pc_file (
|
||||
${name}
|
||||
${template_dir}/opm-project.pc.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}.pc
|
||||
${PROJECT_BINARY_DIR}
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# replace the build directory with the target directory in the
|
||||
# variables that contains build paths
|
||||
string (REPLACE
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
"${CMAKE_INSTALL_PREFIX}/include${${name}_VER_DIR}"
|
||||
${name}_INCLUDE_DIRS
|
||||
"${${name}_INCLUDE_DIRS}"
|
||||
)
|
||||
string (REPLACE
|
||||
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${${name}_VER_DIR}"
|
||||
${name}_LIBRARY
|
||||
"${${name}_LIBRARY}"
|
||||
)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${${name}_VER_DIR}"
|
||||
)
|
||||
# create a config mode file which targets the install directory instead
|
||||
# of the build directory (using the same input template)
|
||||
set(OPM_PROJECT_EXTRA_CODE ${OPM_PROJECT_EXTRA_CODE_INSTALLED})
|
||||
configure_cmake_file (${name} "install" "")
|
||||
configure_vars (
|
||||
FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake"
|
||||
APPEND "${${name}_CONFIG_VARS}"
|
||||
)
|
||||
# this file gets copied to the final installation directory
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake
|
||||
DESTINATION share/cmake${${name}_VER_DIR}/${${name}_NAME}
|
||||
RENAME ${${name}_NAME}-config.cmake
|
||||
)
|
||||
# assume that there exists a version file already
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-config-version.cmake
|
||||
DESTINATION share/cmake${${name}_VER_DIR}/${${name}_NAME}
|
||||
)
|
||||
|
||||
# find-mode .pc file; use this to locate system installation
|
||||
configure_pc_file (
|
||||
${name}
|
||||
${template_dir}/opm-project.pc.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${${name}_VER_DIR}
|
||||
${CMAKE_INSTALL_PREFIX}/include${${name}_VER_DIR}
|
||||
)
|
||||
|
||||
# put this in the right system location; if we have binaries then it
|
||||
# should go in the arch-specific lib/ directory, otherwise use the
|
||||
# common/noarch lib/ directory (these targets come from UseMultiArch)
|
||||
if (${name}_TARGET)
|
||||
set (_pkg_dir ${CMAKE_INSTALL_LIBDIR})
|
||||
else ()
|
||||
set (_pkg_dir ${LIBDIR_MULTIARCH_UNAWARE})
|
||||
endif ()
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${_pkg_dir}/pkgconfig${${name}_VER_DIR}/
|
||||
RENAME ${${name}_NAME}.pc
|
||||
)
|
||||
endfunction (opm_cmake_config name)
|
@ -1,7 +0,0 @@
|
||||
function (opm_add_python_test TEST_NAME TEST_SCRIPT)
|
||||
add_test(NAME ${TEST_NAME}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
COMMAND ${TEST_SCRIPT} ${ARGN})
|
||||
|
||||
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "PYTHONPATH=${ERT_PYTHON_PATH}:${CWRAP_PYTHON_PATH}:${PYTHONPATH}")
|
||||
endfunction(opm_add_python_test)
|
@ -1,361 +0,0 @@
|
||||
# - Build satellites that are dependent of main library
|
||||
|
||||
option(ADD_DISABLED_CTESTS "Add the tests which are disabled due to failed preconditions to the ctest output (this makes ctest return an error if such a test is present)" ON)
|
||||
mark_as_advanced(ADD_DISABLED_CTESTS)
|
||||
|
||||
#
|
||||
# Enumerate all source code in a "satellite" directory such as tests/,
|
||||
# compile each of them and optionally set them as a test for CTest to
|
||||
# run. They will be linked to the main library created by the project.
|
||||
#
|
||||
# The following suffices must be defined for the opm prefix passed as
|
||||
# parameter:
|
||||
#
|
||||
# _LINKER_FLAGS Necessary flags to link with this library
|
||||
# _TARGET CMake target which creates the library
|
||||
# _LIBRARIES Other dependencies that must also be linked
|
||||
|
||||
# Synopsis:
|
||||
# opm_compile_satellites (opm satellite excl_all test_regexp)
|
||||
#
|
||||
# Parameters:
|
||||
# opm Prefix of the variable which contain information
|
||||
# about the library these satellites depends on, e.g.
|
||||
# pass "opm-core" if opm-core_TARGET is the name of
|
||||
# the target the builds this library. Variables with
|
||||
# suffixes _TARGET and _LIBRARIES must exist.
|
||||
#
|
||||
# satellite Prefix of variable which contain the names of the
|
||||
# files, e.g. pass "tests" if the files are in the
|
||||
# variable tests_SOURCES. Variables with suffixes
|
||||
# _DATAFILES, _SOURCES and _DIR should exist. This
|
||||
# name is also used as name of the target that builds
|
||||
# all these files.
|
||||
#
|
||||
# excl_all EXCLUDE_FROM_ALL if these targets should not be built by
|
||||
# default, otherwise empty string.
|
||||
#
|
||||
# test_regexp Regular expression which picks the name of a test
|
||||
# out of the filename, or blank if no test should be
|
||||
# setup.
|
||||
#
|
||||
# Example:
|
||||
# opm_compile_satellites (opm-core test "" "^test_([^/]*)$")
|
||||
#
|
||||
macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
# if we are going to build the tests always, then make sure that
|
||||
# the datafiles are present too
|
||||
if (NOT (${excl_all} MATCHES "EXCLUDE_FROM_ALL"))
|
||||
set (_incl_all "ALL")
|
||||
else (NOT (${excl_all} MATCHES "EXCLUDE_FROM_ALL"))
|
||||
set (_incl_all "")
|
||||
endif (NOT (${excl_all} MATCHES "EXCLUDE_FROM_ALL"))
|
||||
|
||||
# if a set of datafiles has been setup, pull those in
|
||||
add_custom_target (${satellite} ${_incl_all})
|
||||
if (${satellite}_DATAFILES)
|
||||
add_dependencies (${satellite} ${${satellite}_DATAFILES})
|
||||
endif (${satellite}_DATAFILES)
|
||||
|
||||
# compile each of these separately
|
||||
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
|
||||
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
|
||||
add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE})
|
||||
add_dependencies (${satellite} ${_sat_NAME})
|
||||
set_target_properties (${_sat_NAME} PROPERTIES
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
)
|
||||
# are we building a test? luckily, the testing framework doesn't
|
||||
# require anything else, so we don't have to figure out where it
|
||||
# should go in the library list
|
||||
if (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
|
||||
else (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "")
|
||||
endif (NOT "${test_regexp}" STREQUAL "")
|
||||
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
|
||||
if (STRIP_DEBUGGING_SYMBOLS)
|
||||
strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
|
||||
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
|
||||
endif()
|
||||
|
||||
# variable with regular expression doubles as a flag for
|
||||
# whether tests should be setup or not
|
||||
if (NOT "${test_regexp}" STREQUAL "")
|
||||
foreach (_regexp IN ITEMS ${test_regexp})
|
||||
if ("${_sat_NAME}" MATCHES "${_regexp}")
|
||||
string (REGEX REPLACE "${_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
|
||||
endif ("${_sat_NAME}" MATCHES "${_regexp}")
|
||||
endforeach (_regexp)
|
||||
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
|
||||
# Run tests through mpi-run. Ubuntu 14.04 provided mpi libs will crash
|
||||
# in the MPI_Finalize() call otherwise.
|
||||
if(MPI_FOUND)
|
||||
set(_sat_LOC ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${_sat_LOC})
|
||||
endif()
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
add_test (
|
||||
NAME ${_sat_FANCY}
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir "${PROJECT_BINARY_DIR}/${${satellite}_DIR}" ${_sat_LOC}
|
||||
)
|
||||
else (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
add_test (${_sat_FANCY} ${_sat_LOC})
|
||||
# run the test in the directory where the data files are
|
||||
set_tests_properties (${_sat_FANCY} PROPERTIES
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR}
|
||||
)
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
if(NOT TARGET test-suite)
|
||||
add_custom_target(test-suite)
|
||||
endif()
|
||||
add_dependencies(test-suite "${_sat_NAME}")
|
||||
endif(NOT "${test_regexp}" STREQUAL "")
|
||||
|
||||
# if this program on the list of files that should be distributed?
|
||||
# we check by the name of the source file
|
||||
list (FIND ${satellite}_SOURCES_DIST "${_sat_FILE}" _is_util)
|
||||
if (NOT (_is_util EQUAL -1))
|
||||
install (TARGETS ${_sat_NAME} RUNTIME
|
||||
DESTINATION bin${${opm}_VER_DIR}/
|
||||
)
|
||||
endif (NOT (_is_util EQUAL -1))
|
||||
endforeach (_sat_FILE)
|
||||
endmacro (opm_compile_satellites opm prefix)
|
||||
|
||||
# Synopsis:
|
||||
# opm_data (satellite target dirname files)
|
||||
#
|
||||
# provides these output variables:
|
||||
#
|
||||
# ${satellite}_INPUT_FILES List of all files that are copied
|
||||
# ${satellite}_DATAFILES Name of target which copies these files
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# opm_data (tests datafiles "tests/")
|
||||
#
|
||||
macro (opm_data satellite target dirname)
|
||||
# even if there are no datafiles, create the directory so the
|
||||
# satellite programs have a homedir to run in
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dirname}
|
||||
)
|
||||
|
||||
# if ever huge test datafiles are necessary, then change this
|
||||
# into "create_symlink" (on UNIX only, apparently)
|
||||
set (make_avail "copy")
|
||||
|
||||
# provide datafiles as inputs for the tests, by copying them
|
||||
# to a tests/ directory in the output tree (if different)
|
||||
set (${satellite}_INPUT_FILES)
|
||||
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
foreach (input_datafile IN LISTS ${satellite}_DATA)
|
||||
file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})
|
||||
set (output_datafile "${PROJECT_BINARY_DIR}/${rel_datafile}")
|
||||
add_custom_command (
|
||||
OUTPUT ${output_datafile}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E ${make_avail} ${input_datafile} ${output_datafile}
|
||||
DEPENDS ${input_datafile}
|
||||
VERBATIM
|
||||
)
|
||||
list (APPEND ${satellite}_INPUT_FILES "${output_datafile}")
|
||||
endforeach (input_datafile)
|
||||
endif(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
|
||||
# setup a target which does all the copying
|
||||
set (${satellite}_DATAFILES "${target}")
|
||||
add_custom_target (${${satellite}_DATAFILES}
|
||||
DEPENDS ${${satellite}_INPUT_FILES}
|
||||
COMMENT "Making \"${satellite}\" data available in output tree"
|
||||
)
|
||||
if(NOT TARGET test-suite)
|
||||
add_custom_target(test-suite)
|
||||
endif()
|
||||
add_dependencies(test-suite ${${satellite}_DATAFILES})
|
||||
endmacro (opm_data satellite target dirname files)
|
||||
|
||||
# Add a single unit test (can be orchestrated by the 'ctest' command)
|
||||
#
|
||||
# Synopsis:
|
||||
# opm_add_test(TestName)
|
||||
#
|
||||
# Parameters:
|
||||
# TestName Name of test
|
||||
# ONLY_COMPILE Only build test but do not run it (optional)
|
||||
# ALWAYS_ENABLE Force enabling test even if -DBUILD_TESTING=OFF was set (optional)
|
||||
# EXE_NAME Name of test executable (optional, default: ./bin/${TestName})
|
||||
# CONDITION Condition to enable test (optional, cmake code)
|
||||
# DEPENDS Targets which the test depends on (optional)
|
||||
# DRIVER The script which supervises the test (optional, default: ${OPM_TEST_DRIVER})
|
||||
# DRIVER_ARGS The script which supervises the test (optional, default: ${OPM_TEST_DRIVER_ARGS})
|
||||
# TEST_ARGS Arguments to pass to test's binary (optional, default: empty)
|
||||
# SOURCES Source files for the test (optional, default: ${EXE_NAME}.cpp)
|
||||
# PROCESSORS Number of processors to run test on (optional, default: 1)
|
||||
# TEST_DEPENDS Other tests which must be run before running this test (optional, default: None)
|
||||
# LIBRARIES Libraries to link test against (optional)
|
||||
# WORKING_DIRECTORY Working directory for test (optional, default: ${PROJECT_BINARY_DIR})
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# opm_add_test(funky_test
|
||||
# ALWAYS_ENABLE
|
||||
# CONDITION FUNKY_GRID_FOUND
|
||||
# SOURCES tests/MyFunkyTest.cpp
|
||||
# LIBRARIES -lgmp -lm)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
macro(opm_add_test TestName)
|
||||
cmake_parse_arguments(CURTEST
|
||||
"NO_COMPILE;ONLY_COMPILE;ALWAYS_ENABLE" # flags
|
||||
"EXE_NAME;PROCESSORS;WORKING_DIRECTORY" # one value args
|
||||
"CONDITION;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
|
||||
${ARGN})
|
||||
|
||||
set(BUILD_TESTING "${BUILD_TESTING}")
|
||||
|
||||
# set the default values for optional parameters
|
||||
if (NOT CURTEST_EXE_NAME)
|
||||
set(CURTEST_EXE_NAME ${TestName})
|
||||
endif()
|
||||
|
||||
# try to auto-detect the name of the source file if SOURCES are not
|
||||
# explicitly specified.
|
||||
if (NOT CURTEST_SOURCES)
|
||||
set(CURTEST_SOURCES "")
|
||||
set(_SDir "${PROJECT_SOURCE_DIR}")
|
||||
foreach(CURTEST_CANDIDATE "${CURTEST_EXE_NAME}.cpp"
|
||||
"${CURTEST_EXE_NAME}.cc"
|
||||
"tests/${CURTEST_EXE_NAME}.cpp"
|
||||
"tests/${CURTEST_EXE_NAME}.cc")
|
||||
if (EXISTS "${_SDir}/${CURTEST_CANDIDATE}")
|
||||
set(CURTEST_SOURCES "${_SDir}/${CURTEST_CANDIDATE}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# the default working directory is the content of
|
||||
# OPM_TEST_DEFAULT_WORKING_DIRECTORY or the source directory if this
|
||||
# is unspecified
|
||||
if (NOT CURTEST_WORKING_DIRECTORY)
|
||||
if (OPM_TEST_DEFAULT_WORKING_DIRECTORY)
|
||||
set(CURTEST_WORKING_DIRECTORY ${OPM_TEST_DEFAULT_WORKING_DIRECTORY})
|
||||
else()
|
||||
set(CURTEST_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# don't build the tests by _default_ if BUILD_TESTING is false,
|
||||
# i.e., when typing 'make' the tests are not build in that
|
||||
# case. They can still be build using 'make test-suite' and they can
|
||||
# be build and run using 'make check'
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "")
|
||||
if (NOT BUILD_TESTING AND NOT CURTEST_ALWAYS_ENABLE)
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
|
||||
# figure out the test driver script and its arguments. (the variable
|
||||
# for the driver script may be empty. In this case the binary is run
|
||||
# "bare metal".)
|
||||
if (NOT CURTEST_DRIVER)
|
||||
set(CURTEST_DRIVER "${OPM_TEST_DRIVER}")
|
||||
endif()
|
||||
if (NOT CURTEST_DRIVER_ARGS)
|
||||
set(CURTEST_DRIVER_ARGS "${OPM_TEST_DRIVER_ARGS}")
|
||||
endif()
|
||||
|
||||
# the libraries to link against
|
||||
if (NOT CURTEST_LIBRARIES)
|
||||
SET(CURTEST_LIBRARIES "${${CMAKE_PROJECT_NAME}_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# determine if the test should be completely ignored, i.e., the
|
||||
# CONDITION argument evaluates to false. the "AND OR " is a hack
|
||||
# which is required to prevent CMake from evaluating the condition
|
||||
# in the string. (which might evaluate to an empty string even
|
||||
# though "${CURTEST_CONDITION}" is not empty.)
|
||||
if ("AND OR ${CURTEST_CONDITION}" STREQUAL "AND OR ")
|
||||
set(SKIP_CUR_TEST "0")
|
||||
elseif(${CURTEST_CONDITION})
|
||||
set(SKIP_CUR_TEST "0")
|
||||
else()
|
||||
set(SKIP_CUR_TEST "1")
|
||||
endif()
|
||||
|
||||
if (NOT SKIP_CUR_TEST)
|
||||
if (CURTEST_ONLY_COMPILE)
|
||||
# only compile the binary but do not run it as a test
|
||||
add_executable("${CURTEST_EXE_NAME}" ${CURTEST_EXCLUDE_FROM_ALL} ${CURTEST_SOURCES})
|
||||
target_link_libraries (${CURTEST_EXE_NAME} ${CURTEST_LIBRARIES})
|
||||
|
||||
if(CURTEST_DEPENDS)
|
||||
add_dependencies("${CURTEST_EXE_NAME}" ${CURTEST_DEPENDS})
|
||||
endif()
|
||||
else()
|
||||
if (NOT CURTEST_NO_COMPILE)
|
||||
# in addition to being run, the test must be compiled. (the
|
||||
# run-only case occurs if the binary is already compiled by an
|
||||
# earlier test.)
|
||||
add_executable("${CURTEST_EXE_NAME}" ${CURTEST_EXCLUDE_FROM_ALL} ${CURTEST_SOURCES})
|
||||
target_link_libraries (${CURTEST_EXE_NAME} ${CURTEST_LIBRARIES})
|
||||
|
||||
if(CURTEST_DEPENDS)
|
||||
add_dependencies("${CURTEST_EXE_NAME}" ${CURTEST_DEPENDS})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET test-suite)
|
||||
add_custom_target(test-suite)
|
||||
endif()
|
||||
add_dependencies(test-suite "${CURTEST_EXE_NAME}")
|
||||
endif()
|
||||
|
||||
# figure out how the test should be run. if a test driver script
|
||||
# has been specified to supervise the test binary, use it else
|
||||
# run the test binary "naked".
|
||||
if (CURTEST_DRIVER)
|
||||
set(CURTEST_COMMAND ${CURTEST_DRIVER} ${CURTEST_DRIVER_ARGS} ${CURTEST_EXE_NAME} ${CURTEST_TEST_ARGS})
|
||||
else()
|
||||
set(CURTEST_COMMAND ${PROJECT_BINARY_DIR}/bin/${CURTEST_EXE_NAME})
|
||||
if (CURTEST_TEST_ARGS)
|
||||
list(APPEND CURTEST_COMMAND ${CURTEST_TEST_ARGS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_test(NAME ${TestName}
|
||||
WORKING_DIRECTORY "${CURTEST_WORKING_DIRECTORY}"
|
||||
COMMAND ${CURTEST_COMMAND})
|
||||
|
||||
# specify the dependencies between the tests
|
||||
if (CURTEST_TEST_DEPENDS)
|
||||
set_tests_properties(${TestName} PROPERTIES DEPENDS "${CURTEST_TEST_DEPENDS}")
|
||||
endif()
|
||||
|
||||
# tell ctest how many cores it should reserve to run the test
|
||||
if (CURTEST_PROCESSORS)
|
||||
set_tests_properties(${TestName} PROPERTIES PROCESSORS "${CURTEST_PROCESSORS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else() # test is skipped
|
||||
|
||||
# the following causes the test to appear as 'skipped' in the
|
||||
# CDash dashboard. it this is removed, the test is just silently
|
||||
# ignored.
|
||||
if (NOT CURTEST_ONLY_COMPILE AND ADD_DISABLED_CTESTS)
|
||||
add_test(${TestName} skip_test_dummy)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# macro to set the default test driver script and the its default
|
||||
# arguments
|
||||
macro(opm_set_test_driver DriverBinary DriverDefaultArgs)
|
||||
set(OPM_TEST_DRIVER "${DriverBinary}")
|
||||
set(OPM_TEST_DRIVER_ARGS "${DriverDefaultArgs}")
|
||||
endmacro()
|
||||
|
||||
# macro to set the default test driver script and the its default
|
||||
# arguments
|
||||
macro(opm_set_test_default_working_directory Dir)
|
||||
set(OPM_TEST_DEFAULT_WORKING_DIRECTORY "${Dir}")
|
||||
endmacro()
|
@ -1,103 +0,0 @@
|
||||
####################################################################
|
||||
# #
|
||||
# Setup static targets for all submodules. #
|
||||
# Useful when building a static benchmark executable #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
# Macros
|
||||
|
||||
# Clone a git and build it statically
|
||||
# If ARGN is specified installation is skipped, ARGN0 is
|
||||
# a build-system target name and the rest of ARGN are build tool parameters
|
||||
function(opm_from_git repo name revision)
|
||||
if(ARGN)
|
||||
list(GET ARGN 0 target)
|
||||
list(REMOVE_AT ARGN 0)
|
||||
# This is used for top build of benchmarks.
|
||||
# Clones the local source tree and builds it against the static libraries,
|
||||
# skipping the install step. Note that in pricinple URL instead of GIT_REPOSITORY
|
||||
# could have been used, but externalproject cannot handle build directories
|
||||
# which are a subdirectory of the source tree, and since that is typically the case
|
||||
# we work-around by re-cloning the local git.
|
||||
# The ommision of GIT_TAG ensures that we build the tip of the local git.
|
||||
set(COMMANDS BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target ${target} -- ${ARGN}
|
||||
GIT_TAG ${revision}
|
||||
INSTALL_COMMAND)
|
||||
else()
|
||||
# This is used with "normal" static builds.
|
||||
set(COMMANDS GIT_TAG ${revision})
|
||||
endif()
|
||||
externalproject_add(${name}-static
|
||||
GIT_REPOSITORY ${repo}
|
||||
PREFIX static/${name}
|
||||
CONFIGURE_COMMAND PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/static/installed/lib/pkgconfig:${CMAKE_BINARY_DIR}/static/installed/${CMAKE_INSTALL_LIBDIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}
|
||||
${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/static/installed
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DBUILD_SHARED_LIBS=0
|
||||
-DBUILD_TESTING=0 -DBUILD_EXAMPLES=0 <SOURCE_DIR>
|
||||
-G ${CMAKE_GENERATOR}
|
||||
${COMMANDS} "")
|
||||
set_target_properties(${name}-static PROPERTIES EXCLUDE_FROM_ALL 1)
|
||||
endfunction()
|
||||
|
||||
# Convenience macro for adding dependencies without having to include the -static all over
|
||||
macro(opm_static_add_dependencies target)
|
||||
foreach(arg ${ARGN})
|
||||
add_dependencies(${target}-static ${arg}-static)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include(ExternalProject)
|
||||
include(UseMultiArch)
|
||||
|
||||
# Defaults to building master
|
||||
if(NOT OPM_BENCHMARK_VERSION)
|
||||
set(OPM_BENCHMARK_VERSION "origin/master")
|
||||
endif()
|
||||
|
||||
# ERT
|
||||
externalproject_add(ert-static
|
||||
GIT_REPOSITORY https://github.com/Ensembles/ert
|
||||
PREFIX static/ert
|
||||
GIT_TAG ${revision}
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/static/installed
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DBUILD_SHARED_LIBS=0 <SOURCE_DIR>/devel)
|
||||
set_target_properties(ert-static PROPERTIES EXCLUDE_FROM_ALL 1)
|
||||
|
||||
# 2015.04 release used dune v2.3.1
|
||||
if(OPM_BENCHMARK_VERSION STREQUAL "release/2015.04/final")
|
||||
set(DUNE_VERSION v2.3.1)
|
||||
endif()
|
||||
|
||||
# Master currently uses dune v2.3.1
|
||||
if(OPM_BENCHMARK_VERSION STREQUAL "origin/master")
|
||||
set(DUNE_VERSION v2.3.1)
|
||||
endif()
|
||||
|
||||
# Fallback
|
||||
if(NOT DUNE_VERSION)
|
||||
set(DUNE_VERSION v2.3.1)
|
||||
endif()
|
||||
|
||||
# Dune
|
||||
foreach(dune_repo dune-common dune-geometry dune-grid dune-istl)
|
||||
opm_from_git(http://git.dune-project.org/repositories/${dune_repo} ${dune_repo} ${DUNE_VERSION})
|
||||
endforeach()
|
||||
opm_static_add_dependencies(dune-istl dune-common)
|
||||
opm_static_add_dependencies(dune-geometry dune-common)
|
||||
opm_static_add_dependencies(dune-grid dune-geometry)
|
||||
|
||||
# OPM
|
||||
foreach(opm_repo opm-common opm-parser opm-core opm-output opm-grid opm-material
|
||||
opm-upscaling)
|
||||
opm_from_git(https://github.com/OPM/${opm_repo} ${opm_repo} ${OPM_BENCHMARK_VERSION})
|
||||
endforeach()
|
||||
opm_static_add_dependencies(opm-parser opm-common ert)
|
||||
opm_static_add_dependencies(opm-core opm-parser dune-istl)
|
||||
opm_static_add_dependencies(opm-grid opm-core dune-grid)
|
||||
opm_static_add_dependencies(opm-material opm-core)
|
||||
opm_static_add_dependencies(opm-upscaling opm-grid opm-material)
|
@ -1,108 +0,0 @@
|
||||
# - Get compiler version
|
||||
|
||||
# probe the GCC version, returns empty string if GCC is not compiler
|
||||
function (get_gcc_version language ver_name)
|
||||
if(CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
# exec_program is deprecated, but execute_process does't work :-(
|
||||
exec_program (${CMAKE_${language}_COMPILER}
|
||||
ARGS ${CMAKE_${language}_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE _version
|
||||
)
|
||||
set (${ver_name} ${_version} PARENT_SCOPE)
|
||||
else (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
set (${ver_name} "" PARENT_SCOPE)
|
||||
endif (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
endfunction (get_gcc_version ver_name)
|
||||
|
||||
# less reliable, but includes the patch number
|
||||
function (get_gcc_patch language ver_name)
|
||||
if(CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
# exec_program is deprecated, but execute_process does't work :-(
|
||||
exec_program (${CMAKE_${language}_COMPILER}
|
||||
ARGS ${CMAKE_${language}_COMPILER_ARG1} --version
|
||||
OUTPUT_VARIABLE _version
|
||||
)
|
||||
# split multi-line string into list
|
||||
if (WIN32)
|
||||
string (REPLACE "\r\n" ";" _version "${_version}")
|
||||
else (WIN32)
|
||||
string (REPLACE "\n" ";" _version "${_version}")
|
||||
endif (WIN32)
|
||||
# only keep first line
|
||||
list (GET _version 0 _version)
|
||||
# extract version number from it (this is the fragile part)
|
||||
string (REGEX REPLACE "^[^\\(]+(\\([^\\)]*\\))?[\ \t]*([0-9]+\\.[0-9]+\\.[0-9]+)(.*\\(.*\\))?" "\\2" _version "${_version}")
|
||||
# return this to the caller
|
||||
set (${ver_name} ${_version} PARENT_SCOPE)
|
||||
else (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
set (${ver_name} "" PARENT_SCOPE)
|
||||
endif (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
endfunction (get_gcc_patch language ver_name)
|
||||
|
||||
function (compiler_info)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
get_gcc_patch (CXX version)
|
||||
message (STATUS "GNU C++ compiler version: ${version}")
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
endfunction (compiler_info)
|
||||
|
||||
function (get_ld_version ver_name)
|
||||
# run linker to get the version number. interestingly, this option works
|
||||
# (for our purposes) on all major platforms (Linux, Mac OS X and Windows);
|
||||
# it returns the program version although it may have ended in error
|
||||
exec_program (${CMAKE_LINKER}
|
||||
ARGS "-v"
|
||||
OUTPUT_VARIABLE _version
|
||||
)
|
||||
|
||||
# keep only first line, even on Mac OS X there is no line end
|
||||
list (GET _version 0 _version)
|
||||
|
||||
# format of the version string is platform-specific
|
||||
if (NOT WIN32)
|
||||
if (APPLE)
|
||||
string (REGEX REPLACE ".*, from Apple (.*\)" "\\1" _version "${_version}")
|
||||
else (APPLE)
|
||||
# assuming some GNU toolchain now
|
||||
string (REGEX REPLACE "GNU ([a-zA-Z0-9_]*) (version|\\(.*\\)) ([^\\ ]*).*" "\\1 \\3" _version "${_version}")
|
||||
endif (APPLE)
|
||||
endif (NOT WIN32)
|
||||
|
||||
# return the string to the caller
|
||||
set (${ver_name} "${_version}" PARENT_SCOPE)
|
||||
endfunction (get_ld_version ver_name)
|
||||
|
||||
function (linker_info)
|
||||
get_ld_version (version)
|
||||
message (STATUS "Linker: ${version}")
|
||||
endfunction (linker_info)
|
||||
|
||||
# sets CXX_COMPAT_GCC if we have either GCC or Clang
|
||||
macro (is_compiler_gcc_compatible)
|
||||
# is the C++ compiler clang++?
|
||||
string (TOUPPER "${CMAKE_CXX_COMPILER_ID}" _comp_id)
|
||||
if (_comp_id MATCHES "CLANG")
|
||||
set (CMAKE_COMPILER_IS_CLANGXX TRUE)
|
||||
else ()
|
||||
set (CMAKE_COMPILER_IS_CLANGXX FALSE)
|
||||
endif ()
|
||||
# is the C++ compiler g++ or clang++?
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
||||
set (CXX_COMPAT_GCC TRUE)
|
||||
else ()
|
||||
set (CXX_COMPAT_GCC FALSE)
|
||||
endif ()
|
||||
# is the C compiler clang?
|
||||
string (TOUPPER "${CMAKE_C_COMPILER_ID}" _comp_id)
|
||||
if (_comp_id MATCHES "CLANG")
|
||||
set (CMAKE_COMPILER_IS_CLANG TRUE)
|
||||
else ()
|
||||
set (CMAKE_COMPILER_IS_CLANG FALSE)
|
||||
endif ()
|
||||
# is the C compiler gcc or clang?
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
||||
set (C_COMPAT_GCC TRUE)
|
||||
else ()
|
||||
set (C_COMPAT_GCC FALSE)
|
||||
endif ()
|
||||
endmacro (is_compiler_gcc_compatible)
|
@ -1,132 +0,0 @@
|
||||
# - Generate debug symbols in a separate file
|
||||
#
|
||||
# (1) Include this file in your CMakeLists.txt; it will setup everything
|
||||
# to compile WITH debug symbols in any case.
|
||||
#
|
||||
# (2) Run the strip_debug_symbols function on every target that you want
|
||||
# to strip.
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (AddOptions)
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
# only debugging using the GNU toolchain is supported for now
|
||||
if (CXX_COMPAT_GCC)
|
||||
# default debug level, if not specified by the user
|
||||
set_default_option (CXX _dbg_flag "-ggdb3" "(^|\ )-g")
|
||||
|
||||
# add debug symbols to *all* targets if the build mode is either "Debug" or "RelWithDebInfo"
|
||||
if (_dbg_flag)
|
||||
message (STATUS "Generating debug symbols: ${_dbg_flag}")
|
||||
add_options (ALL_LANGUAGES "Debug;RelWithDebInfo" "${_dbg_flag}")
|
||||
endif (_dbg_flag)
|
||||
|
||||
# extracting the debug info is done by a separate utility in the GNU
|
||||
# toolchain. check that this is actually installed.
|
||||
message (STATUS "Looking for strip utility")
|
||||
if (APPLE)
|
||||
# MacOS X has a duo of utilities; we need both
|
||||
find_program (OBJCOPY strip)
|
||||
find_program (DSYMUTIL dsymutil)
|
||||
mark_as_advanced (DSYMUTIL)
|
||||
if (NOT DSYMUTIL)
|
||||
set (OBJCOPY dsymutil-NOTFOUND)
|
||||
endif (NOT DSYMUTIL)
|
||||
else (APPLE)
|
||||
find_program (OBJCOPY
|
||||
objcopy
|
||||
${CYGWIN_INSTALL_PATH}/bin /usr/bin /usr/local/bin
|
||||
)
|
||||
endif (APPLE)
|
||||
mark_as_advanced (OBJCOPY)
|
||||
if (OBJCOPY)
|
||||
message (STATUS "Looking for strip utility - found")
|
||||
else (OBJCOPY)
|
||||
message (WARNING "Looking for strip utility - not found")
|
||||
endif (OBJCOPY)
|
||||
endif ()
|
||||
|
||||
# command to separate the debug information from the executable into
|
||||
# its own file; this must be called for each target; optionally takes
|
||||
# the name of a variable to receive the list of .debug files
|
||||
function (strip_debug_symbols targets)
|
||||
if (CXX_COMPAT_GCC AND OBJCOPY)
|
||||
foreach (target IN LISTS targets)
|
||||
# libraries must retain the symbols in order to link to them, but
|
||||
# everything can be stripped in an executable
|
||||
get_target_property (_kind ${target} TYPE)
|
||||
|
||||
# don't strip static libraries
|
||||
if ("${_kind}" STREQUAL "STATIC_LIBRARY")
|
||||
return ()
|
||||
endif ("${_kind}" STREQUAL "STATIC_LIBRARY")
|
||||
|
||||
# don't strip public symbols in shared objects
|
||||
if ("${_kind}" STREQUAL "EXECUTABLE")
|
||||
set (_strip_args "--strip-all")
|
||||
else ("${_kind}" STREQUAL "EXECUTABLE")
|
||||
set (_strip_args "--strip-debug")
|
||||
endif ("${_kind}" STREQUAL "EXECUTABLE")
|
||||
|
||||
# add_custom_command doesn't support generator expressions in the
|
||||
# working_directory argument (sic; that's what you get when you do
|
||||
# ad hoc programming all the time), so we need to extract the
|
||||
# location up front (the location on the other hand should not be
|
||||
# used for libraries as it does not include the soversion -- sic
|
||||
# again)
|
||||
get_target_property (_full ${target} LOCATION)
|
||||
get_filename_component (_dir ${_full} PATH)
|
||||
if (NOT (("${_dir}" STREQUAL "") OR ("${_dir}" MATCHES ".*/$")))
|
||||
set (_dir "${_dir}/")
|
||||
endif (NOT (("${_dir}" STREQUAL "") OR ("${_dir}" MATCHES ".*/$")))
|
||||
get_filename_component (_name ${_full} NAME_WE)
|
||||
get_filename_component (_ext ${_full} EXT)
|
||||
# only libraries have soversion property attached
|
||||
get_target_property (_target_soversion ${target} SOVERSION)
|
||||
get_target_property (_target_version ${target} VERSION)
|
||||
if (_target_soversion)
|
||||
# MacOS X puts the version number before the extension
|
||||
if (APPLE)
|
||||
set (_target_file_name "${_name}.${_target_version}${_ext}")
|
||||
else (APPLE)
|
||||
set (_target_file_name "${_name}${_ext}.${_target_version}")
|
||||
endif (APPLE)
|
||||
else (_target_soversion)
|
||||
set (_target_file_name "${_name}${_ext}")
|
||||
endif (_target_soversion)
|
||||
set (_target_file "${_dir}${_target_file_name}")
|
||||
# do without generator expressions (which doesn't work everywhere)
|
||||
if (APPLE)
|
||||
set (_debug_ext ".dSYM")
|
||||
add_custom_command (TARGET ${target}
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${_dir}
|
||||
COMMAND ${DSYMUTIL} ARGS --out=${_target_file}${_debug_ext} ${_target_file}
|
||||
COMMAND ${OBJCOPY} ARGS -S ${_target_file}
|
||||
VERBATIM
|
||||
)
|
||||
else (APPLE)
|
||||
set (_debug_ext ".debug")
|
||||
add_custom_command (TARGET ${target}
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${_dir}
|
||||
COMMAND ${OBJCOPY} ARGS --only-keep-debug ${_target_file} ${_target_file}${_debug_ext}
|
||||
COMMAND ${OBJCOPY} ARGS ${_strip_args} ${_target_file}
|
||||
COMMAND ${OBJCOPY} ARGS --add-gnu-debuglink=${_target_file_name}${_debug_ext} ${_target_file}
|
||||
VERBATIM
|
||||
)
|
||||
endif (APPLE)
|
||||
# add this .debug file to the list
|
||||
file (RELATIVE_PATH _this_debug_file "${PROJECT_BINARY_DIR}" "${_target_file}${_debug_ext}")
|
||||
set (_debug_files ${_debug_files} ${_this_debug_file})
|
||||
endforeach (target)
|
||||
# if optional debug list was requested, then copy to output parameter
|
||||
if (ARGV1)
|
||||
set (${ARGV1} ${_debug_files} PARENT_SCOPE)
|
||||
endif (ARGV1)
|
||||
endif ()
|
||||
endfunction (strip_debug_symbols targets)
|
||||
|
@ -1,152 +0,0 @@
|
||||
# - Find version of a DUNE package
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_dune_version (suite module)
|
||||
#
|
||||
# where:
|
||||
# suite Name of the suite; this should always be "dune"
|
||||
# module Name of the module, e.g. "common"
|
||||
#
|
||||
# Finds the content of DUNE_${MODULE}_VERSION_{MAJOR,MINOR,REVISION}
|
||||
# from the installation.
|
||||
#
|
||||
# Add these variables to ${project}_CONFIG_IMPL_VARS in CMakeLists.txt
|
||||
# if you need these in the code.
|
||||
|
||||
include (UseMultiArch)
|
||||
|
||||
function (find_dune_version suite module)
|
||||
# the _ROOT variable may or may not be set, but the include
|
||||
# variable should always be; get the prefix from the header path
|
||||
# if we have a multilib installation where the package maintainer
|
||||
# have installed it in e.g. /usr/include/dune-2.2/dune/istl, then
|
||||
# stash this extra indirection and add it back later in lib/
|
||||
set (_inc_path "${${suite}-${module}_INCLUDE_DIR}")
|
||||
file (TO_CMAKE_PATH _inc_path "${_inc_path}")
|
||||
set (_multilib_regexp "(.*)/include(/${suite}[^/]+)?")
|
||||
if (_inc_path MATCHES "${_multilib_regexp}")
|
||||
set (_orig_inc "${_inc_path}")
|
||||
string (REGEX REPLACE "${_multilib_regexp}" "\\1" _inc_path "${_orig_inc}")
|
||||
# only get the second group if it is really there (there is
|
||||
# probably a better way to do this in CMake)
|
||||
if ("${_inc_path}/include" STREQUAL "${_orig_inc}")
|
||||
set (_multilib "")
|
||||
else ()
|
||||
string (REGEX REPLACE "${_multilib_regexp}" "\\2" _multilib "${_orig_inc}")
|
||||
endif ()
|
||||
else ()
|
||||
set (_multilib "")
|
||||
endif ()
|
||||
|
||||
# some modules does not have a library, use the directory of the
|
||||
# header files to find what would be the library dir.
|
||||
# note that when we refer to a build tree, then the libraries always
|
||||
# go into lib/, but we don't care about that because in that case,
|
||||
# dune.module isn't in the lib/ directory anyway but must be retrieved
|
||||
# from the source. hence, we only have to worry about the library
|
||||
# directory of a system installation here.
|
||||
if (NOT ${suite}-${module}_LIBRARY)
|
||||
# this suffix is gotten from UseMultiArch.cmake
|
||||
set (_lib_path "${_inc_path}/${CMAKE_INSTALL_LIBDIR}")
|
||||
else ()
|
||||
get_filename_component (_lib_path "${${suite}-${module}_LIBRARY}" PATH)
|
||||
endif ()
|
||||
|
||||
# if we have a source tree, dune.module is available there
|
||||
set (_dune_mod "${_inc_path}/dune.module")
|
||||
if (NOT EXISTS "${_dune_mod}")
|
||||
set (_last_dune_mod_src "${_dune_mod}")
|
||||
set (_dune_mod "")
|
||||
endif ()
|
||||
|
||||
if (NOT _dune_mod)
|
||||
# look for the build tree; if we found the library, then the
|
||||
# dune.module file should be in a sub-directory
|
||||
get_filename_component (_immediate "${_lib_path}" NAME)
|
||||
if ("${_immediate}" STREQUAL ".libs")
|
||||
# remove autotools internal path
|
||||
get_filename_component (_lib_path "${_lib_path}" PATH)
|
||||
endif ()
|
||||
get_filename_component (_immediate "${_lib_path}" NAME)
|
||||
if ("${_immediate}" STREQUAL "${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
# remove multi-arch part of the library path to get parent
|
||||
get_filename_component (_lib_path "${_lib_path}" PATH)
|
||||
endif ()
|
||||
get_filename_component (_immediate "${_lib_path}" NAME)
|
||||
if (("${_immediate}" STREQUAL "${CMAKE_INSTALL_LIBDIR}")
|
||||
OR ("${_immediate}" STREQUAL "lib")
|
||||
OR ("${_immediate}" STREQUAL "${LIBDIR_MULTIARCH_UNAWARE}"))
|
||||
# remove library part of the path; this also undo the suffix
|
||||
# we added if we used the library as a standin
|
||||
get_filename_component (_lib_path "${_lib_path}" PATH)
|
||||
endif ()
|
||||
# from this point on, _lib_path does not contain an architecture-
|
||||
# specific component anymore; dune.module is always put in straight
|
||||
# noarch lib/ since it does not contain any paths to binaries
|
||||
set (_suffix "${_multilib}/dunecontrol/${suite}-${module}/dune.module")
|
||||
set (_dune_mod "${_lib_path}/${LIBDIR_MULTIARCH_UNAWARE}${_suffix}")
|
||||
if (NOT EXISTS "${_dune_mod}")
|
||||
set (_last_dune_mod_bld "${_dune_mod}")
|
||||
# one more try, if we have a private install, then it doesn't use
|
||||
# e.g. lib64 but always lib (!)
|
||||
if ("${LIBDIR_MULTIARCH_UNAWARE}" STREQUAL "lib")
|
||||
set (_dune_mod "")
|
||||
else ()
|
||||
set (_dune_mod "${_lib_path}/lib${_suffix}")
|
||||
if (NOT EXISTS "${_dune_mod}")
|
||||
set (_last_dune_mod_pri "${_dune_mod}")
|
||||
# use the name itself as a flag for whether it was found or not
|
||||
set (_dune_mod "")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# if it is not available, it may make havoc having empty defines in the source
|
||||
# code later, so we bail out early
|
||||
if (NOT _dune_mod)
|
||||
if (${suite}-${module}_FOUND)
|
||||
set (_searched_paths "\"${_last_dune_mod_src}\"")
|
||||
if (NOT ("${_last_dune_mod_bld}" STREQUAL ""))
|
||||
set (_searched_paths "either ${_searched_paths} or \"${_last_dune_mod_bld}\"")
|
||||
endif ()
|
||||
if (NOT ("${_last_dune_mod_pri}" STREQUAL ""))
|
||||
set (_searched_paths "${_searched_paths} or \"${_last_dune_mod_pri}\"")
|
||||
endif ()
|
||||
message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module} (looking for ${_searched_paths})")
|
||||
else ()
|
||||
return ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# parse the file for the Version: field
|
||||
set (_ver_regexp "[ ]*Version:[ ]*([0-9]+)\\.([0-9]+)(.*)")
|
||||
file (STRINGS "${_dune_mod}" _ver_field REGEX "${_ver_regexp}")
|
||||
string (REGEX REPLACE "${_ver_regexp}" "\\1" _major "${_ver_field}")
|
||||
string (REGEX REPLACE "${_ver_regexp}" "\\2" _minor "${_ver_field}")
|
||||
string (REGEX REPLACE "${_ver_regexp}" "\\3" _revision "${_ver_field}")
|
||||
|
||||
# revision may or may not be there
|
||||
set (_rev_regexp "\\.([0-9]+).*")
|
||||
if (_revision MATCHES "${_rev_regexp}")
|
||||
string (REGEX REPLACE "${_rev_regexp}" "\\1" _revision "${_revision}")
|
||||
else ()
|
||||
set (_revision "0")
|
||||
endif ()
|
||||
|
||||
# generate variable for what we have found
|
||||
string (TOUPPER "${suite}" _SUITE)
|
||||
string (TOUPPER "${module}" _MODULE)
|
||||
string (REPLACE "-" "_" _MODULE "${_MODULE}")
|
||||
if ((NOT DEFINED ${_SUITE}_${_MODULE}_VERSION_MAJOR) AND
|
||||
(NOT DEFINED ${_SUITE}_${_MODULE}_VERSION_MINOR) AND
|
||||
(NOT DEFINED ${_SUITE}_${_MODULE}_VERSION_REVISION))
|
||||
set (${_SUITE}_${_MODULE}_VERSION_MAJOR "${_major}" PARENT_SCOPE)
|
||||
set (${_SUITE}_${_MODULE}_VERSION_MINOR "${_minor}" PARENT_SCOPE)
|
||||
set (${_SUITE}_${_MODULE}_VERSION_REVISION "${_revision}" PARENT_SCOPE)
|
||||
endif ()
|
||||
|
||||
# print the version number we detected in the configuration log
|
||||
message (STATUS "Version ${_major}.${_minor}.${_revision} of ${suite}-${module} from ${_dune_mod}")
|
||||
endfunction (find_dune_version suite module)
|
@ -1,38 +0,0 @@
|
||||
if (NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
find_package (Boost 1.44.0 COMPONENTS unit_test_framework QUIET)
|
||||
endif ()
|
||||
|
||||
if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
# setup to do a test compile
|
||||
include (CMakePushCheckState)
|
||||
cmake_push_check_state ()
|
||||
include (CheckCXXSourceCompiles)
|
||||
list (APPEND CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS})
|
||||
list (APPEND CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES})
|
||||
|
||||
unset(HAVE_DYNAMIC_BOOST_TEST CACHE)
|
||||
check_cxx_source_compiles("
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#define BOOST_TEST_MODULE DYNLINK_TEST
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
int f(int x) { return 2 * x; }
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynlinkConfigureTest) {
|
||||
BOOST_CHECK_MESSAGE(f(2) == 4,
|
||||
\"Apparently, multiplication doesn't \"
|
||||
\"work: f(2) = \" << f(2));
|
||||
}" HAVE_DYNAMIC_BOOST_TEST)
|
||||
cmake_pop_check_state ()
|
||||
else (Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
# no Boost, no compile
|
||||
set (HAVE_DYNAMIC_BOOST_TEST 0)
|
||||
endif (Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
|
||||
# save this for later
|
||||
set (HAVE_DYNAMIC_BOOST_TEST "${HAVE_DYNAMIC_BOOST_TEST}"
|
||||
CACHE BOOL "Whether Boost::Test is dynamically linked or not"
|
||||
)
|
||||
|
||||
# include in config.h
|
||||
list (APPEND TESTING_CONFIG_VARS "HAVE_DYNAMIC_BOOST_TEST")
|
@ -1,11 +0,0 @@
|
||||
# - Try to build faster depending on the compiler
|
||||
|
||||
# faster builds by using a pipe instead of temp files
|
||||
include (AddOptions)
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
if (CXX_COMPAT_GCC)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-pipe")
|
||||
endif ()
|
||||
|
@ -1,90 +0,0 @@
|
||||
# - Provide C wrappers for Fortran code
|
||||
#
|
||||
# Synopsis:
|
||||
# define_fc_func (APPEND config.h IF HAVE_BLAS)
|
||||
|
||||
function (define_fc_func verb file)
|
||||
# check that we are being called correctly
|
||||
if (NOT (("${verb}" STREQUAL "APPEND") OR
|
||||
("${verb}" STREQUAL "WRITE")))
|
||||
message (FATAL_ERROR
|
||||
"Unknown verb \"${verb}\" passed as first argument."
|
||||
)
|
||||
endif (NOT (("${verb}" STREQUAL "APPEND") OR
|
||||
("${verb}" STREQUAL "WRITE")))
|
||||
|
||||
# check under which conditions we should do our work
|
||||
if (NOT "${ARGN}" STREQUAL "")
|
||||
set (args ${ARGN})
|
||||
list (GET args 0 keyword)
|
||||
if (NOT "${keyword}" STREQUAL "IF")
|
||||
message (FATAL_ERROR
|
||||
"Unknown conditional \"${keyword}\" passed as third argument."
|
||||
)
|
||||
endif (NOT "${keyword}" STREQUAL "IF")
|
||||
list (REMOVE_AT args 0)
|
||||
set (needed FALSE)
|
||||
foreach (condition IN LISTS args)
|
||||
if (${${condition}})
|
||||
set (needed TRUE)
|
||||
break ()
|
||||
endif (${${condition}})
|
||||
endforeach (condition)
|
||||
else (NOT "${ARGN}" STREQUAL "")
|
||||
# if called unconditionally, then always include the wrapper
|
||||
set (needed TRUE)
|
||||
endif (NOT "${ARGN}" STREQUAL "")
|
||||
|
||||
# only do something if we actually have some components which requires
|
||||
# the interaction -- don't load the Fortran compiler just to write
|
||||
# this macro (which apparently nobody uses then)
|
||||
if (needed)
|
||||
# if this option is enabled, we skip detecting the Fortran externals
|
||||
# using a real compiler (which may not be the same that compiled the
|
||||
# library) and just write a macro that uses a single underscore (which
|
||||
# is the assumption that FindLAPACK operates on anyway)
|
||||
option (USE_UNDERSCORING "Assume that Fortran routines have underscore suffix" OFF)
|
||||
if (USE_UNDERSCORING)
|
||||
message (STATUS "Assuming Fortran externals have underscore suffix")
|
||||
set (_str "#define FC_FUNC(name,NAME) name##_\n")
|
||||
else (USE_UNDERSCORING)
|
||||
|
||||
# enable languages needed
|
||||
if (NOT CMAKE_C_COMPILER_LOADED)
|
||||
enable_language (C)
|
||||
endif (NOT CMAKE_C_COMPILER_LOADED)
|
||||
if (NOT CMAKE_Fortran_COMPILER_LOADED)
|
||||
enable_language (Fortran)
|
||||
endif (NOT CMAKE_Fortran_COMPILER_LOADED)
|
||||
|
||||
# get a temporary file
|
||||
set (_tmp_hdr ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/config_f.h)
|
||||
|
||||
# write a small config file that contains the proper convention for
|
||||
# calling Fortran from C
|
||||
include (FortranCInterface)
|
||||
fortrancinterface_header (${_tmp_hdr})
|
||||
|
||||
# read the definition back in from the file
|
||||
file (STRINGS
|
||||
${_tmp_hdr}
|
||||
_str
|
||||
REGEX "^#define FortranCInterface_GLOBAL\\(name,NAME\\) .*$"
|
||||
)
|
||||
|
||||
# massage it to look like the one AC_FC_WRAPPERS provide
|
||||
string (REPLACE "FortranCInterface_GLOBAL" "FC_FUNC" _str ${_str})
|
||||
|
||||
endif (USE_UNDERSCORING)
|
||||
|
||||
# write this definition to the end of our own configuration file
|
||||
file (${verb} ${file}
|
||||
"\n/* Define to a macro mangling the given C identifier (in lower and upper
|
||||
case), which must not contain underscores, for linking with Fortran. */\n"
|
||||
${_str}
|
||||
"\n"
|
||||
)
|
||||
else (needed)
|
||||
message (STATUS "Fortran/C interface not activated")
|
||||
endif (needed)
|
||||
endfunction (define_fc_func)
|
@ -1,35 +0,0 @@
|
||||
# - Multiarch support in object code library directories
|
||||
#
|
||||
# This module sets the following variable
|
||||
# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
|
||||
# depending on the platform; use this path
|
||||
# for platform-specific binaries.
|
||||
#
|
||||
# Note that it will override the results of GNUInstallDirs if included after
|
||||
# that module.
|
||||
|
||||
# default if we need to put something in the library directory for a
|
||||
# component that is *not* multiarch-aware
|
||||
set (LIBDIR_MULTIARCH_UNAWARE "lib")
|
||||
|
||||
# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
# Debian or Ubuntu?
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
else (EXISTS "/etc/debian_version")
|
||||
# 64-bit system?
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_def "lib64")
|
||||
set (LIBDIR_MULTIARCH_UNAWARE "${_libdir_def}")
|
||||
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_def "lib")
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
endif (EXISTS "/etc/debian_version")
|
||||
else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set (_libdir_def "lib")
|
||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
|
||||
# let the user override if somewhere else is desirable
|
||||
set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries")
|
||||
mark_as_advanced (CMAKE_INSTALL_LIBDIR)
|
@ -1,50 +0,0 @@
|
||||
# - Use only needed imports from libraries
|
||||
#
|
||||
# Add the -Wl,--as-needed flag to the default linker flags on Linux
|
||||
# in order to get only the minimal set of dependencies.
|
||||
|
||||
function (prepend var_name value)
|
||||
# only add the prefix if it is not already at the beginning. this
|
||||
# prevents the same string to be added at the same place every time
|
||||
# we check for reconfiguration (e.g. "--as-needed" below)
|
||||
string (LENGTH "${value}" _val_len)
|
||||
string (LENGTH "${${var_name}}" _var_len)
|
||||
if (NOT (${_var_len} LESS ${_val_len}))
|
||||
string (SUBSTRING "${${var_name}}" 0 ${_val_len} _var_pre)
|
||||
else (NOT (${_var_len} LESS ${_val_len}))
|
||||
set (_var_pre)
|
||||
endif (NOT (${_var_len} LESS ${_val_len}))
|
||||
if (NOT ("${_var_pre}" STREQUAL "${value}"))
|
||||
if (${var_name})
|
||||
set (${var_name} "${value} ${${var_name}}" PARENT_SCOPE)
|
||||
else (${var_name})
|
||||
set (${var_name} "${value}")
|
||||
endif (${var_name})
|
||||
endif (NOT ("${_var_pre}" STREQUAL "${value}"))
|
||||
endfunction (prepend var_name value)
|
||||
|
||||
option (ONLY_NEEDED_LIBRARIES "Instruct the linker to not use libraries which are unused" OFF)
|
||||
|
||||
# only ELF shared objects can be underlinked, and only GNU will accept
|
||||
# these parameters; otherwise just leave it to the defaults
|
||||
if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC AND ONLY_NEEDED_LIBRARIES)
|
||||
# these are the modules whose probes will turn up incompatible
|
||||
# flags on some systems
|
||||
set (_maybe_underlinked
|
||||
SuiteSparse
|
||||
)
|
||||
# check if any modules actually reported problems (by setting an
|
||||
# appropriate linker flag)
|
||||
set (_underlinked FALSE)
|
||||
foreach (_module IN LISTS _maybe_underlinked)
|
||||
if ("${${_module}_LINKER_FLAGS}" MATCHES "-Wl,--no-as-needed")
|
||||
set (_underlinked TRUE)
|
||||
endif ("${${_module}_LINKER_FLAGS}" MATCHES "-Wl,--no-as-needed")
|
||||
endforeach (_module)
|
||||
# if we didn't have any problems, then go ahead and add
|
||||
if (NOT _underlinked)
|
||||
prepend (CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
|
||||
prepend (CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed")
|
||||
prepend (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
||||
endif (NOT _underlinked)
|
||||
endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC AND ONLY_NEEDED_LIBRARIES)
|
@ -1,70 +0,0 @@
|
||||
# - Use OpenMP features
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_openmp (module)
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# module Name of the module to which OpenMP libraries
|
||||
# etc. should be added, e.g. "opm-core".
|
||||
#
|
||||
# Note: Compiler flags are always added globally, to avoid ABI
|
||||
# incompatibility problems.
|
||||
#
|
||||
# It is assumed that the following variables are available
|
||||
#
|
||||
# ${module}_QUIET Verbosity level of the parent's find module
|
||||
# ${module}_LIBRARIES List of libraries to which OpenMP will be added
|
||||
#
|
||||
# Example:
|
||||
# find_openmp (opm-core)
|
||||
# remove_dup_deps (opm-core)
|
||||
|
||||
include (AddOptions)
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
macro (find_openmp opm)
|
||||
# default is that OpenMP is not considered to be there; if we set this
|
||||
# to a blank definition, it may be added but it cannot be removed if
|
||||
# it propagates to other projects (someone declares it to be part of
|
||||
# _CONFIG_VARS)
|
||||
set (HAVE_OPENMP)
|
||||
|
||||
# user code can be conservative by setting USE_OPENMP_DEFAULT
|
||||
if (NOT DEFINED USE_OPENMP_DEFAULT)
|
||||
set (USE_OPENMP_DEFAULT ON)
|
||||
endif (NOT DEFINED USE_OPENMP_DEFAULT)
|
||||
option (USE_OPENMP "Enable OpenMP for parallelization" ${USE_OPENMP_DEFAULT})
|
||||
if (USE_OPENMP)
|
||||
|
||||
# enabling OpenMP is supposedly enough to make the compiler link with
|
||||
# the appropriate libraries
|
||||
find_package (OpenMP ${${opm}_QUIET})
|
||||
list (APPEND ${opm}_LIBRARIES ${OpenMP_LIBRARIES})
|
||||
if (OPENMP_FOUND)
|
||||
add_options (C ALL_BUILDS "${OpenMP_C_FLAGS}")
|
||||
add_options (CXX ALL_BUILDS "${OpenMP_CXX_FLAGS}")
|
||||
set (HAVE_OPENMP 1)
|
||||
endif (OPENMP_FOUND)
|
||||
|
||||
# threading library (search for this *after* OpenMP
|
||||
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package (Threads ${${opm}_QUIET})
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
list (APPEND ${opm}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif (CMAKE_USE_PTHREADS_INIT)
|
||||
|
||||
else (USE_OPENMP)
|
||||
message (STATUS "OpenMP: disabled")
|
||||
|
||||
# if we don't have OpenMP support, then don't show warnings that these
|
||||
# pragmas are unknown
|
||||
if (CXX_COMPAT_GCC)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-Wno-unknown-pragmas")
|
||||
elseif (MSVC)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-wd4068")
|
||||
endif()
|
||||
endif (USE_OPENMP)
|
||||
endmacro (find_openmp opm)
|
@ -1,64 +0,0 @@
|
||||
# - Turn on optimizations based on build type
|
||||
|
||||
include(TestCXXAcceptsFlag)
|
||||
include (AddOptions)
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
# mapping from profile name (in CMAKE_BUILD_TYPE) to variable part
|
||||
set (_prof_DEBUG "Debug")
|
||||
set (_prof_RELEASE "Release;RelWithDebInfo;MinSizeRel")
|
||||
|
||||
# if we are building a debug target, then disable all optimizations
|
||||
# otherwise, turn them on. indicate to the code what we have done
|
||||
# so it can turn on assertions etc.
|
||||
|
||||
if (CXX_COMPAT_GCC)
|
||||
# extra flags passed for optimization
|
||||
set (_opt_flags "")
|
||||
|
||||
# link-time (a.k.a. global) optimizations
|
||||
# disabled due to widespread bugs in the linker plugin
|
||||
option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" OFF)
|
||||
if (WHOLE_PROG_OPTIM)
|
||||
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
|
||||
if (HAVE_LINK_OPTS)
|
||||
list (APPEND _opt_flags "-flto")
|
||||
endif (HAVE_LINK_OPTS)
|
||||
endif (WHOLE_PROG_OPTIM)
|
||||
|
||||
# native instruction set tuning
|
||||
option (WITH_NATIVE "Use native instruction set" ON)
|
||||
if (WITH_NATIVE)
|
||||
check_cxx_accepts_flag ("-mtune=native" HAVE_MTUNE)
|
||||
if (HAVE_MTUNE)
|
||||
list (APPEND _opt_flags "-mtune=native")
|
||||
endif (HAVE_MTUNE)
|
||||
endif (WITH_NATIVE)
|
||||
|
||||
# default optimization flags, if not set by user
|
||||
set_default_option (CXX _opt_dbg "-O0" "(^|\ )-O")
|
||||
set_default_option (CXX _opt_rel "-O2" "(^|\ )-O")
|
||||
|
||||
# use these options for debug builds - no optimizations
|
||||
add_options (ALL_LANGUAGES "${_prof_DEBUG}" ${_opt_dbg} "-DDEBUG")
|
||||
|
||||
# use these options for release builds - full optimization
|
||||
add_options (ALL_LANGUAGES "${_prof_RELEASE}" ${_opt_rel} "-DNDEBUG" ${_opt_flags})
|
||||
|
||||
else ()
|
||||
# default information from system
|
||||
foreach (lang IN ITEMS C CXX Fortran)
|
||||
if (lang STREQUAL "Fortran")
|
||||
set (_lang F)
|
||||
else (lang STREQUAL "Fortran")
|
||||
set (_lang ${lang})
|
||||
endif (lang STREQUAL "Fortran")
|
||||
foreach (profile IN ITEMS DEBUG RELEASE)
|
||||
if (NOT CMAKE_${lang}_FLAGS_${profile})
|
||||
add_options (${lang} "${_prof_${profile}}"
|
||||
"$ENV{${_lang}FLAGS} ${CMAKE_${lang}_FLAGS_${profile}_INIT}")
|
||||
endif (NOT CMAKE_${lang}_FLAGS_${profile})
|
||||
endforeach (profile)
|
||||
endforeach (lang)
|
||||
endif ()
|
@ -1,171 +0,0 @@
|
||||
# - Use precompiled headers
|
||||
#
|
||||
# precompile_header takes these parameters
|
||||
#
|
||||
# language Language in which the header is written; C or CXX.
|
||||
#
|
||||
# type Type of target being build, SHARED_LIBRARY, STATIC_LIBRARY
|
||||
# or EXECUTABLE.
|
||||
#
|
||||
# header Relative path within the source tree to the header
|
||||
# that contains the list of includes to be precompiled.
|
||||
# This header should not be added to the installation,
|
||||
# as it will be specific for this project.
|
||||
#
|
||||
# target Name of target to be created. All targets that
|
||||
# use the precompiled header should depend on this target
|
||||
# so that it is built before them. A variable with this
|
||||
# name will also be created which contains the file name.
|
||||
#
|
||||
# flags_name Name of variable to receive the flags that should be
|
||||
# added to the command-line.
|
||||
#
|
||||
# Example:
|
||||
# get_target_property (type opmcore TYPE)
|
||||
# precompile_header (CXX ${type}
|
||||
# HEADER "opm/core/opm-core-pch.hpp"
|
||||
# TARGET opmcore_CXX_pch
|
||||
# FLAGS opmcore_PRECOMP_CXX_FLAGS
|
||||
# )
|
||||
# set_source_files_properties (${opmcore_CXX_SOURCES} PROPERTIES
|
||||
# OBJECT_DEPENDS "${opmcore_CXX_pch}"
|
||||
# COMPILE_FLAGS "${opmcore_PRECOMP_CXX_FLAGS}"
|
||||
# )
|
||||
|
||||
# get compiler version
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
# reconstruct the compiler command line; this does NOT include the
|
||||
# DEFINE_SYMBOL that is added for shared libraries. type is the TYPE
|
||||
# target property.
|
||||
# see larsch's PrecompiledHeader.cmake: <https://gist.github.com/573926>
|
||||
# and <https://github.com/loaden/qtcreator/blob/wip/cmake/cmake/PrecompiledHeader.cmake>
|
||||
function (compiler_cmdline language type cmd_name args_name)
|
||||
# get the compiler for this particular language
|
||||
set (${cmd_name} "${CMAKE_${language}_COMPILER}" PARENT_SCOPE)
|
||||
|
||||
# in case someone has overridden the compiler (e.g. ccache)
|
||||
set (_args "${CMAKE_${language}_COMPILER_ARG1}")
|
||||
|
||||
# macro definitions
|
||||
get_directory_property (_defs DEFINITIONS)
|
||||
list (APPEND _args "${_defs}")
|
||||
|
||||
# global flags (such as -std=c++11); notice that there are both
|
||||
# release-dependent and non-release-dependent ones
|
||||
string (TOUPPER "CMAKE_${language}_FLAGS" _flags)
|
||||
list (APPEND _args "${${_flags}}")
|
||||
string (TOUPPER "CMAKE_${language}_FLAGS_${CMAKE_BUILD_TYPE}" _flags)
|
||||
list (APPEND _args "${${_flags}}")
|
||||
|
||||
# assume that we are always generating position-independent code
|
||||
# when compiling for a shared library
|
||||
if (type STREQUAL "SHARED_LIBRARY")
|
||||
list (APPEND _args "${CMAKE_SHARED_LIBRARY_${language}_FLAGS}")
|
||||
endif (type STREQUAL "SHARED_LIBRARY")
|
||||
|
||||
# directories included
|
||||
get_directory_property (_dirs INCLUDE_DIRECTORIES)
|
||||
foreach (_dir ${_dirs})
|
||||
list (APPEND _args "-I${_dir}")
|
||||
endforeach (_dir)
|
||||
|
||||
# make arguments a real list, and write to output variable
|
||||
separate_arguments (_args)
|
||||
set (${args_name} "${_args}" PARENT_SCOPE)
|
||||
endfunction (compiler_cmdline language type cmd_name args_name)
|
||||
|
||||
function (precompile_header
|
||||
language type hdr_kw header tgt_kw target flgs_kw flags_name)
|
||||
|
||||
# check "syntax"
|
||||
if (NOT hdr_kw STREQUAL "HEADER")
|
||||
message (FATAL "Third token to precompile_header shoulde be \"HEADER\"")
|
||||
endif (NOT hdr_kw STREQUAL "HEADER")
|
||||
if (NOT tgt_kw STREQUAL "TARGET")
|
||||
message (FATAL "Fifth token to precompile_header should be \"TARGET\"")
|
||||
endif (NOT tgt_kw STREQUAL "TARGET")
|
||||
if (NOT flgs_kw STREQUAL "FLAGS")
|
||||
message (FATAL "Seventh token to precompile_header should be \"FLAGS\"")
|
||||
endif (NOT flgs_kw STREQUAL "FLAGS")
|
||||
|
||||
# check language
|
||||
if (language STREQUAL "CXX")
|
||||
set (gcc_lang "c++-header")
|
||||
elseif (language STREQUAL "C")
|
||||
set (gcc_lang "c-header")
|
||||
else (language STREQUAL "CXX")
|
||||
message (FATAL "Only C or C++ can have precompiled headers")
|
||||
endif (language STREQUAL "CXX")
|
||||
|
||||
# if no precompiled header was found, then we shouldn't do anything here
|
||||
if (NOT header)
|
||||
return ()
|
||||
endif (NOT header)
|
||||
|
||||
# only support precompiled headers if the compiler is gcc >= 3.4 or clang
|
||||
if (CXX_COMPAT_GCC)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# genuine GCC; must test version
|
||||
get_gcc_version (${language} GCC_VERSION)
|
||||
if (GCC_VERSION VERSION_EQUAL 3.4 OR GCC_VERSION VERSION_GREATER 3.4)
|
||||
set (_do_pch TRUE)
|
||||
else ()
|
||||
set (_do_pch FALSE)
|
||||
endif ()
|
||||
elseif (CMAKE_COMPILER_IS_CLANGXX)
|
||||
# any Clang version that is new enough to compile us can do this
|
||||
set (_do_pch TRUE)
|
||||
else ()
|
||||
set (_do_pch FALSE)
|
||||
endif ()
|
||||
if (_do_pch)
|
||||
# command-line used to compile modules in this kind of target
|
||||
compiler_cmdline (${language} ${type} _cmd _args)
|
||||
|
||||
# gcc will include any configurations which are in a directory
|
||||
# with the same name as the header included
|
||||
set (_pch_dir "CMakeFiles/pch")
|
||||
set (_pch_file "${_pch_dir}/${header}.gch/${target}")
|
||||
|
||||
# make sure that output directory exists
|
||||
get_filename_component (_outdir "${PROJECT_BINARY_DIR}/${_pch_file}" PATH)
|
||||
file (MAKE_DIRECTORY ${_outdir})
|
||||
|
||||
# we need to generate the precompiled header in the output tree, but
|
||||
# at the same time prevent the compiler to pick up the header from the
|
||||
# source tree. getting the order of the include paths right is fragile
|
||||
# in CMake. by copying the header, we can put the precompile dump
|
||||
# right next to it and have the compiler pick it up there
|
||||
add_custom_command (
|
||||
OUTPUT "${_pch_dir}/${header}"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy "${PROJECT_SOURCE_DIR}/${header}" "${_pch_dir}/${header}"
|
||||
DEPENDS "${PROJECT_SOURCE_DIR}/${header}"
|
||||
)
|
||||
|
||||
# add a makefile rule to create the precompiled header
|
||||
add_custom_command (
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/${_pch_file}
|
||||
COMMAND ${_cmd}
|
||||
ARGS ${_args} "-o" "${_pch_file}" "-x" "${gcc_lang}" "-c" "${_pch_dir}/${header}"
|
||||
DEPENDS "${_pch_dir}/${header}"
|
||||
COMMENT "Precompiling headers ${_pch_file}"
|
||||
)
|
||||
|
||||
# create a phony target that is always built, but which only checks
|
||||
# if the header file is OK (i.e. the header only gets rebuilt if
|
||||
# necessary)
|
||||
add_custom_target (${target} ALL
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/${_pch_file}
|
||||
)
|
||||
|
||||
# these flags need to be added to the target
|
||||
set (${target} "${_pch_file}" PARENT_SCOPE)
|
||||
set (${flags_name} "-Winvalid-pch -include ${_pch_dir}/${header}" PARENT_SCOPE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
endfunction (precompile_header
|
||||
language type header tgt_kw target flgs_kw flags_name)
|
@ -1,198 +0,0 @@
|
||||
# - Print CMake and OS distribution version
|
||||
#
|
||||
function (system_info)
|
||||
message (STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
if (CMAKE_SYSTEM MATCHES "Linux")
|
||||
distro_name (DISTRO_NAME)
|
||||
message (STATUS "Linux distribution: ${DISTRO_NAME}")
|
||||
elseif (CMAKE_SYSTEM MATCHES "Darwin")
|
||||
sw_vers (OS_VERSION)
|
||||
message (STATUS "${OS_VERSION}")
|
||||
else (CMAKE_SYSTEM MATCHES "Linux")
|
||||
message (STATUS "Operating system: ${CMAKE_SYSTEM}")
|
||||
endif (CMAKE_SYSTEM MATCHES "Linux")
|
||||
|
||||
target_architecture (TARGET_CPU)
|
||||
message (STATUS "Target architecture: ${TARGET_CPU}")
|
||||
endfunction (system_info)
|
||||
|
||||
function (sw_vers varname)
|
||||
# query operating system for information
|
||||
exec_program (sw_vers OUTPUT_VARIABLE _vers)
|
||||
# split multi-line into various fields
|
||||
string (REPLACE "\n" ";" _vers "${_vers}")
|
||||
string (REPLACE ":" ";" _vers "${_vers}")
|
||||
# get the various fields
|
||||
list (GET _vers 1 _prod_name)
|
||||
list (GET _vers 3 _prod_vers)
|
||||
list (GET _vers 5 _prod_build)
|
||||
# remove extraneous whitespace
|
||||
string (STRIP "${_prod_name}" _prod_name)
|
||||
string (STRIP "${_prod_vers}" _prod_vers)
|
||||
string (STRIP "${_prod_build}" _prod_build)
|
||||
# assemble result variable
|
||||
set (${varname} "${_prod_name} version: ${_prod_vers} (${_prod_build})" PARENT_SCOPE)
|
||||
endfunction (sw_vers varname)
|
||||
|
||||
# probe various system files that may be found
|
||||
function (distro_name varname)
|
||||
file (GLOB has_os_release /etc/os-release)
|
||||
file (GLOB has_lsb_release /etc/lsb-release)
|
||||
file (GLOB has_sys_release /etc/system-release)
|
||||
file (GLOB has_redhat_release /etc/redhat-release)
|
||||
set (_descr)
|
||||
# start with /etc/os-release,
|
||||
# see <http://0pointer.de/blog/projects/os-release.html>
|
||||
if (NOT has_os_release STREQUAL "")
|
||||
read_release (PRETTY_NAME FROM /etc/os-release INTO _descr)
|
||||
# previous "standard", used on older Ubuntu and Debian
|
||||
elseif (NOT has_lsb_release STREQUAL "")
|
||||
read_release (DISTRIB_DESCRIPTION FROM /etc/lsb-release INTO _descr)
|
||||
endif (NOT has_os_release STREQUAL "")
|
||||
# RHEL/CentOS etc. has just a text-file
|
||||
if (NOT _descr)
|
||||
if (NOT has_sys_release STREQUAL "")
|
||||
file (READ /etc/system-release _descr)
|
||||
elseif (NOT has_redhat_release STREQUAL "")
|
||||
file (READ /etc/redhat-release _descr)
|
||||
else (NOT has_sys_release STREQUAL "")
|
||||
# no yet known release file found
|
||||
set (_descr "unknown")
|
||||
endif (NOT has_sys_release STREQUAL "")
|
||||
endif (NOT _descr)
|
||||
# return from function (into appropriate variable)
|
||||
string (STRIP "${_descr}" _descr)
|
||||
set (${varname} "${_descr}" PARENT_SCOPE)
|
||||
endfunction (distro_name varname)
|
||||
|
||||
# read property from the newer /etc/os-release
|
||||
function (read_release valuename FROM filename INTO varname)
|
||||
file (STRINGS ${filename} _distrib
|
||||
REGEX "^${valuename}="
|
||||
)
|
||||
string (REGEX REPLACE
|
||||
"^${valuename}=\"?\(.*\)" "\\1" ${varname} "${_distrib}"
|
||||
)
|
||||
# remove trailing quote that got globbed by the wildcard (greedy match)
|
||||
string (REGEX REPLACE
|
||||
"\"$" "" ${varname} "${${varname}}"
|
||||
)
|
||||
set (${varname} "${${varname}}" PARENT_SCOPE)
|
||||
endfunction (read_release valuename FROM filename INTO varname)
|
||||
|
||||
# the following code is adapted from commit f7467762 of the code at
|
||||
# <https://github.com/petroules/solar-cmake/blob/master/TargetArch.cmake>
|
||||
# which is Copyright (c) 2012 Petroules Corporation, and which at the
|
||||
# time of download (2013-04-07 12:30 CET) is made available with a BSD license.
|
||||
#
|
||||
# it attempts to compile a program which detects the architecture from the
|
||||
# preprocessor symbols and communicate this back to us through an error message(!)
|
||||
function (target_architecture output_var)
|
||||
# OS X is capable of building for *several* architectures at once in
|
||||
# the Mach-O binary, and there is a variable that tells us which those
|
||||
# are, but they may be in any order, so they must be normalized
|
||||
if (APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
# detect each of the possible candidates as a separate flag
|
||||
set (osx_arch_list i386 x86_64)
|
||||
foreach (osx_arch IN ITEMS ${CMAKE_OSX_ARCHITECTURES})
|
||||
foreach (candidate IN LISTS osx_arch_list)
|
||||
if ("${osx_arch}" STREQUAL "${candidate}")
|
||||
set (osx_arch_${candidate} TRUE)
|
||||
endif ("${osx_arch}" STREQUAL "${candidate}")
|
||||
endforeach (candidate)
|
||||
endforeach (osx_arch)
|
||||
|
||||
# add all architectures back in normalized order
|
||||
foreach (candidate IN LISTS osx_arch_list)
|
||||
if (osx_arch_${candidate})
|
||||
list (APPEND ARCH ${candidate})
|
||||
endif (osx_arch_${candidate})
|
||||
endforeach (candidate)
|
||||
|
||||
else (APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
# use the preprocessor defines to determine which target architectures
|
||||
# that are available
|
||||
set (arch_c_src "
|
||||
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
|
||||
# if defined(__ARM_ARCH_7__) \\
|
||||
|| defined(__ARM_ARCH_7A__) \\
|
||||
|| defined(__ARM_ARCH_7R__) \\
|
||||
|| defined(__ARM_ARCH_7M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
|
||||
# error cmake_ARCH armv7
|
||||
# elif defined(__ARM_ARCH_6__) \\
|
||||
|| defined(__ARM_ARCH_6J__) \\
|
||||
|| defined(__ARM_ARCH_6T2__) \\
|
||||
|| defined(__ARM_ARCH_6Z__) \\
|
||||
|| defined(__ARM_ARCH_6K__) \\
|
||||
|| defined(__ARM_ARCH_6ZK__) \\
|
||||
|| defined(__ARM_ARCH_6M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
|
||||
# error cmake_ARCH armv6
|
||||
# elif defined(__ARM_ARCH_5TEJ__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
|
||||
# error cmake_ARCH armv5
|
||||
# else
|
||||
# error cmake_ARCH arm
|
||||
# endif
|
||||
#elif defined(__i386) \\
|
||||
|| defined(__i386__) \\
|
||||
|| defined(_M_IX86)
|
||||
# error cmake_ARCH i386
|
||||
#elif defined(__x86_64) \\
|
||||
|| defined(__x86_64__) \\
|
||||
|| defined(__amd64) \\
|
||||
|| defined(_M_X64)
|
||||
# error cmake_ARCH x86_64
|
||||
#elif defined(__ia64) \\
|
||||
|| defined(__ia64__) \\
|
||||
|| defined(_M_IA64)
|
||||
# error cmake_ARCH ia64
|
||||
#elif defined(__ppc__) \\
|
||||
|| defined(__ppc) \\
|
||||
|| defined(__powerpc__) \\
|
||||
|| defined(_ARCH_COM) \\
|
||||
|| defined(_ARCH_PWR) \\
|
||||
|| defined(_ARCH_PPC) \\
|
||||
|| defined(_M_MPPC) \\
|
||||
|| defined(_M_PPC)
|
||||
# if defined(__ppc64__) \\
|
||||
|| defined(__powerpc64__) \\
|
||||
|| defined(__64BIT__)
|
||||
# error cmake_ARCH ppc64
|
||||
# else
|
||||
# error cmake_ARCH ppc
|
||||
# endif
|
||||
#else
|
||||
# error cmake_ARCH unknown
|
||||
#endif
|
||||
")
|
||||
|
||||
# write a temporary program that can be compiled to get the result
|
||||
set (tmp_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
|
||||
set (arch_c "${tmp_dir}/arch.c")
|
||||
file (WRITE "${arch_c}" "${arch_c_src}")
|
||||
try_compile (
|
||||
compile_result_unused
|
||||
"${tmp_dir}"
|
||||
"${arch_c}"
|
||||
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
|
||||
OUTPUT_VARIABLE ARCH
|
||||
)
|
||||
|
||||
# parse the architecture name from the compiler output
|
||||
string (REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
|
||||
|
||||
# get rid of the value marker leaving just the architecture name
|
||||
string (REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
|
||||
|
||||
# if we are compiling with an unknown architecture this variable should
|
||||
# already be set to "unknown" but in the case that it's empty (i.e. due
|
||||
# to a typo in the code), then set it to unknown
|
||||
if (NOT ARCH)
|
||||
set (ARCH "unknown")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (${output_var} "${ARCH}" PARENT_SCOPE)
|
||||
endfunction()
|
@ -1,53 +0,0 @@
|
||||
# - Use PThread features
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_threads (module)
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# module Name of the module to which Threads support
|
||||
# etc. should be added, e.g. "opm-core".
|
||||
#
|
||||
# Note: Compiler flags are always added globally, to avoid ABI
|
||||
# incompatibility problems.
|
||||
#
|
||||
# It is assumed that the following variables are available
|
||||
#
|
||||
# ${module}_QUIET Verbosity level of the parent's find module
|
||||
# ${module}_LIBRARIES List of libraries to which Thread support will be added
|
||||
#
|
||||
# Example:
|
||||
# find_threads (opm-core)
|
||||
|
||||
include (AddOptions)
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
macro(find_threads opm)
|
||||
# default is that Threads are added
|
||||
option(USE_PTHREAD "Use pthreads" ON)
|
||||
|
||||
# if USE_PTHREAD is enabled then check and set HAVE_PTHREAD
|
||||
if( USE_PTHREAD )
|
||||
# threading library
|
||||
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package (Threads ${${opm}_QUIET})
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
list (APPEND ${opm}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
if (CXX_COMPAT_GCC)
|
||||
check_cxx_accepts_flag ("-pthread" HAVE_PTHREAD)
|
||||
if(HAVE_PTHREAD)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-pthread")
|
||||
set(HAVE_PTHREAD "1")
|
||||
endif(HAVE_PTHREAD)
|
||||
endif (CXX_COMPAT_GCC)
|
||||
else(CMAKE_USE_PTHREADS_INIT)
|
||||
set(USE_PTHREAD OFF)
|
||||
endif (CMAKE_USE_PTHREADS_INIT)
|
||||
else( USE_PTHREAD )
|
||||
# reset HAVE_PTHREAD
|
||||
set(HAVE_PTHREAD "")
|
||||
endif( USE_PTHREAD )
|
||||
|
||||
endmacro(find_threads opm)
|
@ -1,102 +0,0 @@
|
||||
# - Get version control information from source tree
|
||||
#
|
||||
# Sets the following variables
|
||||
#
|
||||
# VCS_SYSTEM Currently, this will only be "git", or empty if
|
||||
# no source code control system is found.
|
||||
#
|
||||
# VCS_SHA1 Hash code of the last commit. If this is empty,
|
||||
# then no source code repository was found.
|
||||
#
|
||||
# VCS_DECOR Characters that denotes any local modifications:
|
||||
# "*" - Unstaged local changes
|
||||
# "+" - Staged, but not committed, local changes
|
||||
# "%" - Untracked local files
|
||||
function (vcs_info)
|
||||
# if we haven't located git yet, then do it now
|
||||
if (NOT GIT_FOUND)
|
||||
find_package (Git)
|
||||
endif (NOT GIT_FOUND)
|
||||
|
||||
# if git is not installed (unpacked tarball), then just state that
|
||||
# the version practically is unknown
|
||||
set (VCS_DECOR "")
|
||||
if (GIT_FOUND)
|
||||
set (VCS_SYSTEM "git")
|
||||
|
||||
# assume that we have a .git subdirectory under the source directory;
|
||||
# if we have a bare repository, then we won't be able to build in there
|
||||
# and we won't be able to identify the git dir to use from only a work
|
||||
# tree, so we handle that like a regular unpacked tarball
|
||||
|
||||
# exec_program is used because execute_process is buggy on common
|
||||
# platforms (notable CMake 2.8.7 in Ubuntu Precise 12.04)
|
||||
|
||||
# get hash code
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS rev-parse --short --verify HEAD
|
||||
OUTPUT_VARIABLE VCS_SHA1
|
||||
RETURN_VALUE has_sha
|
||||
)
|
||||
|
||||
# exec_program mashes together output and error
|
||||
if (NOT ${has_sha} EQUAL 0)
|
||||
set (VCS_SHA1 "")
|
||||
endif (NOT ${has_sha} EQUAL 0)
|
||||
|
||||
# only proceed if we actually found a source tree in there
|
||||
if (VCS_SHA1)
|
||||
# check for unstaged local changes
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS diff --no-ext-diff --quiet --exit-code
|
||||
RETURN_VALUE dirty
|
||||
OUTPUT_VARIABLE _dummy
|
||||
)
|
||||
if (NOT ${dirty} EQUAL 0)
|
||||
list (APPEND VCS_DECOR "*")
|
||||
endif (NOT ${dirty} EQUAL 0)
|
||||
|
||||
# check for staged local changes
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS diff-index --no-ext-diff --cached --quiet --exit-code HEAD --
|
||||
RETURN_VALUE staged
|
||||
OUTPUT_VARIABLE _dummy
|
||||
)
|
||||
if (NOT ${staged} EQUAL 0)
|
||||
list (APPEND VCS_DECOR "+")
|
||||
endif (NOT ${staged} EQUAL 0)
|
||||
|
||||
# check for untracked files
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS ls-files --others --exclude-standard
|
||||
OUTPUT_VARIABLE untracked
|
||||
)
|
||||
if (untracked)
|
||||
list (APPEND VCS_DECOR "%")
|
||||
endif (untracked)
|
||||
|
||||
# convert list to regular string
|
||||
string (REPLACE ";" "" VCS_DECOR "${VCS_DECOR}")
|
||||
endif (VCS_SHA1)
|
||||
else (GIT_FOUND)
|
||||
set (VCS_SYSTEM "")
|
||||
set (VCS_SHA1 "")
|
||||
set (VCS_DECOR "")
|
||||
endif (GIT_FOUND)
|
||||
|
||||
# diagnostic output
|
||||
if (VCS_SYSTEM AND VCS_SHA1)
|
||||
message (STATUS "Source code repository: ${VCS_SYSTEM} ${VCS_SHA1}${VCS_DECOR}")
|
||||
else (VCS_SYSTEM AND VCS_SHA1)
|
||||
message (STATUS "Source code repository: not found!")
|
||||
endif (VCS_SYSTEM AND VCS_SHA1)
|
||||
|
||||
# export to parent context
|
||||
set (VCS_SYSTEM "${VCS_SYSTEM}" PARENT_SCOPE)
|
||||
set (VCS_SHA1 "${VCS_SHA1}" PARENT_SCOPE)
|
||||
set (VCS_DECOR "${VCS_DECOR}" PARENT_SCOPE)
|
||||
endfunction (vcs_info)
|
@ -1,104 +0,0 @@
|
||||
# - Write version information into the source code
|
||||
#
|
||||
# Add an unconditional target to the Makefile which checks the current
|
||||
# SHA of the source directory and write to a header file if and *only*
|
||||
# if this has changed (thus we avoid unnecessary rebuilds). By having
|
||||
# this in the Makefile, we get updated version information even though
|
||||
# we haven't done any reconfiguring.
|
||||
#
|
||||
# The time it takes to probe the VCS for this information and write it
|
||||
# to the miniature file in negligable.
|
||||
#
|
||||
# If the build type is Debug, then we only write a static version
|
||||
# information as it gets tiresome to rebuild the project everytime one
|
||||
# makes changes to any of the unit tests.
|
||||
|
||||
message("-- Writing version information to local header project-version.h")
|
||||
|
||||
string (TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_upper_)
|
||||
if (cmake_build_type_upper_ MATCHES DEBUG)
|
||||
file (WRITE "${PROJECT_BINARY_DIR}/project-version.h"
|
||||
"#ifndef OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
"#define OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
"#define PROJECT_VERSION_NAME \"${${project}_LABEL}\"\n"
|
||||
"#define PROJECT_VERSION_HASH \"debug\"\n"
|
||||
"#define PROJECT_VERSION \"${${project}_LABEL} (debug)\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
)
|
||||
else ()
|
||||
if (NOT GIT_FOUND)
|
||||
find_package (Git)
|
||||
endif ()
|
||||
|
||||
# if git is *still* not found means it is not present on the
|
||||
# system, so there is "no" way we can update the SHA. notice
|
||||
# that this is a slightly different version of the label than
|
||||
# above.
|
||||
if (NOT GIT_FOUND)
|
||||
file (WRITE "${PROJECT_BINARY_DIR}/project-version.h"
|
||||
"#ifndef OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
"#define OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
"#define PROJECT_VERSION_NAME \"${${project}_LABEL}\"\n"
|
||||
"#define PROJECT_VERSION_HASH \"unknown git version\"\n"
|
||||
"#define PROJECT_VERSION \"${${project}_LABEL} (unknown git version)\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
)
|
||||
else ()
|
||||
add_custom_target (update-version ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY}
|
||||
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
|
||||
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
|
||||
-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}
|
||||
-DPROJECT_LABEL=${${project}_LABEL}
|
||||
-P ${OPM_MACROS_ROOT}/cmake/Scripts/WriteVerSHA.cmake
|
||||
COMMENT "Updating version information"
|
||||
)
|
||||
|
||||
# the target above gets built every time thanks to the "ALL" modifier,
|
||||
# but it must also be done before the main library so it can pick up
|
||||
# any changes it does.
|
||||
if (${project}_TARGET)
|
||||
add_dependencies (${${project}_TARGET} update-version)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# safety precaution: check that we don't have version number mismatch.
|
||||
|
||||
# first get the name of the module (e.g. "core")
|
||||
set (_module_regexp "([^-]+)-(.*)")
|
||||
string (REGEX REPLACE "${_module_regexp}" "\\1" _suite_name "${project}")
|
||||
string (REGEX REPLACE "${_module_regexp}" "\\2" _module_name "${project}")
|
||||
|
||||
# if we have a version number it must be in this file, e.g. opm/core/version.h
|
||||
set (_rel_ver_h "${${project}_DIR}/${_module_name}/version.h")
|
||||
set (_version_h "${PROJECT_SOURCE_DIR}/${_rel_ver_h}")
|
||||
|
||||
# not all modules have version files, so only check if they do
|
||||
if (EXISTS "${_version_h}")
|
||||
# uppercase versions which is used in the file
|
||||
string (TOUPPER "${_suite_name}" _suite_upper)
|
||||
string (TOUPPER "${_module_name}" _module_upper)
|
||||
|
||||
# scan the files for version define for major version
|
||||
set (_major_regexp "#define[ ]+${_suite_upper}_${_module_upper}_VERSION_MAJOR[ ]+([0-9]*)")
|
||||
file (STRINGS "${_version_h}" _version_h_major REGEX "${_major_regexp}")
|
||||
string (REGEX REPLACE "${_major_regexp}" "\\1" _version_h_major "${_version_h_major}")
|
||||
|
||||
# exactly the same, but minor version (making a macro is more lines...)
|
||||
set (_minor_regexp "#define[ ]+${_suite_upper}_${_module_upper}_VERSION_MINOR[ ]+([0-9]*)")
|
||||
file (STRINGS "${_version_h}" _version_h_minor REGEX "${_minor_regexp}")
|
||||
string (REGEX REPLACE "${_minor_regexp}" "\\1" _version_h_minor "${_version_h_minor}")
|
||||
|
||||
# compare what we got from the file with what we have defined here
|
||||
if (NOT (("${_version_h_major}" EQUAL "${${project}_VERSION_MAJOR}")
|
||||
AND ("${_version_h_minor}" EQUAL "${${project}_VERSION_MINOR}")))
|
||||
set (_proj_ver "${${project}_VERSION_MAJOR}.${${project}_VERSION_MINOR}")
|
||||
set (_file_ver "${_version_h_major}.${_version_h_minor}")
|
||||
message (AUTHOR_WARNING
|
||||
"Version in build system (dune.module) is \"${_proj_ver}\", "
|
||||
"but version in source (${_rel_ver_h}) is \"${_file_ver}\""
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
@ -1,19 +0,0 @@
|
||||
# - Turn on warnings when compiling
|
||||
|
||||
include (AddOptions)
|
||||
include (UseCompVer)
|
||||
is_compiler_gcc_compatible ()
|
||||
|
||||
if (CXX_COMPAT_GCC)
|
||||
# default warnings flags, if not set by user
|
||||
set_default_option (CXX _warn_flag "-Wall" "(^|\ )-W")
|
||||
if (_warn_flag)
|
||||
message (STATUS "All warnings enabled: ${_warn_flag}")
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "${_warn_flag}")
|
||||
endif (_warn_flag)
|
||||
endif ()
|
||||
|
||||
option(SILENCE_EXTERNAL_WARNINGS "Disable some warnings from external packages (requires GCC 4.6 or newer)" OFF)
|
||||
if(SILENCE_EXTERNAL_WARNINGS AND CXX_COMPAT_GCC)
|
||||
add_definitions(-DSILENCE_EXTERNAL_WARNINGS)
|
||||
endif()
|
@ -1,138 +0,0 @@
|
||||
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
|
||||
#
|
||||
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
|
||||
# parsing the arguments given to that macro or function.
|
||||
# It processes the arguments and defines a set of variables which hold the
|
||||
# values of the respective options.
|
||||
#
|
||||
# The <options> argument contains all options for the respective macro,
|
||||
# i.e. keywords which can be used when calling the macro without any value
|
||||
# following, like e.g. the OPTIONAL keyword of the install() command.
|
||||
#
|
||||
# The <one_value_keywords> argument contains all keywords for this macro
|
||||
# which are followed by one value, like e.g. DESTINATION keyword of the
|
||||
# install() command.
|
||||
#
|
||||
# The <multi_value_keywords> argument contains all keywords for this macro
|
||||
# which can be followed by more than one value, like e.g. the TARGETS or
|
||||
# FILES keywords of the install() command.
|
||||
#
|
||||
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
|
||||
# keywords listed in <options>, <one_value_keywords> and
|
||||
# <multi_value_keywords> a variable composed of the given <prefix>
|
||||
# followed by "_" and the name of the respective keyword.
|
||||
# These variables will then hold the respective value from the argument list.
|
||||
# For the <options> keywords this will be TRUE or FALSE.
|
||||
#
|
||||
# All remaining arguments are collected in a variable
|
||||
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
|
||||
# your macro was called with unrecognized parameters.
|
||||
#
|
||||
# As an example here a my_install() macro, which takes similar arguments as the
|
||||
# real install() command:
|
||||
#
|
||||
# function(MY_INSTALL)
|
||||
# set(options OPTIONAL FAST)
|
||||
# set(oneValueArgs DESTINATION RENAME)
|
||||
# set(multiValueArgs TARGETS CONFIGURATIONS)
|
||||
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
# ...
|
||||
#
|
||||
# Assume my_install() has been called like this:
|
||||
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
|
||||
#
|
||||
# After the cmake_parse_arguments() call the macro will have set the following
|
||||
# variables:
|
||||
# MY_INSTALL_OPTIONAL = TRUE
|
||||
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
|
||||
# MY_INSTALL_DESTINATION = "bin"
|
||||
# MY_INSTALL_RENAME = "" (was not used)
|
||||
# MY_INSTALL_TARGETS = "foo;bar"
|
||||
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
|
||||
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
|
||||
#
|
||||
# You can the continue and process these variables.
|
||||
#
|
||||
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
|
||||
# another recognized keyword follows, this is interpreted as the beginning of
|
||||
# the new option.
|
||||
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
|
||||
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
|
||||
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
|
||||
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
|
||||
|
||||
|
||||
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
|
||||
# first set all result variables to empty/FALSE
|
||||
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
|
||||
set(${prefix}_${arg_name})
|
||||
endforeach(arg_name)
|
||||
|
||||
foreach(option ${_optionNames})
|
||||
set(${prefix}_${option} FALSE)
|
||||
endforeach(option)
|
||||
|
||||
set(${prefix}_UNPARSED_ARGUMENTS)
|
||||
|
||||
set(insideValues FALSE)
|
||||
set(currentArgName)
|
||||
|
||||
# now iterate over all arguments and fill the result variables
|
||||
foreach(currentArg ${ARGN})
|
||||
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||
|
||||
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
|
||||
if(insideValues)
|
||||
if("${insideValues}" STREQUAL "SINGLE")
|
||||
set(${prefix}_${currentArgName} ${currentArg})
|
||||
set(insideValues FALSE)
|
||||
elseif("${insideValues}" STREQUAL "MULTI")
|
||||
list(APPEND ${prefix}_${currentArgName} ${currentArg})
|
||||
endif()
|
||||
else(insideValues)
|
||||
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
|
||||
endif(insideValues)
|
||||
else()
|
||||
if(NOT ${optionIndex} EQUAL -1)
|
||||
set(${prefix}_${currentArg} TRUE)
|
||||
set(insideValues FALSE)
|
||||
elseif(NOT ${singleArgIndex} EQUAL -1)
|
||||
set(currentArgName ${currentArg})
|
||||
set(${prefix}_${currentArgName})
|
||||
set(insideValues "SINGLE")
|
||||
elseif(NOT ${multiArgIndex} EQUAL -1)
|
||||
set(currentArgName ${currentArg})
|
||||
set(${prefix}_${currentArgName})
|
||||
set(insideValues "MULTI")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach(currentArg)
|
||||
|
||||
# propagate the result variables to the caller:
|
||||
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
|
||||
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
|
||||
endforeach(arg_name)
|
||||
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
|
||||
|
||||
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
|
@ -1,47 +0,0 @@
|
||||
# The module defines the following variables:
|
||||
# GIT_EXECUTABLE - path to git command line client
|
||||
# GIT_FOUND - true if the command line client was found
|
||||
# Example usage:
|
||||
# find_package(Git)
|
||||
# if(GIT_FOUND)
|
||||
# message("git found: ${GIT_EXECUTABLE}")
|
||||
# endif()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Look for 'git' or 'eg' (easy git)
|
||||
#
|
||||
set(git_names git eg)
|
||||
|
||||
# Prefer .cmd variants on Windows unless running in a Makefile
|
||||
# in the MSYS shell.
|
||||
#
|
||||
if(WIN32)
|
||||
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
|
||||
set(git_names git.cmd git eg.cmd eg)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(GIT_EXECUTABLE
|
||||
NAMES ${git_names}
|
||||
PATH_SUFFIXES Git/cmd Git/bin
|
||||
DOC "git command line client"
|
||||
)
|
||||
mark_as_advanced(GIT_EXECUTABLE)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
|
@ -1,61 +0,0 @@
|
||||
# This module defines two macros:
|
||||
# CMAKE_PUSH_CHECK_STATE()
|
||||
# and
|
||||
# CMAKE_POP_CHECK_STATE()
|
||||
# These two macros can be used to save and restore the state of the variables
|
||||
# CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES
|
||||
# and CMAKE_REQUIRED_INCLUDES used by the various Check-files coming with CMake,
|
||||
# like e.g. check_function_exists() etc.
|
||||
# The variable contents are pushed on a stack, pushing multiple times is supported.
|
||||
# This is useful e.g. when executing such tests in a Find-module, where they have to be set,
|
||||
# but after the Find-module has been executed they should have the same value
|
||||
# as they had before.
|
||||
#
|
||||
# Usage:
|
||||
# cmake_push_check_state()
|
||||
# set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
|
||||
# check_function_exists(...)
|
||||
# cmake_pop_check_state()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
|
||||
MACRO(CMAKE_PUSH_CHECK_STATE)
|
||||
|
||||
IF(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER)
|
||||
SET(_CMAKE_PUSH_CHECK_STATE_COUNTER 0)
|
||||
ENDIF()
|
||||
|
||||
MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1")
|
||||
|
||||
SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
|
||||
SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
|
||||
ENDMACRO(CMAKE_PUSH_CHECK_STATE)
|
||||
|
||||
MACRO(CMAKE_POP_CHECK_STATE)
|
||||
|
||||
# don't pop more than we pushed
|
||||
IF("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0")
|
||||
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
|
||||
MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
|
||||
ENDIF()
|
||||
|
||||
ENDMACRO(CMAKE_POP_CHECK_STATE)
|
@ -1,624 +0,0 @@
|
||||
# - Find BLAS library
|
||||
# This module finds an installed fortran library that implements the BLAS
|
||||
# linear-algebra interface (see http://www.netlib.org/blas/).
|
||||
# The list of libraries searched for is taken
|
||||
# from the autoconf macro file, acx_blas.m4 (distributed at
|
||||
# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
|
||||
#
|
||||
# This module sets the following variables:
|
||||
# BLAS_FOUND - set to true if a library implementing the BLAS interface
|
||||
# is found
|
||||
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
||||
# and -L).
|
||||
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
|
||||
# link against to use BLAS
|
||||
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
|
||||
# to link against to use BLAS95 interface
|
||||
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
|
||||
# is found
|
||||
# BLA_STATIC if set on this determines what kind of linkage we do (static)
|
||||
# BLA_VENDOR if set checks only the specified vendor, if not set checks
|
||||
# all the possibilities
|
||||
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
|
||||
##########
|
||||
### List of vendors (BLA_VENDOR) valid in this module
|
||||
## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
|
||||
## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
|
||||
# C/CXX should be enabled to use Intel mkl
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckFortranFunctionExists)
|
||||
|
||||
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
# Check the language being used
|
||||
get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
|
||||
if( _LANGUAGES_ MATCHES Fortran )
|
||||
set( _CHECK_FORTRAN TRUE )
|
||||
elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
|
||||
set( _CHECK_FORTRAN FALSE )
|
||||
else()
|
||||
if(BLAS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
|
||||
else(BLAS_FIND_REQUIRED)
|
||||
message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
|
||||
return()
|
||||
endif(BLAS_FIND_REQUIRED)
|
||||
endif( )
|
||||
|
||||
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
|
||||
# This macro checks for the existence of the combination of fortran libraries
|
||||
# given by _list. If the combination is found, this macro checks (using the
|
||||
# Check_Fortran_Function_Exists macro) whether can link against that library
|
||||
# combination using the name of a routine given by _name using the linker
|
||||
# flags given by _flags. If the combination of libraries is found and passes
|
||||
# the link test, LIBRARIES is set to the list of complete library paths that
|
||||
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
||||
|
||||
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
||||
# are generated internally and marked advanced by this macro.
|
||||
|
||||
set(_libdir ${ARGN})
|
||||
|
||||
set(_libraries_work TRUE)
|
||||
set(${LIBRARIES})
|
||||
set(_combined_name)
|
||||
if (NOT _libdir)
|
||||
if (WIN32)
|
||||
set(_libdir ENV LIB)
|
||||
elseif (APPLE)
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
|
||||
else ()
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
|
||||
endif ()
|
||||
endif ()
|
||||
foreach(_library ${_list})
|
||||
set(_combined_name ${_combined_name}_${_library})
|
||||
|
||||
if(_libraries_work)
|
||||
if (BLA_STATIC)
|
||||
if (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif ( WIN32 )
|
||||
if (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif (APPLE)
|
||||
else (BLA_STATIC)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# for ubuntu's libblas3gf and liblapack3gf packages
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
|
||||
endif ()
|
||||
endif (BLA_STATIC)
|
||||
find_library(${_prefix}_${_library}_LIBRARY
|
||||
NAMES ${_library}
|
||||
PATHS ${_libdir}
|
||||
)
|
||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||
endif(_libraries_work)
|
||||
endforeach(_library ${_list})
|
||||
if(_libraries_work)
|
||||
# Test this combination of libraries.
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
|
||||
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||
if (_CHECK_FORTRAN)
|
||||
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
|
||||
else()
|
||||
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||
endif(_libraries_work)
|
||||
if(NOT _libraries_work)
|
||||
set(${LIBRARIES} FALSE)
|
||||
endif(NOT _libraries_work)
|
||||
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
||||
endmacro(Check_Fortran_Libraries)
|
||||
|
||||
set(BLAS_LINKER_FLAGS)
|
||||
set(BLAS_LIBRARIES)
|
||||
set(BLAS95_LIBRARIES)
|
||||
if ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
set(BLA_VENDOR $ENV{BLA_VENDOR})
|
||||
else ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
if(NOT BLA_VENDOR)
|
||||
set(BLA_VENDOR "All")
|
||||
endif(NOT BLA_VENDOR)
|
||||
endif ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
# gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"goto2"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
dgemm
|
||||
""
|
||||
"f77blas;atlas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
|
||||
if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"sgemm;dgemm;blas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in Alpha CXML library?
|
||||
if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"cxml"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in Alpha DXML library? (now called CXML, see above)
|
||||
if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"dxml"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in Sun Performance library?
|
||||
if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"-xlic_lib=sunperf"
|
||||
"sunperf;sunmath"
|
||||
""
|
||||
)
|
||||
if(BLAS_LIBRARIES)
|
||||
set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
|
||||
endif(BLAS_LIBRARIES)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in SCSL library? (SGI/Cray Scientific Library)
|
||||
if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"scsl"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in SGIMATH library?
|
||||
if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"complib.sgimath"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
|
||||
if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"essl;blas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
#BLAS in acml library?
|
||||
if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
|
||||
if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
|
||||
((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
|
||||
((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
|
||||
)
|
||||
# try to find acml in "standard" paths
|
||||
if( WIN32 )
|
||||
file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
|
||||
else()
|
||||
file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
|
||||
endif()
|
||||
if( WIN32 )
|
||||
file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
|
||||
else()
|
||||
file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
|
||||
endif()
|
||||
list(GET _ACML_ROOT 0 _ACML_ROOT)
|
||||
list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
|
||||
if( _ACML_ROOT )
|
||||
get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
|
||||
if( SIZEOF_INTEGER EQUAL 8 )
|
||||
set( _ACML_PATH_SUFFIX "_int64" )
|
||||
else()
|
||||
set( _ACML_PATH_SUFFIX "" )
|
||||
endif()
|
||||
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
|
||||
set( _ACML_COMPILER32 "ifort32" )
|
||||
set( _ACML_COMPILER64 "ifort64" )
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
|
||||
set( _ACML_COMPILER32 "sun32" )
|
||||
set( _ACML_COMPILER64 "sun64" )
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
|
||||
set( _ACML_COMPILER32 "pgi32" )
|
||||
if( WIN32 )
|
||||
set( _ACML_COMPILER64 "win64" )
|
||||
else()
|
||||
set( _ACML_COMPILER64 "pgi64" )
|
||||
endif()
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
|
||||
# 32 bit builds not supported on Open64 but for code simplicity
|
||||
# We'll just use the same directory twice
|
||||
set( _ACML_COMPILER32 "open64_64" )
|
||||
set( _ACML_COMPILER64 "open64_64" )
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
|
||||
set( _ACML_COMPILER32 "nag32" )
|
||||
set( _ACML_COMPILER64 "nag64" )
|
||||
else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
|
||||
set( _ACML_COMPILER32 "gfortran32" )
|
||||
set( _ACML_COMPILER64 "gfortran64" )
|
||||
endif()
|
||||
|
||||
if( BLA_VENDOR STREQUAL "ACML_MP" )
|
||||
set(_ACML_MP_LIB_DIRS
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
|
||||
else() #if( _BLAS_VENDOR STREQUAL "ACML" )
|
||||
set(_ACML_LIB_DIRS
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
|
||||
endif()
|
||||
endif()
|
||||
elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
|
||||
set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
|
||||
endif()
|
||||
|
||||
if( BLA_VENDOR STREQUAL "ACML_MP" )
|
||||
foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
|
||||
check_fortran_libraries (
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
|
||||
)
|
||||
if( BLAS_LIBRARIES )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
|
||||
foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
|
||||
check_fortran_libraries (
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
|
||||
)
|
||||
if( BLAS_LIBRARIES )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
else() #if( _BLAS_VENDOR STREQUAL "ACML" )
|
||||
foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
|
||||
check_fortran_libraries (
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
|
||||
)
|
||||
if( BLAS_LIBRARIES )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"acml;acml_mv"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"acml_mp;acml_mv"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"acml;acml_mv;CALBLAS"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif () # ACML
|
||||
|
||||
# Apple BLAS library?
|
||||
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
dgemm
|
||||
""
|
||||
"Accelerate"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
if ( NOT BLAS_LIBRARIES )
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
dgemm
|
||||
""
|
||||
"vecLib"
|
||||
""
|
||||
)
|
||||
endif ( NOT BLAS_LIBRARIES )
|
||||
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
# Generic BLAS library?
|
||||
if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"blas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
#BLAS in intel mkl 10 library? (em64t 64bit)
|
||||
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
if (NOT WIN32)
|
||||
set(LM "-lm")
|
||||
endif ()
|
||||
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||
find_package(Threads)
|
||||
else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||
if (WIN32)
|
||||
if(BLA_F95)
|
||||
if(NOT BLAS95_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS95_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
SGEMM
|
||||
""
|
||||
"mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
else(WIN32)
|
||||
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
|
||||
if(BLA_F95)
|
||||
if(NOT BLAS95_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS95_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT}"
|
||||
"${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
|
||||
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
|
||||
if(BLA_F95)
|
||||
if(NOT BLAS95_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS95_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
|
||||
endif (WIN32)
|
||||
#older vesions of intel mkl libs
|
||||
# BLAS in intel mkl library? (shared)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
#BLAS in intel mkl library? (static, 32bit)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_ia32;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
#BLAS in intel mkl library? (static, em64t 64bit)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_em64t;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
|
||||
if(BLA_F95)
|
||||
if(BLAS95_LIBRARIES)
|
||||
set(BLAS95_FOUND TRUE)
|
||||
else(BLAS95_LIBRARIES)
|
||||
set(BLAS95_FOUND FALSE)
|
||||
endif(BLAS95_LIBRARIES)
|
||||
|
||||
if(NOT BLAS_FIND_QUIETLY)
|
||||
if(BLAS95_FOUND)
|
||||
message(STATUS "A library with BLAS95 API found.")
|
||||
else(BLAS95_FOUND)
|
||||
if(BLAS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with BLAS95 API not found. Please specify library location.")
|
||||
else(BLAS_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with BLAS95 API not found. Please specify library location.")
|
||||
endif(BLAS_FIND_REQUIRED)
|
||||
endif(BLAS95_FOUND)
|
||||
endif(NOT BLAS_FIND_QUIETLY)
|
||||
set(BLAS_FOUND TRUE)
|
||||
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
|
||||
else(BLA_F95)
|
||||
if(BLAS_LIBRARIES)
|
||||
set(BLAS_FOUND TRUE)
|
||||
else(BLAS_LIBRARIES)
|
||||
set(BLAS_FOUND FALSE)
|
||||
endif(BLAS_LIBRARIES)
|
||||
|
||||
if(NOT BLAS_FIND_QUIETLY)
|
||||
if(BLAS_FOUND)
|
||||
message(STATUS "A library with BLAS API found.")
|
||||
else(BLAS_FOUND)
|
||||
if(BLAS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with BLAS API not found. Please specify library location."
|
||||
)
|
||||
else(BLAS_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with BLAS API not found. Please specify library location."
|
||||
)
|
||||
endif(BLAS_FIND_REQUIRED)
|
||||
endif(BLAS_FOUND)
|
||||
endif(NOT BLAS_FIND_QUIETLY)
|
||||
endif(BLA_F95)
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
@ -1,307 +0,0 @@
|
||||
# - Find LAPACK library
|
||||
# This module finds an installed fortran library that implements the LAPACK
|
||||
# linear-algebra interface (see http://www.netlib.org/lapack/).
|
||||
#
|
||||
# The approach follows that taken for the autoconf macro file, acx_lapack.m4
|
||||
# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
|
||||
#
|
||||
# This module sets the following variables:
|
||||
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
|
||||
# is found
|
||||
# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
||||
# and -L).
|
||||
# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
|
||||
# link against to use LAPACK
|
||||
# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
|
||||
# link against to use LAPACK95
|
||||
# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95
|
||||
# interface is found
|
||||
# BLA_STATIC if set on this determines what kind of linkage we do (static)
|
||||
# BLA_VENDOR if set checks only the specified vendor, if not set checks
|
||||
# all the possibilities
|
||||
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
|
||||
### List of vendors (BLA_VENDOR) valid in this module
|
||||
## Intel(mkl), ACML,Apple, NAS, Generic
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
if (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
include(CheckFunctionExists)
|
||||
else (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
include(CheckFortranFunctionExists)
|
||||
endif (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
|
||||
set(LAPACK_FOUND FALSE)
|
||||
set(LAPACK95_FOUND FALSE)
|
||||
|
||||
# TODO: move this stuff to separate module
|
||||
|
||||
macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
|
||||
# This macro checks for the existence of the combination of fortran libraries
|
||||
# given by _list. If the combination is found, this macro checks (using the
|
||||
# Check_Fortran_Function_Exists macro) whether can link against that library
|
||||
# combination using the name of a routine given by _name using the linker
|
||||
# flags given by _flags. If the combination of libraries is found and passes
|
||||
# the link test, LIBRARIES is set to the list of complete library paths that
|
||||
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
||||
|
||||
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
||||
# are generated internally and marked advanced by this macro.
|
||||
|
||||
set(_libraries_work TRUE)
|
||||
set(${LIBRARIES})
|
||||
set(_combined_name)
|
||||
if (NOT _libdir)
|
||||
if (WIN32)
|
||||
set(_libdir ENV LIB)
|
||||
elseif (APPLE)
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
|
||||
else ()
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
|
||||
endif ()
|
||||
endif ()
|
||||
foreach(_library ${_list})
|
||||
set(_combined_name ${_combined_name}_${_library})
|
||||
|
||||
if(_libraries_work)
|
||||
if (BLA_STATIC)
|
||||
if (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif ( WIN32 )
|
||||
if (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif (APPLE)
|
||||
else (BLA_STATIC)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# for ubuntu's libblas3gf and liblapack3gf packages
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
|
||||
endif ()
|
||||
endif (BLA_STATIC)
|
||||
find_library(${_prefix}_${_library}_LIBRARY
|
||||
NAMES ${_library}
|
||||
PATHS ${_libdir}
|
||||
)
|
||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||
endif(_libraries_work)
|
||||
endforeach(_library ${_list})
|
||||
|
||||
if(_libraries_work)
|
||||
# Test this combination of libraries.
|
||||
if(UNIX AND BLA_STATIC)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads})
|
||||
else(UNIX AND BLA_STATIC)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
|
||||
endif(UNIX AND BLA_STATIC)
|
||||
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||
if (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
|
||||
else (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
||||
endif (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
||||
endif(_libraries_work)
|
||||
|
||||
if(_libraries_work)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads})
|
||||
else(_libraries_work)
|
||||
set(${LIBRARIES} FALSE)
|
||||
endif(_libraries_work)
|
||||
|
||||
endmacro(Check_Lapack_Libraries)
|
||||
|
||||
|
||||
set(LAPACK_LINKER_FLAGS)
|
||||
set(LAPACK_LIBRARIES)
|
||||
set(LAPACK95_LIBRARIES)
|
||||
|
||||
|
||||
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_package(BLAS)
|
||||
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_package(BLAS REQUIRED)
|
||||
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
|
||||
|
||||
if(BLAS_FOUND)
|
||||
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||
if ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
set(BLA_VENDOR $ENV{BLA_VENDOR})
|
||||
else ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
if(NOT BLA_VENDOR)
|
||||
set(BLA_VENDOR "All")
|
||||
endif(NOT BLA_VENDOR)
|
||||
endif ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT LAPACK_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"goto2"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif(NOT LAPACK_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
|
||||
#acml lapack
|
||||
if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
|
||||
if (BLAS_LIBRARIES MATCHES ".+acml.+")
|
||||
set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Apple LAPACK library?
|
||||
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT LAPACK_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"Accelerate"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif(NOT LAPACK_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
if ( NOT LAPACK_LIBRARIES )
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"vecLib"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif ( NOT LAPACK_LIBRARIES )
|
||||
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
# Generic LAPACK library?
|
||||
if (BLA_VENDOR STREQUAL "Generic" OR
|
||||
BLA_VENDOR STREQUAL "ATLAS" OR
|
||||
BLA_VENDOR STREQUAL "All")
|
||||
if ( NOT LAPACK_LIBRARIES )
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"lapack"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif ( NOT LAPACK_LIBRARIES )
|
||||
endif ()
|
||||
#intel lapack
|
||||
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_PACKAGE(Threads)
|
||||
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
if (BLA_F95)
|
||||
if(NOT LAPACK95_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK95_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"mkl_lapack95"
|
||||
"${BLAS95_LIBRARIES}"
|
||||
"${CMAKE_THREAD_LIBS_INIT}"
|
||||
)
|
||||
endif(NOT LAPACK95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT LAPACK_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"mkl_lapack"
|
||||
"${BLAS_LIBRARIES}"
|
||||
"${CMAKE_THREAD_LIBS_INIT}"
|
||||
)
|
||||
endif(NOT LAPACK_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
else(BLAS_FOUND)
|
||||
message(STATUS "LAPACK requires BLAS")
|
||||
endif(BLAS_FOUND)
|
||||
|
||||
if(BLA_F95)
|
||||
if(LAPACK95_LIBRARIES)
|
||||
set(LAPACK95_FOUND TRUE)
|
||||
else(LAPACK95_LIBRARIES)
|
||||
set(LAPACK95_FOUND FALSE)
|
||||
endif(LAPACK95_LIBRARIES)
|
||||
if(NOT LAPACK_FIND_QUIETLY)
|
||||
if(LAPACK95_FOUND)
|
||||
message(STATUS "A library with LAPACK95 API found.")
|
||||
else(LAPACK95_FOUND)
|
||||
if(LAPACK_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with LAPACK95 API not found. Please specify library location."
|
||||
)
|
||||
else(LAPACK_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with LAPACK95 API not found. Please specify library location."
|
||||
)
|
||||
endif(LAPACK_FIND_REQUIRED)
|
||||
endif(LAPACK95_FOUND)
|
||||
endif(NOT LAPACK_FIND_QUIETLY)
|
||||
set(LAPACK_FOUND "${LAPACK95_FOUND}")
|
||||
set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
|
||||
else(BLA_F95)
|
||||
if(LAPACK_LIBRARIES)
|
||||
set(LAPACK_FOUND TRUE)
|
||||
else(LAPACK_LIBRARIES)
|
||||
set(LAPACK_FOUND FALSE)
|
||||
endif(LAPACK_LIBRARIES)
|
||||
|
||||
if(NOT LAPACK_FIND_QUIETLY)
|
||||
if(LAPACK_FOUND)
|
||||
message(STATUS "A library with LAPACK API found.")
|
||||
else(LAPACK_FOUND)
|
||||
if(LAPACK_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with LAPACK API not found. Please specify library location."
|
||||
)
|
||||
else(LAPACK_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with LAPACK API not found. Please specify library location."
|
||||
)
|
||||
endif(LAPACK_FIND_REQUIRED)
|
||||
endif(LAPACK_FOUND)
|
||||
endif(NOT LAPACK_FIND_QUIETLY)
|
||||
endif(BLA_F95)
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
@ -1,44 +0,0 @@
|
||||
# -*- 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:
|
||||
|
||||
# this avoids an annoying deprecation warning on DUNE 2.4 (which we
|
||||
# are not interested in anyway)
|
||||
set(DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING 1)
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (ewoms_CONFIG_VAR
|
||||
HAVE_QUAD
|
||||
HAVE_VALGRIND
|
||||
HAVE_DUNE_COMMON
|
||||
HAVE_DUNE_GEOMETRY
|
||||
HAVE_DUNE_GRID
|
||||
HAVE_DUNE_LOCALFUNCTIONS
|
||||
HAVE_DUNE_ISTL
|
||||
HAVE_DUNE_ALUGRID
|
||||
HAVE_DUNE_FEM
|
||||
DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (ewoms_DEPS
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# DUNE prerequisites
|
||||
"dune-common REQUIRED"
|
||||
"dune-geometry REQUIRED"
|
||||
"dune-grid REQUIRED"
|
||||
"dune-istl REQUIRED"
|
||||
"opm-common REQUIRED"
|
||||
"opm-material REQUIRED"
|
||||
"dune-localfunctions"
|
||||
"dune-alugrid"
|
||||
"dune-fem"
|
||||
"opm-parser"
|
||||
"opm-grid"
|
||||
# librt (on some systems necessary for clock_gettime())
|
||||
"librt REQUIRED"
|
||||
# valgrind client requests
|
||||
"Valgrind"
|
||||
# quadruple precision floating point calculations
|
||||
"Quadmath"
|
||||
)
|
@ -1,19 +0,0 @@
|
||||
# -*- 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-benchmarks_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-benchmarks_DEPS
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# OPM dependency
|
||||
"opm-common"
|
||||
"opm-core REQUIRED"
|
||||
"opm-upscaling REQUIRED"
|
||||
)
|
@ -1,17 +0,0 @@
|
||||
# -*- 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-common_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-common_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS system unit_test_framework REQUIRED"
|
||||
)
|
@ -1,46 +0,0 @@
|
||||
# -*- 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-core_CONFIG_VAR
|
||||
HAVE_ERT
|
||||
HAVE_SUITESPARSE_UMFPACK_H
|
||||
HAVE_DUNE_ISTL
|
||||
HAVE_MPI
|
||||
HAVE_PETSC
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-core_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# matrix library
|
||||
"BLAS REQUIRED"
|
||||
"LAPACK REQUIRED"
|
||||
# Tim Davis' SuiteSparse archive
|
||||
"SuiteSparse COMPONENTS umfpack"
|
||||
# solver
|
||||
"SuperLU"
|
||||
# xml processing (for config parsing)
|
||||
"TinyXML"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT REQUIRED"
|
||||
# Look for MPI support
|
||||
"MPI"
|
||||
# PETSc numerical backend
|
||||
"PETSc"
|
||||
# DUNE dependency
|
||||
"dune-common"
|
||||
"dune-istl"
|
||||
"opm-common REQUIRED"
|
||||
# Parser library for ECL-type simulation models
|
||||
"opm-parser REQUIRED"
|
||||
# the code which implements the material laws
|
||||
"opm-material REQUIRED"
|
||||
"opm-output REQUIRED"
|
||||
)
|
@ -1,21 +0,0 @@
|
||||
# -*- 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-applications_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-flowdiagnostics-applications_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
"Boost 1.44.0
|
||||
COMPONENTS filesystem system unit_test_framework REQUIRED"
|
||||
"ERT REQUIRED"
|
||||
# prerequisite OPM modules
|
||||
"opm-common REQUIRED;
|
||||
opm-flowdiagnostics REQUIRED;
|
||||
opm-core REQUIRED"
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
# -*- 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"
|
||||
)
|
@ -1,32 +0,0 @@
|
||||
# -*- 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-grid_CONFIG_VAR
|
||||
DUNE_GRID_VERSION_MAJOR
|
||||
DUNE_GRID_VERSION_MINOR
|
||||
DUNE_GRID_VERSION_REVISION
|
||||
DUNE_COMMON_VERSION_MAJOR
|
||||
DUNE_COMMON_VERSION_MINOR
|
||||
DUNE_COMMON_VERSION_REVISION
|
||||
HAVE_ZOLTAN
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-grid_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# DUNE dependency
|
||||
"dune-common REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
dune-geometry REQUIRED"
|
||||
# OPM dependency
|
||||
"opm-common REQUIRED;
|
||||
opm-core REQUIRED"
|
||||
"ZOLTAN"
|
||||
)
|
@ -1,23 +0,0 @@
|
||||
# -*- 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-material_CONFIG_VAR
|
||||
HAVE_MPI
|
||||
HAVE_TYPE_TRAITS
|
||||
HAVE_VALGRIND
|
||||
HAVE_FINAL
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-material_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# prerequisite OPM modules
|
||||
"opm-parser"
|
||||
"opm-common REQUIRED"
|
||||
# DUNE dependency
|
||||
"dune-common REQUIRED"
|
||||
)
|
@ -1,24 +0,0 @@
|
||||
# -*- 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-output_CONFIG_VAR
|
||||
HAVE_ERT
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-output_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS unit_test_framework REQUIRED"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT REQUIRED"
|
||||
# Look for MPI support
|
||||
"opm-common REQUIRED"
|
||||
# Parser library for ECL-type simulation models
|
||||
"opm-parser REQUIRED"
|
||||
)
|
@ -1,31 +0,0 @@
|
||||
# -*- 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-simulators_CONFIG_VAR
|
||||
HAVE_OPM_GRID
|
||||
HAVE_PTHREAD
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-simulators_DEPS
|
||||
# Compile with C99 support if available
|
||||
"C99"
|
||||
# Compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# Various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# DUNE prerequisites
|
||||
"dune-common REQUIRED;
|
||||
dune-istl REQUIRED"
|
||||
"ERTPython"
|
||||
# OPM dependency
|
||||
"opm-common REQUIRED;
|
||||
opm-parser REQUIRED;
|
||||
opm-core REQUIRED;
|
||||
opm-output REQUIRED;
|
||||
opm-grid"
|
||||
# Eigen
|
||||
"Eigen3 3.2.0"
|
||||
)
|
@ -1,32 +0,0 @@
|
||||
# -*- 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-upscaling_CONFIG_VAR
|
||||
HAVE_SUPERLU
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-upscaling_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
|
||||
# matrix library
|
||||
"BLAS REQUIRED"
|
||||
"LAPACK REQUIRED"
|
||||
# solver
|
||||
"SuperLU"
|
||||
# DUNE dependency
|
||||
"dune-common REQUIRED;
|
||||
dune-istl REQUIRED;
|
||||
dune-geometry REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
opm-common REQUIRED;
|
||||
opm-core REQUIRED;
|
||||
opm-grid REQUIRED;
|
||||
opm-output REQUIRED"
|
||||
)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user