diff --git a/conanfile.py b/conanfile.py index 30fdfe43..b42c87ca 100644 --- a/conanfile.py +++ b/conanfile.py @@ -129,7 +129,7 @@ def requirements(self): modules = self._enabled_modules self.output.info("Enabled modules:", modules) if "imageproc" in modules: - self.requires("libsgm/3.0.0@cupoch") + self.requires("libsgm/3.0.0@cupoch", transitive_headers=True) if "io" in modules: self.requires("libjpeg-turbo/3.0.0") self.requires("libpng/1.6.40") diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 04c4673e..dafb2086 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -3,9 +3,19 @@ project(PackageTest LANGUAGES CXX CUDA) find_package(cupoch REQUIRED) -if (TARGET cupoch::registration) - add_executable(test_registration test_registration.cpp) - target_link_libraries(test_registration PRIVATE cupoch::registration) +# Build a separate test executable for each module with external dependencies +# to ensure that everything compiles and links correctly. + +# Using cupoch::cupoch as the link_libraries would also work. + +if (TARGET cupoch::imageproc) + add_executable(test_imageproc test_imageproc.cpp) + target_link_libraries(test_imageproc PRIVATE cupoch::imageproc cupoch::io) +endif() + +if (TARGET cupoch::io) + add_executable(test_io test_io.cpp) + target_link_libraries(test_io PRIVATE cupoch::io) endif() if (TARGET cupoch::kinematics) @@ -13,7 +23,12 @@ if (TARGET cupoch::kinematics) target_link_libraries(test_kinematics PRIVATE cupoch::kinematics) endif() -if (TARGET cupoch::io) - add_executable(test_io test_io.cpp) - target_link_libraries(test_io PRIVATE cupoch::io) +if (TARGET cupoch::registration) + add_executable(test_registration test_registration.cpp) + target_link_libraries(test_registration PRIVATE cupoch::registration) +endif() + +if (TARGET cupoch::visualization) + add_executable(test_visualization test_visualization.cpp) + target_link_libraries(test_visualization PRIVATE cupoch::visualization) endif() diff --git a/test_package/conanfile.py b/test_package/conanfile.py index de774b44..32e086ac 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -25,12 +25,18 @@ def test(self): if not can_run(self): return cupoch_opts = self.dependencies["cupoch"].options - if cupoch_opts.registration: - cmd = os.path.join(self.cpp.build.bindir, "test_registration") - self.run(cmd, env="conanrun") if cupoch_opts.kinematics: cmd = os.path.join(self.cpp.build.bindir, "test_kinematics") self.run(cmd, env="conanrun") + if cupoch_opts.imageproc and cupoch_opts.io: + cmd = os.path.join(self.cpp.build.bindir, "test_imageproc") + self.run(cmd, env="conanrun") if cupoch_opts.io: cmd = os.path.join(self.cpp.build.bindir, "test_io") self.run(cmd, env="conanrun") + if cupoch_opts.registration: + cmd = os.path.join(self.cpp.build.bindir, "test_registration") + self.run(cmd, env="conanrun") + if cupoch_opts.visualization: + cmd = os.path.join(self.cpp.build.bindir, "test_visualization") + self.run(cmd, env="conanrun") diff --git a/test_package/test_imageproc.cpp b/test_package/test_imageproc.cpp new file mode 100644 index 00000000..2419b991 --- /dev/null +++ b/test_package/test_imageproc.cpp @@ -0,0 +1,19 @@ +#include +#include +#include + +using namespace cupoch; + +void testSGM() { + auto limg = io::CreateImageFromFile("../../testdata/left.png")->CreateGrayImage(); + auto rimg = io::CreateImageFromFile("../../testdata/right.png")->CreateGrayImage(); + imageproc::SGMOption params(limg->width_, limg->height_); + imageproc::SemiGlobalMatching sgm(params); + auto disp = sgm.ProcessFrame(*limg, *rimg); + disp->LinearTransform(255.0 / 127.0); +} + +int main() { + // Only testing that the code compiles and links. + return 0; +} diff --git a/test_package/test_visualization.cpp b/test_package/test_visualization.cpp new file mode 100644 index 00000000..08353c17 --- /dev/null +++ b/test_package/test_visualization.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +using namespace cupoch; + +void displayPointCloud() { + auto pcd = io::CreatePointCloudFromFile("test.ply"); + pcd->EstimateNormals(); + visualization::DrawGeometries({pcd}); +} + +int main() { + // Only testing that the code compiles and links. + return 0; +}