From 30a3d92650e1468c0948e647260bc3591449e1bb Mon Sep 17 00:00:00 2001
From: Guillaume Cerutti <guillaume.cerutti@inria.fr>
Date: Sun, 24 Mar 2024 09:26:05 +0100
Subject: [PATCH] wrapper cmakelists + test

---
 CMakeLists.txt                 |  7 +------
 tests/test_cgal.py             |  2 +-
 tests/test_tetrahedral_mesh.py | 10 ++++++++++
 wrp/CMakeLists.txt             |  8 ++++++++
 4 files changed, 20 insertions(+), 7 deletions(-)
 create mode 100644 tests/test_tetrahedral_mesh.py
 create mode 100644 wrp/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index df60d59..242fc59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,7 @@ find_package(CGAL REQUIRED COMPONENTS ImageIO)
 include(GNUInstallDirs)
 
 add_subdirectory(cpp)
+add_subdirectory(wrp)
 
 # Add a library using FindPython's tooling (pybind11 also provides a helper like
 # this)
@@ -36,9 +37,3 @@ target_link_libraries(_cgal PRIVATE CGAL::CGAL)
 # The install directory is the output (wheel) directory
 install(TARGETS _core DESTINATION pybind_example)
 install(TARGETS _cgal DESTINATION pybind_example)
-
-pybind11_add_module(_wrp MODULE wrp/LabelledTetrahedralMeshWrapper.cpp)
-target_include_directories(_wrp PRIVATE ${CMAKE_SOURCE_DIR}/cpp/)
-target_link_libraries(_wrp PUBLIC _cpp)
-
-install(TARGETS _wrp DESTINATION pybind_example)
\ No newline at end of file
diff --git a/tests/test_cgal.py b/tests/test_cgal.py
index 9537216..7931783 100644
--- a/tests/test_cgal.py
+++ b/tests/test_cgal.py
@@ -17,7 +17,7 @@ class TestCgalMesh(unittest.TestCase):
         if os.path.exists(self.mesh_filename):
             os.remove(self.mesh_filename)
 
-    def test_tissue_image_surface_topomesh(self):
+    def test_mesh_3d_image(self):
         res = mesh_3d_image(self.image_filename, self.mesh_filename)
         assert res == 1 # should not work for now, test that it fails
         assert not os.path.exists(self.mesh_filename)
diff --git a/tests/test_tetrahedral_mesh.py b/tests/test_tetrahedral_mesh.py
new file mode 100644
index 0000000..2f44dbe
--- /dev/null
+++ b/tests/test_tetrahedral_mesh.py
@@ -0,0 +1,10 @@
+import unittest
+
+from pybind_example.labelled_tetrahedral_mesh import LabelledTetrahedralMesh
+
+
+class TestTetrahedralMesh(unittest.TestCase):
+
+    def test_tetrahedral_mesh_init(self):
+        mesh = LabelledTetrahedralMesh()
+        assert mesh is not None
diff --git a/wrp/CMakeLists.txt b/wrp/CMakeLists.txt
new file mode 100644
index 0000000..75b15a7
--- /dev/null
+++ b/wrp/CMakeLists.txt
@@ -0,0 +1,8 @@
+project(_wrp)
+
+pybind11_add_module(_wrp MODULE LabelledTetrahedralMeshWrapper.cpp)
+
+target_include_directories(_wrp PRIVATE ${CMAKE_SOURCE_DIR}/cpp/)
+target_link_libraries(_wrp PUBLIC _cpp)
+
+install(TARGETS _wrp DESTINATION pybind_example)
\ No newline at end of file
-- 
GitLab