diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 91bec4b..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,122 +0,0 @@ -version: "{build}" - - -# x64 is a CMake-compatible solution platform name. -# This allows us to pass %PLATFORM% to CMake -A. -platform: - - x64 - - -environment: - # The (encrypted) user and password for the PyPI account - PYPIUSER: - secure: 1Hn7JfM/388aPRdxSThkkQ== - PYPIPASSWORD: - secure: 1sOoohMQBYezWsPx41QsuDkQrW+8gUuY9fh9J6BFrsI= - - # - Set VS version and configuration - # - Add Python3 path - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - configuration: Release - PYTHON: "C:\\Python36-x64" - CMAKE_OPTIONS: "-DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_PYTHON_BINDINGS=ON" - EXCLUDETESTS: - PYPI: true - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - configuration: Debug - PYTHON: "C:\\Python36-x64" - CMAKE_OPTIONS: "-DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_PYTHON_BINDINGS=ON" - EXCLUDETESTS: - PYPI: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - configuration: Release - PYTHON: "C:\\Python36-x64" - CMAKE_OPTIONS: "-DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_PYTHON_BINDINGS=ON" - EXCLUDETESTS: - PYPI: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - configuration: Debug - PYTHON: "C:\\Python36-x64" - CMAKE_OPTIONS: "-DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_PYTHON_BINDINGS=ON" - EXCLUDETESTS: - PYPI: - # Build and test with pinning and defects - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - configuration: Release - PYTHON: "C:\\Python36-x64" - CMAKE_OPTIONS: "-DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_PYTHON_BINDINGS=ON" - EXCLUDETESTS: - PYPI: - - -install: - # Log out the python version just so we know it - - ECHO "%PYTHON_VERSION%" - - # update path to use installed pip - - set PATH=%PYTHON%\\scripts;%PATH% - - # Install numpy wheel and twine - - "%PYTHON%/Scripts/pip.exe install numpy wheel twine" - - -# Cmake will autodetect the compiler, but we set the arch -before_build: - - set CXXFLAGS=%additional_flags% - - cmake -H. -BBuild -A%PLATFORM% %CMAKE_OPTIONS% - - -# Build with MSBuild -build: - project: Build\ovf.sln # path to Visual Studio solution or project - parallel: true # enable MSBuild parallel builds - verbosity: normal # MSBuild verbosity level {quiet|minimal|normal|detailed} - - -# # Run unit tests with CTest -# test_script: -# - cd Build -# - ctest --output-on-failure -C %CONFIGURATION% -# - cd .. - - -# Deployment: -after_test: - # Build source distro and wheel - - echo Going to build python package and wheel - - ps: if ("$Env:APPVEYOR_REPO_BRANCH" -eq "master") {$env:OVF_ADD_VERSION_SUFFIX="false"} else {$env:OVF_ADD_VERSION_SUFFIX="true"} - - ps: echo "Add suffix to version tag for python package $env:OVF_ADD_VERSION_SUFFIX" - - - cd python - - "%PYTHON%/python setup.py sdist bdist_wheel" - - # Specify account details for PyPI - - echo [distutils] > %USERPROFILE%\\.pypirc - - echo index-servers = >> %USERPROFILE%\\.pypirc - - echo pypi >> %USERPROFILE%\\.pypirc - - echo testpypi >> %USERPROFILE%\\.pypirc - - echo [pypi] >> %USERPROFILE%\\.pypirc - - echo repository=https://upload.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc - - echo username=%PYPIUSER% >> %USERPROFILE%\\.pypirc - - echo password=%PYPIPASSWORD% >> %USERPROFILE%\\.pypirc - - echo [testpypi] >> %USERPROFILE%\\.pypirc - - echo repository=https://test.pypi.org/legacy/ >> %USERPROFILE%\\.pypirc - - echo username=%PYPIUSER% >> %USERPROFILE%\\.pypirc - - echo password=%PYPIPASSWORD% >> %USERPROFILE%\\.pypirc - - # Workaround required to ensure setup.py finds the .pypirc under Windows - - set HOME=%USERPROFILE% - - # Publish python package - - ps: echo "PYPI deployment:" - - ps: if ("$Env:PYPI" -ne "true") {echo "Not going to deploy because not configured to."} - # Do not build pull requests - - ps: if (Test-Path env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) {echo "Not going to deploy because pull request."} - - ps: if (Test-Path env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) {$env:PYPI="false"} - # Upload to pypi on master commits (if PYPI == true) - - ps: if (("$Env:PYPI" -eq "true") -and ("$Env:APPVEYOR_REPO_BRANCH" -eq "master")) {echo "Deploying to pypi because on master branch."} else {echo "Not deploying to pypi."} - - ps: if (("$Env:PYPI" -eq "true") -and ("$Env:APPVEYOR_REPO_BRANCH" -eq "master")) {Invoke-Expression "twine upload -r pypi --skip-existing dist/*"} - # Upload to testpypi on all commits (if PYPI == true) - - ps: if (("$Env:PYPI" -eq "true")) {echo "Deploying to testpypi."} else {echo "Not deploying to testpypi."} - - ps: if (("$Env:PYPI" -eq "true")) {Invoke-Expression "twine upload -r testpypi --skip-existing dist/*"} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cca3c11 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,175 @@ +name: CI + +on: [push, pull_request] + +jobs: + + test: + runs-on: ${{ matrix.os }} + name: test${{ matrix.name-suffix }} (${{ matrix.os }}, ${{ matrix.build-type }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + build-type: [Release, Debug] + name-suffix: [""] + include: + - build-type: Debug + env: + CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=ON + BUILD_TYPE: ${{ matrix.build-type }} + + steps: + - uses: actions/checkout@v2 + + - name: Install necessary packages + run: | + python -m pip install --upgrade pip + python -m pip install numpy + + - name: ๐Ÿ“ Create build folder + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: โš™ Configure + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ] + then + export CMAKE_FLAGS="$CMAKE_FLAGS -DOVF_BUILD_FORTRAN_BINDINGS=ON" + fi + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS + + - name: ๐Ÿ›  Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config $BUILD_TYPE -j 2 + + - name: ๐Ÿงช Test + shell: bash + working-directory: ${{runner.workspace}}/build + run: ctest -C $BUILD_TYPE -E $EXCLUDETESTS --output-on-failure --verbose + + test-coverage: + runs-on: ubuntu-latest + env: + BUILD_TYPE: Release + CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=ON + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: ๐Ÿ“ Create build folder + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: โš™ Configure + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS + + - name: ๐Ÿ›  Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release -j 2 + + - name: Install necessary packages + run: | + python -m pip install --upgrade pip + python -m pip install coverage numpy 'coveralls<3' wheel + sudo apt update + sudo apt install lcov + + - name: Generate C++ coverage + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + lcov -c -i --no-external --directory . --base-directory $GITHUB_WORKSPACE -o baseline.info + make test + lcov -c --no-external --directory . --base-directory $GITHUB_WORKSPACE -o after_test.info + lcov -a baseline.info -a after_test.info -o total_test.info + lcov -r total_test.info \*thirdparty\* \*/test/\* \*Collection\* \*DLL_\* -o coverage.info + + - name: Upload C++ coverage + uses: codecov/codecov-action@v1 + with: + files: ${{runner.workspace}}/build/coverage.info + + - name: Python API coverage + working-directory: ./python + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + coverage run --source ovf --omit=ovf/ovflib.py setup.py test > cov.txt + head cov.txt + coverage report -m + coverage xml + coveralls + + deploy-pypi: + if: github.event_name != 'pull_request' + needs: test + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + env: + BUILD_TYPE: Release + CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=OFF + OVF_ADD_VERSION_SUFFIX: true + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Configure environment + shell: bash + if: github.ref == 'refs/heads/master' + run: echo "OVF_ADD_VERSION_SUFFIX=false" >> $GITHUB_ENV + + - name: Create build folder + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: โš™ Configure + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS + + - name: ๐Ÿ›  Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config $BUILD_TYPE -j 2 + + - name: Install necessary packages + run: | + python -m pip install --upgrade pip + python -m pip install numpy setuptools wheel twine + + - name: Build python package + shell: bash + working-directory: ./python + run: | + echo "Python package build" + echo "Add suffix to ovf version tag for python package $OVF_ADD_VERSION_SUFFIX" + python setup.py sdist bdist_wheel + + - name: ๐Ÿš€ Deploy to TestPyPI + working-directory: ./python + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + if: github.ref != 'refs/heads/master' + run: twine upload --skip-existing --repository testpypi dist/* + + - name: ๐Ÿš€ Deploy to PyPI + working-directory: ./python + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + if: github.ref == 'refs/heads/master' + run: twine upload --skip-existing dist/* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dbe66b0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,159 +0,0 @@ -sudo: required -language: cpp - - -cache: - directories: - - ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2 - - ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1 - - ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.0 - - ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.0 - - -env: - global: - - secure: 7QmFfQWAEX4ZUI9SlkswmdIEdw0fynrl+kVTPdC7Ybi2Vh1K3o1cRzUGJK0RrktVdd6qFXvH9tijm+pCJz45KCrz84K6gHpa2tkmlq9XU8O5YCQQZR4/KSxd51xlFvpGogCQWKU+Ft+aDn/RQ/cqAKIa7S8qD/tQd4XsVKZWeUXBbDtyBIHdjQbjOyLh1YWCfdF+tc1WG4Ic50CEmhxTZDYLqLjRFrbYEIRTAA/fAIcZE0dGvbCaEULD2YZZeW+DK7qU98rsqZ8qL3zNwFoin/sD3iG8UNJxMp1lg4urUGsFauU+VJrLOjg22A7kb2TF2dPMpk36ipVOFKWmrLz9Q0r7WQBnbe2lpNTQGBAIjgzHI0jPVHB72jD+pVtK2zXwXh9IC0qVn3P8dAsK9yvnG+0p6eJ19Pqv0S3RqOcsespfIYLT97ZALdQpE6fGdAEFasdoPY0Zhx1y8jusmQEBCUplUzECLc3HVsMLiSM3ZiQfHZ2V6xEnyAxPjalvCidINSsEM5hYO6Ugzx8n4AQMY+0CWasMam9tY1OBcuOlHpY9CXNLBesMTP6W5tmpCOv+y7QfxDukghLSnnSwJTdhFBjGcb1SVsVnb12a7sXLbqe8vGYyurKVWSeT+hJeDkPZ9uryQTJg8X1RDgEw3ZuH3Si+62PNpdUMLm8FkCLI5OI= - - secure: 4pU4q9DQtbfNDQl0j6lhqjY2A1NBkmKplQQ22/z/7utRpm5e79bBFIrHFDSZazryur9GJw+dw0aDFEv/JT0RWoxl5GJX6QRTe1MJyPo1sWC+K/PteROgcT2x7E3/F4Bk6uYtDlfNGYkCHLe4fNJMPovn9csOgq7uOdu0MHew/CADnk1ljegNZ1Z3SjGBFqA9vvRZr4GFrAnMqwtRla6BZWJ7rabN9lfJY1MTcbarO/otLwePy4w4IzxWwIk1uoO9IFX4yybONZeDpKjHr+vwK6bQb1zxnSzxsODKctMUJ38ZPlwJlqki8vG9MN5OToCvNR5wODFCYKYYjCC0O2f8cb7NYii/UmQ5dZyEIcxoZSkkjuR3P8eNKSaLypDNQ099RuCPStW2QPuol9pQXD93gmdIqBVV01zij/9GbXFaYBQPe+zSOf7WPqYiaJ2SkJj4z9mlfIOiKZ192KqzoWIy57GQtfOOi+wR1hwOnqL0rrELu9PZVjc3lWGQ1hIG2MiKbyrpY4Ty95hMAFIF7UDEg6VZy/oXqpfJ1fQStwvbrN/UPx0ZYawDzv5zEqScgKZaAhmBJll3ESTm479wLlK40J28EjjWHbIuLuraUwBN9OIC9Vcl9mn92Z7xUQ1YTfU1XMCxWjVldoyY4El+/X8ebP4AYRrUEjiAVH9XYnU1u/c= - - -matrix: - include: - # OSX, xcode 8 - - os: osx - osx_image: xcode10 - env: CMAKE_OPTIONS="-DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=OFF" PYPI=true COVERAGE=false RUNTESTS=true - # Linux, GCC 7 - - os: linux - dist: bionic - env: COMPILER_C=gcc COMPILER_CXX=g++ COMPILER_FORTRAN=gfortran CMAKE_OPTIONS="-DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_FORTRAN_BINDINGS=ON -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=OFF" PYPI=true COVERAGE=false RUNTESTS=true - compiler: g++ - addons: - apt: - packages: - - gfortran - # Linux, GCC 5 - - os: linux - dist: xenial - env: COMPILER_C=gcc-5 COMPILER_CXX=g++-5 CMAKE_OPTIONS="-DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=OFF" PYPI=false COVERAGE=false RUNTESTS=true - compiler: g++ - addons: - apt: - packages: - - g++-5 - - gfortran-5 - - python2.7 - sources: - - sourceline: 'ppa:ubuntu-toolchain-r/test' - - sourceline: 'ppa:jonathonf/python-2.7' - # Linux, GCC 7 coverage build - - os: linux - dist: bionic - env: COMPILER_C=gcc COMPILER_CXX=g++ CMAKE_OPTIONS="-DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_FORTRAN_BINDINGS=OFF -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=ON" PYPI=false COVERAGE=true RUNTESTS=false - compiler: g++ - addons: - apt: - packages: - - gfortran - - lcov - - ca-certificates - - python2.7 - sources: - - sourceline: 'ppa:ubuntu-toolchain-r/test' - - sourceline: 'ppa:jonathonf/python-2.7' - - -before_install: - - python --version - - sudo pip install --upgrade pip six pyOpenSSL - - sudo pip install numpy wheel urllib3==1.23 twine coveralls - # Run homebrew on osx - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi - # Setup default versions and override compiler if needed - - if [[ "${LLVM_VERSION}" == "default" ]]; then LLVM_VERSION=3.9.0; fi - # Install a recent CMake (unless already installed on OS X) - - | - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} - CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz" - mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake - export PATH=${DEPS_DIR}/cmake/bin:${PATH} - export CC=${COMPILER_C} CXX=${COMPILER_CXX} FC=${COMPILER_FORTRAN} - else - if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi - fi - - -install: - # Build everything - - cd ${TRAVIS_BUILD_DIR} - - | - mkdir -p build - cd build - cmake ${CMAKE_OPTIONS} .. - - make -j2 - - cd .. - - -before_script: - # Test everything - - | - cd build - if [ "$RUNTESTS" != "false" ]; then ctest --output-on-failure; fi - - cd .. - - -script: - # Build the python package - - echo "Python package build" - - if [ "$TRAVIS_BRANCH" != "master" ]; then export OVF_ADD_VERSION_SUFFIX=true; else export OVF_ADD_VERSION_SUFFIX=false; fi - - echo "Add suffix to ovf version tag for python package $OVF_ADD_VERSION_SUFFIX" - - cd python - - python setup.py sdist bdist_wheel; - - # Specify account details for PyPI - - echo "[distutils]" > ~/.pypirc - - echo "index-servers =" >> ~/.pypirc - - echo " testpypi" >> ~/.pypirc - - echo " pypi" >> ~/.pypirc - - echo "[pypi]" >> ~/.pypirc - - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc - - echo "username=$PYPIUSER" >> ~/.pypirc - - echo "password=$PYPIPASSWORD" >> ~/.pypirc - - echo "[testpypi]" >> ~/.pypirc - - echo "repository=https://test.pypi.org/legacy/" >> ~/.pypirc - - echo "username=$PYPIUSER" >> ~/.pypirc - - echo "password=$PYPIPASSWORD" >> ~/.pypirc - - # Publish python package - - echo "PYPI deployment:" - - if [ "$PYPI" != "true" ]; then echo "Not going to deploy because not configured to."; fi - # Do not build pull requests - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "Not going to deploy because pull request."; fi - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then PYPI=false; fi - # Upload to pypi on master commits (if PYPI == true) - - if [ "$PYPI" == "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then echo "Deploying to pypi because on master branch."; else echo "Not deploying to pypi."; fi - - if [ "$PYPI" == "true" ] && [ "$TRAVIS_BRANCH" == "master" ]; then twine upload --skip-existing -r pypi dist/*; fi - # Upload to testpypi on all commits (if PYPI == true) - - if [ "$PYPI" == "true" ]; then echo "Deploying to testpypi."; else echo "Not deploying to testpypi."; fi - - if [ "$PYPI" == "true" ]; then twine upload --skip-existing -r testpypi dist/*; fi - - # Don't run coverage on branches other than master or develop (or pull requests targeting those) - - if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "develop" ]; then COVERAGE=false; fi - - # Run C++ coverage report generation and upload to codecov - - cd ../build - - if [ "$COVERAGE" == "true" ]; then lcov -c --initial --no-external --directory $(pwd) --base-directory $(cd ..; pwd) -o baseline.info; fi - - if [ "$COVERAGE" == "true" ]; then make test; fi - - if [ "$COVERAGE" == "true" ]; then lcov -c --no-external --directory $(pwd) --base-directory $(cd ..; pwd) -o after_test.info; fi - - if [ "$COVERAGE" == "true" ]; then lcov -a baseline.info -a after_test.info -o total_test.info; fi - - if [ "$COVERAGE" == "true" ]; then lcov -r total_test.info \*/thirdparty/\* \*/test/\* \*/fmt/\* -o coverage.info; fi - - if [ "$COVERAGE" == "true" ]; then bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"; fi - - # Run Python coverage report generation and upload to coveralls - - cd ../python - - if [ "$COVERAGE" == "true" ]; then coverage run --source ovf --omit=ovf/ovflib.py setup.py test > cov.txt; fi - - if [ "$COVERAGE" == "true" ]; then head cov.txt; fi - - if [ "$COVERAGE" == "true" ]; then coverage report -m; fi - - if [ "$COVERAGE" == "true" ]; then coverage xml; fi - - if [ "$COVERAGE" == "true" ]; then coveralls; fi \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 051b8c6..b68cb1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,7 +111,15 @@ if( OVF_BUILD_PYTHON_BINDINGS ) add_library( ${PROJECT_NAME}_python SHARED $ ) set_property( TARGET ${PROJECT_NAME}_python PROPERTY OUTPUT_NAME "${PROJECT_NAME}" ) - set_property( TARGET ${PROJECT_NAME}_python PROPERTY LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/python/ovf ) + + if(WIN32) + # On Windows the runtime_output_directory is used https://cmake.org/cmake/help/v3.9/manual/cmake-buildsystem.7.html#output-artifacts + set_property( TARGET ${PROJECT_NAME}_python PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/python/ovf ) # Use runtime_output_directory_debug to avoid an additional debug directory being created + set_property( TARGET ${PROJECT_NAME}_python PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/python/ovf ) + else() + set_property( TARGET ${PROJECT_NAME}_python PROPERTY LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/python/ovf ) + endif() + set_property( TARGET ${PROJECT_NAME}_python PROPERTY LINK_FLAGS ${OVF_LINK_FLAGS_COVERAGE} ) ### Utility python files diff --git a/README.md b/README.md index 22c2002..22450a5 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ OVF Parser Library [OVF format specification](#specification) -[![Build Status](https://api.travis-ci.com/spirit-code/ovf.svg?branch=master)](https://travis-ci.com/github/spirit-code/ovf) -[![Build status](https://ci.appveyor.com/api/projects/status/y04beatp3t3lc5td/branch/master?svg=true)](https://ci.appveyor.com/project/spirit-code/ovf) +![Build Status](https://github.com/spirit-code/ovf/workflows/CI/badge.svg?branch=master) **[Python package](https://pypi.org/project/ovf/):** [![PyPI version](https://badge.fury.io/py/ovf.svg)](https://badge.fury.io/py/ovf) diff --git a/fortran/ovf.f90 b/fortran/ovf.f90 index 906b575..53e34d6 100644 --- a/fortran/ovf.f90 +++ b/fortran/ovf.f90 @@ -101,8 +101,9 @@ function get_string(c_pointer) result(f_string) type(c_ptr), intent(in) :: c_pointer character(len=:), allocatable :: f_string - integer(c_size_t) :: l_str - character(len=:), pointer :: f_ptr + integer :: idx + integer(c_size_t) :: l_str + character(len=1), dimension(:), pointer :: f_ptr interface function c_strlen(str_ptr) bind ( C, name = "strlen" ) result(len) @@ -113,9 +114,12 @@ end function c_strlen end interface l_str = c_strlen(c_pointer) - call c_f_pointer(c_pointer, f_ptr) + call c_f_pointer(c_pointer, f_ptr, [l_str]) - f_string = f_ptr(1:l_str) + allocate(character(l_str) :: f_string) + do idx=1,l_str + f_string(idx:idx)=f_ptr(idx) + end do end function get_string ! Assign from C string wrapper to Fortran string @@ -170,7 +174,7 @@ function get_c_ovf_segment(segment) result(c_segment) c_segment%valuedim = segment%ValueDim c_segment%valueunits = segment%ValueUnits c_segment%valuelabels = segment%ValueLabels - + c_segment%meshtype = segment%MeshType c_segment%meshunits = segment%MeshUnits c_segment%pointcount = segment%PointCount diff --git a/python/setup.py b/python/setup.py index 6a28280..5463d2e 100644 --- a/python/setup.py +++ b/python/setup.py @@ -43,7 +43,7 @@ def read(*parts): resulting file. Assume UTF-8 encoding. """ with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f: - return f.read() + return f.read().replace('\r\n', '\n') META_FILE = read(META_PATH)