From 10c9a28e8304a47ec5fdb2ca7d26ce59e9c687bc Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Fri, 23 Sep 2022 16:22:01 +0200 Subject: [PATCH] feat(OpenGeode): Update to OpenGeode v12 standards. --- .github/workflows/CD.yml | 22 +++++--------------- .github/workflows/CI.yml | 31 +++++++++++++---------------- CMakeLists.txt | 4 +++- bindings/python/__init__.py | 2 +- bindings/python/mylib.py | 8 ++++++++ bindings/python/requirements.txt | 2 +- bindings/python/src/mylib/mylib.cpp | 2 ++ include/mylib/common.h | 14 +++++++++++++ include/mylib/hello_world.h | 2 +- src/mylib/common.cpp | 9 ++++++--- tests/CMakeLists.txt | 2 +- tests/mylib/test-hello-world.cpp | 1 + 12 files changed, 57 insertions(+), 42 deletions(-) create mode 100644 bindings/python/mylib.py create mode 100644 include/mylib/common.h diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 2c349fc..06c194f 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -10,42 +10,30 @@ jobs: with: name: OPENGEODE_MYMODULE repos: OpenGeode - secrets: - TOKEN: ${{ secrets.TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + secrets: inherit 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 }} + secrets: inherit release-windows: 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 }} + secrets: inherit 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 }} + secrets: inherit notify: uses: Geode-solutions/actions/.github/workflows/end-cd.yml@master needs: [release-linux, release-linux-python, release-windows, release-windows-python] - secrets: - TOKEN: ${{ secrets.TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + secrets: inherit diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7b1833f..2ec3296 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,24 +2,20 @@ name: CI on: push: - pull_request: schedule: - cron: 0 0 * * * jobs: format: uses: Geode-solutions/actions/.github/workflows/format.yml@master - secrets: - TOKEN: ${{ secrets.TOKEN }} + secrets: inherit build-linux: needs: format uses: Geode-solutions/actions/.github/workflows/ci-linux.yml@master with: repos: OpenGeode - secrets: - TOKEN: ${{ secrets.TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + secrets: inherit build-linux-python: needs: format @@ -27,30 +23,31 @@ jobs: with: name: OPENGEODE_MYMODULE repos: OpenGeode - secrets: - TOKEN: ${{ secrets.TOKEN }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + secrets: inherit coverage: needs: format uses: Geode-solutions/actions/.github/workflows/coverage.yml@master with: repos: OpenGeode - secrets: - TOKEN: ${{ secrets.TOKEN }} + secrets: inherit build-windows: needs: format 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 }} + secrets: inherit + build-windows-python: + needs: format + uses: Geode-solutions/actions/.github/workflows/ci-windows-python.yml@master + with: + name: OPENGEODE_MYMODULE + repos: OpenGeode + secrets: inherit + semantic-release: needs: [build-linux, build-linux-python, build-windows] uses: Geode-solutions/actions/.github/workflows/release.yml@master - secrets: - TOKEN: ${{ secrets.TOKEN }} + secrets: inherit diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a20f7d..739d7ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.15) + +cmake_policy(SET CMP0091 NEW) # Define the project project(OpenGeode-MyModule CXX) diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py index 6beac8b..fe7c25e 100644 --- a/bindings/python/__init__.py +++ b/bindings/python/__init__.py @@ -19,4 +19,4 @@ # SOFTWARE. -from .opengeode_mymodule_py_mylib import * +from .mylib import * \ No newline at end of file diff --git a/bindings/python/mylib.py b/bindings/python/mylib.py new file mode 100644 index 0000000..000af36 --- /dev/null +++ b/bindings/python/mylib.py @@ -0,0 +1,8 @@ +# +# Copyright (c) 2019 - 2022 Geode-solutions. All rights reserved. +# + +import opengeode + +from .opengeode_mymodule_py_mylib import * +MyModuleMyLib.initialize() diff --git a/bindings/python/requirements.txt b/bindings/python/requirements.txt index 5b514bf..f07b831 100644 --- a/bindings/python/requirements.txt +++ b/bindings/python/requirements.txt @@ -1 +1 @@ -OpenGeode-core >= 10.0.16, == 10.* +OpenGeode-core >= 12.1.8, == 12.* diff --git a/bindings/python/src/mylib/mylib.cpp b/bindings/python/src/mylib/mylib.cpp index 8dac0fa..cd690ab 100644 --- a/bindings/python/src/mylib/mylib.cpp +++ b/bindings/python/src/mylib/mylib.cpp @@ -28,5 +28,7 @@ PYBIND11_MODULE( opengeode_mymodule_py_mylib, module ) { module.doc() = "OpenGeode-ModuleTemplate Python binding for mylib"; + pybind11::class_< mymodule::MyModuleMyLib >( module, "MyModuleMyLib" ) + .def( "initialize", &mymodule::MyModuleMyLib::initialize ); module.def( "hello_world", &mymodule::hello_world ); } \ No newline at end of file diff --git a/include/mylib/common.h b/include/mylib/common.h new file mode 100644 index 0000000..fb5635f --- /dev/null +++ b/include/mylib/common.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2019 - 2022 Geode-solutions. All rights reserved. + */ + +#pragma once + +#include +#include +#include + +namespace mymodule +{ + OPENGEODE_LIBRARY( opengeode_mymodule_mylib_api, MyModuleMyLib ); +} // namespace mymodule \ No newline at end of file diff --git a/include/mylib/hello_world.h b/include/mylib/hello_world.h index 3e13782..662589c 100644 --- a/include/mylib/hello_world.h +++ b/include/mylib/hello_world.h @@ -23,7 +23,7 @@ #pragma once -#include +#include namespace mymodule { diff --git a/src/mylib/common.cpp b/src/mylib/common.cpp index 73f7e81..52cd764 100644 --- a/src/mylib/common.cpp +++ b/src/mylib/common.cpp @@ -21,14 +21,17 @@ * */ +#include + #include -namespace +namespace mymodule { - OPENGEODE_LIBRARY_INITIALIZE( myLib ) + OPENGEODE_LIBRARY_IMPLEMENTATION( MyModuleMyLib ) { /* Here the functions to call when initializing the library * For exemple: registers, ... */ + geode::OpenGeodeBasic::initialize(); } -} // namespace +} // namespace mymodule diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9b98a90..6975c24 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,7 +18,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.15) if(NOT TARGET OpenGeode-MyModule::mylib) project(OpenGeode-MyModule CXX) diff --git a/tests/mylib/test-hello-world.cpp b/tests/mylib/test-hello-world.cpp index 03efecf..27e6b76 100644 --- a/tests/mylib/test-hello-world.cpp +++ b/tests/mylib/test-hello-world.cpp @@ -30,6 +30,7 @@ int main() { try { + mymodule::MyModuleMyLib::initialize(); OPENGEODE_EXCEPTION( mymodule::hello_world(), "[Test] Hello World is not correct" );