Skip to content

Commit

Permalink
Merge pull request #354 from F2I-Consulting/dev
Browse files Browse the repository at this point in the history
v2.12.0.0
  • Loading branch information
philippeVerney authored Nov 28, 2024
2 parents a3e3015 + 04d4506 commit 08a5d07
Show file tree
Hide file tree
Showing 40 changed files with 2,302 additions and 1,141 deletions.
60 changes: 44 additions & 16 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,40 @@ jobs:
with:
name: ubuntu-20.04-${{ matrix.cxx }}
path: ${{ runner.temp }}/fesapi-install
build_wheels_windows:
name: Build wheels on windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Stub `setup.py` check
# It will be generated during CMake run
# https://github.com/pypa/cibuildwheel/issues/1139
run: touch python/setup.py
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: cp38-win_amd64 cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64 cp313-win_amd64
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL: >
%VCPKG_INSTALLATION_ROOT%\vcpkg install boost-uuid minizip hdf5[zlib] &&
cd ${{ runner.temp }} &&
mkdir fesapi-build &&
cd fesapi-build &&
cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -G"Visual Studio 17 2022" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/fesapi-install ${{ github.workspace }} &&
cmake --build . --config Release -j2 &&
cmake --build . --config Release --target INSTALL &&
pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
delvewheel repair --add-path ${{ runner.temp }}\fesapi-build\Release --namespace-pkg fesapi -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: python ${{github.workspace}}\python\example\example.py
with:
package-dir: ./python
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-windows
path: ./wheelhouse/*.whl
build_wheels_linux:
name: Build wheels on ubuntu-latest
runs-on: ubuntu-latest
Expand All @@ -176,28 +210,20 @@ jobs:
# https://github.com/pypa/cibuildwheel/issues/1139
run: touch python/setup.py
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.2
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: cp38-manylinux_* cp39-manylinux_* cp310-manylinux_* cp311-manylinux_* cp312-manylinux_* cp313-manylinux_*
CIBW_ARCHS: auto64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BEFORE_ALL: >
yum install -y wget minizip-devel gcc-c++ boost-devel &&
yum install -y wget gcc-c++ boost-devel &&
yum search epel-release &&
yum info epel-release &&
yum install -y epel-release &&
yum --enablerepo=epel install -y cmake3 &&
cd / &&
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.3/src/hdf5-1.12.3.tar.gz &&
tar xf hdf5-1.12.3.tar.gz &&
mkdir hdf5-build &&
cd hdf5-build &&
cmake3 -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DCMAKE_INSTALL_PREFIX:STRING=/hdf5-install ../hdf5-1.12.3 &&
cmake3 --build . -j2 --config Release &&
cmake3 --install . &&
cd / &&
yum --enablerepo=epel install -y minizip1.2-devel hdf5-devel cmake3 &&
mkdir build &&
cd build &&
cmake3 -DCMAKE_BUILD_TYPE=Release -DHDF5_ROOT=/hdf5-install -DHDF5_USE_STATIC_LIBRARIES=TRUE -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX:STRING=/fesapi-install {project} &&
cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON_WRAPPING=TRUE -DCMAKE_INSTALL_PREFIX:STRING=/fesapi-install {project} &&
cmake3 --build . -j2 --config Release &&
cmake3 --install .
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
Expand All @@ -209,7 +235,7 @@ jobs:
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-ubuntu-latest
name: cibw-wheels-manylinux_2_28
path: ./wheelhouse/*.whl
build_wheels_mac:
name: Build wheels on macos-14
Expand All @@ -221,10 +247,12 @@ jobs:
# https://github.com/pypa/cibuildwheel/issues/1139
run: touch python/setup.py
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.2
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: cp38-macosx_* cp39-macosx_* cp310-macosx_* cp311-macosx_* cp312-macosx_* cp313-macosx_*
CIBW_ARCHS: auto64
# See https://cibuildwheel.pypa.io/en/stable/cpp_standards/#macos-and-deployment-target-versions
MACOSX_DEPLOYMENT_TARGET: 10.14
CIBW_BEFORE_ALL: >
brew install boost swig &&
git clone https://github.com/F2I-Consulting/Minizip.git ${{ github.workspace }}/../minizip &&
Expand Down Expand Up @@ -256,7 +284,7 @@ jobs:
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-macos-14
name: cibw-wheels-macosx_arm64
path: ./wheelhouse/*.whl
ubuntu-20-mpi:
runs-on: ubuntu-20.04
Expand Down
33 changes: 4 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set (FESAPI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

# version mechanism
set (Fesapi_VERSION_MAJOR 2)
set (Fesapi_VERSION_MINOR 11)
set (Fesapi_VERSION_MINOR 12)
set (Fesapi_VERSION_PATCH 0)
set (Fesapi_VERSION_TWEAK 0)

Expand All @@ -31,7 +31,7 @@ IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
ENDIF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -94,33 +94,8 @@ IF (NOT EXISTS ${SZIP_LIBRARY_DEBUG} AND WIN32 AND NOT ${HDF5_BUILT_AS_DYNAMIC_L
MESSAGE(WARNING "The Szip library (SZIP_LIBRARY_DEBUG variable) does not look to be a valid file. Please modify it.")
ENDIF ()

# Boost DEPENDENCY : Uuid (and potentially regex)
unset(CAN_USE_STD_REGEX CACHE)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles(
"#include <iostream>
//https://gcc.gnu.org/develop.html#timeline
int a =
#if !defined(__GLIBCXX__) || __GLIBCXX__ > 20150623 || __GLIBCXX__ == 20140422 || __GLIBCXX__ == 20140716 || __GLIBCXX__ == 20141030
1;
#else
fgsfds;
#endif
int main ()
{
return 0;
}"

CAN_USE_STD_REGEX
)
if (NOT CAN_USE_STD_REGEX)
find_package(Boost 1.44.0 REQUIRED regex) # 1.44 because we want boost::uuids::to_string method
else ()
find_package(Boost 1.44.0 REQUIRED) # 1.44 because we want boost::uuids::to_string method
endif()
# Boost DEPENDENCY
find_package(Boost 1.44.0 REQUIRED) # 1.44 because we want boost::uuids::to_string method

# ============================================================================
# some useful variables
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
- build
- fesapi (Git clone this repository into this folder "fesapi". You should then have a path fesapiEnv/fesapi/src)
- dependencies
- The following compilers are known to work (used in CI)
- gcc from version 4.8
- visual studio from version 2017
- The following compilers are known to work
- gcc from version 8
- visual studio from version 2019
- clang from version 5.0

# Prepare the dependencies
Download (build and install if necessary) third party libraries:
- HDF5: Versions of 1.8.* (starting from 1.8.18), 1.10.* ([starting from 1.10.2](https://www.hdfgroup.org/2018/04/why-should-i-care-about-the-hdf5-1-10-2-release/)), all 1.12.* and all 1.14.* should be ok. https://support.hdfgroup.org/ftp/HDF5/releases/
- MINIZIP : Version 1.1 is needed : it is the official version included in [current zlib distribution](https://www.zlib.net/) (look into "contrib" folder). You can directly install minizip development package on most of Linux distributions (https://packages.ubuntu.com/xenial/libminizip-dev). On Windows (or older Linux distributions), you can copy the CMakeLists.txt file from fesapi/cmake/minizip to the zlib minizip directory to help you to build minizip (we also provide a copy of minizip 1.1 with cmake files on github : https://github.com/F2I-Consulting/Minizip). It is also highly recommended to link minizip to the same zlib library than the one associated to your HDF5 library.
- BOOST : Starting from version 1.44.0 (and at least 1.67.0 if you don't want to face [valgrid false positives](https://www.boost.org/doc/libs/1_66_0/libs/uuid/doc/uuid.html#Design%20notes)). FYI, on windows, boost uuid depends on bcrypt library.
- BOOST (uuid) : Starting from version 1.44.0 (and at least 1.67.0 if you don't want to face [valgrid false positives](https://www.boost.org/doc/libs/1_66_0/libs/uuid/doc/uuid.html#Design%20notes)). FYI, on windows, boost uuid depends on bcrypt library.

We advise you to install these third party libraries respectively into
- fesapiEnv/dependencies/hdf5-particularVersion
Expand Down
60 changes: 60 additions & 0 deletions cmake/pyproject.toml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = 'fesapi'
version = '${Fesapi_PYTHON_VERSION}'
authors = [
{name = "F2I-CONSULTING"},
]
maintainers = [
{name = "F2I-CONSULTING"},
]
description = "A library for using the Energistics data standards"
readme = "README.md"
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Application Frameworks ',
'Topic :: File Formats',
]
keywords = [
"energistics",
"resqml",
"eml",
"witsml",
"prodml",
"osdu",
"rddms",
]
requires-python = ">=3.8"

[project.urls]
source = "https://github.com/F2I-Consulting/fesapi/issues"
releasenotes = "https://github.com/F2I-Consulting/fesapi/releases"
documentation = "https://www.f2i-consulting.com/fesapi/doxygen/"
issues = "https://github.com/F2I-Consulting/fesapi/issues"

[tool.setuptools]
packages=['fesapi']
package-dir={"fesapi" = "fesapi"}
ext-modules = [
{name='fesapi._fesapi', sources=['swigGeneratedPythonWrapper.cpp'], library-dirs=['${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}'], libraries=['${ASSEMBLY_NAME}',], ${EXTRA_COMPILE_ARGS}}
]

[tool.setuptools.package-data]
fesapi = ["*.dll", "*.so", "*.so.*"]
65 changes: 0 additions & 65 deletions cmake/setup.py.in

This file was deleted.

25 changes: 24 additions & 1 deletion example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2468,7 +2468,26 @@ bool serialize(const string& filePath)
EML2_NS::AbstractHdfProxy* hdfProxy = repo.createHdfProxy("", "Hdf Proxy", epcDoc.getStorageDirectory(), epcDoc.getName() + ".h5", COMMON_NS::DataObjectRepository::openingMode::OVERWRITE);
//hdfProxy->setCompressionLevel(6);

localTime3dCrs = repo.createLocalTime3dCrs("", "Default local time CRS", 1.0, 0.1, 15, .0, gsoap_resqml2_0_1::eml20__LengthUom::m, 23031, gsoap_resqml2_0_1::eml20__TimeUom::s, gsoap_resqml2_0_1::eml20__LengthUom::m, "Unknown", false); // CRS translation is just for testing;
localTime3dCrs = repo.createLocalTime3dCrs("", "Default local time CRS", 1.0, 0.1, 15, .0, gsoap_resqml2_0_1::eml20__LengthUom::m,
"PROJCRS[\"ETRS89 Lambert Azimuthal Equal Area CRS\", BASEGEODCRS[\"ETRS89\","
"DATUM[\"ETRS89\","
"ELLIPSOID[\"GRS 80\", 6378137, 298.257222101, LENGTHUNIT[\"metre\", 1.0]]]],"
"CONVERSION[\"LAEA\","
"METHOD[\"Lambert Azimuthal Equal Area\", ID[\"EPSG\", 9820]],"
"PARAMETER[\"Latitude of origin\", 52.0,"
"ANGLEUNIT[\"degree\", 0.0174532925199433]],"
"PARAMETER[\"Longitude of origin\", 10.0,"
"ANGLEUNIT[\"degree\", 0.0174532925199433]],"
"PARAMETER[\"False easting\", 4321000.0, LENGTHUNIT[\"metre\", 1.0]],"
"PARAMETER[\"False northing\", 3210000.0, LENGTHUNIT[\"metre\", 1.0]]],"
"CS[Cartesian, 2],"
"AXIS[\"(Y)\", north, ORDER[1]],"
"AXIS[\"(X)\", east, ORDER[2]],"
"LENGTHUNIT[\"metre\", 1.0],"
"SCOPE[\"Description of a purpose\"],"
"AREA[\"An area description\"],"
"ID[\"EuroGeographics\", \"ETRS-LAEA\"]]",
gsoap_resqml2_0_1::eml20__TimeUom::s, gsoap_resqml2_0_1::eml20__LengthUom::m, "Unknown", false); // CRS translation is just for testing;
local3dCrs = repo.createLocalDepth3dCrs("", "Default local CRS", .0, .0, .0, .0, gsoap_resqml2_0_1::eml20__LengthUom::m, 23031, gsoap_resqml2_0_1::eml20__LengthUom::m, "Unknown", false);
repo.setDefaultCrs(local3dCrs);

Expand Down Expand Up @@ -5114,11 +5133,15 @@ void deserialize(const string & inputFile)
cout << "Title is : " << crs->getTitle() << endl;
if (crs->isProjectedCrsDefinedWithEpsg())
cout << "Projected : EPSG " << crs->getProjectedCrsEpsgCode() << endl;
else if (crs->isProjectedCrsDefinedWithWkt())
cout << "Projected : WKT " << crs->getProjectedCrsWkt() << endl;
else if (crs->isProjectedCrsUnknown())
cout << "Projected : Unknown." << "Reason is:" << crs->getProjectedCrsUnknownReason() << endl;

if (crs->isVerticalCrsDefinedWithEpsg())
cout << "Vertical : EPSG one" << endl;
else if (crs->isVerticalCrsDefinedWithWkt())
cout << "Vertical : WKT " << crs->getVerticalCrsWkt() << endl;
else if (crs->isVerticalCrsUnknown())
cout << "Vertical : Unknown." << "Reason is:" << crs->getVerticalCrsUnknownReason() << endl;

Expand Down
2 changes: 1 addition & 1 deletion python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ignore cmake and swig auto generated files
setup.py
pyproject.toml
swigGeneratedPythonWrapper.cpp
swigGeneratedPythonWrapper.h

Expand Down
3 changes: 3 additions & 0 deletions python/BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enable CMake boolean variable SWIG_PYTHON_BUILTIN if you want more performance : read [SWIG documentation](http://swig.org/Doc4.0/SWIGDocumentation.html#Python_nn28) for more information about this "builtin" parameter. The main drawback of using such a parameter is that it will be harder/impossible for your Python IDE to enable autocompletion for your FESAPI python extension. The recommendation is to use SWIG_PYTHON_BUILTIN only in production.

Please disable the SWIG_LINKED_TO_RELEASE cmake variable if you build FESAPI in Debug mode.
6 changes: 3 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ else (WIN32)
endif (WIN32)
configure_file(${CMAKE_SOURCE_DIR}/cmake/swigPythonInclude.i.in ${CMAKE_SOURCE_DIR}/swig/swigPythonInclude.i) # Overwrite if different
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set (EXTRA_COMPILE_ARGS "extra_compile_args=['/DSWIG_TYPE_TABLE=FESTAPI']")
set (EXTRA_COMPILE_ARGS "extra-compile-args=['/DSWIG_TYPE_TABLE=FESTAPI']")
else ()
set (EXTRA_COMPILE_ARGS "extra_compile_args=['-DSWIG_TYPE_TABLE=FESTAPI', '-std=c++11']")
set (EXTRA_COMPILE_ARGS "extra-compile-args=['-DSWIG_TYPE_TABLE=FESTAPI', '-std=c++11']")
endif()
configure_file(${CMAKE_SOURCE_DIR}/cmake/setup.py.in ${CMAKE_SOURCE_DIR}/python/setup.py) # Overwrite if different
configure_file(${CMAKE_SOURCE_DIR}/cmake/pyproject.toml.in ${CMAKE_SOURCE_DIR}/python/pyproject.toml) # Overwrite if different

# SWIG execution
message("Generating SWIG Python files...")
Expand Down
16 changes: 14 additions & 2 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Enable CMake boolean variable SWIG_PYTHON_BUILTIN if you want more performance : read [SWIG documentation](http://swig.org/Doc4.0/SWIGDocumentation.html#Python_nn28) for more information about this "builtin" parameter. The main drawback of using such a parameter is that it will be harder/impossible for your Python IDE to enable autocompletion for your FESAPI python extension. The recommendation is to use SWIG_PYTHON_BUILTIN only in production.

Please disable the SWIG_LINKED_TO_RELEASE cmake variable if you build FESAPI in Debug mode.
**FESAPI** is a library for Energistics data standards (mainly RESQML™)

### Examples

A Python script and a Jupyter Notebook are available [here](https://github.com/F2I-Consulting/fesapi/tree/master/python/example).

### Credits
This software was developed with :
- the gSOAP toolkit from Genivia Inc
- the date library from Howard Hinnant

FESAPI Product incorporates RESQML™, WITSML™ and PRODML™ technology/standards provided by the Energistics Consortium, Inc.

RESQML, WITSML and PRODML are trademarks or registered trademarks of Energistics Consortium, Inc.
Loading

0 comments on commit 08a5d07

Please sign in to comment.