From 1ba040db37c8cb6470bf79b1924ea32a231aa15c Mon Sep 17 00:00:00 2001 From: sguionni Date: Wed, 12 Jun 2024 14:53:06 +0200 Subject: [PATCH] vtx_tool & vtx_tool_test --- dev/CMakeLists.txt | 8 ++++++ lib/renderer/test/cmake/library.cmake | 1 - lib/tool/CMakeLists.txt | 25 +++-------------- lib/tool/cmake/library.cmake | 27 +++++++++++++++++++ lib/tool/conanfile.py | 6 ++--- .../core/example/tool_registration_test.hpp | 2 +- .../tool/core/io/vtx_layout_reader.hpp | 2 +- lib/tool/include/tool/core/layout_builder.hpp | 2 +- .../serialization/ui_core_serializers.hpp | 2 +- lib/tool/include/tool/core/tool_handler.hpp | 4 +-- lib/tool/include/tool/qt/base_qt_widget.hpp | 2 +- .../core/example/tool_registration_test.cpp | 2 +- .../src/tool/core/io/vtx_layout_reader.cpp | 4 +-- lib/tool/src/tool/core/layout_builder.cpp | 4 +-- lib/tool/src/tool/core/layout_descriptor.cpp | 2 +- .../serialization/ui_core_serializers.cpp | 2 +- lib/tool/src/tool/core/tool_handler.cpp | 5 ++-- lib/tool/src/tool/qt/base_qt_widget.cpp | 2 +- lib/tool/test/CMakeLists.txt | 13 +++------ lib/tool/test/cmake/library.cmake | 14 ++++++++++ lib/ui/cmake/library.cmake | 19 +++++-------- lib/ui/include/ui/qt/base_qt_widget.hpp | 16 ----------- 22 files changed, 81 insertions(+), 83 deletions(-) create mode 100644 lib/tool/cmake/library.cmake create mode 100644 lib/tool/test/cmake/library.cmake delete mode 100644 lib/ui/include/ui/qt/base_qt_widget.hpp diff --git a/dev/CMakeLists.txt b/dev/CMakeLists.txt index 1de119f62..de637f3e1 100644 --- a/dev/CMakeLists.txt +++ b/dev/CMakeLists.txt @@ -82,6 +82,14 @@ include("${DIR_LIBS}/ui/test/cmake/library.cmake") vtx_clear_registered_copies() +# Tool. +include("${DIR_LIBS}/tool/cmake/library.cmake") + +# Tool test. +include("${DIR_LIBS}/tool/test/cmake/library.cmake") + +vtx_clear_registered_copies() + # MdPrep. include("${DIR_LIBS}/tool/tools/mdprep/cmake/library.cmake") diff --git a/lib/renderer/test/cmake/library.cmake b/lib/renderer/test/cmake/library.cmake index 003daaba5..3d93508c0 100644 --- a/lib/renderer/test/cmake/library.cmake +++ b/lib/renderer/test/cmake/library.cmake @@ -8,7 +8,6 @@ if (NOT DEFINED _VTX_RENDERER_TEST_CONAN) target_link_libraries(vtx_renderer_test PRIVATE vtx_core) target_link_libraries(vtx_renderer_test PRIVATE vtx_io) target_link_libraries(vtx_renderer_test PRIVATE Catch2::Catch2WithMain) - else() target_link_libraries(vtx_renderer_test PRIVATE vtx_util::vtx_util) target_link_libraries(vtx_renderer_test PRIVATE vtx_renderer::vtx_renderer_no_opengl) diff --git a/lib/tool/CMakeLists.txt b/lib/tool/CMakeLists.txt index 5316ff6e8..566382c16 100644 --- a/lib/tool/CMakeLists.txt +++ b/lib/tool/CMakeLists.txt @@ -1,33 +1,14 @@ message("vtx_tool") cmake_minimum_required(VERSION 3.23) - project(vtx_tool) find_package(vtx_util CONFIG REQUIRED) find_package(vtx_app CONFIG REQUIRED) find_package(vtx_ui CONFIG REQUIRED) -find_package(Eigen3 REQUIRED) find_package(vtx_tool_mdprep REQUIRED) +find_package(Eigen3 REQUIRED) -configure_qt() -add_library(vtx_tool) -configure_target(vtx_tool) - -set(QT_RESOURCES_PATH asset/qt/resources) - -file(GLOB_RECURSE HEADERS include/*) -file(GLOB_RECURSE SOURCES src/*) -file(GLOB_RECURSE QT_RESOURCES ${QT_RESOURCES_PATH}/*) -target_sources(vtx_tool - PRIVATE ${SOURCES} - PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${HEADERS}) - -qt_add_resources(vtx_tool vtx_qt_resources_tool BASE ${QT_RESOURCES_PATH} FILES ${QT_RESOURCES}) - -target_link_libraries(vtx_tool PRIVATE vtx_util::vtx_util) -target_link_libraries(vtx_tool PRIVATE vtx_app::vtx_app) -target_link_libraries(vtx_tool PRIVATE vtx_ui::vtx_ui) -target_link_libraries(vtx_tool PRIVATE Eigen3::Eigen) -target_link_libraries(vtx_tool PRIVATE vtx_tool_mdprep::vtx_tool_mdprep) +set(_VTX_TOOL_CONAN " ") +include("./cmake/library.cmake") install(TARGETS vtx_tool FILE_SET public_headers DESTINATION include) \ No newline at end of file diff --git a/lib/tool/cmake/library.cmake b/lib/tool/cmake/library.cmake new file mode 100644 index 000000000..ff9ffc077 --- /dev/null +++ b/lib/tool/cmake/library.cmake @@ -0,0 +1,27 @@ +add_library(vtx_tool) +configure_target(vtx_tool) + +set(QT_RESOURCES_PATH ${CMAKE_CURRENT_LIST_DIR}/../asset/qt/resources) + +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_LIST_DIR}/../include/*) +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_LIST_DIR}/../src/*) +file(GLOB_RECURSE QT_RESOURCES ${QT_RESOURCES_PATH}/*) +target_sources(vtx_tool + PRIVATE ${SOURCES} + PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../include FILES ${HEADERS}) + +qt_add_resources(vtx_tool vtx_qt_resources_tool BASE ${QT_RESOURCES_PATH} FILES ${QT_RESOURCES}) + +if (NOT DEFINED _VTX_TOOL_CONAN) + target_link_libraries(vtx_tool PRIVATE vtx_util) + target_link_libraries(vtx_tool PRIVATE vtx_app) + target_link_libraries(vtx_tool PRIVATE vtx_ui) + target_link_libraries(vtx_tool PRIVATE vtx_tool_mdprep) +else() + target_link_libraries(vtx_tool PRIVATE vtx_util::vtx_util) + target_link_libraries(vtx_tool PRIVATE vtx_app::vtx_app) + target_link_libraries(vtx_tool PRIVATE vtx_ui::vtx_ui) + target_link_libraries(vtx_tool PRIVATE vtx_tool_mdprep::vtx_tool_mdprep) +endif() + +target_link_libraries(vtx_tool PRIVATE Eigen3::Eigen) \ No newline at end of file diff --git a/lib/tool/conanfile.py b/lib/tool/conanfile.py index 5ff58dd0a..6237ef017 100644 --- a/lib/tool/conanfile.py +++ b/lib/tool/conanfile.py @@ -19,9 +19,9 @@ class VTXToolRecipe(ConanFile): def requirements(self): self.requires("vtx_util/1.0") self.requires("vtx_app/1.0") - self.requires("vtx_ui/1.0") - self.requires("eigen/3.4.0") - self.requires("vtx_tool_mdprep/1.0") + self.requires("vtx_ui/1.0") + self.requires("vtx_tool_mdprep/1.0") + self.requires("eigen/3.4.0") def generate(self): copy( diff --git a/lib/tool/include/tool/core/example/tool_registration_test.hpp b/lib/tool/include/tool/core/example/tool_registration_test.hpp index 762799792..ecc4fb277 100644 --- a/lib/tool/include/tool/core/example/tool_registration_test.hpp +++ b/lib/tool/include/tool/core/example/tool_registration_test.hpp @@ -1,7 +1,7 @@ #ifndef __VTX_UI_CORE_EXAMPLE_TOOL_REGISTRATION_TEST__ #define __VTX_UI_CORE_EXAMPLE_TOOL_REGISTRATION_TEST__ -#include "ui/core/tool_registry.hpp" +#include "tool/core/tool_registry.hpp" namespace VTX::UI::Core::Example { diff --git a/lib/tool/include/tool/core/io/vtx_layout_reader.hpp b/lib/tool/include/tool/core/io/vtx_layout_reader.hpp index dafcd0744..1fd879629 100644 --- a/lib/tool/include/tool/core/io/vtx_layout_reader.hpp +++ b/lib/tool/include/tool/core/io/vtx_layout_reader.hpp @@ -1,7 +1,7 @@ #ifndef __VTX_UI_CORE_IO_VTX_LAYOUT_READER__ #define __VTX_UI_CORE_IO_VTX_LAYOUT_READER__ -#include "ui/core/layout_descriptor.hpp" +#include "tool/core/layout_descriptor.hpp" #include #include diff --git a/lib/tool/include/tool/core/layout_builder.hpp b/lib/tool/include/tool/core/layout_builder.hpp index 37c2501a9..a3e91d574 100644 --- a/lib/tool/include/tool/core/layout_builder.hpp +++ b/lib/tool/include/tool/core/layout_builder.hpp @@ -1,7 +1,7 @@ #ifndef __VTX_UI_CORE_LAYOUT_BUILDER__ #define __VTX_UI_CORE_LAYOUT_BUILDER__ -#include "ui/core/layout_descriptor.hpp" +#include "tool/core/layout_descriptor.hpp" #include namespace VTX::UI::Core diff --git a/lib/tool/include/tool/core/serialization/ui_core_serializers.hpp b/lib/tool/include/tool/core/serialization/ui_core_serializers.hpp index 23cc6f90e..f788f99a8 100644 --- a/lib/tool/include/tool/core/serialization/ui_core_serializers.hpp +++ b/lib/tool/include/tool/core/serialization/ui_core_serializers.hpp @@ -1,7 +1,7 @@ #ifndef __VTX_UI_CORE_SERIALIZATION_UI_CORE_SERIALIZERS__ #define __VTX_UI_CORE_SERIALIZATION_UI_CORE_SERIALIZERS__ -#include "ui/core/layout_descriptor.hpp" +#include "tool/core/layout_descriptor.hpp" #include #include diff --git a/lib/tool/include/tool/core/tool_handler.hpp b/lib/tool/include/tool/core/tool_handler.hpp index 33e2db087..8d34c1760 100644 --- a/lib/tool/include/tool/core/tool_handler.hpp +++ b/lib/tool/include/tool/core/tool_handler.hpp @@ -2,8 +2,8 @@ #define __VTX_UI_CORE_TOOL_HANDLER__ #include -#include -#include +#include +#include #include namespace VTX::UI::Core diff --git a/lib/tool/include/tool/qt/base_qt_widget.hpp b/lib/tool/include/tool/qt/base_qt_widget.hpp index d5610f800..78aa21aad 100644 --- a/lib/tool/include/tool/qt/base_qt_widget.hpp +++ b/lib/tool/include/tool/qt/base_qt_widget.hpp @@ -1,7 +1,7 @@ #ifndef __VTX_UI_QT_BASE_QT_TOOL__ #define __VTX_UI_QT_BASE_QT_TOOL__ -#include "ui/core/base_ui_tool.hpp" +#include "tool/core/base_ui_tool.hpp" #include namespace VTX::UI::QT diff --git a/lib/tool/src/tool/core/example/tool_registration_test.cpp b/lib/tool/src/tool/core/example/tool_registration_test.cpp index 405e6ea78..a2a0b0255 100644 --- a/lib/tool/src/tool/core/example/tool_registration_test.cpp +++ b/lib/tool/src/tool/core/example/tool_registration_test.cpp @@ -1,4 +1,4 @@ -#include "ui/core/example/tool_registration_test.hpp" +#include "tool/core/example/tool_registration_test.hpp" #include namespace VTX::UI::Core::Example diff --git a/lib/tool/src/tool/core/io/vtx_layout_reader.cpp b/lib/tool/src/tool/core/io/vtx_layout_reader.cpp index 6ce9a219e..103cfd1e6 100644 --- a/lib/tool/src/tool/core/io/vtx_layout_reader.cpp +++ b/lib/tool/src/tool/core/io/vtx_layout_reader.cpp @@ -1,5 +1,5 @@ -#include "ui/core/io/vtx_layout_reader.hpp" -#include "ui/core/serialization/ui_core_serializers.hpp" +#include "tool/core/io/vtx_layout_reader.hpp" +#include "tool/core/serialization/ui_core_serializers.hpp" #include namespace VTX::UI::Core::IO diff --git a/lib/tool/src/tool/core/layout_builder.cpp b/lib/tool/src/tool/core/layout_builder.cpp index b024dc03c..fdb228aaf 100644 --- a/lib/tool/src/tool/core/layout_builder.cpp +++ b/lib/tool/src/tool/core/layout_builder.cpp @@ -1,5 +1,5 @@ -#include "ui/core/layout_builder.hpp" -#include "ui/core/tool_handler.hpp" +#include "tool/core/layout_builder.hpp" +#include "tool/core/tool_handler.hpp" #include namespace VTX::UI::Core diff --git a/lib/tool/src/tool/core/layout_descriptor.cpp b/lib/tool/src/tool/core/layout_descriptor.cpp index 31a4b3a17..c9a88b322 100644 --- a/lib/tool/src/tool/core/layout_descriptor.cpp +++ b/lib/tool/src/tool/core/layout_descriptor.cpp @@ -1,4 +1,4 @@ -#include "ui/core/layout_descriptor.hpp" +#include "tool/core/layout_descriptor.hpp" namespace VTX::UI::Core { diff --git a/lib/tool/src/tool/core/serialization/ui_core_serializers.cpp b/lib/tool/src/tool/core/serialization/ui_core_serializers.cpp index 8276d6d43..82e5ed5f0 100644 --- a/lib/tool/src/tool/core/serialization/ui_core_serializers.cpp +++ b/lib/tool/src/tool/core/serialization/ui_core_serializers.cpp @@ -1,4 +1,4 @@ -#include "ui/core/serialization/ui_core_serializers.hpp" +#include "tool/core/serialization/ui_core_serializers.hpp" #include #include #include diff --git a/lib/tool/src/tool/core/tool_handler.cpp b/lib/tool/src/tool/core/tool_handler.cpp index 37d4cae9d..5b2850ffc 100644 --- a/lib/tool/src/tool/core/tool_handler.cpp +++ b/lib/tool/src/tool/core/tool_handler.cpp @@ -1,6 +1,5 @@ -#include "ui/core/tool_handler.hpp" -#include "ui/core/tool_registry.hpp" -#include "ui/qt/core/custom/dock_window_main_widget.hpp" +#include "tool/core/tool_handler.hpp" +#include "tool/core/tool_registry.hpp" namespace VTX::UI::Core { diff --git a/lib/tool/src/tool/qt/base_qt_widget.cpp b/lib/tool/src/tool/qt/base_qt_widget.cpp index fcb0c6ae9..c177141a1 100644 --- a/lib/tool/src/tool/qt/base_qt_widget.cpp +++ b/lib/tool/src/tool/qt/base_qt_widget.cpp @@ -1,4 +1,4 @@ -#include "ui/qt/base_qt_widget.hpp" +#include "tool/qt/base_qt_widget.hpp" namespace VTX::UI::QT { diff --git a/lib/tool/test/CMakeLists.txt b/lib/tool/test/CMakeLists.txt index 7f0fc9215..ea1cbcc92 100644 --- a/lib/tool/test/CMakeLists.txt +++ b/lib/tool/test/CMakeLists.txt @@ -1,22 +1,15 @@ message("vtx_tool_test") cmake_minimum_required(VERSION 3.23) - project(vtx_tool_test) find_package(vtx_tool CONFIG REQUIRED) find_package(Eigen3 REQUIRED) find_package(Catch2 REQUIRED) -add_executable(vtx_tool_test src/main.cpp) -configure_target(vtx_tool_test) - -target_link_libraries(vtx_tool_test PRIVATE vtx_tool::vtx_tool) -target_link_libraries(vtx_tool_test PRIVATE Catch2::Catch2WithMain) - -target_compile_definitions(vtx_tool_test PRIVATE VTX_RENDERER_NO_OPENGL) - include(CTest) include(Catch) -catch_discover_tests(vtx_tool_test DISCOVERY_MODE PRE_TEST) + +set(_VTX_TOOL_TEST_CONAN " ") +include(cmake/library.cmake) install(TARGETS vtx_tool_test) diff --git a/lib/tool/test/cmake/library.cmake b/lib/tool/test/cmake/library.cmake new file mode 100644 index 000000000..cde29b252 --- /dev/null +++ b/lib/tool/test/cmake/library.cmake @@ -0,0 +1,14 @@ +add_executable(vtx_tool_test ${CMAKE_CURRENT_LIST_DIR}/../src/main.cpp) +configure_target(vtx_tool_test) + +if (NOT DEFINED _VTX_TOOL_TEST_CONAN) + target_link_libraries(vtx_tool_test PRIVATE vtx_tool) +else() + target_link_libraries(vtx_tool_test PRIVATE vtx_tool::vtx_tool) +endif() + +target_link_libraries(vtx_tool_test PRIVATE Eigen3::Eigen) +target_link_libraries(vtx_tool_test PRIVATE Catch2::Catch2WithMain) +target_compile_definitions(vtx_tool_test PRIVATE VTX_RENDERER_NO_OPENGL) + +catch_discover_tests(vtx_tool_test DISCOVERY_MODE PRE_TEST) diff --git a/lib/ui/cmake/library.cmake b/lib/ui/cmake/library.cmake index 93d077076..97a300e86 100644 --- a/lib/ui/cmake/library.cmake +++ b/lib/ui/cmake/library.cmake @@ -4,11 +4,6 @@ configure_qt() add_library(vtx_ui) configure_target(vtx_ui) -find_package(Qt6 COMPONENTS Core REQUIRED) -find_package(Qt6 COMPONENTS Gui REQUIRED) -find_package(Qt6 COMPONENTS Widgets REQUIRED) -find_package(Qt6 COMPONENTS OpenGLWidgets REQUIRED) - set(QT_RESOURCES_PATH ${CMAKE_CURRENT_LIST_DIR}/../asset/qt/resources) file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_LIST_DIR}/../include/*) @@ -28,10 +23,6 @@ if (NOT DEFINED _VTX_UI_CONAN) target_link_libraries(vtx_ui PUBLIC vtx_app) target_link_libraries(vtx_ui PUBLIC vtx_python_binding) target_link_libraries(vtx_ui PUBLIC PyTX) - target_link_libraries(vtx_ui PUBLIC Qt6::Core) - target_link_libraries(vtx_ui PUBLIC Qt6::Gui) - target_link_libraries(vtx_ui PUBLIC Qt6::Widgets) - target_link_libraries(vtx_ui PUBLIC Qt6::OpenGLWidgets) else() target_link_libraries(vtx_ui PRIVATE vtx_util::vtx_util) @@ -41,12 +32,14 @@ else() target_link_libraries(vtx_ui PRIVATE vtx_app::vtx_app) target_link_libraries(vtx_ui PRIVATE vtx_python_binding::vtx_python_binding) target_link_libraries(vtx_ui PRIVATE vtx_python_binding::PyTX) - target_link_libraries(vtx_ui PRIVATE Qt6::Core) - target_link_libraries(vtx_ui PRIVATE Qt6::Gui) - target_link_libraries(vtx_ui PRIVATE Qt6::Widgets) - target_link_libraries(vtx_ui PRIVATE Qt6::OpenGLWidgets) + endif() +target_link_libraries(vtx_ui PRIVATE Qt6::Core) +target_link_libraries(vtx_ui PRIVATE Qt6::Gui) +target_link_libraries(vtx_ui PRIVATE Qt6::Widgets) +target_link_libraries(vtx_ui PRIVATE Qt6::OpenGLWidgets) + if(MSVC) target_link_libraries(vtx_ui PRIVATE Qt6::QWindowsIntegrationPlugin) endif() diff --git a/lib/ui/include/ui/qt/base_qt_widget.hpp b/lib/ui/include/ui/qt/base_qt_widget.hpp deleted file mode 100644 index d5610f800..000000000 --- a/lib/ui/include/ui/qt/base_qt_widget.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __VTX_UI_QT_BASE_QT_TOOL__ -#define __VTX_UI_QT_BASE_QT_TOOL__ - -#include "ui/core/base_ui_tool.hpp" -#include - -namespace VTX::UI::QT -{ - class BaseQtTool : public VTX::UI::Core::BaseVTXUITool, public QObject - { - public: - BaseQtTool(); - }; -} // namespace VTX::UI::QT - -#endif