diff --git a/CMakeLists.txt b/CMakeLists.txt index 24e80378..15e6fe57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,18 +113,10 @@ opm_auto_dirs () # put libraries in lib/ opm_out_dirs () -# identify the compilation units in the library +# identify the compilation units in the library; sources in opm/, +# tests files in tests/, examples in tutorials/ and examples/ opm_sources (${project}) -# enumerate all testing programs in test/ directory -opm_find_tests () - -# tutorial programs are found in the tutorials/ directory -opm_find_tutorials () - -# example programs are found in the examples/ directory -opm_find_examples () - ### --- begin AGMG specific --- ### # Algebraic Multigrid must be compiled together with our program; # if it is not available, then remove our corresponding component @@ -151,13 +143,11 @@ if (NOT SuiteSparse_FOUND) ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/call_umfpack.c ${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverUmfpack.cpp ) - list (REMOVE_ITEM tutorial_SOURCES - ${PROJECT_SOURCE_DIR}/${tutorial_DIR}/tutorial2.cpp - ${PROJECT_SOURCE_DIR}/${tutorial_DIR}/tutorial3.cpp - ${PROJECT_SOURCE_DIR}/${tutorial_DIR}/tutorial4.cpp - ) list (REMOVE_ITEM examples_SOURCES - ${PROJECT_SOURCE_DIR}/${examples_DIR}/spu_2p.cpp + ${PROJECT_SOURCE_DIR}/tutorials/tutorial2.cpp + ${PROJECT_SOURCE_DIR}/tutorials/tutorial3.cpp + ${PROJECT_SOURCE_DIR}/tutorials/tutorial4.cpp + ${PROJECT_SOURCE_DIR}/examples/spu_2p.cpp ) endif (NOT SuiteSparse_FOUND) @@ -197,7 +187,10 @@ endif (NOT HAVE_ERT) # includes the necessary defines by the dependencies include (ConfigVars) list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR}) -set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h") + +# write configuration variables to this file. note that it is a temporary. +message (STATUS "Writing config file \"${PROJECT_BINARY_DIR}/config.h\"...") +set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h.tmp") configure_vars ( FILE CXX ${CONFIG_H} WRITE ${${project}_CONFIG_VARS} @@ -209,6 +202,13 @@ define_fc_func ( IF HAVE_AGMG # HAVE_BLAS HAVE_LAPACK ) +# overwrite the config.h that is used by the code only if we have some +# real changes. thus, we don't have to recompile if a reconfigure is run +# due to some files being added, for instance +execute_process (COMMAND + ${CMAKE_COMMAND} -E copy_if_different ${CONFIG_H} ${PROJECT_BINARY_DIR}/config.h + ) + # compile main library; pull in all required includes and libraries include (OpmCompile) opm_compile (${project}) @@ -226,8 +226,7 @@ opm_cmake_config (${project}) # routines to build satellites such as tests, tutorials and samples include (OpmSatellites) -# tutorial programs are found in the tutorials/ directory -opm_compile_satellites (${project} tutorial "" "") +# example programs are found in the tutorials/ and examples/ directory opm_compile_satellites (${project} examples "" "") # infrastructure for testing @@ -249,7 +248,7 @@ cond_disable_test ("ERT") ### --- end opm-core specific --- ### # make datafiles necessary for tests available in output directory -opm_data (tests datafiles "${tests_DIR}" "*.xml") +opm_data (tests datafiles "${tests_DIR}") opm_compile_satellites (${project} tests "" "${tests_REGEXP}") # use this target to run all tests diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake new file mode 100644 index 00000000..a2c2cc62 --- /dev/null +++ b/CMakeLists_files.cmake @@ -0,0 +1,334 @@ +# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*- +# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap: + +# This file sets up five lists: +# MAIN_SOURCE_FILES List of compilation units which will be included in +# the library. If it isn't on this list, it won't be +# part of the library. Please try to keep it sorted to +# maintain sanity. +# +# TEST_SOURCE_FILES List of programs that will be run as unit tests. +# +# TEST_DATA_FILES Files from the source three that should be made +# available in the corresponding location in the build +# tree in order to run tests there. +# +# EXAMPLE_SOURCE_FILES Other programs that will be compiled as part of the +# build, but which is not part of the library nor is +# run as tests. +# +# PUBLIC_HEADER_FILES List of public header files that should be +# distributed together with the library. The source +# files can of course include other files than these; +# you should only add to this list if the *user* of +# the library needs it. + +# originally generated with the command: +# find opm -name '*.c*' -printf '\t%p\n' | sort +list (APPEND MAIN_SOURCE_FILES + opm/core/eclipse/EclipseGridInspector.cpp + opm/core/eclipse/EclipseGridParser.cpp + opm/core/fluid/blackoil/BlackoilPvtProperties.cpp + opm/core/fluid/BlackoilPropertiesBasic.cpp + opm/core/fluid/BlackoilPropertiesFromDeck.cpp + opm/core/fluid/blackoil/SinglePvtDead.cpp + opm/core/fluid/blackoil/SinglePvtDeadSpline.cpp + opm/core/fluid/blackoil/SinglePvtInterface.cpp + opm/core/fluid/blackoil/SinglePvtLiveGas.cpp + opm/core/fluid/blackoil/SinglePvtLiveOil.cpp + opm/core/fluid/IncompPropertiesBasic.cpp + opm/core/fluid/IncompPropertiesFromDeck.cpp + opm/core/fluid/PvtPropertiesBasic.cpp + opm/core/fluid/PvtPropertiesIncompFromDeck.cpp + opm/core/fluid/RockBasic.cpp + opm/core/fluid/RockCompressibility.cpp + opm/core/fluid/RockFromDeck.cpp + opm/core/fluid/SatFuncGwseg.cpp + opm/core/fluid/SatFuncSimple.cpp + opm/core/fluid/SatFuncStone2.cpp + opm/core/fluid/SaturationPropsBasic.cpp + opm/core/fluid/SaturationPropsFromDeck.cpp + opm/core/grid.c + opm/core/grid/cart_grid.c + opm/core/grid/cornerpoint_grid.c + opm/core/grid/cpgpreprocess/facetopology.c + opm/core/grid/cpgpreprocess/geometry.c + opm/core/grid/cpgpreprocess/mxgrdecl.c + opm/core/grid/cpgpreprocess/preprocess.c + opm/core/grid/cpgpreprocess/processgrid.c + opm/core/grid/cpgpreprocess/uniquepoints.c + opm/core/GridManager.cpp + opm/core/linalg/call_umfpack.c + opm/core/linalg/LinearSolverAGMG.cpp + opm/core/linalg/LinearSolverFactory.cpp + opm/core/linalg/LinearSolverInterface.cpp + opm/core/linalg/LinearSolverIstl.cpp + opm/core/linalg/LinearSolverUmfpack.cpp + opm/core/linalg/sparse_sys.c + opm/core/newwells.c + opm/core/pressure/cfsh.c + opm/core/pressure/CompressibleTpfa.cpp + opm/core/pressure/flow_bc.c + opm/core/pressure/FlowBCManager.cpp + opm/core/pressure/fsh.c + opm/core/pressure/fsh_common_impl.c + opm/core/pressure/ifsh.c + opm/core/pressure/IncompTpfa.cpp + opm/core/pressure/mimetic/hybsys.c + opm/core/pressure/mimetic/hybsys_global.c + opm/core/pressure/mimetic/mimetic.c + opm/core/pressure/msmfem/coarse_conn.c + opm/core/pressure/msmfem/coarse_sys.c + opm/core/pressure/msmfem/dfs.c + opm/core/pressure/msmfem/hash_set.c + opm/core/pressure/msmfem/ifsh_ms.c + opm/core/pressure/msmfem/partition.c + opm/core/pressure/tpfa/cfs_tpfa.c + opm/core/pressure/tpfa/cfs_tpfa_residual.c + opm/core/pressure/tpfa/compr_bc.c + opm/core/pressure/tpfa/compr_quant.c + opm/core/pressure/tpfa/compr_quant_general.c + opm/core/pressure/tpfa/compr_source.c + opm/core/pressure/tpfa/ifs_tpfa.c + opm/core/pressure/tpfa/trans_tpfa.c + opm/core/pressure/well.c + opm/core/simulator/SimulatorCompressibleTwophase.cpp + opm/core/simulator/SimulatorIncompTwophase.cpp + opm/core/simulator/SimulatorReport.cpp + opm/core/simulator/SimulatorTimer.cpp + opm/core/transport/reorder/DGBasis.cpp + opm/core/transport/reorder/nlsolvers.c + opm/core/transport/reorder/reordersequence.cpp + opm/core/transport/reorder/tarjan.c + opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp + opm/core/transport/reorder/TransportModelInterface.cpp + opm/core/transport/reorder/TransportModelTracerTof.cpp + opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp + opm/core/transport/reorder/TransportModelTwophase.cpp + opm/core/transport/spu_explicit.c + opm/core/transport/spu_implicit.c + opm/core/transport/transport_source.c + opm/core/utility/miscUtilitiesBlackoil.cpp + opm/core/utility/miscUtilities.cpp + opm/core/utility/MonotCubicInterpolator.cpp + opm/core/utility/parameters/Parameter.cpp + opm/core/utility/parameters/ParameterGroup.cpp + opm/core/utility/parameters/ParameterTools.cpp + opm/core/utility/parameters/ParameterXML.cpp + opm/core/utility/parameters/tinyxml/tinystr.cpp + opm/core/utility/parameters/tinyxml/tinyxml.cpp + opm/core/utility/parameters/tinyxml/tinyxmlerror.cpp + opm/core/utility/parameters/tinyxml/tinyxmlparser.cpp + opm/core/utility/parameters/tinyxml/xmltest.cpp + opm/core/utility/StopWatch.cpp + opm/core/utility/VelocityInterpolation.cpp + opm/core/utility/WachspressCoord.cpp + opm/core/utility/writeECLData.cpp + opm/core/utility/writeVtkData.cpp + opm/core/vag_format/vag.cpp + opm/core/wells/InjectionSpecification.cpp + opm/core/wells/ProductionSpecification.cpp + opm/core/wells/WellCollection.cpp + opm/core/wells/WellsGroup.cpp + opm/core/wells/WellsManager.cpp + ) + +# originally generated with the command: +# find tests -name '*.cpp' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort +list (APPEND TEST_SOURCE_FILES + tests/test_dgbasis.cpp + tests/test_sparsevector.cpp + tests/test_sparsetable.cpp + tests/test_velocityinterpolation.cpp + tests/test_quadratures.cpp + tests/test_wells.cpp + tests/test_wachspresscoord.cpp + tests/test_column_extract.cpp + tests/test_geom2d.cpp + tests/test_param.cpp + ) + +# originally generated with the command: +# find tests -name '*.xml' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort +list (APPEND TEST_DATA_FILES + tests/extratestdata.xml + tests/testdata.xml + ) + +# originally generated with the command: +# find tutorials examples -name '*.c*' -printf '\t%p\n' | sort +list (APPEND EXAMPLE_SOURCE_FILES + examples/compute_tof.cpp + examples/compute_tof_from_files.cpp + examples/import_rewrite.cpp + examples/refine_wells.cpp + examples/scaneclipsedeck.c + examples/sim_2p_comp_reorder.cpp + examples/sim_2p_incomp_reorder.cpp + examples/sim_wateroil.cpp + examples/spu_2p.cpp + examples/wells_example.cpp + tutorials/tutorial1.cpp + tutorials/tutorial2.cpp + tutorials/tutorial3.cpp + tutorials/tutorial4.cpp + ) + +# originally generated with the command: +# find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort +list (APPEND PUBLIC_HEADER_FILES + opm/core/transport/ImplicitTransport.hpp + opm/core/transport/SimpleFluid2pWrapper.hpp + opm/core/transport/CSRMatrixBlockAssembler.hpp + opm/core/transport/ImplicitAssembly.hpp + opm/core/transport/CSRMatrixUmfpackSolver.hpp + opm/core/transport/GravityColumnSolver_impl.hpp + opm/core/transport/spu_implicit.h + opm/core/transport/transport_source.h + opm/core/transport/SinglePointUpwindTwoPhase.hpp + opm/core/transport/JacobianSystem.hpp + opm/core/transport/reorder/TransportModelTwophase.hpp + opm/core/transport/reorder/TransportModelTracerTof.hpp + opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp + opm/core/transport/reorder/DGBasis.hpp + opm/core/transport/reorder/reordersequence.h + opm/core/transport/reorder/tarjan.h + opm/core/transport/reorder/TransportModelInterface.hpp + opm/core/transport/reorder/nlsolvers.h + opm/core/transport/reorder/TransportModelTracerTofDiscGal.hpp + opm/core/transport/GravityColumnSolver.hpp + opm/core/transport/NormSupport.hpp + opm/core/transport/spu_explicit.h + opm/core/eclipse/SpecialEclipseFields.hpp + opm/core/eclipse/EclipseUnits.hpp + opm/core/eclipse/EclipseGridParserHelpers.hpp + opm/core/eclipse/CornerpointChopper.hpp + opm/core/eclipse/EclipseGridParser.hpp + opm/core/eclipse/EclipseGridInspector.hpp + opm/core/GridManager.hpp + opm/core/linalg/blas_lapack.h + opm/core/linalg/LinearSolverAGMG.hpp + opm/core/linalg/LinearSolverFactory.hpp + opm/core/linalg/LinearSolverUmfpack.hpp + opm/core/linalg/LinearSolverIstl.hpp + opm/core/linalg/call_umfpack.h + opm/core/linalg/sparse_sys.h + opm/core/linalg/LinearSolverInterface.hpp + opm/core/newwells.h + opm/core/vag_format/vag.hpp + opm/core/doxygen_main.hpp + opm/core/simulator/SimulatorIncompTwophase.hpp + opm/core/simulator/WellState.hpp + opm/core/simulator/SimulatorCompressibleTwophase.hpp + opm/core/simulator/SimulatorReport.hpp + opm/core/simulator/SimulatorTimer.hpp + opm/core/simulator/TwophaseState.hpp + opm/core/simulator/BlackoilState.hpp + opm/core/utility/linearInterpolation.hpp + opm/core/utility/WachspressCoord.hpp + opm/core/utility/initState_impl.hpp + opm/core/utility/initState.hpp + opm/core/utility/NonuniformTableLinear.hpp + opm/core/utility/Units.hpp + opm/core/utility/DataMap.hpp + opm/core/utility/linInt.hpp + opm/core/utility/parameters/ParameterXML.hpp + opm/core/utility/parameters/ParameterGroup_impl.hpp + opm/core/utility/parameters/Parameter.hpp + opm/core/utility/parameters/ParameterTools.hpp + opm/core/utility/parameters/ParameterRequirement.hpp + opm/core/utility/parameters/ParameterMapItem.hpp + opm/core/utility/parameters/ParameterGroup.hpp + opm/core/utility/parameters/tinyxml/tinystr.h + opm/core/utility/parameters/tinyxml/tinyxml.h + opm/core/utility/parameters/ParameterStrings.hpp + opm/core/utility/miscUtilitiesBlackoil.hpp + opm/core/utility/MonotCubicInterpolator.hpp + opm/core/utility/UniformTableLinear.hpp + opm/core/utility/writeVtkData.hpp + opm/core/utility/Average.hpp + opm/core/utility/Factory.hpp + opm/core/utility/VelocityInterpolation.hpp + opm/core/utility/SparseVector.hpp + opm/core/utility/StopWatch.hpp + opm/core/utility/buildUniformMonotoneTable.hpp + opm/core/utility/ErrorMacros.hpp + opm/core/utility/miscUtilities.hpp + opm/core/utility/ColumnExtract.hpp + opm/core/utility/RootFinders.hpp + opm/core/utility/SparseTable.hpp + opm/core/utility/have_boost_redef.hpp + opm/core/utility/writeECLData.hpp + opm/core/grid/CellQuadrature.hpp + opm/core/grid/cornerpoint_grid.h + opm/core/grid/cpgpreprocess/geometry.h + opm/core/grid/cpgpreprocess/uniquepoints.h + opm/core/grid/cpgpreprocess/mxgrdecl.h + opm/core/grid/cpgpreprocess/preprocess.h + opm/core/grid/cpgpreprocess/grdecl.h + opm/core/grid/cpgpreprocess/facetopology.h + opm/core/grid/cart_grid.h + opm/core/grid/FaceQuadrature.hpp + opm/core/pressure/TPFAPressureSolver.hpp + opm/core/pressure/fsh_common_impl.h + opm/core/pressure/msmfem/dfs.h + opm/core/pressure/msmfem/coarse_conn.h + opm/core/pressure/msmfem/hash_set.h + opm/core/pressure/msmfem/partition.h + opm/core/pressure/msmfem/ifsh_ms.h + opm/core/pressure/msmfem/coarse_sys.h + opm/core/pressure/IncompTpfa.hpp + opm/core/pressure/HybridPressureSolver.hpp + opm/core/pressure/fsh.h + opm/core/pressure/flow_bc.h + opm/core/pressure/tpfa/compr_quant_general.h + opm/core/pressure/tpfa/compr_bc.h + opm/core/pressure/tpfa/trans_tpfa.h + opm/core/pressure/tpfa/compr_quant.h + opm/core/pressure/tpfa/cfs_tpfa_residual.h + opm/core/pressure/tpfa/ifs_tpfa.h + opm/core/pressure/tpfa/compr_source.h + opm/core/pressure/tpfa/cfs_tpfa.h + opm/core/pressure/mimetic/hybsys_global.h + opm/core/pressure/mimetic/hybsys.h + opm/core/pressure/mimetic/mimetic.h + opm/core/pressure/FlowBCManager.hpp + opm/core/pressure/CompressibleTpfa.hpp + opm/core/pressure/TPFACompressiblePressureSolver.hpp + opm/core/wells/InjectionSpecification.hpp + opm/core/wells/WellsGroup.hpp + opm/core/wells/WellsManager.hpp + opm/core/wells/ProductionSpecification.hpp + opm/core/wells/WellCollection.hpp + opm/core/fluid/SaturationPropsInterface.hpp + opm/core/fluid/SaturationPropsFromDeck_impl.hpp + opm/core/fluid/RockFromDeck.hpp + opm/core/fluid/BlackoilPropertiesBasic.hpp + opm/core/fluid/RockCompressibility.hpp + opm/core/fluid/PvtPropertiesIncompFromDeck.hpp + opm/core/fluid/IncompPropertiesBasic.hpp + opm/core/fluid/SaturationPropsFromDeck.hpp + opm/core/fluid/SaturationPropsBasic.hpp + opm/core/fluid/BlackoilPropertiesFromDeck.hpp + opm/core/fluid/BlackoilPropertiesInterface.hpp + opm/core/fluid/blackoil/SinglePvtInterface.hpp + opm/core/fluid/blackoil/BlackoilPhases.hpp + opm/core/fluid/blackoil/SinglePvtDeadSpline.hpp + opm/core/fluid/blackoil/SinglePvtLiveOil.hpp + opm/core/fluid/blackoil/SinglePvtConstCompr.hpp + opm/core/fluid/blackoil/SinglePvtDead.hpp + opm/core/fluid/blackoil/phaseUsageFromDeck.hpp + opm/core/fluid/blackoil/BlackoilPvtProperties.hpp + opm/core/fluid/blackoil/SinglePvtLiveGas.hpp + opm/core/fluid/SimpleFluid2p.hpp + opm/core/fluid/IncompPropertiesInterface.hpp + opm/core/fluid/PvtPropertiesBasic.hpp + opm/core/fluid/SatFuncSimple.hpp + opm/core/fluid/SatFuncGwseg.hpp + opm/core/fluid/IncompPropertiesFromDeck.hpp + opm/core/fluid/RockBasic.hpp + opm/core/fluid/SatFuncStone2.hpp + opm/core/grid.h + opm/core/well.h + opm/core/GridAdapter.hpp + ) diff --git a/cmake/Modules/ConfigVars.cmake b/cmake/Modules/ConfigVars.cmake index 072d2b7f..ad81e988 100644 --- a/cmake/Modules/ConfigVars.cmake +++ b/cmake/Modules/ConfigVars.cmake @@ -27,7 +27,6 @@ function (configure_vars obj syntax filename verb) # this is just to make the syntax look like the build-in commands - message (STATUS "Writing config file \"${filename}\"...") if (NOT ("${obj}" STREQUAL "FILE" AND (("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND")))) message (FATAL_ERROR "Syntax error in argument list") @@ -47,10 +46,10 @@ function (configure_vars obj syntax filename verb) # to avoid confusion from other configuration files. get_filename_component (_config_path "${filename}" PATH) get_filename_component (_config_file "${filename}" NAME) - if ("${_config_file}" STREQUAL "config.h") + if ("${_config_file}" MATCHES "config\\.h(\\..+)?") add_definitions (-DHAVE_CONFIG_H=1) include_directories (BEFORE "${_config_path}") - endif ("${_config_file}" STREQUAL "config.h") + endif ("${_config_file}" MATCHES "config\\.h(\\..+)?") # only write the current value of each variable once set (_args ${ARGN}) diff --git a/cmake/Modules/OpmFiles.cmake b/cmake/Modules/OpmFiles.cmake index 51795cf3..40460c84 100644 --- a/cmake/Modules/OpmFiles.cmake +++ b/cmake/Modules/OpmFiles.cmake @@ -16,28 +16,53 @@ macro (opm_auto_dirs) endmacro (opm_auto_dirs) macro (opm_sources opm) - # find all the source code (note that these variables have name after - # the target library and not the project). the documentation recommends - # against using globs to enumerate source code, but if you list the - # files explicitly you'll change the build files every time you add to - # the project as well as having to rebuild completely anyway. - file (GLOB_RECURSE ${opm}_C_SOURCES "${${opm}_DIR}/[^.]*.c") - file (GLOB_RECURSE ${opm}_CXX_SOURCES "${${opm}_DIR}/[^.]*.cpp") - file (GLOB_RECURSE ${opm}_C_HEADERS "${${opm}_DIR}/[^.]*.h") - file (GLOB_RECURSE ${opm}_CXX_HEADERS "${${opm}_DIR}/[^.]*.hpp") + # this is necessary to set so that we know where we are going to + # execute the test programs (and make datafiles available) + set (tests_DIR "tests") - # remove pre-compile headers from output list - file (GLOB_RECURSE ${opm}_PRECOMP_CXX_HEADER "${${opm}_DIR}/${${opm}_NAME}-pch.hpp") - if ("${${opm}_PRECOMP_CXX_HEADER}" MATCHES ";") - message (FATAL_ERROR "There can only be one precompiled header!") - endif ("${${opm}_PRECOMP_CXX_HEADER}" MATCHES ";") - list (REMOVE_ITEM ${opm}_CXX_HEADERS - ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER} + # how to retrieve the "fancy" name from the filename + set (tests_REGEXP + "^test_([^/]*)$" + "^([^/]*)_test$" ) - # merge both languages into one compilation/installation - set (${opm}_SOURCES ${${opm}_C_SOURCES} ${${opm}_CXX_SOURCES}) - set (${opm}_HEADERS ${${opm}_C_HEADERS} ${${opm}_CXX_HEADERS}) + # start out with defined, empty lists which will be specified externally + set (MAIN_SOURCE_FILES) + set (EXAMPLE_SOURCE_FILES) + set (TEST_SOURCE_FILES) + set (TEST_DATA_FILES) + set (PUBLIC_HEADER_FILES) + + # read the list of components from this file; it should set the above + # lists (which are generic names) + include (${PROJECT_SOURCE_DIR}/CMakeLists_files.cmake) + + # rename from "friendly" names to ones that fit the "almost-structural" + # scheme used in the .cmake modules, converting them to absolute file + # names in the process + foreach (_file IN LISTS MAIN_SOURCE_FILES) + list (APPEND ${opm}_SOURCES ${PROJECT_SOURCE_DIR}/${_file}) + endforeach (_file) + foreach (_file IN LISTS PUBLIC_HEADER_FILES) + list (APPEND ${opm}_HEADERS ${PROJECT_SOURCE_DIR}/${_file}) + endforeach (_file) + foreach (_file IN LISTS TEST_SOURCE_FILES) + list (APPEND tests_SOURCES ${PROJECT_SOURCE_DIR}/${_file}) + endforeach (_file) + foreach (_file IN LISTS TEST_DATA_FILES) + list (APPEND tests_DATA ${PROJECT_SOURCE_DIR}/${_file}) + endforeach (_file) + foreach (_file IN LISTS EXAMPLE_SOURCE_FILES) + list (APPEND examples_SOURCES ${PROJECT_SOURCE_DIR}/${_file}) + endforeach (_file) + + # identify pre-compile header; if the project is called opm-foobar, + # then it should be in opm/foobar/opm-foobar-pch.hpp + string (REPLACE "-" "/" opm_NAME_AS_DIR ${${opm}_NAME}) + set (${opm}_PRECOMP_CXX_HEADER "${opm_NAME_AS_DIR}/${${opm}_NAME}-pch.hpp") + if (NOT EXISTS ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER}) + set (${opm}_PRECOMP_CXX_HEADER "") + endif (NOT EXISTS ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER}) endmacro (opm_sources opm) # disable an entire directory from sources @@ -60,36 +85,3 @@ macro (opm_disable_source opm) endforeach (_file) endforeach (_exp) endmacro (opm_disable_source opm reldir) - -macro (opm_find_tests) - # every C++ program prefixed with test_ under tests/ directory should - # be automatically set up as a test - set (tests_DIR "tests") - file (GLOB_RECURSE tests_SOURCES - "${tests_DIR}/test_*.cpp" - "${tests_DIR}/*_test.cpp" - ) - file (GLOB_RECURSE not_tests_SOURCES - "${tests_DIR}/not-unit/test_*.cpp" - "${tests_DIR}/not-unit/*_test.cpp" - ) - # how to retrieve the "fancy" name from the filename - set (tests_REGEXP - "^test_([^/]*)$" - "^([^/]*)_test$" - ) - if (tests_SOURCES AND not_tests_SOURCES) - list (REMOVE_ITEM tests_SOURCES ${not_tests_SOURCES}) - endif (tests_SOURCES AND not_tests_SOURCES) -endmacro (opm_find_tests) - -macro (opm_find_tutorials) - # enumerate tutorials in project - set (tutorial_DIR "tutorials") - file (GLOB tutorial_SOURCES "${tutorial_DIR}/tutorial[0-9].cpp") -endmacro (opm_find_tutorials) - -macro (opm_find_examples) - set (examples_DIR "examples") - file (GLOB examples_SOURCES "${examples_DIR}/*.cpp") -endmacro (opm_find_examples) diff --git a/cmake/Modules/OpmSatellites.cmake b/cmake/Modules/OpmSatellites.cmake index c2a1ce21..fdc2b328 100644 --- a/cmake/Modules/OpmSatellites.cmake +++ b/cmake/Modules/OpmSatellites.cmake @@ -108,9 +108,9 @@ endmacro (opm_compile_satellites opm prefix) # # Example: # -# opm_data (tests datafiles "tests/" "*.xml") +# opm_data (tests datafiles "tests/") # -macro (opm_data satellite target dirname files) +macro (opm_data satellite target dirname) # even if there are no datafiles, create the directory so the # satellite programs have a homedir to run in execute_process ( @@ -124,11 +124,6 @@ macro (opm_data satellite target dirname files) # provide datafiles as inputs for the tests, by copying them # to a tests/ directory in the output tree (if different) set (${satellite}_INPUT_FILES) - set (${satellite}_DATA) - foreach (_fileset IN ITEMS ${files}) - file (GLOB _fileset_DATA "${dirname}/${_fileset}") - list (APPEND ${satellite}_DATA ${_fileset_DATA}) - endforeach (_fileset) if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) foreach (input_datafile IN LISTS ${satellite}_DATA) file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})