Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add float32 array EclSum.to_numpy #820

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
cmake_minimum_required(
VERSION 2.8.12) # If you are creating Python wrappers for Windows, the actual
# version requirement is 3.4
cmake_minimum_required(VERSION 3.12)
project(ecl C CXX)

include(GNUInstallDirs)
include(TestBigEndian)

if(NOT DEFINED CMAKE_MACOSX_RPATH)
# There is some weirdness around this variable, the default value is different
# depending on the cmake version, see policy CMP0042. A more explicit way to
# treat this would be `cmake_policy(SET CMP0042 NEW)` but that would fail on
# CMake 2.8.12 (the variable exists but the policy doesn't)
set(CMAKE_MACOSX_RPATH ON)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

# -----------------------------------------------------------------

Expand Down Expand Up @@ -174,7 +167,6 @@ if(MSVC)
endif()

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
find_package(CXX11Features)

# -----------------------------------------------------------------

Expand Down Expand Up @@ -402,21 +394,37 @@ if(ENABLE_PYTHON AND ERT_WINDOWS)
endif()
endif()

if(ENABLE_PYTHON)
# If finding the Python interpreter and required packages fails in the
# python/CMakeLists.txt file the ENABLE_PYTHON will be set to OFF.
add_subdirectory(python)
endif()

if(ENABLE_PYTHON)
if(NOT ${BUILD_SHARED_LIBS})
message(FATAL_ERROR "The Python wrappers require shared libraries")
endif()
endif()

if(NOT SKBUILD)
# Avoid installing when calling from python setup.py
if(SKBUILD)
# Building from Python
install(TARGETS ecl LIBRARY DESTINATION python/ecl/.libs)
install(TARGETS _native DESTINATION python/ecl)
install(DIRECTORY lib/include/ DESTINATION python/ecl/.include)
install(DIRECTORY ${CMAKE_BINARY_DIR}/lib/include/
DESTINATION python/ecl/.include)
if(APPLICATIONS)
install(TARGETS ${APPLICATIONS} RUNTIME DESTINATION python/ecl/.bin)
endif()
else()
install(EXPORT ecl-config DESTINATION share/cmake/ecl)
export(TARGETS ecl FILE eclConfig.cmake)
export(PACKAGE ecl)

install(
TARGETS ecl
EXPORT ecl-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(APPLICATIONS)
install(TARGETS ${APPLICATIONS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
14 changes: 5 additions & 9 deletions applications/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
project(libecl-applications)

function(target_link_libecl target)
target_link_libraries(${target} ecl)
if(SKBUILD)
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN/../.libs")
endif()
target_link_libraries(${target} ecl-static)
endfunction()

if(BUILD_APPLICATIONS)
Expand Down Expand Up @@ -94,9 +91,8 @@ if(apps)
PROPERTY LINK_FLAGS ${OpenMP_C_FLAGS})
endforeach()
endif()
install(
TARGETS ${apps}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

set(APPLICATIONS
${apps}
PARENT_SCOPE)
endif()
25 changes: 0 additions & 25 deletions cmake/Modules/FindCXX11Features.cmake

This file was deleted.

220 changes: 120 additions & 100 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,93 +57,97 @@ configure_file(ert_api_config.h.in include/ert/util/ert_api_config.h)
configure_file(build_config.hpp.in include/ert/util/build_config.hpp)
configure_file(ert_api_config.hpp.in include/ert/util/ert_api_config.hpp)

add_library(
ecl
util/rng.cpp
util/lookup_table.cpp
util/statistics.cpp
util/mzran.cpp
util/hash_node.cpp
util/hash_sll.cpp
util/path.cpp
util/hash.cpp
util/node_data.cpp
util/node_ctype.cpp
util/util.cpp
util/util_symlink.cpp
util/util_lfs.c
util/util_unlink.cpp
util/vector.cpp
util/parser.cpp
util/stringlist.cpp
util/buffer.cpp
util/string_util.cpp
util/type_vector_functions.cpp
util/ecl_version.cpp
util/perm_vector.cpp
util/test_util.cpp
util/cxx_string_util.cpp
${opt_srcs}
ecl/ecl_rsthead.cpp
ecl/ecl_sum_tstep.cpp
ecl/ecl_rst_file.cpp
ecl/ecl_init_file.cpp
ecl/ecl_grid_cache.cpp
ecl/smspec_node.cpp
ecl/ecl_kw_grdecl.cpp
ecl/ecl_file_kw.cpp
ecl/ecl_file_view.cpp
ecl/ecl_grav.cpp
ecl/ecl_grav_calc.cpp
ecl/ecl_smspec.cpp
ecl/ecl_unsmry_loader.cpp
ecl/ecl_sum_data.cpp
ecl/ecl_sum_file_data.cpp
ecl/ecl_util.cpp
ecl/ecl_kw.cpp
ecl/ecl_sum.cpp
ecl/ecl_sum_vector.cpp
ecl/fortio.c
ecl/ecl_rft_file.cpp
ecl/ecl_rft_node.cpp
ecl/ecl_rft_cell.cpp
ecl/ecl_grid.cpp
ecl/ecl_coarse_cell.cpp
ecl/ecl_box.cpp
ecl/ecl_io_config.cpp
ecl/ecl_file.cpp
ecl/ecl_region.cpp
ecl/ecl_subsidence.cpp
ecl/ecl_grid_dims.cpp
ecl/grid_dims.cpp
ecl/nnc_info.cpp
ecl/ecl_grav_common.cpp
ecl/nnc_vector.cpp
ecl/ecl_nnc_export.cpp
ecl/ecl_nnc_data.cpp
ecl/ecl_nnc_geometry.cpp
ecl/layer.cpp
ecl/fault_block.cpp
ecl/fault_block_layer.cpp
ecl/ecl_type.cpp
ecl/ecl_type_python.cpp
ecl/well_state.cpp
ecl/well_conn.cpp
ecl/well_info.cpp
ecl/well_ts.cpp
ecl/well_conn_collection.cpp
ecl/well_segment.cpp
ecl/well_segment_collection.cpp
ecl/well_branch_collection.cpp
ecl/well_rseg_loader.cpp
ecl/FortIO.cpp
ecl/EclFilename.cpp
geometry/geo_surface.cpp
geometry/geo_util.cpp
geometry/geo_pointset.cpp
geometry/geo_region.cpp
geometry/geo_polygon.cpp
geometry/geo_polygon_collection.cpp)
set(ECL_SOURCES
util/rng.cpp
util/lookup_table.cpp
util/statistics.cpp
util/mzran.cpp
util/hash_node.cpp
util/hash_sll.cpp
util/path.cpp
util/hash.cpp
util/node_data.cpp
util/node_ctype.cpp
util/util.cpp
util/util_symlink.cpp
util/util_lfs.c
util/util_unlink.cpp
util/vector.cpp
util/parser.cpp
util/stringlist.cpp
util/buffer.cpp
util/string_util.cpp
util/type_vector_functions.cpp
util/ecl_version.cpp
util/perm_vector.cpp
util/test_util.cpp
util/cxx_string_util.cpp
${opt_srcs}
ecl/ecl_rsthead.cpp
ecl/ecl_sum_tstep.cpp
ecl/ecl_rst_file.cpp
ecl/ecl_init_file.cpp
ecl/ecl_grid_cache.cpp
ecl/smspec_node.cpp
ecl/ecl_kw_grdecl.cpp
ecl/ecl_file_kw.cpp
ecl/ecl_file_view.cpp
ecl/ecl_grav.cpp
ecl/ecl_grav_calc.cpp
ecl/ecl_smspec.cpp
ecl/ecl_unsmry_loader.cpp
ecl/ecl_sum_data.cpp
ecl/ecl_sum_file_data.cpp
ecl/ecl_util.cpp
ecl/ecl_kw.cpp
ecl/ecl_sum.cpp
ecl/ecl_sum_vector.cpp
ecl/fortio.c
ecl/ecl_rft_file.cpp
ecl/ecl_rft_node.cpp
ecl/ecl_rft_cell.cpp
ecl/ecl_grid.cpp
ecl/ecl_coarse_cell.cpp
ecl/ecl_box.cpp
ecl/ecl_io_config.cpp
ecl/ecl_file.cpp
ecl/ecl_region.cpp
ecl/ecl_subsidence.cpp
ecl/ecl_grid_dims.cpp
ecl/grid_dims.cpp
ecl/nnc_info.cpp
ecl/ecl_grav_common.cpp
ecl/nnc_vector.cpp
ecl/ecl_nnc_export.cpp
ecl/ecl_nnc_data.cpp
ecl/ecl_nnc_geometry.cpp
ecl/layer.cpp
ecl/fault_block.cpp
ecl/fault_block_layer.cpp
ecl/ecl_type.cpp
ecl/ecl_type_python.cpp
ecl/well_state.cpp
ecl/well_conn.cpp
ecl/well_info.cpp
ecl/well_ts.cpp
ecl/well_conn_collection.cpp
ecl/well_segment.cpp
ecl/well_segment_collection.cpp
ecl/well_branch_collection.cpp
ecl/well_rseg_loader.cpp
ecl/FortIO.cpp
ecl/EclFilename.cpp
geometry/geo_surface.cpp
geometry/geo_util.cpp
geometry/geo_pointset.cpp
geometry/geo_region.cpp
geometry/geo_polygon.cpp
geometry/geo_polygon_collection.cpp)

add_library(ecl-static STATIC ${ECL_SOURCES})
set_property(TARGET ecl-static PROPERTY POSITION_INDEPENDENT_CODE ON)

add_library(ecl SHARED ${ECL_SOURCES})

if(ERT_WINDOWS)
set_target_properties(ecl PROPERTIES PREFIX "lib")
Expand All @@ -152,9 +156,20 @@ if(ERT_WINDOWS)
endif()
endif()

target_link_libraries(ecl-static PUBLIC ${m} ${dl} ${pthread} ${blas} ${zlib}
${shlwapi})
target_link_libraries(ecl PUBLIC ${m} ${dl} ${pthread} ${blas} ${zlib}
${shlwapi})

target_include_directories(
ecl-static
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE ${ZLIB_INCLUDE_DIRS} util include
${CMAKE_CURRENT_SOURCE_DIR}/private-include
${CMAKE_CURRENT_BINARY_DIR}/include)

target_include_directories(
ecl
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand All @@ -164,6 +179,15 @@ target_include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/private-include
${CMAKE_CURRENT_BINARY_DIR}/include)

target_compile_definitions(
ecl-static
PRIVATE -DGIT_COMMIT=${GIT_COMMIT}
-DGIT_COMMIT_SHORT=${GIT_COMMIT_SHORT}
-DECL_VERSION_MAJOR=${ECL_VERSION_MAJOR}
-DECL_VERSION_MINOR=${ECL_VERSION_MINOR}
-DECL_VERSION_MICRO=${ECL_VERSION_MICRO}
$<$<BOOL:${BIG_ENDIAN}>:HOST_BIG_ENDIAN>)

target_compile_definitions(
ecl
PRIVATE -DGIT_COMMIT=${GIT_COMMIT}
Expand All @@ -184,19 +208,15 @@ if(ERT_USE_OPENMP)
target_link_libraries(ecl PUBLIC ${OpenMP_EXE_LINKER_FLAGS})
endif()

set_target_properties(
ecl PROPERTIES VERSION ${ECL_VERSION_MAJOR}.${ECL_VERSION_MINOR}
SOVERSION ${ECL_VERSION_MAJOR})
if(NOT SKBUILD)
set_target_properties(
ecl PROPERTIES VERSION ${ECL_VERSION_MAJOR}.${ECL_VERSION_MINOR}
SOVERSION ${ECL_VERSION_MAJOR})
endif()

install(
TARGETS ecl
EXPORT ecl-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(SKBUILD)
add_subdirectory(python-binding)
endif()

if(NOT BUILD_TESTS)
return()
Expand Down Expand Up @@ -363,7 +383,7 @@ foreach(
well_segment_collection
ecl_file)
add_executable(${name} ecl/tests/${name}.cpp)
target_link_libraries(${name} ecl)
target_link_libraries(${name} ecl-static)
target_include_directories(
${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/private-include)
add_test(NAME ${name} COMMAND ${name})
Expand Down
Loading