changed: switch to the shared opm build system

This commit is contained in:
Arne Morten Kvarving 2018-01-24 11:54:16 +01:00
parent 53d8d65c7b
commit f7c288a3f4
20 changed files with 199 additions and 690 deletions

108
ExtraTests.cmake Normal file
View File

@ -0,0 +1,108 @@
# Libs to link tests against
set(TEST_LIBS opmparser ecl Boost::unit_test_framework)
set(EXTRA_TESTS)
# Generated source, needs to be here
opm_add_test(InlineKeywordTest
EXE_NAME inlinekw
SOURCES ${PROJECT_BINARY_DIR}/inlinekw.cpp
LIBRARIES ${TEST_LIBS})
list(APPEND EXTRA_TESTS inlinekw)
# Extra compile definitions and extra parameters
include(cmake/Modules/CheckCaseSensitiveFileSystem.cmake)
set(_testdir ${PROJECT_SOURCE_DIR}/lib/eclipse/tests/data)
opm_add_test(LoaderTest
SOURCES lib/eclipse/tests/KeywordLoaderTests.cpp
lib/eclipse/Generator/KeywordLoader.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/parser/keyword-generator/)
list(APPEND EXTRA_TESTS LoaderTest)
opm_add_test(ParserTests
SOURCES lib/eclipse/tests/ParserTests.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/)
list(APPEND EXTRA_TESTS ParserTests)
opm_add_test(ParserIncludeTests
SOURCES lib/eclipse/tests/ParserIncludeTests.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/parser/)
target_compile_definitions(ParserIncludeTests PRIVATE
-DHAVE_CASE_SENSITIVE_FILESYSTEM=${HAVE_CASE_SENSITIVE_FILESYSTEM})
list(APPEND EXTRA_TESTS ParserIncludeTests)
opm_add_test(PvtxTableTests
SOURCES lib/eclipse/tests/PvtxTableTests.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/integration_tests/)
list(APPEND EXTRA_TESTS PvtxTableTests)
opm_add_test(EclipseStateTests
SOURCES lib/eclipse/tests/EclipseStateTests.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/integration_tests/)
list(APPEND EXTRA_TESTS EclipseStateTests)
foreach (test BoxTest
CheckDeckValidity
CompletionsFromDeck
EclipseGridCreateFromDeck
IncludeTest
IntegrationTests
IOConfigIntegrationTest
NNCTests
ParseKEYWORD
ParseDATAWithDefault
Polymer
ResinsightTest
ScheduleCreateFromDeck
TransMultIntegrationTests)
opm_add_test(${test}
SOURCES lib/eclipse/tests/integration/${test}.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/integration_tests/)
list(APPEND EXTRA_TESTS ${test})
endforeach ()
# opm-data dependent tests
if(HAVE_OPM_DATA)
opm_add_test(parse_write ONLY_COMPILE
SOURCES lib/eclipse/tests/integration/parse_write.cpp
LIBRARIES ${TEST_LIBS})
list(APPEND EXTRA_TESTS parse_write)
foreach (deck ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE1CASE2_SOLVENT.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE9_CP_SOLVENT_CO2.DATA
${OPM_DATA_ROOT}/spe5/SPE5CASE1.DATA
${OPM_DATA_ROOT}/polymer_simple2D/2D_THREEPHASE_POLY_HETER.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_FAMII.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_SLGOF.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE1.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE2.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP_GROUP.DATA
${OPM_DATA_ROOT}/spe9/SPE9.DATA
${OPM_DATA_ROOT}/spe10model1/SPE10_MODEL1.DATA
${OPM_DATA_ROOT}/spe10model2/SPE10_MODEL2.DATA
${OPM_DATA_ROOT}/msw_2d_h/2D_H__.DATA )
get_filename_component(test_name ${deck} NAME_WE)
opm_add_test(${test_name} NO_COMPILE
EXE_NAME parse_write
TEST_ARGS ${deck})
endforeach()
set_property(TEST NORNE_ATW2013
PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")
endif()
# JSON tests
opm_add_test(jsonTests
SOURCES lib/json/tests/jsonTests.cpp
LIBRARIES ${TEST_LIBS} opmjson
TEST_ARGS ${PROJECT_SOURCE_DIR}/lib/json/tests/example1.json)
list(APPEND EXTRA_TESTS jsonTests)

42
GenerateKeywords.cmake Normal file
View File

@ -0,0 +1,42 @@
set(genkw_SOURCES lib/eclipse/Parser/createDefaultKeywordList.cpp
lib/eclipse/Deck/Deck.cpp
lib/eclipse/Deck/DeckItem.cpp
lib/eclipse/Deck/DeckKeyword.cpp
lib/eclipse/Deck/DeckRecord.cpp
lib/eclipse/Deck/DeckOutput.cpp
lib/eclipse/Generator/KeywordGenerator.cpp
lib/eclipse/Generator/KeywordLoader.cpp
lib/eclipse/Parser/MessageContainer.cpp
lib/eclipse/Parser/ParseContext.cpp
lib/eclipse/Parser/ParserEnums.cpp
lib/eclipse/Parser/ParserItem.cpp
lib/eclipse/Parser/ParserKeyword.cpp
lib/eclipse/Parser/ParserRecord.cpp
lib/eclipse/RawDeck/RawKeyword.cpp
lib/eclipse/RawDeck/RawRecord.cpp
lib/eclipse/RawDeck/StarToken.cpp
lib/eclipse/Units/Dimension.cpp
lib/eclipse/Units/UnitSystem.cpp
lib/eclipse/Utility/Stringview.cpp
)
add_executable(genkw ${genkw_SOURCES})
target_link_libraries(genkw opmjson ecl Boost::regex Boost::filesystem Boost::system)
target_include_directories(genkw PRIVATE lib/eclipse/include
lib/json/include)
# Generate keyword list
include(lib/eclipse/share/keywords/keyword_list.cmake)
string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/lib/eclipse/share/keywords/\\1" keyword_files "${keywords}")
configure_file(lib/eclipse/keyword_list.argv.in keyword_list.argv)
# Generate keyword source
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/ParserKeywords.cpp ${PROJECT_BINARY_DIR}/inlinekw.cpp
COMMAND genkw keyword_list.argv
${PROJECT_BINARY_DIR}/ParserKeywords.cpp
${PROJECT_BINARY_DIR}/include/
opm/parser/eclipse/Parser/ParserKeywords
${PROJECT_BINARY_DIR}/inlinekw.cpp
DEPENDS genkw ${keyword_files} lib/eclipse/share/keywords/keyword_list.cmake
)

View File

@ -1,16 +0,0 @@
project(opm-parser-applications CXX)
add_executable(opmi opmi.cpp)
target_link_libraries(opmi opmparser)
install(TARGETS opmi DESTINATION ${CMAKE_INSTALL_BINDIR})
set(app_src ${PROJECT_SOURCE_DIR}/opmi.cpp)
get_property(app_includes_all TARGET opmparser PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
foreach(prop ${app_includes_all})
string(REGEX REPLACE "^.*BUILD_INTERFACE:([^>]*)>.*" "\\1" incl "${prop}")
if(NOT incl MATCHES "<")
list(APPEND app_includes ${incl})
endif()
endforeach()
add_static_analysis_tests(app_src app_includes)

View File

@ -0,0 +1,49 @@
# make targets for boost if find module did not do the job
if(NOT TARGET Boost::system)
add_library(Boost::system UNKNOWN IMPORTED)
set_target_properties(Boost::system PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
IMPORTED_LOCATION "${Boost_SYSTEM_LIBRARY}"
IMPORTED_LOCATION_DEBUG "${Boost_SYSTEM_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${Boost_SYSTEM_LIBRARY_RELEASE}"
)
endif()
if(NOT TARGET Boost::filesystem)
add_library(Boost::filesystem UNKNOWN IMPORTED)
set_target_properties(Boost::filesystem PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_COMPILE_DEFINITIONS BOOST_FILESYSTEM_VERSION=3
INTERFACE_LINK_LIBRARIES "${boost_system}"
IMPORTED_LOCATION "${Boost_FILESYSTEM_LIBRARY}"
IMPORTED_LOCATION_DEBUG "${Boost_FILESYSTEM_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${Boost_FILESYSTEM_LIBRARY_RELEASE}"
)
endif()
if(NOT TARGET Boost::regex)
add_library(Boost::regex UNKNOWN IMPORTED)
set_target_properties(Boost::regex PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${boost_system}"
IMPORTED_LOCATION "${Boost_REGEX_LIBRARY}"
IMPORTED_LOCATION_DEBUG "${Boost_REGEX_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${Boost_REGEX_LIBRARY_RELEASE}"
)
endif()
if(NOT TARGET Boost::unit_test_framework)
add_library(Boost::unit_test_framework UNKNOWN IMPORTED)
set_target_properties(Boost::unit_test_framework PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${boost_system}"
IMPORTED_LOCATION "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}"
IMPORTED_LOCATION_DEBUG "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE}"
)
endif()

View File

@ -1,11 +0,0 @@
# Find clang-check.
#
# This module defines:
# CLANGCHECK_PROGRAM, the clang-check executable.
# CLANGHCECK_FOUND, If false, do not try to use cppcheck.
#
find_program(CLANGCHECK_PROGRAM NAMES clang-check clang-check-3.8)
find_package_handle_standard_args(ClangCheck DEFAULT_MSG CLANGCHECK_PROGRAM)
mark_as_advanced(CLANGCHECK_PROGRAM)

View File

@ -1,12 +0,0 @@
# Find CppCheck.
#
# This module defines:
# CPPCHECK_PROGRAM, the cppcheck executable.
# CPPCHECK_FOUND, If false, do not try to use cppcheck.
#
find_program(CPPCHECK_PROGRAM NAMES cppcheck)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CppCheck DEFAULT_MSG CPPCHECK_PROGRAM)
mark_as_advanced(CPPCHECK_PROGRAM)

View File

@ -1,52 +0,0 @@
# Add static analysis tests for a given source file
macro(setup_static_analysis_tools)
find_package(CppCheck)
if(CMAKE_EXPORT_COMPILE_COMMANDS)
find_package(ClangCheck)
else()
message(STATUS "Disabling clang-check as CMAKE_EXPORT_COMPILE_COMMANDS is not enabled")
endif()
if(OPM_COMMON_ROOT)
set(DIR ${OPM_COMMON_ROOT})
elseif(OPM_MACROS_ROOT)
set(DIR ${OPM_MACROS_ROOT})
else()
set(DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(CPPCHECK_FOUND)
file(COPY ${DIR}/cmake/Scripts/cppcheck-test.sh
DESTINATION bin
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS)
configure_file(${DIR}/cmake/Scripts/clang-check-test.sh.in
${CMAKE_BINARY_DIR}/CMakeFiles/clang-check-test.sh)
file(COPY ${CMAKE_BINARY_DIR}/CMakeFiles/clang-check-test.sh
DESTINATION bin
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
set(CPPCHECK_SCRIPT ${PROJECT_BINARY_DIR}/bin/cppcheck-test.sh)
set(CLANGCHECK_SCRIPT ${PROJECT_BINARY_DIR}/bin/clang-check-test.sh)
endmacro()
function(add_static_analysis_tests sources includes)
if(CPPCHECK_FOUND OR (CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS))
foreach(dep ${${includes}})
list(APPEND IPATHS -I ${dep})
endforeach()
foreach(src ${${sources}})
file(RELATIVE_PATH name ${PROJECT_SOURCE_DIR} ${src})
if(CPPCHECK_FOUND AND UNIX)
add_test(NAME cppcheck+${name}
COMMAND ${CPPCHECK_SCRIPT} ${CPPCHECK_PROGRAM} ${src} ${IPATHS}
CONFIGURATIONS analyze cppcheck)
endif()
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS AND UNIX)
add_test(NAME clang-check+${name}
COMMAND ${CLANGCHECK_SCRIPT} ${CLANGCHECK_PROGRAM} ${src}
CONFIGURATIONS analyze clang-check)
endif()
endforeach()
endif()
endfunction()

View File

@ -1,8 +0,0 @@
function ( install_headers header-list prefix )
foreach (header ${header-list})
set( abs_path "${CMAKE_CURRENT_SOURCE_DIR}/${header}")
get_filename_component( path ${abs_path} PATH )
file( RELATIVE_PATH rel_path "${PROJECT_SOURCE_DIR}" "${path}")
install ( FILES ${header} DESTINATION ${prefix}/include/${rel_path} )
endforeach()
endfunction()

View File

@ -1,23 +0,0 @@
#!/bin/bash
# This script performs a single analysis using clang-check
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'ctest -C clang-check' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Source file to process
clangcheck_cmd=$1
source_file=$2
tmpfil=$(mktemp)
$clangcheck_cmd -p @CMAKE_BINARY_DIR@ -analyze $source_file &> $tmpfil
cat $tmpfil
if test -s $tmpfil
then
rm $tmpfil
exit 1
fi
rm $tmpfil
exit 0

View File

@ -1,31 +0,0 @@
#!/bin/bash
# This script performs a single analysis using cppcheck
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'ctest -C cppcheck' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Source file to process
# $3..$N = include path parameters (-I dir1 -I dir2 ...)
cppcheck_cmd=$1
source_file=$2
shift 2
tmpfil=$(mktemp)
$cppcheck_cmd $@ --inline-suppr --enable=all --suppress=unusedFunction $source_file &> $tmpfil
declare -a ignorere
ignorere=(\\[/usr.*\\]
\\[\\*\\]
\\[.*Too.many.\#ifdef)
nmatch=$(cat $tmpfil | grep "\[.*\]" | wc -l)
for RE in ${ignorere[*]}
do
nign=$(cat $tmpfil | grep "$RE" | wc -l)
let "nmatch=$nmatch-$nign"
done
cat $tmpfil
rm $tmpfil
test $nmatch -eq 0 || exit 1

View File

@ -1,13 +0,0 @@
# This file contains checks which are used to implement portable
# utility functions. The results of these check are assembled in the
# generated header "opm_parser_build_config.hpp" - that header is NOT part
# of the public api and it should only be included from source files
# as part of the compilation.
include( CheckFunctionExists )
check_function_exists( symlink OPM_PARSER_BUILD_HAVE_SYMLINK )
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config/opm_parser_build_config.hpp.in ${PROJECT_BINARY_DIR}/opm_parser_build_config.hpp)

View File

@ -1,7 +0,0 @@
// This file contains #define symols which come from feature tests
// during the configure phase. This file should not be part of the
// public api of opm-parser, and it should *only* be included in .cpp
// files.
#cmakedefine OPM_PARSER_BUILD_HAVE_SYMLINK

View File

@ -1,50 +0,0 @@
/* begin opm-parser
put the definitions for config.h specific to
your project here. Everything above will be
overwritten
*/
/* begin private */
/* Name of package */
#define PACKAGE "@DUNE_MOD_NAME@"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@DUNE_MAINTAINER@"
/* Define to the full name of this package. */
#define PACKAGE_NAME "@DUNE_MOD_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@DUNE_MOD_NAME@ @DUNE_MOD_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@DUNE_MOD_NAME@"
/* Define to the home page for this package. */
#define PACKAGE_URL "@DUNE_MOD_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@DUNE_MOD_VERSION@"
/* end private */
/* Define to the version of opm-parser */
#define OPM_PARSER_VERSION "${OPM_PARSER_VERSION}"
/* Define to the major version of opm-parser */
#define OPM_PARSER_VERSION_MAJOR ${OPM_PARSER_VERSION_MAJOR}
/* Define to the minor version of opm-parser */
#define OPM_PARSER_VERSION_MINOR ${OPM_PARSER_VERSION_MINOR}
/* Define to the revision of opm-parser */
#define OPM_PARSER_VERSION_REVISION ${OPM_PARSER_VERSION_REVISION}
/* Specify whether ERT/libecl is available or not */
#cmakedefine HAVE_ERT 1
#cmakedefine HAVE_LIBECL 1
/* begin bottom */
/* end bottom */
/* end opm-parser */

View File

@ -1,8 +0,0 @@
project(opm-cjson C)
add_library(cjson OBJECT cJSON.c)
set_target_properties(cjson PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_include_directories(cjson
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
$<INSTALL_INTERFACE:include>
)

View File

@ -1,28 +0,0 @@
# - CMake version file for opm-parser
#
# Determine if requested version matches exactly or is compatible with
# the installed package. It sets the following variables:
#
# PACKAGE_VERSION Full provided version string
# PACKAGE_VERSION_COMPATIBLE True if version is compatible
# PACKAGE_VERSION_EXACT True if version is exact match
# This file is used by find_package to see if the installed version of a
# package can be used by the client, before the main -config.cmake file
# is loaded.
# see <http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Package_Version_Files>
# this is the version that is installed
set (PACKAGE_VERSION @opm-parser_VERSION_MAJOR@.@opm-parser_VERSION_MINOR@)
# if we wanted this exact version, then everything's fine
if (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
set (PACKAGE_VERSION_EXACT TRUE)
endif (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
# in general, we assume that there is going to be API breakage between
# released versions; this will hopefully change in the future
## compatible versions
#if (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
# set (PACKAGE_VERSION_COMPATIBLE TRUE)
#endif (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)

View File

@ -1,30 +0,0 @@
if(NOT opm-parser_FOUND)
#import the target
if(NOT ecl_DIR)
set(ecl_DIR @ECL_DIR@)
endif()
# Find without registry
find_package(ecl NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
# Fall back to registry
find_package(ecl REQUIRED)
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${_dir}/opm-parser-targets.cmake")
#report other information
set(opm-parser_INSTALLED "@OPM_PARSER_INSTALLED@")
set(opm-parser_PREFIX "@OPM_PARSER_PREFIX@")
set(opm-parser_INCLUDE_DIRS "@OPM_PARSER_INCLUDEDIRS@")
set(opm-parser_LIBRARY_DIRS "@OPM_PARSER_LIBDIRS@")
set(opm-parser_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(opm-parser_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(opm-parser_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@")
set(opm-parser_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(opm-parser_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
set(opm-parser_LIBRARY "@OPM_PARSER_LIBRARY@")
set(opm-parser_LIBRARIES "@OPM_PARSER_LIBRARIES@")
set(opm-parser_MODULE_PATH "@OPM_PARSER_MODULE_PATH@")
set(opm-parser_CONFIG_VARS HAVE_OPM_PARSER)
set(opm-parser_DEFINITIONS -DBOOST_FILESYSTEM_VERSION=3)
set(HAVE_OPM_PARSER 1)
endif(NOT opm-parser_FOUND)

View File

@ -1,15 +0,0 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
CXX=@CMAKE_CXX_COMPILER@
CC=@CMAKE_C_COMPILER@
DEPENDENCIES=
Name: opm-parser
Version: @VERSION@
Description: The opm-parser module
URL: http://www.opm-project.org/
Requires: ${DEPENDENCIES}
Libs: -L${libdir} -lopmparser
Cflags: -I${includedir}

View File

@ -1,320 +0,0 @@
project(opm-parser-eclipse CXX)
set(genkw_SOURCES Parser/createDefaultKeywordList.cpp
Deck/Deck.cpp
Deck/DeckItem.cpp
Deck/DeckKeyword.cpp
Deck/DeckRecord.cpp
Deck/DeckOutput.cpp
Generator/KeywordGenerator.cpp
Generator/KeywordLoader.cpp
Parser/MessageContainer.cpp
Parser/ParseContext.cpp
Parser/ParserEnums.cpp
Parser/ParserItem.cpp
Parser/ParserKeyword.cpp
Parser/ParserRecord.cpp
RawDeck/RawKeyword.cpp
RawDeck/RawRecord.cpp
RawDeck/StarToken.cpp
Units/Dimension.cpp
Units/UnitSystem.cpp
Utility/Stringview.cpp
)
add_executable(genkw ${genkw_SOURCES})
target_link_libraries(genkw opmjson ecl ${boost_regex})
target_include_directories(genkw PRIVATE include)
include( share/keywords/keyword_list.cmake )
string(REGEX REPLACE "([^;]+)" "${CMAKE_CURRENT_SOURCE_DIR}/share/keywords/\\1" keyword_files "${keywords}")
configure_file( keyword_list.argv.in keyword_list.argv )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords.cpp ${CMAKE_CURRENT_BINARY_DIR}/inlinekw.cpp
COMMAND genkw keyword_list.argv
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords.cpp
${CMAKE_CURRENT_BINARY_DIR}/include/
opm/parser/eclipse/Parser/ParserKeywords
${CMAKE_CURRENT_BINARY_DIR}/inlinekw.cpp
DEPENDS genkw ${keyword_files} share/keywords/keyword_list.cmake
)
#-----------------------------------------------------------------
set(opmparser_SOURCES Deck/Deck.cpp
Deck/DeckItem.cpp
Deck/DeckKeyword.cpp
Deck/DeckRecord.cpp
Deck/DeckOutput.cpp
Deck/Section.cpp
EclipseState/checkDeck.cpp
EclipseState/Eclipse3DProperties.cpp
EclipseState/EclipseConfig.cpp
EclipseState/EclipseState.cpp
EclipseState/Aquancon.cpp
EclipseState/EndpointScaling.cpp
EclipseState/Grid/Box.cpp
EclipseState/Grid/BoxManager.cpp
EclipseState/Grid/EclipseGrid.cpp
EclipseState/Grid/FaceDir.cpp
EclipseState/Grid/FaultCollection.cpp
EclipseState/Grid/Fault.cpp
EclipseState/Grid/FaultFace.cpp
EclipseState/Grid/GridDims.cpp
EclipseState/Grid/GridProperties.cpp
EclipseState/Grid/GridProperty.cpp
EclipseState/Grid/MULTREGTScanner.cpp
EclipseState/Grid/NNC.cpp
EclipseState/Grid/PinchMode.cpp
EclipseState/Grid/SatfuncPropertyInitializers.cpp
EclipseState/Grid/setKeywordBox.cpp
EclipseState/Grid/TransMult.cpp
EclipseState/InitConfig/Equil.cpp
EclipseState/InitConfig/InitConfig.cpp
EclipseState/IOConfig/IOConfig.cpp
EclipseState/IOConfig/RestartConfig.cpp
EclipseState/Runspec.cpp
EclipseState/Schedule/Completion.cpp
EclipseState/Schedule/CompletionSet.cpp
EclipseState/Schedule/Events.cpp
EclipseState/Schedule/Group.cpp
EclipseState/Schedule/GroupTree.cpp
EclipseState/Schedule/MessageLimits.cpp
EclipseState/Schedule/MSW/Compsegs.cpp
EclipseState/Schedule/MSW/Segment.cpp
EclipseState/Schedule/MSW/SegmentSet.cpp
EclipseState/Schedule/MSW/updatingCompletionsWithSegments.cpp
EclipseState/Schedule/OilVaporizationProperties.cpp
EclipseState/Schedule/Schedule.cpp
EclipseState/Schedule/ScheduleEnums.cpp
EclipseState/Schedule/TimeMap.cpp
EclipseState/Schedule/Tuning.cpp
EclipseState/Schedule/Well.cpp
EclipseState/Schedule/WellEconProductionLimits.cpp
EclipseState/Schedule/WellInjectionProperties.cpp
EclipseState/Schedule/WellPolymerProperties.cpp
EclipseState/Schedule/WellProductionProperties.cpp
EclipseState/SimulationConfig/SimulationConfig.cpp
EclipseState/SimulationConfig/ThresholdPressure.cpp
EclipseState/SummaryConfig/SummaryConfig.cpp
EclipseState/Tables/ColumnSchema.cpp
EclipseState/Tables/JFunc.cpp
EclipseState/Tables/PvtxTable.cpp
EclipseState/Tables/SimpleTable.cpp
EclipseState/Tables/TableColumn.cpp
EclipseState/Tables/TableContainer.cpp
EclipseState/Tables/TableIndex.cpp
EclipseState/Tables/TableManager.cpp
EclipseState/Tables/TableSchema.cpp
EclipseState/Tables/Tables.cpp
EclipseState/Tables/VFPInjTable.cpp
EclipseState/Tables/VFPProdTable.cpp
Parser/MessageContainer.cpp
Parser/ParseContext.cpp
Parser/Parser.cpp
Parser/ParserEnums.cpp
Parser/ParserItem.cpp
Parser/ParserKeyword.cpp
Parser/ParserRecord.cpp
RawDeck/RawKeyword.cpp
RawDeck/RawRecord.cpp
RawDeck/StarToken.cpp
Units/Dimension.cpp
Units/UnitSystem.cpp
Utility/Functional.cpp
Utility/Stringview.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords.cpp
)
add_library(opmparser ${opmparser_SOURCES})
target_link_libraries(opmparser PUBLIC opmjson
ecl
${Boost_LIBRARIES})
target_compile_definitions(opmparser PRIVATE -DOPM_PARSER_DECK_API=1)
target_include_directories(opmparser
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
${Boost_INCLUDE_DIRS}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
)
set(opmparser_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
${Boost_INCLUDE_DIRS})
list(APPEND opmparser_SOURCES ${genkw_SOURCES})
list(REMOVE_DUPLICATES opmparser_SOURCES)
foreach(src ${opmparser_SOURCES})
if (src MATCHES "^/")
list(APPEND opmparser_SRC ${src})
else()
list(APPEND opmparser_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${src})
endif()
endforeach()
add_static_analysis_tests(opmparser_SRC opmparser_INCLUDES)
install(TARGETS opmparser
EXPORT opm-parser-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/ DESTINATION include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION include
PATTERN *.hpp
)
set_target_properties(opmparser PROPERTIES
VERSION ${opm-parser_VERSION_MAJOR}.${opm-parser_VERSION_MINOR}
SOVERSION ${opm-parser_VERSION_MAJOR}
)
if (NOT BUILD_TESTING)
return ()
endif ()
set(_testdir ${CMAKE_CURRENT_SOURCE_DIR}/tests/data)
add_executable(inlinekw ${CMAKE_CURRENT_BINARY_DIR}/inlinekw.cpp)
target_link_libraries(inlinekw opmparser boost_test)
add_test(NAME InlineKeywordTest COMMAND inlinekw)
add_executable(LoaderTest tests/KeywordLoaderTests.cpp Generator/KeywordLoader.cpp)
target_link_libraries(LoaderTest opmparser boost_test)
add_test(NAME LoaderTest
COMMAND LoaderTest ${_testdir}/parser/keyword-generator/)
add_executable(ParserTests tests/ParserTests.cpp)
target_link_libraries(ParserTests opmparser boost_test)
add_test(NAME ParserTests COMMAND ParserTests ${_testdir}/)
add_executable(ParserIncludeTests tests/ParserIncludeTests.cpp)
target_compile_definitions(ParserIncludeTests PRIVATE
-DHAVE_CASE_SENSITIVE_FILESYSTEM=${HAVE_CASE_SENSITIVE_FILESYSTEM}
)
target_link_libraries(ParserIncludeTests opmparser boost_test)
add_test(NAME ParserIncludeTests COMMAND ParserIncludeTests ${_testdir}/parser/)
add_executable(PvtxTableTests tests/PvtxTableTests.cpp)
target_link_libraries(PvtxTableTests opmparser boost_test)
add_test(NAME PvtxTableTests
COMMAND PvtxTableTests ${_testdir}/integration_tests/)
add_executable(EclipseStateTests tests/EclipseStateTests.cpp)
target_link_libraries(EclipseStateTests opmparser boost_test)
add_test(NAME EclipseStateTests
COMMAND EclipseStateTests ${_testdir}/integration_tests/)
foreach(test ADDREGTests
AqudimsTests
AquanconTests
BoxTests
ColumnSchemaTests
CompletionTests
COMPSEGUnits
CopyRegTests
DeckTests
DynamicStateTests
DynamicVectorTests
Eclipse3DPropertiesTests
EclipseGridTests
EqualRegTests
EventTests
FaceDirTests
FaultTests
FunctionalTests
GeomodifierTests
GridPropertyTests
GroupTests
InitConfigTest
IOConfigTests
MessageContainerTest
MessageLimitTests
MultiRegTests
MultisegmentWellTests
MULTREGTScannerTests
OrderedMapTests
ParseContextTests
PORVTests
RawKeywordTests
RestartConfigTests
RunspecTests
SatfuncPropertyInitializersTests
ScheduleTests
SectionTests
SimpleTableTests
SimulationConfigTest
StarTokenTests
StringTests
SummaryConfigTests
TabdimsTests
TableColumnTests
TableContainerTests
TableManagerTests
TableSchemaTests
ThresholdPressureTest
TimeMapTest
TransMultTests
TuningTests
UnitTests
ValueTests
WellSolventTests
WellTests
)
add_executable(${test} tests/${test}.cpp)
target_link_libraries(${test} opmparser boost_test)
add_test(NAME ${test} COMMAND ${test})
endforeach ()
foreach (test BoxTest
CheckDeckValidity
CompletionsFromDeck
EclipseGridCreateFromDeck
IncludeTest
IntegrationTests
IOConfigIntegrationTest
NNCTests
ParseKEYWORD
ParseDATAWithDefault
Polymer
ResinsightTest
ScheduleCreateFromDeck
TransMultIntegrationTests
)
add_executable(${test} tests/integration/${test}.cpp)
target_link_libraries(${test} opmparser boost_test)
add_test(NAME ${test} COMMAND ${test} ${_testdir}/integration_tests/)
endforeach ()
add_executable(parse_write tests/integration/parse_write.cpp)
target_link_libraries(parse_write opmparser boost_test)
if (NOT HAVE_OPM_DATA)
return ()
endif ()
foreach (deck ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE1CASE2_SOLVENT.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE9_CP_SOLVENT_CO2.DATA
${OPM_DATA_ROOT}/spe5/SPE5CASE1.DATA
${OPM_DATA_ROOT}/polymer_simple2D/2D_THREEPHASE_POLY_HETER.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_FAMII.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_SLGOF.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE1.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE2.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP_GROUP.DATA
${OPM_DATA_ROOT}/spe9/SPE9.DATA
${OPM_DATA_ROOT}/spe10model1/SPE10_MODEL1.DATA
${OPM_DATA_ROOT}/spe10model2/SPE10_MODEL2.DATA
${OPM_DATA_ROOT}/msw_2d_h/2D_H__.DATA )
get_filename_component(test_name ${deck} NAME_WE)
add_test(NAME ${test_name} COMMAND parse_write ${deck})
endforeach()
set_property(TEST NORNE_ATW2013
PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")

View File

@ -1,25 +0,0 @@
install( DIRECTORY keywords DESTINATION ${CMAKE_INSTALL_PREFIX}/share/opm/parser/eclipse)
#-----------------------------------------------------------------
# The install() command above will recursively install all the files and
# directories below the current directory. This will potentially include
# editor backup files and other garbage.
#
# An alternative which queries git for files to install is:
#
# execute_process( COMMAND git ls-tree --name-only -r HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE KEYWORD_LIST_STRING)
# string(REPLACE "\n" ";" KEYWORD_LIST ${KEYWORD_LIST_STRING})
#
# foreach( keyword ${KEYWORD_LIST} )
# install( FILES ${keyword} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/opm/parser/eclipse RENAME ${keyword})
# endforeach()
#
# The disadvantage with this is approach is that:
#
# 1. You must be building from a proper git clone, and can not build
# from e.g. a .tar.gz distribution
#
# 2. The list of files is configured during the cmake configure
# process, and will typically be out of sync if you have added more
# keywords.
#-----------------------------------------------------------------

View File

@ -1,41 +0,0 @@
add_definitions( -DKEYWORD_DIRECTORY="${PROJECT_SOURCE_DIR}/opm/parser/share/keywords/000_Eclipse100")
foreach(tapp TransMultIntegrationTests CheckDeckValidity IntegrationTests ParseWellProbe
ParseDEBUG ParseTITLE ParseTOPS ParseWCONHIST ParseWellWithWildcards
ParsePORO ParsePLYVISC ParsePLYDHFLF ParsePLYSHLOG ParseDATAWithDefault
ParseTVDP ParseDENSITY ParseVFPPROD ParsePRORDER ScheduleCreateFromDeck
CompletionsFromDeck ParseEND ParseLGR ParseTRACERS IncludeTest ParseEQUIL
ParseRSVD ParsePVTG ParsePVTO ParseSWOF ParseCOORDSYS ParseGRUPRIG BoxTest
ParseMULTREGT ParseSGOF ParseSLGOF EclipseGridCreateFromDeck NNCTests
ResinsightTest IOConfigIntegrationTest ParseCECON ParseWDFACCOR
ParseWORKLIM ParseTUNINGDP
ParseWEFAC Polymer ParsePLYADSS ParseMULTSEGWELL ParseMiscible)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()
if (HAVE_OPM_DATA)
foreach( test_deck ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE1CASE2_SOLVENT.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE9_CP_SOLVENT_CO2.DATA
${OPM_DATA_ROOT}/spe5/SPE5CASE1.DATA
${OPM_DATA_ROOT}/polymer_simple2D/2D_THREEPHASE_POLY_HETER.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_FAMII.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_SLGOF.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE1.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE2.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP_GROUP.DATA
${OPM_DATA_ROOT}/spe9/SPE9.DATA
${OPM_DATA_ROOT}/spe10model1/SPE10_MODEL1.DATA
${OPM_DATA_ROOT}/spe10model2/SPE10_MODEL2.DATA
${OPM_DATA_ROOT}/msw_2d_h/2D_H__.DATA )
get_filename_component( test_name ${test_deck} NAME_WE )
add_test( NAME ${test_name} COMMAND opmi ${test_deck})
endforeach()
set_property(TEST NORNE_ATW2013 PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")
endif()