Commit 51f77b2f authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

pytnl: set proper debug postfix and pybind11 module names

Python cannot easily import modules containing "-" so we use "_dbg"
instead of "-dbg".
parent d798788e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -15,7 +15,12 @@ set( sources
pybind11_add_module( pytnl ${sources} )

# rename the shared library to tnl.cpython-XXm-x86_64-linux-gnu.so
set_target_properties( pytnl PROPERTIES LIBRARY_OUTPUT_NAME tnl )
set_target_properties( pytnl PROPERTIES LIBRARY_OUTPUT_NAME tnl DEBUG_POSTFIX "_dbg" )

# indicate the postfix to the target so that the pybind11 module name can be set accordingly
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
   target_compile_options( pytnl PRIVATE -DPYTNL_MODULE_POSTFIX=_dbg )
endif()

# Skip -march=native -mtune=native for pytnl - optimizing python bindings for
# a specific architecture is not very useful and prevents using Python tools on
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ template< typename T >
using _vector = TNL::Containers::Vector< T, TNL::Devices::Host, IndexType >;

// Python module definition
PYBIND11_MODULE(tnl, m)
PYBIND11_MODULE(PYTNL_MODULE_NAME(tnl), m)
{
    register_exceptions(m);

+6 −1
Original line number Diff line number Diff line
@@ -9,7 +9,12 @@ set( sources
pybind11_add_module( pytnl_mpi ${sources} )

# rename the shared library to tnl_mpi.cpython-XXm-x86_64-linux-gnu.so
set_target_properties( pytnl_mpi PROPERTIES LIBRARY_OUTPUT_NAME tnl_mpi )
set_target_properties( pytnl_mpi PROPERTIES LIBRARY_OUTPUT_NAME tnl_mpi DEBUG_POSTFIX "_dbg" )

# indicate the postfix to the target so that the pybind11 module name can be set accordingly
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
   target_compile_options( pytnl_mpi PRIVATE -DPYTNL_MODULE_POSTFIX=_dbg )
endif()

# Skip -march=native -mtune=native for pytnl_mpi - optimizing python bindings for
# a specific architecture is not very useful and prevents using Python tools on
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
void export_DistributedMeshes( py::module & m )
{
    // make sure that bindings for the local meshes are available
    py::module_::import("tnl");
    py::module_::import(PYTNL_STRINGIFY(PYTNL_MODULE_NAME(tnl)));

    export_DistributedMesh< DistributedMeshOfEdges >( m, "DistributedMeshOfEdges" );
    export_DistributedMesh< DistributedMeshOfTriangles >( m, "DistributedMeshOfTriangles" );
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ void export_DistributedMeshReaders( py::module & m )
    using PVTUReader = TNL::Meshes::Readers::PVTUReader;

    // make sure that bindings for the parent class are available
    py::module_::import("tnl");
    py::module_::import(PYTNL_STRINGIFY(PYTNL_MODULE_NAME(tnl)));

    py::class_< PVTUReader, XMLVTK >( m, "PVTUReader" )
        .def(py::init<std::string>())
Loading