From cb15d9d3ca9f99578220bef3276a6605d2961963 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 8 Nov 2023 15:19:52 +0900 Subject: [PATCH] enable launching glfw or imgui guis --- bindings/SofaGui/CMakeLists.txt | 11 +++++++++++ .../src/SofaPython3/SofaGui/Module_SofaGui.cpp | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/bindings/SofaGui/CMakeLists.txt b/bindings/SofaGui/CMakeLists.txt index 7e7a556a0..a5f42e57e 100644 --- a/bindings/SofaGui/CMakeLists.txt +++ b/bindings/SofaGui/CMakeLists.txt @@ -23,6 +23,17 @@ sofa_find_package(Sofa.GUI.Qt QUIET) if(Sofa.GUI.Qt_FOUND) list(APPEND SUPPORTED_GUIS Sofa.GUI.Qt) endif() + + +sofa_find_package(SofaGLFW QUIET) +if(SofaGLFW_FOUND) + list(APPEND SUPPORTED_GUIS SofaGLFW) +endif() +sofa_find_package(SofaImGui QUIET) +if(SofaImGui_FOUND) + list(APPEND SUPPORTED_GUIS SofaImGui) +endif() + sofa_find_package(Sofa.GUI.HeadlessRecorder QUIET) if(Sofa.GUI.HeadlessRecorder_FOUND) list(APPEND SUPPORTED_GUIS Sofa.GUI.HeadlessRecorder) diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp index 048133a96..72f40a895 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp @@ -37,6 +37,16 @@ using sofa::helper::system::FileSystem; #define HAS_GUI_QT #endif +#if __has_include() +#include +#define HAS_GUI_SOFAGLFW +#endif + +#if __has_include() +#include +#define HAS_GUI_SOFAIMGUI +#endif + #if __has_include() #include #define HAS_GUI_HEADLESSRECORDER @@ -106,6 +116,12 @@ PYBIND11_MODULE(Gui, m) { #ifdef HAS_GUI_HEADLESSRECORDER sofa::gui::headlessrecorder::init(); #endif +#ifdef HAS_GUI_SOFAGLFW + sofaglfw::init(); +#endif +#ifdef HAS_GUI_SOFAIMGUI + sofaimgui::init(); +#endif sofa::core::init();