diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index d9ad79a..b129cd6 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -4,100 +4,41 @@ on: push: tags: 'v*' -jobs: +jobs: release-linux: - runs-on: ubuntu-18.04 - container: ${{ matrix.config.container }} - strategy: - matrix: - config: - - {container: "geodesolutions/ubuntu", system: "ubuntu", doc: true} - - {container: "geodesolutions/centos", system: "rhel", doc: false} + uses: Geode-solutions/actions/.github/workflows/cd-linux.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + release-linux-python: + uses: Geode-solutions/actions/.github/workflows/cd-linux-python.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-${{ matrix.config.system }}.tar.gz' - token: ${{ secrets.TOKEN }} - - name: Generate package - id: package - run: | - mkdir -p build - cd build - version="${GITHUB_REF##*/*/}" - echo ::set-output name=version::$version - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DMYMODULE_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=${{ matrix.config.system }} .. - cmake --build . -- -j2 - cmake --build . --target package - - name: Upload - uses: softprops/action-gh-release@v1 - with: - files: "build/MyModule-${{ steps.package.outputs.version }}-${{ matrix.config.system }}.tar.gz" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Doc - if: matrix.config.doc - run: curl -s https://raw.githubusercontent.com/Geode-solutions/actions/master/doc/doc.sh | bash -s -- ${GITHUB_WORKSPACE}/build - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} - - release-mac: - runs-on: macOS-10.14 - - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-darwin.tar.gz' - token: ${{ secrets.TOKEN }} - - name: Generate package - id: package - run: | - mkdir -p build - cd build - version="${GITHUB_REF##*/*/}" - echo ::set-output name=version::$version - cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DMYMODULE_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=darwin .. - cmake --build . --config Release - cmake --build . --target package --config Release - - name: Upload - uses: softprops/action-gh-release@v1 - with: - files: "build/MyModule-${{ steps.package.outputs.version }}-darwin.tar.gz" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - release-windows: - runs-on: windows-2016 + uses: Geode-solutions/actions/.github/workflows/cd-windows.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-win64.zip' - token: ${{ secrets.TOKEN }} - - name: Generate package - id: package - run: | - mkdir -p build - cd build - version="${GITHUB_REF##*/*/}" - echo ::set-output name=version::$version - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} -DMYMODULE_WITH_TESTS:BOOL=OFF -DCPACK_PACKAGE_VERSION:STRING=$version -DCPACK_SYSTEM_NAME:STRING=win64 .. - cmake --build . --config Release - cmake --build . --target PACKAGE --config Release - shell: bash - - name: Upload - uses: softprops/action-gh-release@v1 - with: - files: "build/MyModule-${{ steps.package.outputs.version }}-win64.zip" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + release-windows-python: + uses: Geode-solutions/actions/.github/workflows/cd-windows-python.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7e34ecb..7b1833f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,159 +8,49 @@ on: jobs: format: - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/clang-format@master - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} + uses: Geode-solutions/actions/.github/workflows/format.yml@master + secrets: + TOKEN: ${{ secrets.TOKEN }} build-linux: - runs-on: ubuntu-18.04 - container: ${{ matrix.config.container }} needs: format - strategy: - matrix: - config: - - {container: "geodesolutions/ubuntu", cmake_args: "-DCMAKE_BUILD_TYPE=Debug", system: ubuntu} - - {container: "geodesolutions/ubuntu", cmake_args: "-DCMAKE_BUILD_TYPE=Release -DUSE_BENCHMARK=ON", system: ubuntu} - - {container: "geodesolutions/centos", cmake_args: "-DCMAKE_BUILD_TYPE=Debug", system: rhel} - - {container: "geodesolutions/centos", cmake_args: "-DCMAKE_BUILD_TYPE=Release", system: rhel} - - - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-${{ matrix.config.system }}.tar.gz' - token: ${{ secrets.TOKEN }} - - name: Compile - run: | - mkdir -p build - cd build - cmake ${{ matrix.config.cmake_args }} -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} .. - cmake --build . -- -j2 - - name: Test - run: | - mkdir -p test - cd test - cmake -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_PREFIX_PATH:PATH="$GITHUB_WORKSPACE/build;$GITHUB_WORKSPACE/${{ steps.opengeode.outputs.path }}" ../tests - cmake --build . -- -j2 - ctest --output-on-failure - - name: Notify slack - if: failure() && github.ref == 'refs/heads/master' - uses: 8398a7/action-slack@v2 - with: - status: failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - coverage: - runs-on: ubuntu-18.04 + uses: Geode-solutions/actions/.github/workflows/ci-linux.yml@master + with: + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + build-linux-python: needs: format - if: (github.event_name == 'pull_request' || github.ref == 'refs/heads/master') - + uses: Geode-solutions/actions/.github/workflows/ci-linux-python.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-ubuntu.tar.gz' - token: ${{ secrets.TOKEN }} - - name: Compile - run: | - mkdir -p build - cd build - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} .. - cmake --build . -- -j2 - - name: Kcov - run: curl -s https://raw.githubusercontent.com/Geode-solutions/actions/master/kcov.sh | bash -s -- ${GITHUB_WORKSPACE}/build/bin - - uses: codecov/codecov-action@v1.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: kcov/kcov-merged/cobertura.xml - - name: Notify slack - if: failure() && github.ref == 'refs/heads/master' - uses: 8398a7/action-slack@v2 - with: - status: failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - build-mac-xcode: - runs-on: macOS-10.14 + coverage: needs: format - strategy: - matrix: - config: [Debug, Release] - - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-darwin.tar.gz' - token: ${{ secrets.TOKEN }} - - name: Compile & Test - run: | - mkdir -p build - cd build - cmake -G "Xcode" -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} .. - cmake --build . --config ${{ matrix.config }} - ctest -C ${{ matrix.config }} --output-on-failure - - name: Notify slack - if: failure() && github.ref == 'refs/heads/master' - uses: 8398a7/action-slack@v2 - with: - status: failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + uses: Geode-solutions/actions/.github/workflows/coverage.yml@master + with: + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} build-windows: - runs-on: windows-2016 needs: format - strategy: - matrix: - config: [Debug, Release] - - steps: - - uses: actions/checkout@v1 - - uses: Geode-solutions/actions/get-release@master - id: opengeode - with: - repository: OpenGeode - file: '-win64.zip' - token: ${{ secrets.TOKEN }} - - name: Compile & Test - run: | - mkdir -p build - cd build - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH:PATH=${{ steps.opengeode.outputs.path }} .. - cmake --build . --config ${{ matrix.config }} - ctest -C ${{ matrix.config }} --output-on-failure - - name: Notify slack - if: failure() && github.ref == 'refs/heads/master' - uses: 8398a7/action-slack@v2 - with: - status: failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + uses: Geode-solutions/actions/.github/workflows/ci-windows.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: + TOKEN: ${{ secrets.TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} semantic-release: - runs-on: ubuntu-18.04 - needs: [build-linux, coverage, build-mac-xcode, build-windows] - steps: - - uses: actions/checkout@v1 - - run: npx semantic-release - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} + needs: [build-linux, build-linux-python, build-windows] + uses: Geode-solutions/actions/.github/workflows/release.yml@master + secrets: + TOKEN: ${{ secrets.TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f0f3850 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "C_Cpp.default.cppStandard": "c++11", + "C_Cpp.default.includePath": [ + "${workspaceFolder}/include", + "${workspaceFolder}/build", + "${workspaceFolder:OpenGeode}/build/opengeode/install/include" + ], + "files.watcherExclude": { + "${workspaceFolder}/build/**": true + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a9de022..6a20f7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2019 - 2020 Geode-solutions +# Copyright (c) 2019 - 2022 Geode-solutions # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -18,12 +18,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.14) # Define the project -project(MyModule CXX) +project(OpenGeode-MyModule CXX) -option(MYMODULE_WITH_TESTS "Compile test projects" ON) +option(OPENGEODE_MYMODULE_WITH_TESTS "Compile test projects" ON) +option(OPENGEODE_MYMODULE_WITH_PYTHON "Compile Python bindings" OFF) # Get MyModule dependencies find_package(OpenGeode REQUIRED) @@ -44,13 +45,18 @@ add_geode_library( #------------------------------------------------------------------------------------------------ # Optional modules configuration -if(MYMODULE_WITH_TESTS) +if(OPENGEODE_MYMODULE_WITH_TESTS) # Enable testing with CTest enable_testing() - message(STATUS "Configuring MyModule with tests") + message(STATUS "Configuring OpenGeode-MyModule with tests") add_subdirectory(tests) endif() +if(OPENGEODE_MYMODULE_WITH_PYTHON) + message(STATUS "Configuring OpenGeode-MyModule with Python bindings") + add_subdirectory(bindings/python) +endif() + #------------------------------------------------------------------------------------------------ # Configure CPacks if(WIN32) diff --git a/COPYLEFT b/COPYLEFT index 8751f87..c6cdb92 100644 --- a/COPYLEFT +++ b/COPYLEFT @@ -1,4 +1,4 @@ ## Dependencies OpenGeode: MIT -Copyright (c) 2019 - 2020 Geode-solutions +Copyright (c) 2019 - 2022 Geode-solutions diff --git a/LICENSE b/LICENSE index 8edc232..84738bf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 - 2020 Geode-solutions +Copyright (c) 2019 - 2022 Geode-solutions Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c7b5f3e..f88dcf9 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,4 @@ For questions and support please use the official [slack](https://slackin-openge [MIT](https://opensource.org/licenses/MIT) -Copyright (c) 2019 - 2020, Geode-solutions +Copyright (c) 2019 - 2022, Geode-solutions diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt new file mode 100644 index 0000000..49a39b0 --- /dev/null +++ b/bindings/python/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +add_subdirectory(src) + +if(OPENGEODE_MYMODULE_WITH_TESTS) + add_subdirectory(tests) +endif() + +configure_file( + __init__.py + ${PROJECT_BINARY_DIR}/wheel/opengeode_mymodule/__init__.py +) +configure_file( + setup.py + ${PROJECT_BINARY_DIR}/wheel/setup.py +) +execute_process( + COMMAND ${PYTHON_EXECUTABLE} -m pip install --user -r requirements.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) +add_custom_target(wheel + COMMAND ${CMAKE_COMMAND} + -DSOURCE_DIR="${CMAKE_BINARY_DIR}" + -DDEST_DIR="${CMAKE_BINARY_DIR}/wheel/opengeode_mymodule" + -P "${CMAKE_CURRENT_LIST_DIR}/copy_wheel.cmake" + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/wheel +) diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py new file mode 100644 index 0000000..6beac8b --- /dev/null +++ b/bindings/python/__init__.py @@ -0,0 +1,22 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +from .opengeode_mymodule_py_mylib import * diff --git a/bindings/python/copy_wheel.cmake b/bindings/python/copy_wheel.cmake new file mode 100644 index 0000000..ebc5f25 --- /dev/null +++ b/bindings/python/copy_wheel.cmake @@ -0,0 +1,31 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +file(GLOB_RECURSE SO_LIBRARIES "${SOURCE_DIR}/*.so") +file(COPY ${SO_LIBRARIES} DESTINATION "${DEST_DIR}") + +file(GLOB_RECURSE DLL_LIBRARIES "${SOURCE_DIR}/*.dll") +file(COPY ${DLL_LIBRARIES} DESTINATION "${DEST_DIR}") + +file(GLOB_RECURSE PYD_LIBRARIES "${SOURCE_DIR}/*.pyd") +file(COPY ${PYD_LIBRARIES} DESTINATION "${DEST_DIR}") + +file(GLOB_RECURSE DYLIB_LIBRARIES "${SOURCE_DIR}/*.dylib") +file(COPY ${DYLIB_LIBRARIES} DESTINATION "${DEST_DIR}") diff --git a/bindings/python/requirements.txt b/bindings/python/requirements.txt new file mode 100644 index 0000000..5b514bf --- /dev/null +++ b/bindings/python/requirements.txt @@ -0,0 +1 @@ +OpenGeode-core >= 10.0.16, == 10.* diff --git a/bindings/python/setup.py b/bindings/python/setup.py new file mode 100644 index 0000000..9bc05de --- /dev/null +++ b/bindings/python/setup.py @@ -0,0 +1,63 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the 'Software'), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from setuptools import setup +from setuptools.dist import Distribution +from setuptools.command.install import install +from os import path + +class BinaryDistribution(Distribution): + def has_ext_modules(self): + return True + def is_pure(self): + return False + +class InstallPlatlib(install): + def finalize_options(self): + install.finalize_options(self) + self.install_lib = self.install_platlib + +with open(path.join('${CMAKE_SOURCE_DIR}', 'README.md'), encoding='utf-8') as f: + long_description = f.read() +with open('${CMAKE_CURRENT_LIST_DIR}/requirements.txt') as f: + install_requires = f.read().strip().split('\n') + +setup( + name='OpenGeode-MyModule', + version='${WHEEL_VERSION}', + description='Template for creating your own OpenGeode modules', + long_description=long_description, + long_description_content_type='text/markdown', + author='Geode-solutions', + author_email='contact@geode-solutions.com', + url='https://github.com/Geode-solutions/OpenGeode-ModuleTemplate', + packages=['opengeode_mymodule'], + package_data={ + 'opengeode_mymodule': ['*.so', '*.dll', '*.pyd', '*.dylib'] + }, + install_requires=install_requires, + license='MIT', + classifiers=[ + 'License :: OSI Approved :: MIT License' + ], + zip_safe=False, + distclass=BinaryDistribution, + cmdclass={'install': InstallPlatlib} +) \ No newline at end of file diff --git a/bindings/python/src/CMakeLists.txt b/bindings/python/src/CMakeLists.txt new file mode 100644 index 0000000..99dac2f --- /dev/null +++ b/bindings/python/src/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +add_subdirectory(mylib) diff --git a/bindings/python/src/mylib/CMakeLists.txt b/bindings/python/src/mylib/CMakeLists.txt new file mode 100644 index 0000000..ff57466 --- /dev/null +++ b/bindings/python/src/mylib/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +add_geode_python_binding( + NAME "py_mylib" + SOURCES + "mylib.cpp" + DEPENDENCIES + ${PROJECT_NAME}::mylib +) diff --git a/bindings/python/src/mylib/mylib.cpp b/bindings/python/src/mylib/mylib.cpp new file mode 100644 index 0000000..8dac0fa --- /dev/null +++ b/bindings/python/src/mylib/mylib.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 - 2022 Geode-solutions + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include + +PYBIND11_MODULE( opengeode_mymodule_py_mylib, module ) +{ + module.doc() = "OpenGeode-ModuleTemplate Python binding for mylib"; + module.def( "hello_world", &mymodule::hello_world ); +} \ No newline at end of file diff --git a/bindings/python/tests/CMakeLists.txt b/bindings/python/tests/CMakeLists.txt new file mode 100755 index 0000000..99dac2f --- /dev/null +++ b/bindings/python/tests/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +add_subdirectory(mylib) diff --git a/bindings/python/tests/mylib/CMakeLists.txt b/bindings/python/tests/mylib/CMakeLists.txt new file mode 100755 index 0000000..fc46637 --- /dev/null +++ b/bindings/python/tests/mylib/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +add_geode_python_test( + SOURCE "test-py-hello-world.py" + DEPENDENCIES + ${PROJECT_NAME}::py_mylib +) diff --git a/bindings/python/tests/mylib/test-py-hello-world.py b/bindings/python/tests/mylib/test-py-hello-world.py new file mode 100644 index 0000000..ba75bf7 --- /dev/null +++ b/bindings/python/tests/mylib/test-py-hello-world.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019 - 2022 Geode-solutions +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import os, sys, platform +if sys.version_info >= (3,8,0) and platform.system() == "Windows": + for path in [x.strip() for x in os.environ['PATH'].split(';') if x]: + os.add_dll_directory(path) + +import opengeode +import opengeode_mymodule_py_mylib as mylib + +if __name__ == '__main__': + mylib.hello_world() \ No newline at end of file diff --git a/cmake/Doxyfile.in b/cmake/Doxyfile.in index ea0c449..41cb250 100644 --- a/cmake/Doxyfile.in +++ b/cmake/Doxyfile.in @@ -1,4 +1,4 @@ -# Copyright (c) 2019 - 2020 Geode-solutions +# Copyright (c) 2019 - 2022 Geode-solutions # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cmake/MyModuleConfig.cmake.in b/cmake/OpenGeode-MyModuleConfig.cmake.in similarity index 96% rename from cmake/MyModuleConfig.cmake.in rename to cmake/OpenGeode-MyModuleConfig.cmake.in index 129af9c..d4c6583 100644 --- a/cmake/MyModuleConfig.cmake.in +++ b/cmake/OpenGeode-MyModuleConfig.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2019 - 2020 Geode-solutions +# Copyright (c) 2019 - 2022 Geode-solutions # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/include/mylib/hello_world.h b/include/mylib/hello_world.h index 3716cc8..3e13782 100644 --- a/include/mylib/hello_world.h +++ b/include/mylib/hello_world.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 - 2020 Geode-solutions + * Copyright (c) 2019 - 2022 Geode-solutions * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -23,9 +23,9 @@ #pragma once -#include +#include namespace mymodule { - bool mymodule_mylib_api hello_world(); + bool opengeode_mymodule_mylib_api hello_world(); } // namespace mymodule diff --git a/src/mylib/common.cpp b/src/mylib/common.cpp index 5da0395..73f7e81 100644 --- a/src/mylib/common.cpp +++ b/src/mylib/common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 - 2020 Geode-solutions + * Copyright (c) 2019 - 2022 Geode-solutions * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/mylib/hello_world.cpp b/src/mylib/hello_world.cpp index 51a12db..9beffb3 100644 --- a/src/mylib/hello_world.cpp +++ b/src/mylib/hello_world.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 - 2020 Geode-solutions + * Copyright (c) 2019 - 2022 Geode-solutions * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt old mode 100755 new mode 100644 index 7a4025f..9b98a90 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2019 - 2020 Geode-solutions +# Copyright (c) 2019 - 2022 Geode-solutions # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -18,12 +18,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.14) -if(NOT TARGET MyModule::mylib) - project(MyModule CXX) +if(NOT TARGET OpenGeode-MyModule::mylib) + project(OpenGeode-MyModule CXX) find_package(OpenGeode REQUIRED CONFIG) - find_package(MyModule REQUIRED CONFIG) + find_package(OpenGeode-MyModule REQUIRED CONFIG) enable_testing() endif() diff --git a/tests/mylib/CMakeLists.txt b/tests/mylib/CMakeLists.txt index 44d03bc..762ef1e 100755 --- a/tests/mylib/CMakeLists.txt +++ b/tests/mylib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2019 - 2020 Geode-solutions +# Copyright (c) 2019 - 2022 Geode-solutions # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/mylib/test-hello-world.cpp b/tests/mylib/test-hello-world.cpp index 1e5213f..03efecf 100644 --- a/tests/mylib/test-hello-world.cpp +++ b/tests/mylib/test-hello-world.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 - 2020 Geode-solutions + * Copyright (c) 2019 - 2022 Geode-solutions * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal