Files
ResInsight/ApplicationCode/FileInterface/FileInterface_UnitTests/CMakeLists.txt
2012-06-26 16:10:41 +02:00

151 lines
4.7 KiB
CMake

cmake_minimum_required (VERSION 2.8)
SET (ProjectName FileInterface_UnitTests)
project ( ${ProjectName} )
# Qt
find_package (Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
include (${QT_USE_FILE})
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set ( ERT_ROOT "Ert" )
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set ( ERT_ROOT "Ert-windows" )
endif()
include_directories(
${LibCore_SOURCE_DIR}
${LibGeometry_SOURCE_DIR}
${LibRender_SOURCE_DIR}
${LibViewing_SOURCE_DIR}
${ResInsight_SOURCE_DIR}/ApplicationCode
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel
${ResInsight_SOURCE_DIR}/ApplicationCode/FileInterface
${ResInsight_SOURCE_DIR}/ApplicationCode/ProjectDataModel
${ResInsight_SOURCE_DIR}/ThirdParty
${ResInsight_SOURCE_DIR}/cafProjectDataModel
${ResInsight_SOURCE_DIR}/CommonCode
${ResInsight_SOURCE_DIR}/ThirdParty/${ERT_ROOT}/ecl/include
${ResInsight_SOURCE_DIR}/ThirdParty/${ERT_ROOT}/util/include
${ResInsight_SOURCE_DIR}/ThirdParty/${ERT_ROOT}/well/include
)
set( FILEINTERFACE_CPP_SOURCES
../RifEclipseInputFileTools.cpp
../RifEclipseOutputFileTools.cpp
../RifEclipseRestartFilesetAccess.cpp
../RifEclipseRestartDataAccess.cpp
../RifEclipseUnifiedRestartFileAccess.cpp
../RifReaderEclipseOutput.cpp
../RifReaderEclipseInput.cpp
../RifReaderMockModel.cpp
)
set( RESERVOIRDATAMODEL_CPP_SOURCES
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigCell.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigGridBase.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigLocalGrid.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoir.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigWellResults.cpp
${ResInsight_SOURCE_DIR}/cafUserInterface/cafProgressInfo.cpp
)
set( CPP_SOURCES
${FILEINTERFACE_CPP_SOURCES}
${RESERVOIRDATAMODEL_CPP_SOURCES}
)
source_group( "FileInterface" FILES ${FILEINTERFACE_CPP_SOURCES} )
source_group( "ReservoirDataModel" FILES ${RESERVOIRDATAMODEL_CPP_SOURCES} )
set( UNIT_TEST_CPP_SOURCES
main.cpp
RifReaderEclipseOutput-Test.cpp
Ert-Test.cpp
)
set( LINK_LIBRARIES
CommonCode
LibViewing
LibRender
LibGeometry
LibCore
${QT_LIBRARIES}
)
add_executable( ${ProjectName}
${CPP_SOURCES}
${UNIT_TEST_CPP_SOURCES}
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set ( EXTERNAL_LINK_LIBRARIES
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/ecl/lib/libecl.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/util/lib/libutil.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/geometry/lib/libgeometry.a
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert/well/lib/libwell.a
lapack
)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set ( EXTERNAL_LINK_LIBRARIES
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert-windows/ecl/lib/libecl.lib
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert-windows/util/lib/libutil.lib
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert-windows/geometry/lib/libgeometry.lib
${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert-windows/well/lib/libwell.lib
)
endif()
target_link_libraries( ${ProjectName} ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
# Copy Dlls
if (MSVC)
# Qt DLLs
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd)
foreach (qtlib ${QTLIBLIST})
add_custom_command(TARGET ${ProjectName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${QT_BINARY_DIR}/${qtlib}4.dll"
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
endforeach( qtlib )
# DLLs ERT depends on
add_custom_command(TARGET ${ProjectName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/../../../ThirdParty/Ert-windows/bin/"
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
# ERT DLLs
set (ERT_MODULES ecl geometry util well)
foreach (ert_module ${ERT_MODULES})
add_custom_command(TARGET ${ProjectName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/../../../ThirdParty/Ert-windows/${ert_module}/lib/lib${ert_module}.dll"
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
endforeach()
endif(MSVC)