From 0881fece8b74ec4af56e62b00ff088abc5fc6f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Mon, 22 Feb 2016 16:03:25 +0100 Subject: [PATCH] Initial commit. Travis, dune and cmake support. --- .travis.yml | 33 +++++++++++++++++++ .../CheckCaseSensitiveFileSystem.cmake | 29 ++++++++++++++++ cmake/Modules/install_headers.cmake | 8 +++++ opm/output/CMakeLists.txt | 16 +++++++++ opm/output/Output.cpp | 0 opm/output/Output.hpp | 0 travis/build-and-test-opm-output.sh | 8 +++++ travis/build-opm-output.sh | 10 ++++++ 8 files changed, 104 insertions(+) create mode 100644 .travis.yml create mode 100644 cmake/Modules/CheckCaseSensitiveFileSystem.cmake create mode 100644 cmake/Modules/install_headers.cmake create mode 100644 opm/output/CMakeLists.txt create mode 100644 opm/output/Output.cpp create mode 100644 opm/output/Output.hpp create mode 100755 travis/build-and-test-opm-output.sh create mode 100755 travis/build-opm-output.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..54e751acf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +language: cpp + +compiler: + - gcc + +addons: + apt: + sources: + - boost-latest + - ubuntu-toolchain-r-test + packages: + - libboost1.55-all-dev + - gcc-4.8 + - g++-4.8 + - gfortran-4.8 + - liblapack-dev + - libgmp3-dev + - libsuitesparse-dev + - libeigen3-dev + +install: + - export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8" + - cd .. + + - git clone https://github.com/OPM/opm-common.git + - git clone https://github.com/OPM/opm-parser.git + + - opm-parser/travis/clone-and-build-ert.sh + + - opm-common/travis/build-opm-common.sh + - opm-parser/travis/build-opm-parser.sh + +script: opm-output/travis/build-and-test-opm-core.sh diff --git a/cmake/Modules/CheckCaseSensitiveFileSystem.cmake b/cmake/Modules/CheckCaseSensitiveFileSystem.cmake new file mode 100644 index 000000000..8e3581a62 --- /dev/null +++ b/cmake/Modules/CheckCaseSensitiveFileSystem.cmake @@ -0,0 +1,29 @@ +# +# Module to check whether the file system is case sensitive or not +# +# Sets the following variable: +# +# HAVE_CASE_SENSITIVE_FILESYSTEM True if the file system honors the case of files + +message(STATUS "Checking whether the file system is case-sensitive") +# create a file containing uppercase characters +file(WRITE "${CMAKE_BINARY_DIR}/UPPER" "Foo") + +# check if the all-lowercase file with the same name can be opened +set(FooContents "") +if (EXISTS "${CMAKE_BINARY_DIR}/upper") + file(READ "${CMAKE_BINARY_DIR}/upper" FooContents) +endif() + +# remove the file again in order not to have it dangling around... +file(REMOVE "${CMAKE_BINARY_DIR}/UPPER") + +# check the contents of the file opened with lower-case. If it is +# empty, the file system is case sensitive. +if ("${FooContents}" STREQUAL "Foo") + message(STATUS "File system is not case-sensitive") + set(HAVE_CASE_SENSITIVE_FILESYSTEM 0) +else() + message(STATUS "File system is case-sensitive") + set(HAVE_CASE_SENSITIVE_FILESYSTEM 1) +endif() diff --git a/cmake/Modules/install_headers.cmake b/cmake/Modules/install_headers.cmake new file mode 100644 index 000000000..dc962da1d --- /dev/null +++ b/cmake/Modules/install_headers.cmake @@ -0,0 +1,8 @@ +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() \ No newline at end of file diff --git a/opm/output/CMakeLists.txt b/opm/output/CMakeLists.txt new file mode 100644 index 000000000..e98288f4f --- /dev/null +++ b/opm/output/CMakeLists.txt @@ -0,0 +1,16 @@ +set( SOURCE_FILES +Output.cpp +) + +set( HEADER_FILES +Output.hpp +) + +add_library(opmoutput ${SOURCE_FILES}) +target_link_libraries(opmoutput ${ERT_LIBRARIES}) +set_target_properties(opmoutput PROPERTIES VERSION ${opm-output_VERSION_MAJOR}.${opm-output_VERSION_MINOR} + SOVERSION ${opm-output_VERSION_MAJOR}) + +include(${PROJECT_SOURCE_DIR}/cmake/Modules/install_headers.cmake) +install_headers("${HEADER_FILES}" "${CMAKE_INSTALL_PREFIX}") +install(TARGETS opmoutput DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/opm/output/Output.cpp b/opm/output/Output.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/opm/output/Output.hpp b/opm/output/Output.hpp new file mode 100644 index 000000000..e69de29bb diff --git a/travis/build-and-test-opm-output.sh b/travis/build-and-test-opm-output.sh new file mode 100755 index 000000000..5609b1de8 --- /dev/null +++ b/travis/build-and-test-opm-output.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e + +pushd . > /dev/null +opm-output/travis/build-opmoutput- +cd opm-core/build +ctest --output-on-failure +popd > /dev/null diff --git a/travis/build-opm-output.sh b/travis/build-opm-output.sh new file mode 100755 index 000000000..8ea73aed9 --- /dev/null +++ b/travis/build-opm-output.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e + +pushd . > /dev/null +cd opm-output +mkdir build +cd build +cmake ../ +make +popd > /dev/null