diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 935ac2a..cc12359 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,62 +36,16 @@ install(
RUNTIME DESTINATION bin
)
-# TODO: Separate plugins source code to plugins/ dir and add_subdir here
-
-# Qtk Application
-if(QTK_GUI OR QTK_PLUGINS)
- add_subdirectory(app)
-endif()
-
-if(QTK_PLUGINS)
- install(
- TARGETS qtk_plugins qtk_library qtk_plugin_library
- COMPONENT qtk_plugins
- LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
- ARCHIVE DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
- RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
- )
+# The Qtk Application's GUI requires plugins to be built, but not installed.
+# If both are disabled we can skip. If QTK_PLUGINS is set we'll install the
+# plugins to Qt Designer for use in other projects.
+if(QTK_PLUGINS OR QTK_GUI)
+ add_subdirectory(designer-plugins)
endif()
+# Build Qtk Application only if QTK_GUI is set.
if(QTK_GUI)
- install(
- TARGETS qtk_gui
- COMPONENT qtk_gui
- BUNDLE DESTINATION .
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
- RUNTIME DESTINATION bin
- )
-
- qt_generate_deploy_app_script(
- TARGET qtk_gui
- OUTPUT_SCRIPT QTK_DEPLOY_SCRIPT
- NO_UNSUPPORTED_PLATFORM_ERROR
- )
- install(SCRIPT ${QTK_DEPLOY_SCRIPT} COMPONENT qtk_gui)
-
- if(WIN32)
- if(MSVC AND TARGET Qt6::qmake)
- get_target_property(QT6_QMAKE_LOCATION Qt6::qmake IMPORTED_LOCATION)
- execute_process(
- COMMAND "${QT6_QMAKE_LOCATION}" -query QT_INSTALL_PREFIX
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE QT6_INSTALL_PREFIX
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- file(TO_NATIVE_PATH "${QT6_INSTALL_PREFIX}/bin" QT6_INSTALL_PREFIX)
-
- set(VSUSER_FILE "${CMAKE_CURRENT_BINARY_DIR}/qtk_gui.vcxproj.user")
- file(WRITE ${VSUSER_FILE} "\n")
- file(APPEND ${VSUSER_FILE} "\n")
- file(APPEND ${VSUSER_FILE} " \n")
- file(APPEND ${VSUSER_FILE} " Path=$(SolutionDir)\\lib\\$(Configuration);${QT6_INSTALL_PREFIX};$(Path)\n")
- file(APPEND ${VSUSER_FILE} "$(LocalDebuggerEnvironment)\n")
- file(APPEND ${VSUSER_FILE} " WindowsLocalDebugger\n")
- file(APPEND ${VSUSER_FILE} " \n")
- file(APPEND ${VSUSER_FILE} "\n")
- endif()
- endif()
+ add_subdirectory(app)
endif()
write_basic_package_version_file(
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index 41f9765..110e8b0 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -6,54 +6,10 @@
################################################################################
################################################################################
-# Qtk Widget Library
-################################################################################
-# Create a library of widgets used to build Qtk GUI
-set(
- QTK_PLUGIN_LIBRARY_SOURCES
- qtkwidget.cpp
- debugconsole.cpp debugconsole.ui
- toolbox.cpp toolbox.ui
- treeview.cpp treeview.ui
- qtkmainwindow.cpp qtkmainwindow.h qtkmainwindow.ui
-)
-set(
- QTK_PLUGIN_LIBRARY_HEADERS
- qtkwidget.h
- debugconsole.h
- toolbox.h
- treeview.h
-)
-qt_add_library(qtk_plugin_library STATIC EXCLUDE_FROM_ALL)
-target_sources(
- qtk_plugin_library PRIVATE
- "${QTK_PLUGIN_LIBRARY_SOURCES}"
- "${QTK_PLUGIN_LIBRARY_HEADERS}"
-)
-target_link_libraries(qtk_plugin_library PUBLIC Qt6::UiPlugin qtk_library)
-
-################################################################################
-# Qtk Widget Plugins
-################################################################################
-# Create a Qt Designer plugin for a collection of widgets from our library.
-qt_add_plugin(qtk_plugins SHARED)
-target_sources(
- qtk_plugins PRIVATE
- widgetplugincollection.cpp widgetplugincollection.h
- widgetplugin.cpp widgetplugin.h
-)
-target_link_libraries(qtk_plugins PUBLIC qtk_plugin_library)
-
-################################################################################
-# Final Qtk Application
+# Qtk Application
################################################################################
-set(
- QTK_GUI_SOURCES
- qtkscene.cpp qtkscene.h
- main.cpp
-)
-
+set(QTK_GUI_SOURCES qtkscene.cpp qtkscene.h main.cpp)
qt_add_executable(qtk_gui ${QTK_GUI_SOURCES})
target_link_libraries(qtk_gui PRIVATE qtk_plugin_library)
@@ -72,3 +28,42 @@ elseif(APPLE)
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
endif()
+
+install(
+ TARGETS qtk_gui
+ COMPONENT qtk_gui
+ BUNDLE DESTINATION .
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+
+qt_generate_deploy_app_script(
+ TARGET qtk_gui
+ OUTPUT_SCRIPT QTK_DEPLOY_SCRIPT
+ NO_UNSUPPORTED_PLATFORM_ERROR
+)
+install(SCRIPT ${QTK_DEPLOY_SCRIPT} COMPONENT qtk_gui)
+
+if(WIN32)
+ if(MSVC AND TARGET Qt6::qmake)
+ get_target_property(QT6_QMAKE_LOCATION Qt6::qmake IMPORTED_LOCATION)
+ execute_process(
+ COMMAND "${QT6_QMAKE_LOCATION}" -query QT_INSTALL_PREFIX
+ RESULT_VARIABLE return_code
+ OUTPUT_VARIABLE QT6_INSTALL_PREFIX
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ file(TO_NATIVE_PATH "${QT6_INSTALL_PREFIX}/bin" QT6_INSTALL_PREFIX)
+
+ set(VSUSER_FILE "${CMAKE_CURRENT_BINARY_DIR}/qtk_gui.vcxproj.user")
+ file(WRITE ${VSUSER_FILE} "\n")
+ file(APPEND ${VSUSER_FILE} "\n")
+ file(APPEND ${VSUSER_FILE} " \n")
+ file(APPEND ${VSUSER_FILE} " Path=$(SolutionDir)\\lib\\$(Configuration);${QT6_INSTALL_PREFIX};$(Path)\n")
+ file(APPEND ${VSUSER_FILE} "$(LocalDebuggerEnvironment)\n")
+ file(APPEND ${VSUSER_FILE} " WindowsLocalDebugger\n")
+ file(APPEND ${VSUSER_FILE} " \n")
+ file(APPEND ${VSUSER_FILE} "\n")
+ endif()
+endif()
\ No newline at end of file
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 5371f85..d0a7906 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -8,7 +8,7 @@
#include
-#include "qtkmainwindow.h"
+#include "designer-plugins/qtkmainwindow.h"
#include "qtkscene.h"
int main(int argc, char * argv[])
diff --git a/src/designer-plugins/CMakeLists.txt b/src/designer-plugins/CMakeLists.txt
new file mode 100644
index 0000000..6574dd1
--- /dev/null
+++ b/src/designer-plugins/CMakeLists.txt
@@ -0,0 +1,57 @@
+################################################################################
+## Project for working with OpenGL and Qt6 widgets ##
+## ##
+## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
+## All Content (c) 2023 Shaun Reed, all rights reserved ##
+################################################################################
+
+################################################################################
+# Qtk Widget Library
+################################################################################
+# Create a library of widgets used to build Qtk GUI
+set(
+ QTK_PLUGIN_LIBRARY_SOURCES
+ qtkwidget.cpp
+ debugconsole.cpp debugconsole.ui
+ toolbox.cpp toolbox.ui
+ treeview.cpp treeview.ui
+ qtkmainwindow.cpp qtkmainwindow.h qtkmainwindow.ui
+)
+set(
+ QTK_PLUGIN_LIBRARY_HEADERS
+ qtkwidget.h
+ debugconsole.h
+ toolbox.h
+ treeview.h
+)
+qt_add_library(qtk_plugin_library STATIC EXCLUDE_FROM_ALL)
+target_sources(
+ qtk_plugin_library PRIVATE
+ "${QTK_PLUGIN_LIBRARY_SOURCES}"
+ "${QTK_PLUGIN_LIBRARY_HEADERS}"
+)
+target_link_libraries(qtk_plugin_library PUBLIC Qt6::UiPlugin qtk_library)
+
+################################################################################
+# Qtk Widget Plugins
+################################################################################
+# Create a Qt Designer plugin for a collection of widgets from our library.
+qt_add_plugin(qtk_plugins SHARED)
+target_sources(
+ qtk_plugins PRIVATE
+ widgetplugincollection.cpp widgetplugincollection.h
+ widgetplugin.cpp widgetplugin.h
+)
+target_link_libraries(qtk_plugins PUBLIC qtk_plugin_library)
+
+# Install the Qt Designer plugins only if QTK_PLUGINS is set.
+# Otherwise, we just use them for building the Qtk desktop application.
+if(QTK_PLUGINS)
+ install(
+ TARGETS qtk_plugins qtk_library qtk_plugin_library
+ COMPONENT qtk_plugins
+ LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
+ ARCHIVE DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
+ RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
+ )
+endif()
\ No newline at end of file
diff --git a/src/app/debugconsole.cpp b/src/designer-plugins/debugconsole.cpp
similarity index 100%
rename from src/app/debugconsole.cpp
rename to src/designer-plugins/debugconsole.cpp
diff --git a/src/app/debugconsole.h b/src/designer-plugins/debugconsole.h
similarity index 99%
rename from src/app/debugconsole.h
rename to src/designer-plugins/debugconsole.h
index 5ad00a2..10868af 100644
--- a/src/app/debugconsole.h
+++ b/src/designer-plugins/debugconsole.h
@@ -14,7 +14,7 @@
#include
#include
-#include "qtkwidget.h"
+#include "designer-plugins/qtkwidget.h"
namespace Ui
{
diff --git a/src/app/debugconsole.ui b/src/designer-plugins/debugconsole.ui
similarity index 100%
rename from src/app/debugconsole.ui
rename to src/designer-plugins/debugconsole.ui
diff --git a/src/app/qtkmainwindow.cpp b/src/designer-plugins/qtkmainwindow.cpp
similarity index 100%
rename from src/app/qtkmainwindow.cpp
rename to src/designer-plugins/qtkmainwindow.cpp
diff --git a/src/app/qtkmainwindow.h b/src/designer-plugins/qtkmainwindow.h
similarity index 99%
rename from src/app/qtkmainwindow.h
rename to src/designer-plugins/qtkmainwindow.h
index 109150c..f6321f3 100644
--- a/src/app/qtkmainwindow.h
+++ b/src/designer-plugins/qtkmainwindow.h
@@ -15,7 +15,7 @@
#include
#include "debugconsole.h"
-#include "qtkwidget.h"
+#include "designer-plugins/qtkwidget.h"
namespace Ui
{
diff --git a/src/app/qtkmainwindow.ui b/src/designer-plugins/qtkmainwindow.ui
similarity index 100%
rename from src/app/qtkmainwindow.ui
rename to src/designer-plugins/qtkmainwindow.ui
diff --git a/src/app/qtkwidget.cpp b/src/designer-plugins/qtkwidget.cpp
similarity index 98%
rename from src/app/qtkwidget.cpp
rename to src/designer-plugins/qtkwidget.cpp
index b12cbf6..25eab74 100644
--- a/src/app/qtkwidget.cpp
+++ b/src/designer-plugins/qtkwidget.cpp
@@ -10,14 +10,9 @@
#include
#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
+#include "qtk/input.h"
+#include "qtk/scene.h"
+#include "qtk/shape.h"
#include "debugconsole.h"
#include "qtkmainwindow.h"
diff --git a/src/app/qtkwidget.h b/src/designer-plugins/qtkwidget.h
similarity index 99%
rename from src/app/qtkwidget.h
rename to src/designer-plugins/qtkwidget.h
index f2c56e9..edfa471 100644
--- a/src/app/qtkwidget.h
+++ b/src/designer-plugins/qtkwidget.h
@@ -17,8 +17,8 @@
#include
#include
-#include
-#include
+#include "qtk/qtkapi.h"
+#include "qtk/scene.h"
namespace Qtk
{
diff --git a/src/app/toolbox.cpp b/src/designer-plugins/toolbox.cpp
similarity index 100%
rename from src/app/toolbox.cpp
rename to src/designer-plugins/toolbox.cpp
diff --git a/src/app/toolbox.h b/src/designer-plugins/toolbox.h
similarity index 100%
rename from src/app/toolbox.h
rename to src/designer-plugins/toolbox.h
diff --git a/src/app/toolbox.ui b/src/designer-plugins/toolbox.ui
similarity index 100%
rename from src/app/toolbox.ui
rename to src/designer-plugins/toolbox.ui
diff --git a/src/app/treeview.cpp b/src/designer-plugins/treeview.cpp
similarity index 100%
rename from src/app/treeview.cpp
rename to src/designer-plugins/treeview.cpp
diff --git a/src/app/treeview.h b/src/designer-plugins/treeview.h
similarity index 99%
rename from src/app/treeview.h
rename to src/designer-plugins/treeview.h
index 6527509..4b8859e 100644
--- a/src/app/treeview.h
+++ b/src/designer-plugins/treeview.h
@@ -13,10 +13,10 @@
#include
#include
#include
-
-#include
#include
+#include "qtk/scene.h"
+
namespace Ui
{
class TreeView;
diff --git a/src/app/treeview.ui b/src/designer-plugins/treeview.ui
similarity index 100%
rename from src/app/treeview.ui
rename to src/designer-plugins/treeview.ui
diff --git a/src/app/widgetplugin.cpp b/src/designer-plugins/widgetplugin.cpp
similarity index 99%
rename from src/app/widgetplugin.cpp
rename to src/designer-plugins/widgetplugin.cpp
index 4c7b47f..b9edef2 100644
--- a/src/app/widgetplugin.cpp
+++ b/src/designer-plugins/widgetplugin.cpp
@@ -11,7 +11,7 @@
#include
#include
-#include
+#include "qtk/qtkapi.h"
#include "widgetplugin.h"
diff --git a/src/app/widgetplugin.h b/src/designer-plugins/widgetplugin.h
similarity index 100%
rename from src/app/widgetplugin.h
rename to src/designer-plugins/widgetplugin.h
diff --git a/src/app/widgetplugincollection.cpp b/src/designer-plugins/widgetplugincollection.cpp
similarity index 100%
rename from src/app/widgetplugincollection.cpp
rename to src/designer-plugins/widgetplugincollection.cpp
diff --git a/src/app/widgetplugincollection.h b/src/designer-plugins/widgetplugincollection.h
similarity index 100%
rename from src/app/widgetplugincollection.h
rename to src/designer-plugins/widgetplugincollection.h
diff --git a/src/qtk/texture.cpp b/src/qtk/texture.cpp
index ebe26ec..a1debfa 100644
--- a/src/qtk/texture.cpp
+++ b/src/qtk/texture.cpp
@@ -9,7 +9,6 @@
#include
#include
-#include "app/qtkmainwindow.h"
#include "texture.h"
using namespace Qtk;