Commit c7ff1455 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot

Merge topic 'pybind11-remus-extension'

681c0e7c Add pybind11 wrapping for remus extension.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: John Tourtellott's avatarJohn Tourtellott <john.tourtellott@kitware.com>
Merge-request: !366
parents f513f232 681c0e7c
......@@ -28,6 +28,10 @@ endif()
add_subdirectory(plugin)
if (SMTK_USE_PYBIND11)
add_subdirectory(pybind11)
endif()
if (SMTK_ENABLE_TESTING)
add_subdirectory(testing)
endif()
pybind11_add_module(smtkPybindModelRemus PybindModelRemus.cxx)
target_include_directories(smtkPybindModelRemus PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
)
target_link_libraries(smtkPybindModelRemus LINK_PUBLIC smtkCore smtkRemusExt)
set_target_properties(smtkPybindModelRemus
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
COMPILE_FLAGS "-Wno-shadow"
)
install(TARGETS smtkPybindModelRemus DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/__init__.py"
"${PROJECT_BINARY_DIR}/smtk/model/remus/__init__.py" @ONLY
)
install(CODE
"set(LIBRARY_OUTPUT_PATH \"${CMAKE_INSTALL_PREFIX}/lib\")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
${CMAKE_INSTALL_PREFIX}/${SMTK_PYTHON_MODULEDIR}/smtk/model/remus/__init__.py )"
)
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef pybind_smtk_extension_remus_MeshOperator_h
#define pybind_smtk_extension_remus_MeshOperator_h
#include <pybind11/pybind11.h>
#include "smtk/extension/remus/MeshOperator.h"
PySharedPtrClass< smtk::model::MeshOperator, smtk::model::Operator > pybind11_init_smtk_extension_remus_MeshOperator(py::module &m)
{
PySharedPtrClass< smtk::model::MeshOperator, smtk::model::Operator > instance(m, "MeshOperator");
instance
.def("classname", &smtk::model::MeshOperator::classname)
.def_static("create", (std::shared_ptr<smtk::model::MeshOperator> (*)()) &smtk::model::MeshOperator::create)
.def_static("create", (std::shared_ptr<smtk::model::MeshOperator> (*)(::std::shared_ptr<smtk::model::MeshOperator> &)) &smtk::model::MeshOperator::create, py::arg("ref"))
.def("shared_from_this", (std::shared_ptr<smtk::model::MeshOperator> (smtk::model::MeshOperator::*)()) &smtk::model::MeshOperator::shared_from_this)
.def("shared_from_this", (std::shared_ptr<const smtk::model::MeshOperator> (smtk::model::MeshOperator::*)() const) &smtk::model::MeshOperator::shared_from_this)
.def("name", &smtk::model::MeshOperator::name)
.def("className", &smtk::model::MeshOperator::className)
.def_static("baseCreate", &smtk::model::MeshOperator::baseCreate)
.def("ableToOperate", &smtk::model::MeshOperator::ableToOperate)
;
return instance;
}
#endif
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#include <utility>
#include <pybind11/pybind11.h>
namespace py = pybind11;
template <typename T, typename... Args>
using PySharedPtrClass = py::class_<T, std::shared_ptr<T>, Args...>;
#include "PybindMeshOperator.h"
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
PYBIND11_PLUGIN(smtkPybindModelRemus)
{
py::module remus("smtkPybindModelRemus", "<description>");
py::class_< smtk::model::MeshOperator, smtk::model::Operator > smtk_extension_remus_MeshOperator = pybind11_init_smtk_extension_remus_MeshOperator(remus);
return remus.ptr();
}
#=============================================================================
#
# Copyright (c) Kitware, Inc.
# All rights reserved.
# See LICENSE.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notice for more information.
#
#=============================================================================
from smtkPybindModelRemus import *
if(SMTK_ENABLE_PYTHON_WRAPPING AND Shiboken_FOUND)
if(SMTK_ENABLE_PYTHON_WRAPPING)
add_subdirectory(python)
endif()
......@@ -12,6 +12,10 @@
import os, sys
import unittest
import smtk
if smtk.wrappingProtocol() == 'pybind11':
import smtk.model
import smtk.model.remus
import smtk.bridge.discrete
import smtk.testing
from smtk.simple import *
......
......@@ -10,5 +10,4 @@
#
#=============================================================================
if "@SMTK_ENABLE_VTK_SUPPORT@" is "ON":
from smtkPybindIOVTK import *
from smtkPybindIOVTK import *
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment