diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..b23c0bf69 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# 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-material-config.cmake +opm-material-config-version.cmake +opm-material-install.cmake +Makefile +bin/ +lib/ +Doxyfile +Documentation/html +dune.module +*.pc +install_manifest.txt + +# testing framework +CTestTestfile.cmake +DartConfiguration.tcl +Testing/ diff --git a/CMakeCache.txt b/CMakeCache.txt deleted file mode 100644 index 5e25bb4f5..000000000 --- a/CMakeCache.txt +++ /dev/null @@ -1,726 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /home/and/src/opm-material -# It was generated by CMake: /usr/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//Path to a library. -BLAS_Accelerate_LIBRARY:FILEPATH=BLAS_Accelerate_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_acml_LIBRARY:FILEPATH=BLAS_acml_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_acml_mp_LIBRARY:FILEPATH=BLAS_acml_mp_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_blas_LIBRARY:FILEPATH=/usr/lib/libblas.so - -//Path to a library. -BLAS_complib.sgimath_LIBRARY:FILEPATH=BLAS_complib.sgimath_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_cxml_LIBRARY:FILEPATH=BLAS_cxml_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_dxml_LIBRARY:FILEPATH=BLAS_dxml_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_essl_LIBRARY:FILEPATH=BLAS_essl_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_f77blas_LIBRARY:FILEPATH=BLAS_f77blas_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_goto2_LIBRARY:FILEPATH=BLAS_goto2_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_scsl_LIBRARY:FILEPATH=BLAS_scsl_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_sgemm_LIBRARY:FILEPATH=BLAS_sgemm_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_sunperf_LIBRARY:FILEPATH=BLAS_sunperf_LIBRARY-NOTFOUND - -//Path to a library. -BLAS_vecLib_LIBRARY:FILEPATH=BLAS_vecLib_LIBRARY-NOTFOUND - -//Build the testing tree. -BUILD_TESTING:BOOL=ON - -//Path to a program. -BZRCOMMAND:FILEPATH=BZRCOMMAND-NOTFOUND - -//Path to a program. -CMAKE_AR:FILEPATH=/usr/bin/ar - -//No help, variable specified on the command line. -CMAKE_BINARY_DIR:UNINITIALIZED=/home/and/build/opm-material - -//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or -// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. -CMAKE_BUILD_TYPE:STRING= - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler. -CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ - -//Flags used by the compiler during all build types. -CMAKE_CXX_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release minsize builds. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds (/MD /Ob1 /Oi -// /Ot /Oy /Gs will produce slightly less optimized but smaller -// files). -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during Release with Debug Info builds. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//C compiler. -CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc - -//Flags used by the compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release minsize builds. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds (/MD /Ob1 /Oi -// /Ot /Oy /Gs will produce slightly less optimized but smaller -// files). -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during Release with Debug Info builds. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//Flags used by the linker. -CMAKE_EXE_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF - -//Read-only arch.-indep. data root -CMAKE_INSTALL_DATAROOTDIR:STRING=share - -//Documentation root -CMAKE_INSTALL_DOCDIR:STRING=share/doc/opm-material - -//Object code libraries -CMAKE_INSTALL_LIBDIR:PATH=lib/x86_64-linux-gnu - -//Architecture-independent library files -CMAKE_INSTALL_LIBDIR_NOARCH:PATH=lib - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/usr/local - -//Path to a program. -CMAKE_LINKER:FILEPATH=/usr/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make - -//Flags used by the linker during the creation of modules. -CMAKE_MODULE_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/usr/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=opm-material - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib - -//Flags used by the linker during the creation of dll's. -CMAKE_SHARED_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Path to a program. -CMAKE_STRIP:FILEPATH=/usr/bin/strip - -//If true, cmake will use relative paths in makefiles and projects. -CMAKE_USE_RELATIVE_PATHS:BOOL=OFF - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Path to the coverage program that CTest uses for performing coverage -// inspection -COVERAGE_COMMAND:FILEPATH=/usr/bin/gcov - -//Extra command line flags to pass to the coverage tool -COVERAGE_EXTRA_FLAGS:STRING=-l - -//How many times to retry timed-out CTest submissions. -CTEST_SUBMIT_RETRY_COUNT:STRING=3 - -//How long to wait between timed-out CTest submissions. -CTEST_SUBMIT_RETRY_DELAY:STRING=5 - -//Path to a program. -CVSCOMMAND:FILEPATH=/usr/bin/cvs - -//Options passed to the cvs update command. -CVS_UPDATE_OPTIONS:STRING=-d -A -P - -//Maximum time allowed before CTest will kill the test. -DART_TESTING_TIMEOUT:STRING=1500 - -//GDB debug file directory -DEBUG_FILE_DIRECTORY:STRING=/usr/lib/debug - -//Graphviz Dot tool for using Doxygen -DOXYGEN_DOT_EXECUTABLE:FILEPATH=/usr/bin/dot - -DOXYGEN_DOT_PATH:FILEPATH=/usr/bin - -//Doxygen documentation generation tool (http://www.doxygen.org) -DOXYGEN_EXECUTABLE:FILEPATH=/usr/bin/doxygen - -//Path to a program. -GITCOMMAND:FILEPATH=/usr/bin/git - -//git command line client -GIT_EXECUTABLE:FILEPATH=/usr/bin/git - -//Path to a program. -HGCOMMAND:FILEPATH=HGCOMMAND-NOTFOUND - -//Path to a library. -LAPACK_Accelerate_LIBRARY:FILEPATH=LAPACK_Accelerate_LIBRARY-NOTFOUND - -//Path to a library. -LAPACK_goto2_LIBRARY:FILEPATH=LAPACK_goto2_LIBRARY-NOTFOUND - -//Path to a library. -LAPACK_lapack_LIBRARY:FILEPATH=/usr/lib/liblapack.so - -//Path to a library. -LAPACK_vecLib_LIBRARY:FILEPATH=LAPACK_vecLib_LIBRARY-NOTFOUND - -//Command to build the project -MAKECOMMAND:STRING=/usr/bin/make -i - -//Path to the memory checking command, used for memory error detection. -MEMORYCHECK_COMMAND:FILEPATH=/usr/bin/valgrind - -//File that contains suppressions for the memory checker -MEMORYCHECK_SUPPRESSIONS_FILE:FILEPATH= - -//Path to a program. -OBJCOPY:FILEPATH=/usr/bin/objcopy - -//The directory containing a CMake configuration file for OPM_MATERIAL_DEPENDS_LIST. -OPM_MATERIAL_DEPENDS_LIST_DIR:PATH=OPM_MATERIAL_DEPENDS_LIST_DIR-NOTFOUND - -//pkg-config executable -PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config - -//Precompile common headers for speed. -PRECOMPILE_HEADERS:BOOL=OFF - -//Path to scp command, used by CTest for submitting results to -// a Dart server -SCPCOMMAND:FILEPATH=/usr/bin/scp - -//Name of the computer/site where compile is being run -SITE:STRING=singularius - -//Path to the SLURM sbatch executable -SLURM_SBATCH_COMMAND:FILEPATH=SLURM_SBATCH_COMMAND-NOTFOUND - -//Path to the SLURM srun executable -SLURM_SRUN_COMMAND:FILEPATH=SLURM_SRUN_COMMAND-NOTFOUND - -//Path to a file. -SUPERLU_INCLUDE_DIR:PATH=SUPERLU_INCLUDE_DIR-NOTFOUND - -//Path to a library. -SUPERLU_LIBRARY:FILEPATH=SUPERLU_LIBRARY-NOTFOUND - -//Human readable string containing SuperLU version information. -SUPERLU_WITH_VERSION:STRING=SuperLU <= 4.2, post 2005 - -//Path to a program. -SVNCOMMAND:FILEPATH=/usr/bin/svn - -//Put .debug files in GDB debug file directory -SYSTEM_DEBUG:BOOL=OFF - -//Use native instruction set -WITH_NATIVE:BOOL=ON - -//Path to a file. -dune-common_INCLUDE_DIR:PATH=/usr/include - -//Path to a library. -dune-common_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libdunecommon.so - -//Path to a file. -dune-istl_INCLUDE_DIR:PATH=/usr/include - -//Location of libtool -libtool_MAIN:FILEPATH=/usr/share/libtool/config/ltmain.sh - -//Value Computed by CMake -opm-material_BINARY_DIR:STATIC=/home/and/src/opm-material - -//Value Computed by CMake -opm-material_SOURCE_DIR:STATIC=/home/and/src/opm-material - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: BLAS_Accelerate_LIBRARY -BLAS_Accelerate_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_acml_LIBRARY -BLAS_acml_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_acml_mp_LIBRARY -BLAS_acml_mp_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_blas_LIBRARY -BLAS_blas_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_blas_WORKS -BLAS_blas_WORKS-ADVANCED:INTERNAL=1 -//Have function sgemm_ -BLAS_blas_WORKS:INTERNAL=1 -//ADVANCED property for variable: BLAS_complib.sgimath_LIBRARY -BLAS_complib.sgimath_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_cxml_LIBRARY -BLAS_cxml_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_dxml_LIBRARY -BLAS_dxml_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_essl_LIBRARY -BLAS_essl_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_f77blas_LIBRARY -BLAS_f77blas_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_goto2_LIBRARY -BLAS_goto2_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_scsl_LIBRARY -BLAS_scsl_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_sgemm_LIBRARY -BLAS_sgemm_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_sunperf_LIBRARY -BLAS_sunperf_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BLAS_vecLib_LIBRARY -BLAS_vecLib_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: BZRCOMMAND -BZRCOMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_BUILD_TOOL -CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1 -//What is the target build tool cmake is generating for. -CMAKE_BUILD_TOOL:INTERNAL=/usr/bin/make -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/home/and/src/opm-material -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=8 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=10 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack -//ADVANCED property for variable: CMAKE_CTEST_COMMAND -CMAKE_CTEST_COMMAND-ADVANCED:INTERNAL=1 -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Path to cache edit program executable. -CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Have symbol pthread_create -CMAKE_HAVE_LIBC_CREATE:INTERNAL= -//Have library pthreads -CMAKE_HAVE_PTHREADS_CREATE:INTERNAL= -//Have library pthread -CMAKE_HAVE_PTHREAD_CREATE:INTERNAL=1 -//Have include pthread.h -CMAKE_HAVE_PTHREAD_H:INTERNAL=1 -//Start directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/home/and/src/opm-material -//ADVANCED property for variable: CMAKE_INSTALL_LIBDIR -CMAKE_INSTALL_LIBDIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_INSTALL_LIBDIR_NOARCH -CMAKE_INSTALL_LIBDIR_NOARCH-ADVANCED:INTERNAL=1 -//Install .so files without execute permission. -CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/share/cmake-2.8 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//Suppress Warnings that are meant for the author of the CMakeLists.txt -// files. -CMAKE_SUPPRESS_DEVELOPER_WARNINGS:INTERNAL=FALSE -//uname command -CMAKE_UNAME:INTERNAL=/bin/uname -//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS -CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: COVERAGE_COMMAND -COVERAGE_COMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: COVERAGE_EXTRA_FLAGS -COVERAGE_EXTRA_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CTEST_SUBMIT_RETRY_COUNT -CTEST_SUBMIT_RETRY_COUNT-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CTEST_SUBMIT_RETRY_DELAY -CTEST_SUBMIT_RETRY_DELAY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CVSCOMMAND -CVSCOMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CVS_UPDATE_OPTIONS -CVS_UPDATE_OPTIONS-ADVANCED:INTERNAL=1 -//Result of TRY_COMPILE -CXX_FLAG_CXX11:INTERNAL=TRUE -//ADVANCED property for variable: DART_TESTING_TIMEOUT -DART_TESTING_TIMEOUT-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: DEBUG_FILE_DIRECTORY -DEBUG_FILE_DIRECTORY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: DOXYGEN_DOT_EXECUTABLE -DOXYGEN_DOT_EXECUTABLE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: DOXYGEN_DOT_PATH -DOXYGEN_DOT_PATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: DOXYGEN_EXECUTABLE -DOXYGEN_EXECUTABLE-ADVANCED:INTERNAL=1 -//Details about finding C99 -FIND_PACKAGE_MESSAGE_DETAILS_C99:INTERNAL=[-std=c99][v()] -//Details about finding Doxygen -FIND_PACKAGE_MESSAGE_DETAILS_Doxygen:INTERNAL=[/usr/bin/doxygen][v1.8.3.1()] -//Details about finding Git -FIND_PACKAGE_MESSAGE_DETAILS_Git:INTERNAL=[/usr/bin/git][v1.8.1.2()] -//Details about finding PkgConfig -FIND_PACKAGE_MESSAGE_DETAILS_PkgConfig:INTERNAL=[/usr/bin/pkg-config][v0.26()] -//Details about finding Threads -FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()] -//Details about finding dune-common -FIND_PACKAGE_MESSAGE_DETAILS_dune-common:INTERNAL=[/usr/include][/usr/lib/x86_64-linux-gnu/libdunecommon.so][1][v()] -//Details about finding dune-istl -FIND_PACKAGE_MESSAGE_DETAILS_dune-istl:INTERNAL=[/usr/include][1][v()] -//ADVANCED property for variable: GITCOMMAND -GITCOMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: GIT_EXECUTABLE -GIT_EXECUTABLE-ADVANCED:INTERNAL=1 -//Test HAS_ATTRIBUTE_DEPRECATED -HAS_ATTRIBUTE_DEPRECATED:INTERNAL=1 -//Test HAS_ATTRIBUTE_DEPRECATED_MSG -HAS_ATTRIBUTE_DEPRECATED_MSG:INTERNAL=1 -//Test HAS_ATTRIBUTE_UNUSED -HAS_ATTRIBUTE_UNUSED:INTERNAL=1 -//Test HAVE_ARRAY -HAVE_ARRAY:INTERNAL=1 -//Test HAVE_ATTRIBUTE_ALWAYS_INLINE -HAVE_ATTRIBUTE_ALWAYS_INLINE:INTERNAL=1 -//Test HAVE_C99 -HAVE_C99:INTERNAL=1 -//Test HAVE_CONSTEXPR -HAVE_CONSTEXPR:INTERNAL=1 -//Test HAVE_DUNE_COMMON -HAVE_DUNE_COMMON:INTERNAL=1 -//Test HAVE_DUNE_ISTL -HAVE_DUNE_ISTL:INTERNAL=1 -//Test HAVE_INTEGRAL_CONSTANT -HAVE_INTEGRAL_CONSTANT:INTERNAL=1 -//Result of TRY_COMPILE -HAVE_LINK_OPTS:INTERNAL=TRUE -//Test HAVE_MEM_USAGE_T_EXPANSIONS -HAVE_MEM_USAGE_T_EXPANSIONS:INTERNAL= -//Result of TRY_COMPILE -HAVE_MTUNE:INTERNAL=TRUE -//Test HAVE_NULLPTR -HAVE_NULLPTR:INTERNAL=1 -//Test HAVE_RVALUE_REFERENCES -HAVE_RVALUE_REFERENCES:INTERNAL=1 -//Test HAVE_STATIC_ASSERT -HAVE_STATIC_ASSERT:INTERNAL=1 -//Have include tr1/tuple -HAVE_TR1_TUPLE:INTERNAL=1 -//Have include tr1/type_traits -HAVE_TR1_TYPE_TRAITS:INTERNAL=1 -//Have include tuple -HAVE_TUPLE:INTERNAL=1 -//Have include type_traits -HAVE_TYPE_TRAITS:INTERNAL=1 -//Test HAVE_VARIADIC_CONSTRUCTOR_SFINAE -HAVE_VARIADIC_CONSTRUCTOR_SFINAE:INTERNAL=1 -//Test HAVE_VARIADIC_TEMPLATES -HAVE_VARIADIC_TEMPLATES:INTERNAL=1 -//ADVANCED property for variable: HGCOMMAND -HGCOMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: LAPACK_Accelerate_LIBRARY -LAPACK_Accelerate_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: LAPACK_goto2_LIBRARY -LAPACK_goto2_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: LAPACK_lapack_LIBRARY -LAPACK_lapack_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: LAPACK_lapack_WORKS -LAPACK_lapack_WORKS-ADVANCED:INTERNAL=1 -//Have function cheev_ -LAPACK_lapack_WORKS:INTERNAL=1 -//ADVANCED property for variable: LAPACK_vecLib_LIBRARY -LAPACK_vecLib_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: MAKECOMMAND -MAKECOMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: MEMORYCHECK_COMMAND -MEMORYCHECK_COMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: MEMORYCHECK_SUPPRESSIONS_FILE -MEMORYCHECK_SUPPRESSIONS_FILE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: OBJCOPY -OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE -PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: PRECOMPILE_HEADERS -PRECOMPILE_HEADERS-ADVANCED:INTERNAL=1 -PkgConf_dune-common_CFLAGS:INTERNAL= -PkgConf_dune-common_CFLAGS_I:INTERNAL= -PkgConf_dune-common_CFLAGS_OTHER:INTERNAL= -PkgConf_dune-common_FOUND:INTERNAL=1 -PkgConf_dune-common_INCLUDEDIR:INTERNAL=/usr/include -PkgConf_dune-common_INCLUDE_DIRS:INTERNAL= -PkgConf_dune-common_LDFLAGS:INTERNAL=-ldunecommon -PkgConf_dune-common_LDFLAGS_OTHER:INTERNAL= -PkgConf_dune-common_LIBDIR:INTERNAL=/usr/lib/x86_64-linux-gnu -PkgConf_dune-common_LIBRARIES:INTERNAL=dunecommon -PkgConf_dune-common_LIBRARY_DIRS:INTERNAL= -PkgConf_dune-common_LIBS:INTERNAL= -PkgConf_dune-common_LIBS_L:INTERNAL= -PkgConf_dune-common_LIBS_OTHER:INTERNAL= -PkgConf_dune-common_LIBS_PATHS:INTERNAL= -PkgConf_dune-common_PREFIX:INTERNAL=/usr -PkgConf_dune-common_STATIC_CFLAGS:INTERNAL= -PkgConf_dune-common_STATIC_CFLAGS_I:INTERNAL= -PkgConf_dune-common_STATIC_CFLAGS_OTHER:INTERNAL= -PkgConf_dune-common_STATIC_INCLUDE_DIRS:INTERNAL= -PkgConf_dune-common_STATIC_LDFLAGS:INTERNAL=-ldunecommon -PkgConf_dune-common_STATIC_LDFLAGS_OTHER:INTERNAL= -PkgConf_dune-common_STATIC_LIBDIR:INTERNAL= -PkgConf_dune-common_STATIC_LIBRARIES:INTERNAL=dunecommon -PkgConf_dune-common_STATIC_LIBRARY_DIRS:INTERNAL= -PkgConf_dune-common_STATIC_LIBS:INTERNAL= -PkgConf_dune-common_STATIC_LIBS_L:INTERNAL= -PkgConf_dune-common_STATIC_LIBS_OTHER:INTERNAL= -PkgConf_dune-common_STATIC_LIBS_PATHS:INTERNAL= -PkgConf_dune-common_VERSION:INTERNAL=2.2.0 -PkgConf_dune-common_dune-common_INCLUDEDIR:INTERNAL= -PkgConf_dune-common_dune-common_LIBDIR:INTERNAL= -PkgConf_dune-common_dune-common_PREFIX:INTERNAL= -PkgConf_dune-common_dune-common_VERSION:INTERNAL= -PkgConf_dune-istl_CFLAGS:INTERNAL= -PkgConf_dune-istl_CFLAGS_I:INTERNAL= -PkgConf_dune-istl_CFLAGS_OTHER:INTERNAL= -PkgConf_dune-istl_FOUND:INTERNAL=1 -PkgConf_dune-istl_INCLUDEDIR:INTERNAL=/usr/include -PkgConf_dune-istl_INCLUDE_DIRS:INTERNAL= -PkgConf_dune-istl_LDFLAGS:INTERNAL=-ldunecommon -PkgConf_dune-istl_LDFLAGS_OTHER:INTERNAL= -PkgConf_dune-istl_LIBDIR:INTERNAL=/usr/lib -PkgConf_dune-istl_LIBRARIES:INTERNAL=dunecommon -PkgConf_dune-istl_LIBRARY_DIRS:INTERNAL= -PkgConf_dune-istl_LIBS:INTERNAL= -PkgConf_dune-istl_LIBS_L:INTERNAL= -PkgConf_dune-istl_LIBS_OTHER:INTERNAL= -PkgConf_dune-istl_LIBS_PATHS:INTERNAL= -PkgConf_dune-istl_PREFIX:INTERNAL=/usr -PkgConf_dune-istl_STATIC_CFLAGS:INTERNAL= -PkgConf_dune-istl_STATIC_CFLAGS_I:INTERNAL= -PkgConf_dune-istl_STATIC_CFLAGS_OTHER:INTERNAL= -PkgConf_dune-istl_STATIC_INCLUDE_DIRS:INTERNAL= -PkgConf_dune-istl_STATIC_LDFLAGS:INTERNAL=-ldunecommon -PkgConf_dune-istl_STATIC_LDFLAGS_OTHER:INTERNAL= -PkgConf_dune-istl_STATIC_LIBDIR:INTERNAL= -PkgConf_dune-istl_STATIC_LIBRARIES:INTERNAL=dunecommon -PkgConf_dune-istl_STATIC_LIBRARY_DIRS:INTERNAL= -PkgConf_dune-istl_STATIC_LIBS:INTERNAL= -PkgConf_dune-istl_STATIC_LIBS_L:INTERNAL= -PkgConf_dune-istl_STATIC_LIBS_OTHER:INTERNAL= -PkgConf_dune-istl_STATIC_LIBS_PATHS:INTERNAL= -PkgConf_dune-istl_VERSION:INTERNAL=2.2.0 -PkgConf_dune-istl_dune-istl_INCLUDEDIR:INTERNAL= -PkgConf_dune-istl_dune-istl_LIBDIR:INTERNAL= -PkgConf_dune-istl_dune-istl_PREFIX:INTERNAL= -PkgConf_dune-istl_dune-istl_VERSION:INTERNAL= -//ADVANCED property for variable: SCPCOMMAND -SCPCOMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: SITE -SITE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: SLURM_SBATCH_COMMAND -SLURM_SBATCH_COMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: SLURM_SRUN_COMMAND -SLURM_SRUN_COMMAND-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: SUPERLU_INCLUDE_DIR -SUPERLU_INCLUDE_DIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: SUPERLU_LIBRARY -SUPERLU_LIBRARY-ADVANCED:INTERNAL=1 -//Test SUPERLU_MIN_VERSION_4_3 -SUPERLU_MIN_VERSION_4_3:INTERNAL= -//Test SUPERLU_POST_2005_VERSION -SUPERLU_POST_2005_VERSION:INTERNAL= -//ADVANCED property for variable: SVNCOMMAND -SVNCOMMAND-ADVANCED:INTERNAL=1 -__pkg_config_checked_PkgConf_dune-common:INTERNAL=1 -__pkg_config_checked_PkgConf_dune-istl:INTERNAL=1 -//ADVANCED property for variable: dune-common_INCLUDE_DIR -dune-common_INCLUDE_DIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: dune-common_LIBRARY -dune-common_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: dune-istl_INCLUDE_DIR -dune-istl_INCLUDE_DIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: libtool_MAIN -libtool_MAIN-ADVANCED:INTERNAL=1 - diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 51fe06d91..ac3b6102f 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -53,5 +53,5 @@ list (APPEND PROGRAM_SOURCE_FILES) # for OPM-material we do not list all headers explicitly. instead we # glob through the source tree... -file(GLOB_RECURSE TMP RELATIVE "${CMAKE_SOURCE_DIR}/opm" "*.hh") +file(GLOB_RECURSE TMP RELATIVE "${CMAKE_SOURCE_DIR}" "opm/*.hh") list (APPEND PUBLIC_HEADER_FILES ${TMP}) diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 000000000..3755a10fe --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,7 @@ +# this is included after opm-core_NAME is set +set(CTEST_PROJECT_NAME "${${project}_NAME}") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "opm-project.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=${${project}_NAME}") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/cmake/Modules/AddOptions.cmake b/cmake/Modules/AddOptions.cmake index a5fb38647..0ebb82366 100644 --- a/cmake/Modules/AddOptions.cmake +++ b/cmake/Modules/AddOptions.cmake @@ -59,3 +59,24 @@ function (add_options langs builds) 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 varname flag regex) + if (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}" + AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}" + AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}") + set (${varname} ${flag} PARENT_SCOPE) + else (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}" + AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}" + AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}") + set (${varname} PARENT_SCOPE) + endif (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}" + AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}" + AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}") +endfunction (set_default_option) + +# note: this must be called before project() +macro (no_default_options) + # prevent the platform probe to set options + set (CMAKE_NOT_USING_CONFIG_FLAGS TRUE) +endmacro (no_default_options) diff --git a/cmake/Modules/DuneCompat.cmake b/cmake/Modules/DuneCompat.cmake index 1b16fbd8a..e371c832f 100644 --- a/cmake/Modules/DuneCompat.cmake +++ b/cmake/Modules/DuneCompat.cmake @@ -23,9 +23,25 @@ if (CMAKE_GENERATOR MATCHES "Unix Makefiles") endif (CMAKE_GENERATOR MATCHES "Unix Makefiles") # dunecontrol refuses to use a build tree as module directory unless -# there is a dune.module in it -if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) +# 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 PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) +endif (_not_substring) diff --git a/cmake/Modules/Duplicates.cmake b/cmake/Modules/Duplicates.cmake index d277e322d..6b48f3574 100644 --- a/cmake/Modules/Duplicates.cmake +++ b/cmake/Modules/Duplicates.cmake @@ -22,23 +22,17 @@ 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_headers module) - if (DEFINED ${module}_INCLUDE_DIRS) - list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS) - endif (DEFINED ${module}_INCLUDE_DIRS) -endmacro (remove_duplicate_headers module) - -# linker flags may not be specified at all -macro (remove_duplicate_flags module) - if (DEFINED ${module}_LINKER_FLAGS) - list (REMOVE_DUPLICATES ${module}_LINKER_FLAGS) - endif (DEFINED ${module}_LINKER_FLAGS) -endmacro (remove_duplicate_flags module) +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_headers (${module}) + remove_duplicate_var (${module} INCLUDE_DIRS) + remove_duplicate_var (${module} LINKER_FLAGS) + remove_duplicate_var (${module} CONFIG_VARS) remove_duplicate_libraries (${module}) - remove_duplicate_flags (${module}) endmacro (remove_dup_deps module) diff --git a/cmake/Modules/FindAGMG.cmake b/cmake/Modules/FindAGMG.cmake index 5c16c8a2a..0c865006e 100644 --- a/cmake/Modules/FindAGMG.cmake +++ b/cmake/Modules/FindAGMG.cmake @@ -30,9 +30,9 @@ endif (AGMG_SOURCES) # set value for config.h if (AGMG_SOURCES) - set (HAVE_AGMG 1) + set (HAVE_AGMG 1 CACHE INT "Is AGMG present?") else (AGMG_SOURCES) - set (HAVE_AGMG 0) + set (HAVE_AGMG "" CACHE INT "Is AGMG present?") endif (AGMG_SOURCES) # handle REQUIRED and QUIET standard options diff --git a/cmake/Modules/FindERT.cmake b/cmake/Modules/FindERT.cmake index 9aec353b8..87bf3e769 100644 --- a/cmake/Modules/FindERT.cmake +++ b/cmake/Modules/FindERT.cmake @@ -20,6 +20,14 @@ 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 @@ -28,6 +36,7 @@ find_path (ERT_ECL_INCLUDE_DIR PATHS "../ert" PATH_SUFFIXES "devel/libecl/include/" "include" DOC "Path to ERT Eclipse library header files" + ${_no_default_path} ) find_path (ERT_UTIL_INCLUDE_DIR NAMES "ert/util/stringlist.h" @@ -35,6 +44,7 @@ find_path (ERT_UTIL_INCLUDE_DIR PATHS "../ert" PATH_SUFFIXES "devel/libert_util/include/" "include" DOC "Path to ERT Eclipse library header files" + ${_no_default_path} ) find_path (ERT_GEN_INCLUDE_DIR NAMES "ert/util/int_vector.h" @@ -43,32 +53,39 @@ find_path (ERT_GEN_INCLUDE_DIR "${PROJECT_BINARY_DIR}/../ert/devel" PATH_SUFFIXES "libert_util/include/" "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_BINARY_DIR}/../ert-build" "${PROJECT_BINARY_DIR}/../ert/devel" - PATH_SUFFIXES "lib" "lib64" "lib32" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + PATH_SUFFIXES "lib" "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_BINARY_DIR}/../ert-build" "${PROJECT_BINARY_DIR}/../ert/devel" - PATH_SUFFIXES "lib" "lib64" "lib32" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + PATH_SUFFIXES "lib" "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_BINARY_DIR}/../ert-build" "${PROJECT_BINARY_DIR}/../ert/devel" - PATH_SUFFIXES "lib" "lib64" "lib32" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + PATH_SUFFIXES "lib" "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 diff --git a/cmake/Modules/FindSuiteSparse.cmake b/cmake/Modules/FindSuiteSparse.cmake index fb7a4f7ba..118942180 100644 --- a/cmake/Modules/FindSuiteSparse.cmake +++ b/cmake/Modules/FindSuiteSparse.cmake @@ -67,29 +67,40 @@ endif (NOT BLAS_FOUND) if (NOT LAPACK_FOUND) find_package (LAPACK ${SuiteSparse_QUIET} REQUIRED) endif (NOT LAPACK_FOUND) -set (SuiteSparse_EXTRA_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) + +# 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}) # search paths for the library outside of standard system paths. these are the # paths in which the package managers on various distros put the files list (APPEND SuiteSparse_SEARCH_PATH "/usr") # Linux list (APPEND SuiteSparse_SEARCH_PATH "/opt/local") # MacOS X +# if we don't get any further clues about where to look, then start +# roaming around the system +set (_no_default_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}") + set (_no_default_path "NO_DEFAULT_PATH") endif (NOT $ENV{SuiteSparse_DIR} STREQUAL "") if (${SuiteSparse_DIR}) set (SuiteSparse_SEARCH_PATH "${SuiteSparse_DIR}") + set (_no_default_path "NO_DEFAULT_PATH") 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}") + set (_no_default_path "NO_DEFAULT_PATH") endif (NOT $ENV{SuiteSparse_ROOT} STREQUAL "") if (${SuiteSparse_ROOT}) set (SuiteSparse_SEARCH_PATH "${SuiteSparse_ROOT}") + set (_no_default_path "NO_DEFAULT_PATH") endif (${SuiteSparse_ROOT}) # transitive closure of dependencies; after this SuiteSparse_MODULES is the @@ -120,13 +131,19 @@ 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 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 suitesparseconfig PATHS ${SuiteSparse_SEARCH_PATH} - PATH_SUFFIXES ".libs" "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" + 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}) @@ -145,11 +162,13 @@ foreach (module IN LISTS SuiteSparse_MODULES) NAMES ${module}.h PATHS ${SuiteSparse_SEARCH_PATH} PATH_SUFFIXES "include" "include/suitesparse" "include/ufsparse" + ${_no_default_path} ) find_library (${MODULE}_LIBRARY NAMES ${module} PATHS ${SuiteSparse_SEARCH_PATH} - PATH_SUFFIXES "lib/.libs" "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" + PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" + ${_no_default_path} ) # start out by including the module itself; other dependencies will be added later set (${MODULE}_INCLUDE_DIRS ${${MODULE}_INCLUDE_DIR}) @@ -178,21 +197,26 @@ if (UMFPACK_LIBRARY) if (HAVE_UMFPACK_WITHOUT_CHOLMOD) list (APPEND UMFPACK_EXTRA_LIBS ${AMD_LIBRARIES}) else (HAVE_UMFPACK_WITHOUT_CHOLMOD) - 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) + 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 (HAVE_UMFPACK_WITH_CHOLMOD) + endif (CHOLMOD_LIBRARIES) endif (HAVE_UMFPACK_WITHOUT_CHOLMOD) # test if umfpack is underlinked (CentOS 5.9), i.e. doesn't specify # that it depends on amd. in that case, force amd to be linked - if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) + if (UMFPACK_EXTRA_LIBS AND (CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) try_compile_umfpack (HAVE_UMFPACK_NOT_UNDERLINKED "-Wl,--as-needed" ${UMFPACK_EXTRA_LIBS}) if (NOT HAVE_UMFPACK_NOT_UNDERLINKED) list (APPEND UMFPACK_LINKER_FLAGS "-Wl,--no-as-needed") endif (NOT HAVE_UMFPACK_NOT_UNDERLINKED) - endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) + endif (UMFPACK_EXTRA_LIBS AND (CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC) list (APPEND UMFPACK_LIBRARIES ${UMFPACK_EXTRA_LIBS}) list (REVERSE UMFPACK_LIBRARIES) list (REMOVE_DUPLICATES UMFPACK_LIBRARIES) @@ -218,7 +242,9 @@ foreach (module IN LISTS SuiteSparse_FIND_COMPONENTS) endforeach (file) if (NOT SuiteSparse_${MODULE}_FOUND) set (SuiteSparse_FOUND FALSE) - set (HAVE_SUITESPARSE_${MODULE}_H 0 CACHE INT "Is ${module} header present?") + # 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}") diff --git a/cmake/Modules/FindSUPERLU.cmake b/cmake/Modules/FindSuperLU.cmake similarity index 87% rename from cmake/Modules/FindSUPERLU.cmake rename to cmake/Modules/FindSuperLU.cmake index 4b8abe498..eb647dd29 100644 --- a/cmake/Modules/FindSUPERLU.cmake +++ b/cmake/Modules/FindSuperLU.cmake @@ -35,32 +35,33 @@ if(NOT BLAS_FOUND) return() endif(NOT BLAS_FOUND) -# look for header files, only at positions given by the user +# look for files only at the positions given by the user if +# an explicit path is specified +if (SUPERLU_PREFIX OR SUPERLU_ROOT) + set (_no_default_path "NO_DEFAULT_PATH") +else (SUPERLU_PREFIX OR SUPERLU_ROOT) + set (_no_default_path "") +endif (SUPERLU_PREFIX OR SUPERLU_ROOT) + +# look for header files find_path(SUPERLU_INCLUDE_DIR NAMES supermatrix.h PATHS ${SUPERLU_PREFIX} ${SUPERLU_ROOT} PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC" - NO_DEFAULT_PATH + ${_no_default_path} ) -# look for header files, including default paths -find_path(SUPERLU_INCLUDE_DIR - NAMES supermatrix.h - PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC" -) +# only search in architecture-relevant directory +if (CMAKE_SIZEOF_VOID_P) + math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") +endif (CMAKE_SIZEOF_VOID_P) -# look for library, only at positions given by the user +# look for 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_PREFIX} ${SUPERLU_ROOT} - PATH_SUFFIXES "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" - NO_DEFAULT_PATH -) - -# look for library files, including default paths -find_library(SUPERLU_LIBRARY - NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu" - PATH_SUFFIXES "lib" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + ${_no_default_path} ) # check version specific macros @@ -158,5 +159,5 @@ endif(SUPERLU_FOUND) if(SUPERLU_FOUND) set(HAVE_SUPERLU 1) else(SUPERLU_FOUND) - set(HAVE_SUPERLU 0) + set(HAVE_SUPERLU "") endif(SUPERLU_FOUND) diff --git a/cmake/Modules/Finddune-common.cmake b/cmake/Modules/Finddune-common.cmake index 5ba9bc56e..4494d7feb 100644 --- a/cmake/Modules/Finddune-common.cmake +++ b/cmake/Modules/Finddune-common.cmake @@ -16,9 +16,10 @@ find_opm_package ( "dune-common" # dependencies - "CXX11Features REQUIRED; + "CXX11Features; BLAS REQUIRED; - LAPACK REQUIRED + LAPACK REQUIRED; + MPI " # header to search for "dune/common/fvector.hh" diff --git a/cmake/Modules/Finddune-geometry.cmake b/cmake/Modules/Finddune-geometry.cmake index a39865fae..7ab0ce73d 100644 --- a/cmake/Modules/Finddune-geometry.cmake +++ b/cmake/Modules/Finddune-geometry.cmake @@ -19,7 +19,7 @@ find_opm_package ( # 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; + "CXX11Features; dune-common REQUIRED " # header to search for diff --git a/cmake/Modules/Finddune-grid.cmake b/cmake/Modules/Finddune-grid.cmake index 1ee8a0626..6c9e6c68f 100644 --- a/cmake/Modules/Finddune-grid.cmake +++ b/cmake/Modules/Finddune-grid.cmake @@ -19,7 +19,7 @@ find_opm_package ( # 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; + "CXX11Features; dune-common REQUIRED; dune-geometry REQUIRED " @@ -34,12 +34,9 @@ find_opm_package ( # test program "#include -#include int main (void) { - std::vector coords; - Dune::OneDGrid grid(coords); + Dune::OneDGrid grid(1, 0., 1.); return grid.lbegin<0>(0) == grid.lend<0>(0); - return 0; } " # config variables diff --git a/cmake/Modules/Finddune-istl.cmake b/cmake/Modules/Finddune-istl.cmake index d8d1a04c3..14a401047 100644 --- a/cmake/Modules/Finddune-istl.cmake +++ b/cmake/Modules/Finddune-istl.cmake @@ -24,7 +24,7 @@ find_opm_package ( # required dependencies "dune-common ${_require_dune_common}; - SUPERLU + SuperLU " # header to search for "dune/istl/bcrsmatrix.hh" diff --git a/cmake/Modules/Findopm-core.cmake b/cmake/Modules/Findopm-core.cmake index 23a8e6bbe..3703bbd71 100644 --- a/cmake/Modules/Findopm-core.cmake +++ b/cmake/Modules/Findopm-core.cmake @@ -20,11 +20,11 @@ find_opm_package ( "C99; CXX11Features; Boost 1.39.0 - COMPONENTS date_time filesystem system unit_test_framework REQUIRED; + COMPONENTS date_time filesystem system unit_test_framework signals REQUIRED; BLAS REQUIRED; LAPACK REQUIRED; SuiteSparse COMPONENTS umfpack; - SUPERLU; + SuperLU; TinyXML; ERT; dune-istl diff --git a/cmake/Modules/Findopm-material.cmake b/cmake/Modules/Findopm-material.cmake new file mode 100644 index 000000000..d01e97365 --- /dev/null +++ b/cmake/Modules/Findopm-material.cmake @@ -0,0 +1,44 @@ +# - 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 (OpmPackage) +find_opm_package ( + # module name + "opm-material" + + # dependencies + "C99; + CXX11Features + " + # header to search for + "opm/material/constants.hh" + + # library to search for + "" + + # defines to be added to compilations + "" + + # test program +"#include +int main (void) { + double c = Opm::Constants::c; + return 0; +} +" + # config variables + "HAVE_MPI; + HAVE_VALGRIND + ") +include (UseDynamicBoost) +#debug_find_vars ("opm-material") diff --git a/cmake/Modules/Findopm-upscaling.cmake b/cmake/Modules/Findopm-upscaling.cmake index 7f80e4173..5042b1e0e 100644 --- a/cmake/Modules/Findopm-upscaling.cmake +++ b/cmake/Modules/Findopm-upscaling.cmake @@ -21,7 +21,7 @@ find_opm_package ( dune-istl REQUIRED; opm-core REQUIRED; dune-cornerpoint REQUIRED; - opm-porsol REQUIRED; + opm-porsol REQUIRED " # header to search for "opm/upscaling/SinglePhaseUpscaler.hpp" diff --git a/cmake/Modules/LibtoolArchives.cmake b/cmake/Modules/LibtoolArchives.cmake index f8a6a5624..8fbc7935c 100644 --- a/cmake/Modules/LibtoolArchives.cmake +++ b/cmake/Modules/LibtoolArchives.cmake @@ -1,14 +1,7 @@ -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 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 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}") @@ -19,7 +12,7 @@ function (configure_la name target) # (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 dependency_libs) + foreach (deplib IN LISTS ARGN) # starts with a hyphen already? then just add it string (SUBSTRING ${deplib} 0 1 dash) if (${dash} STREQUAL "-") @@ -61,8 +54,30 @@ function (configure_la name target) endif (deplib_orig STREQUAL deplib_name) endif (${dash} STREQUAL "-") endforeach (deplib) - set (dependency_libs ${deplib_list}) + # 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}") diff --git a/cmake/Modules/OpmCompile.cmake b/cmake/Modules/OpmCompile.cmake index 25f93d63a..412c535e2 100644 --- a/cmake/Modules/OpmCompile.cmake +++ b/cmake/Modules/OpmCompile.cmake @@ -4,32 +4,37 @@ macro (opm_compile opm) # some CMake properties do not do list expansion string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}") - # all public header files are together with the source - set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}") - list (APPEND ${opm}_INCLUDE_DIRS "${${opm}_INCLUDE_DIR}") + # 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}") - # create this library + # 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}) - if(${opm}_SOURCES) - # 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}") - - add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES}) - set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}") - set_target_properties (${${opm}_TARGET} PROPERTIES - SOVERSION ${${opm}_VERSION_MAJOR} - VERSION ${${opm}_VERSION} - LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}" - ) - target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES}) - endif() - - # queue this executable to be stripped - strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) + 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}" + ) + target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES}) + # queue this executable to be stripped + strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) + 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) @@ -48,9 +53,9 @@ macro (opm_compile opm) 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) - # we need to know the name of the library which is generated - get_target_property (${opm}_LIBRARY ${${opm}_TARGET} LOCATION) - endif() + get_target_property (${opm}_LIBRARY ${${opm}_TARGET} LOCATION) + endif (${opm}_TARGET) endmacro (opm_compile opm) diff --git a/cmake/Modules/OpmDefaults.cmake b/cmake/Modules/OpmDefaults.cmake index 49c255db5..2e130363f 100644 --- a/cmake/Modules/OpmDefaults.cmake +++ b/cmake/Modules/OpmDefaults.cmake @@ -3,9 +3,9 @@ include (UseCompVer) macro (opm_defaults opm) - # build debug by default + # build release by default if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE "Debug") + 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 diff --git a/cmake/Modules/OpmFiles.cmake b/cmake/Modules/OpmFiles.cmake index 40460c842..eda2598f4 100644 --- a/cmake/Modules/OpmFiles.cmake +++ b/cmake/Modules/OpmFiles.cmake @@ -32,6 +32,7 @@ macro (opm_sources opm) set (TEST_SOURCE_FILES) set (TEST_DATA_FILES) set (PUBLIC_HEADER_FILES) + set (PROGRAM_SOURCE_FILES) # read the list of components from this file; it should set the above # lists (which are generic names) @@ -55,6 +56,9 @@ macro (opm_sources opm) foreach (_file IN LISTS EXAMPLE_SOURCE_FILES) list (APPEND examples_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) # identify pre-compile header; if the project is called opm-foobar, # then it should be in opm/foobar/opm-foobar-pch.hpp diff --git a/cmake/Modules/OpmFind.cmake b/cmake/Modules/OpmFind.cmake index a5e778414..091f0500b 100644 --- a/cmake/Modules/OpmFind.cmake +++ b/cmake/Modules/OpmFind.cmake @@ -51,12 +51,52 @@ foreach (name IN LISTS _opm_proj_vars) 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 + ) + +# although a DUNE module, it is delivered in the OPM suite +set (dune-cornerpoint_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 + 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, @@ -71,6 +111,22 @@ macro (find_and_append_package_to prefix name) 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)) + # 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 @@ -81,23 +137,46 @@ macro (find_and_append_package_to prefix name) message (STATUS "Finding package ${name} using module mode") find_package (${name} ${ARGN}) endif (${name}_DIR) - if (${name}_FOUND) + + # 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}}) - # cleanup lists - if ("${var}" STREQUAL "LIBRARIES") - remove_duplicate_libraries (${prefix}) - else ("${var}" STREQUAL "LIBRARIES") - list (REMOVE_DUPLICATES ${prefix}_${var}) - endif ("${var}" STREQUAL "LIBRARIES") + # 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) + endif (${name}_FOUND OR ${NAME}_FOUND) endmacro (find_and_append_package_to prefix name) # append to the list of variables associated with the project diff --git a/cmake/Modules/OpmInstall.cmake b/cmake/Modules/OpmInstall.cmake index f42e22c10..408df41df 100644 --- a/cmake/Modules/OpmInstall.cmake +++ b/cmake/Modules/OpmInstall.cmake @@ -18,13 +18,11 @@ macro (opm_install opm) DESTINATION include/${_rel_dir} ) endforeach (_hdr) - if (${opm}_TARGET) - install ( - TARGETS ${${opm}_TARGET} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) - endif() + install ( + TARGETS ${${opm}_TARGET} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) # 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 @@ -44,12 +42,12 @@ macro (opm_install opm) endif (SYSTEM_DEBUG) # 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") + if (${opm}_LIBRARY_TYPE STREQUAL "SHARED" AND ${opm}_TARGET) install ( FILES ${PROJECT_BINARY_DIR}/${${opm}_DEBUG} DESTINATION ${_dbg_prefix}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} ) - endif (${opm}_LIBRARY_TYPE STREQUAL "SHARED") + endif (${opm}_LIBRARY_TYPE STREQUAL "SHARED" AND ${opm}_TARGET) install ( FILES ${PROJECT_SOURCE_DIR}/dune.module DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/dunecontrol/${${opm}_NAME} diff --git a/cmake/Modules/OpmPackage.cmake b/cmake/Modules/OpmPackage.cmake index e46863ada..9d6ce1581 100644 --- a/cmake/Modules/OpmPackage.cmake +++ b/cmake/Modules/OpmPackage.cmake @@ -37,7 +37,11 @@ # -include (Duplicates) +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}) @@ -47,7 +51,7 @@ macro (append_found src dst) endforeach (_item) endmacro (append_found src dst) -function (find_opm_package module deps header lib defs prog conf) +macro (find_opm_package module deps header lib defs prog conf) # variables to pass on to other packages if (FIND_QUIETLY) set (${module}_QUIET "QUIET") @@ -60,16 +64,6 @@ function (find_opm_package module deps header lib defs prog conf) return () endif (${${module}_FOUND}) - # dependencies on other packages; underscore version only contains the - # name of the other package - set (_deps) - foreach (_dep IN LISTS deps) - separate_arguments (_args UNIX_COMMAND ${_dep}) - find_package (${_args} QUIET) - list (GET _args 0 _name_only) - list (APPEND _deps ${_name_only}) - endforeach (_dep) - # see if there is a pkg-config entry for this package, and use those # settings as a starting point find_package (PkgConfig) @@ -88,38 +82,111 @@ function (find_opm_package module deps header lib defs prog conf) # 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 + # but with a -build suffix, DUNE likes to have the the build tree + # in a "build-cmake" sub-directory of each module if (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT)) string (TOLOWER "${module}" _module_lower) set (_guess "../${module}" - "../${module}-build" "../${_module_lower}" + ) + set (_guess_bin_only + "../${module}-build" "../${_module_lower}-build" ) + # 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}") + + # look in similar dirs for the other module + list (APPEND _guess_bin_only + "../../${module}/${_build_dir}" + "../../${_module_lower}/${_build_dir}" + ) + + # generate items that are in the build, not source dir set (_guess_bin) - foreach (_item IN ITEMS ${_guess}) + foreach (_item IN ITEMS ${_guess} ${_guess_bin_only}) list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}") endforeach (_item) + set (_no_system "") + else (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT)) + # 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} + ${${module}_DIR}/.. + ${${module}_ROOT}/.. + ${${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 (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT)) + # 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) + # 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 ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_INCLUDE_DIRS} + HINTS ${PkgConf_${module}_INCLUDE_DIRS} ${_guess_hints} PATH_SUFFIXES "include" + ${_no_system} ) # 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) find_library (${module}_LIBRARY NAMES "${lib}" PATHS ${_guess_bin} - HINTS ${${module}_DIR} ${${module}_ROOT} ${${MODULE}_ROOT} ${PkgConf_${module}_LIBRARY_DIRS} - PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib32" "lib64" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" + HINTS ${PkgConf_${module}_LIBRARY_DIRS} ${_guess_hints_bin} + PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib" + ${_no_system} ) else (NOT "${lib}" STREQUAL "") set (${module}_LIBRARY "") @@ -129,45 +196,42 @@ function (find_opm_package module deps header lib defs prog conf) # list of necessities to build with the software set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}") set (${module}_LIBRARIES "${${module}_LIBRARY}") - foreach (_dep IN LISTS _deps) - # only add those packages we actually found (find_package will show - # an error if it was marked as REQUIRED) - if (${_dep}_FOUND) - list (APPEND ${module}_INCLUDE_DIRS ${${_dep}_INCLUDE_DIRS}) - list (APPEND ${module}_LIBRARIES ${${_dep}_LIBRARIES}) - list (APPEND ${module}_DEFINITIONS ${${_dep}_DEFINITIONS}) - list (APPEND ${module}_CONFIG_VARS ${${_dep}_CONFIG_VARS}) - list (APPEND ${module}_LINKER_FLAGS ${${_dep}_LINKER_FLAGS}) - endif (${_dep}_FOUND) + set (_deps) + foreach (_dep IN ITEMS ${deps}) + separate_arguments (_args UNIX_COMMAND ${_dep}) + if (_args) + find_and_append_package_to (${module} ${_args} ${${module}_QUIET}) + list (GET _args 0 _name_only) + list (APPEND _deps ${_name_only}) + else (_args) + message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)") + endif (_args) 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 LISTS defs) + foreach (_def IN ITEMS ${defs}) list (APPEND ${module}_DEFINITIONS "-D${_def}") endforeach (_def) # tidy the lists before returning them - list (REMOVE_DUPLICATES ${module}_INCLUDE_DIRS) - remove_duplicate_libraries (${module}) - list (REMOVE_DUPLICATES ${module}_DEFINITIONS) + 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 LISTS conf) + 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) - foreach (_dep in _deps) - if (DEFINED ${_dep}_CONFIG_VARS) - list (APPEND ${module}_CONFIG_VARS ${_dep}_CONFIG_VARS) - endif (DEFINED ${_dep}_CONFIG_VARS) - endforeach (_dep) - if (${module}_CONFIG_VARS) - list (REMOVE_DUPLICATES ${module}_CONFIG_VARS) - endif (${module}_CONFIG_VARS) # these are the defines that should be set when compiling # without config.h @@ -191,9 +255,24 @@ function (find_opm_package module deps header lib defs prog conf) include (FindPackageHandleStandardArgs) if ("${lib}" STREQUAL "") set (_lib_var "") + set (_and_lib_var) else ("${lib}" STREQUAL "") set (_lib_var "${module}_LIBRARY") + set (_and_lib_var AND ${_lib_var}) 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}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY)) + if (DEFINED ${module}_DIR) + message ("${module}_DIR = ${${module}_DIR}") + elseif (DEFINED ${module}_ROOT) + message ("${module}_ROOT = ${${module}_ROOT}") + elseif (DEFINED ${MODULE}_ROOT) + message ("${MODULE}_ROOT = ${${MODULE}_ROOT}") + endif (DEFINED ${module}_DIR) + endif (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}) + AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY)) find_package_handle_standard_args ( ${module} DEFAULT_MSG @@ -206,17 +285,13 @@ function (find_opm_package module deps header lib defs prog conf) # some genius that coded the FindPackageHandleStandardArgs figured out # that the module name should be in uppercase (?!) - set (${module}_FOUND "${${MODULE_UPPER}_FOUND}" PARENT_SCOPE) + set (${module}_FOUND "${${MODULE_UPPER}_FOUND}") - # return these variables to the caller - set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIRS}" PARENT_SCOPE) - set (${module}_LIBRARIES "${${module}_LIBRARIES}" PARENT_SCOPE) - set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE) - set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE) - set (${module}_LINKER_FLAGS "${${module}_LINKER_FLAGS}" PARENT_SCOPE) - set (${module}_QUIET "${${module}_QUIET}" PARENT_SCOPE) - set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE) -endfunction (find_opm_package module deps header lib defs prog conf) + # 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) diff --git a/cmake/Modules/OpmProject.cmake b/cmake/Modules/OpmProject.cmake index 0aca6056d..4ee05cac0 100644 --- a/cmake/Modules/OpmProject.cmake +++ b/cmake/Modules/OpmProject.cmake @@ -1,5 +1,7 @@ # - 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) @@ -18,15 +20,16 @@ endfunction (unseparate_args var_name prefix value) function (configure_pc_file name source dest prefix libdir includedir) # escape set of standard strings unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}") - unseparate_args (libs "-l" "${${name}_LIBRARIES}") 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 (target "${${name}_LIBRARY}") 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) diff --git a/cmake/Modules/OpmSatellites.cmake b/cmake/Modules/OpmSatellites.cmake index fdc2b3286..9b0d0c8f5 100644 --- a/cmake/Modules/OpmSatellites.cmake +++ b/cmake/Modules/OpmSatellites.cmake @@ -95,6 +95,15 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp) ) endif (CMAKE_VERSION VERSION_LESS "2.8.4") 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/ + ) + endif (NOT (_is_util EQUAL -1)) endforeach (_sat_FILE) endmacro (opm_compile_satellites opm prefix) diff --git a/cmake/Modules/UseDebugSymbols.cmake b/cmake/Modules/UseDebugSymbols.cmake index 2049bd475..10ec7e83a 100644 --- a/cmake/Modules/UseDebugSymbols.cmake +++ b/cmake/Modules/UseDebugSymbols.cmake @@ -13,11 +13,16 @@ include (AddOptions) # only debugging using the GNU toolchain is supported for now if (CMAKE_COMPILER_IS_GNUCXX) + # default debug level, if not specified by the user + set_default_option (_dbg_flag "-ggdb3" "(^|\ )-g") + # add debug symbols to *all* targets, regardless. there WILL come a # time when you need to find a bug which only manifests itself in a # release target on a production system! - message (STATUS "Generating debug symbols: -ggdb3") - add_options (ALL_LANGUAGES ALL_BUILDS "-ggdb3") + if (_dbg_flag) + message (STATUS "Generating debug symbols: ${_dbg_flag}") + add_options (ALL_LANGUAGES ALL_BUILDS "${_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. @@ -85,6 +90,7 @@ function (strip_debug_symbols targets) VERBATIM ) # add this .debug file to the list + file (RELATIVE_PATH _this_debug_file "${PROJECT_BINARY_DIR}" "${_target_file}.debug") set (_debug_files ${_debug_files} ${_this_debug_file}) endforeach (target) # if optional debug list was requested, then copy to output parameter diff --git a/cmake/Modules/UseOptimization.cmake b/cmake/Modules/UseOptimization.cmake index e66f7a22a..4cb99f3dc 100644 --- a/cmake/Modules/UseOptimization.cmake +++ b/cmake/Modules/UseOptimization.cmake @@ -3,25 +3,26 @@ include(TestCXXAcceptsFlag) include (AddOptions) +# 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 (CMAKE_COMPILER_IS_GNUCXX) - # use these options for debug builds - no optimizations - add_options ( - ALL_LANGUAGES - "Debug" - "-O0" "-DDEBUG" - ) +if (CMAKE_COMPILER_IS_GNUCXX) # extra flags passed for optimization set (_opt_flags "") # link-time (a.k.a. global) optimizations - check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS) - if (HAVE_LINK_OPTS) - list (APPEND _opt_flags "-flto") - endif (HAVE_LINK_OPTS) + option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" ON) + 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) @@ -32,10 +33,29 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif (HAVE_MTUNE) endif (WITH_NATIVE) + # default optimization flags, if not set by user + set_default_option (_opt_dbg "-O0" "(^|\ )-O") + set_default_option (_opt_rel "-O3" "(^|\ )-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 - "Release;RelWithDebInfo;MinSizeRel" - "-O3" "-DNDEBUG" ${_opt_flags} - ) + add_options (ALL_LANGUAGES "${_prof_RELEASE}" ${_opt_rel} "-DNDEBUG" ${_opt_flags}) + +else (CMAKE_COMPILER_IS_GNUCXX) + # 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 (CMAKE_COMPILER_IS_GNUCXX) diff --git a/cmake/Modules/UseSystemInfo.cmake b/cmake/Modules/UseSystemInfo.cmake index c0db9c1f1..3e2463df2 100644 --- a/cmake/Modules/UseSystemInfo.cmake +++ b/cmake/Modules/UseSystemInfo.cmake @@ -8,6 +8,9 @@ function (system_info) 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) # probe various system files that may be found @@ -15,6 +18,7 @@ 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) + set (_descr) # start with /etc/os-release, # see if (NOT has_os_release STREQUAL "") @@ -22,13 +26,16 @@ function (distro_name varname) # previous "standard", used on older Ubuntu and Debian elseif (NOT has_lsb_release STREQUAL "") read_release (DISTRIB_DESCRIPTION FROM /etc/lsb-release INTO _descr) - # RHEL/CentOS etc. has just a text-file - elseif (NOT has_sys_release STREQUAL "") - file (READ /etc/system-release _descr) - else (NOT has_lsb_release STREQUAL "") - # no yet known release file found - set (_descr "unknown") 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) + 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) @@ -40,7 +47,7 @@ function (read_release valuename FROM filename INTO varname) REGEX "^${valuename}=" ) string (REGEX REPLACE - "^${valuename}=\"?\(.*\)" "\\1" ${varname} ${_distrib} + "^${valuename}=\"?\(.*\)" "\\1" ${varname} "${_distrib}" ) # remove trailing quote that got globbed by the wildcard (greedy match) string (REGEX REPLACE @@ -48,3 +55,120 @@ function (read_release valuename FROM filename INTO 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 +# +# 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() diff --git a/cmake/Modules/UseWarnings.cmake b/cmake/Modules/UseWarnings.cmake index 2dce6453c..65e8dcc66 100644 --- a/cmake/Modules/UseWarnings.cmake +++ b/cmake/Modules/UseWarnings.cmake @@ -2,6 +2,10 @@ include (AddOptions) if (CMAKE_COMPILER_IS_GNUCXX) - message (STATUS "All warnings enabled: -Wall") - add_options (ALL_LANGUAGES ALL_BUILDS "-Wall") + # default warnings flags, if not set by user + set_default_option (_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 (CMAKE_COMPILER_IS_GNUCXX) diff --git a/cmake/Templates/Doxyfile b/cmake/Templates/Doxyfile index c969c9e71..cbdac0ddb 100644 --- a/cmake/Templates/Doxyfile +++ b/cmake/Templates/Doxyfile @@ -608,7 +608,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = opm/core/utility/parameters/tinyxml +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/cmake/Templates/opm-project-config.cmake.in b/cmake/Templates/opm-project-config.cmake.in index a69a0b070..4f35abffc 100644 --- a/cmake/Templates/opm-project-config.cmake.in +++ b/cmake/Templates/opm-project-config.cmake.in @@ -32,10 +32,13 @@ set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@") set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@") mark_as_advanced (@opm-project_NAME@_LIBRARY) -# add the library as a target, so that other things in the project including -# this file may depend on it and get rebuild if this library changes. -add_library (@opm-project_TARGET@ UNKNOWN IMPORTED) -set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}") +# not all projects have targets; conditionally add this part +if (NOT "@opm-project_TARGET@" STREQUAL "") + # add the library as a target, so that other things in the project including + # this file may depend on it and get rebuild if this library changes. + add_library (@opm-project_TARGET@ UNKNOWN IMPORTED) + set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}") +endif (NOT "@opm-project_TARGET@" STREQUAL "") # ensure that we build with support for C++11 to preserve ABI string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") diff --git a/cmake/Templates/opm-project.pc.in b/cmake/Templates/opm-project.pc.in index 1204d4bd6..8a6c915bd 100644 --- a/cmake/Templates/opm-project.pc.in +++ b/cmake/Templates/opm-project.pc.in @@ -9,5 +9,5 @@ Name: @name@ Description: @description@ @major@.@minor@ Version: @major@.@minor@ URL: http://opm-project.org -Libs: -l@target@ @libs@ +Libs: @target@ @libs@ Cflags: @includes@ @defs@ diff --git a/configure b/configure index 6e9054c99..c054e5361 100755 --- a/configure +++ b/configure @@ -17,17 +17,17 @@ Optional Features: --enable-shared build a shared library [default=yes] --enable-static build a static library [default=no]. Note: only one of the options shared and static may be built. - --disable-debug build a release version of the library [default=no] + --enable-debug build a non-optimized version of the library + [default=no] + --disable-lto do not use whole program optimization [default=yes] --disable-pch do not use precompiled headers (if buggy compiler) --disable-silent-rules print every compilation statement as executed --enable-system-debug put .debug files in global GDB debug dir [default=yes if prefix=/usr, no otherwise] + --enable-parallel process in parallel using MPI [default=no] --disable-option-checking ignore unrecognized --enable/--with options Optional Packages: - --with-boost=PATH use Boost library from a specified location - --with-dune-MODULE=PATH use given DUNE module from a specified location - --with-opm-MODULE=PATH use given OPM module from a specified location --with-cmake=PROGRAM use this program instead of \`cmake' to configure Some influential environment variables: @@ -77,7 +77,8 @@ invalid_opt () { # default values prefix=/usr/local -buildtype=Debug +#buildtype=" -DCMAKE_BUILD_TYPE=Debug" +buildtype= #pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" pch_use= #use_openmp=" -DUSE_OPENMP=OFF" @@ -87,6 +88,8 @@ use_mpi= silent_rules= #debug_loc=" -DSYSTEM_DEBUG=OFF" debug_loc= +#use_lto=" -DWHOLE_PROG_OPTIM=ON" +use_lto= # default is to warn for unknown options, but this can be disabled option_check=yes @@ -137,7 +140,44 @@ for OPT in "$@"; do # expand to full path since CMake changes to source directory (!) # this also normalize the path name wrt. not having a trailing slash test -d "${pkgloc}" && pkgloc=$(sh -c "cd \"${pkgloc}\"; pwd") - + # special aliases + case "${pkgname}" in + umfpack) + pkgname="SuiteSparse" + ;; + tinyxml) + pkgname="TinyXML" + ;; + esac + # packages need different suffix for their root (sic) + case "${pkgname}" in + pch) + pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" + rootvar="" + ;; + mpi |\ + mpi-prefix) + rootvar="_MPI_PREFIX_PATH" + ;; + agmg |\ + ert |\ + boost |\ + superlu |\ + SuiteSparse |\ + TinyXML |\ + opm |\ + opm-* |\ + dune |\ + dune-* |\ + zlib) + rootvar="${pkgname^^}_ROOT" + rootvar="${rootvar/-/_}" + ;; + *) + invalid_opt --with-${pkgname} + rootvar="" + ;; + esac # add this to the list of existing features test -n "${rootvar}" && \ FEATURES="${FEATURES} \"-D${rootvar}=${pkgloc}\"" @@ -148,6 +188,15 @@ for OPT in "$@"; do pkgname=$OPTARG pkgname=${pkgname#disable-} pkgname=${pkgname#without-} + # special aliases + case "${pkgname}" in + umfpack) + pkgname="SuiteSparse" + ;; + tinyxml) + pkgname="TinyXML" + ;; + esac # casing is of course different case "${pkgname}" in option-checking) @@ -156,7 +205,7 @@ for OPT in "$@"; do pkgname="" ;; debug) - buildtype=Release + buildtype=" -DCMAKE_BUILD_TYPE=Release" # special flag: don't disable any particular package pkgname="" ;; @@ -172,6 +221,28 @@ for OPT in "$@"; do debug_loc=" -DSYSTEM_DEBUG=OFF" pkgname="" ;; + wpo |\ + lto ) + use_lto=" -DWHOLE_PROG_OPTIM=OFF" + pkgname="" + ;; + openmp) + use_openmp=" -DUSE_OPENMP=OFF" + pkgname="" + ;; + mpi | \ + parallel) + use_mpi=" -DUSE_MPI=OFF" + pkgname="" + ;; + agmg |\ + ert |\ + superlu) + pkgname="${pkgname^^}" + ;; + openmp) + pkgname="OpenMP" + ;; gxx11check) pkgname="CXX11Features" ;; @@ -198,11 +269,16 @@ for OPT in "$@"; do # special flag; don't set shared/static shared="" ;; + mpi | \ parallel) use_openmp=" -DUSE_MPI=ON" # special flag; don't set shared/static shared="" ;; + debug) + buildtype=" -DCMAKE_BUILD_TYPE=Debug" + shared="" + ;; pch) pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" shared="" @@ -255,7 +331,7 @@ for a in "${VARS[@]}"; do done # pass everything on to CMake -CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi} ${FEATURES}" +CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto} ${FEATURES}" echo --- calling CMake --- echo ${CMDLINE} eval exec ${CMDLINE}