remove the pywrap prefix from pybind11 modules; add _pybind to the cmake target of the same modules

This commit is contained in:
Laurent Perron
2023-07-03 14:30:27 +02:00
parent 32175c9c3b
commit 346642b871
19 changed files with 219 additions and 194 deletions

View File

@@ -11,23 +11,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
pybind11_add_module(init MODULE init.cc)
pybind11_add_module(init_pybind11 MODULE init.cc)
set_target_properties(init_pybind11 PROPERTIES
LIBRARY_OUTPUT_NAME "init")
# note: macOS is APPLE and also UNIX !
if(APPLE)
set_target_properties(init PROPERTIES
set_target_properties(init_pybind11 PROPERTIES
SUFFIX ".so"
INSTALL_RPATH "@loader_path;@loader_path/../../../${PYTHON_PROJECT}/.libs"
)
set_property(TARGET init APPEND PROPERTY
set_property(TARGET init_pybind11 APPEND PROPERTY
LINK_FLAGS "-flat_namespace -undefined suppress"
)
elseif(UNIX)
set_target_properties(init PROPERTIES
set_target_properties(init_pybind11 PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../../${PYTHON_PROJECT}/.libs"
)
endif()
target_link_libraries(init PRIVATE ${PROJECT_NAMESPACE}::ortools)
add_library(${PROJECT_NAMESPACE}::init ALIAS init)
target_link_libraries(init_pybind11 PRIVATE ${PROJECT_NAMESPACE}::ortools)
add_library(${PROJECT_NAMESPACE}::init_pybind11 ALIAS init_pybind11)
if(BUILD_TESTING)
file(GLOB PYTHON_SRCS "*_test.py")

View File

@@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef OR_TOOLS_OPEN_SOURCE_INIT_PYTHON_PYWRAPINIT_DOC_H_
#define OR_TOOLS_OPEN_SOURCE_INIT_PYTHON_PYWRAPINIT_DOC_H_
#ifndef OR_TOOLS_OPEN_SOURCE_INIT_PYTHON_INIT_DOC_H_
#define OR_TOOLS_OPEN_SOURCE_INIT_PYTHON_INIT_DOC_H_
/*
This file contains docstrings for use in the Python bindings.
@@ -141,4 +141,4 @@ static const char* __doc_operations_research_OrToolsVersion_VersionString =
#pragma GCC diagnostic pop
#endif
#endif // OR_TOOLS_OPEN_SOURCE_INIT_PYTHON_PYWRAPINIT_DOC_H_
#endif // OR_TOOLS_OPEN_SOURCE_INIT_PYTHON_INIT_DOC_H_