Skip to content

Commit

Permalink
build: Fully use Plugin from main executable
Browse files Browse the repository at this point in the history
  • Loading branch information
rprospero committed Aug 2, 2024
1 parent 5f8b997 commit eb534a4
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/AxisModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import QtQuick
import QtQuick3D
import com.projectdissolve
import ProjectDissolve

Node {
id: root
Expand Down
24 changes: 15 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
qt_add_qml_module(
unnamed
QuickPlot
URI
com.projectdissolve
ProjectDissolve
VERSION
1.0
STATIC
SOURCES
axis.h
axis.cpp
Expand All @@ -19,17 +20,16 @@ qt_add_qml_module(
scatterGeometry.h
triangle.cpp
QML_FILES
main.qml
AxisModel.qml
LineModel.qml
ScatterModel.qml)

target_include_directories(
unnamed PRIVATE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib
QuickPlot PRIVATE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib
${Qt6Widgets_INCLUDE_DIRS} ${Qt6Quick3D_INCLUDE_DIRS})

target_link_libraries(
unnamed
QuickPlot
PUBLIC ${WHOLE_ARCHIVE_FLAG}
# External libs
Qt6::Widgets
Expand All @@ -39,20 +39,26 @@ target_link_libraries(
Qt6::3DExtras
Qt6::Quick)

set_target_properties(unnamed PROPERTIES PUBLIC_HEADER lineGeometry.h)
set_target_properties(QuickPlot PROPERTIES PUBLIC_HEADER lineGeometry.h)

install(TARGETS unnamed)
install(TARGETS QuickPlot)

# Main target
add_executable(demo main.cpp ${demo_MOC_SRCS})
qt_add_executable(demo main.cpp)
qt_add_qml_module(demo
VERSION 1.0
URI PlotDemo
QML_FILES
main.qml
)

target_include_directories(
demo
PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src
${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib
${Qt6Widgets_INCLUDE_DIRS} ${Qt6Quick3D_INCLUDE_DIRS})

target_link_libraries(demo PRIVATE unnamed Qt6::Widgets Qt6::Gui Qt6::Qml
target_link_libraries(demo PRIVATE QuickPlot QuickPlotplugin Qt6::Widgets Qt6::Gui Qt6::Qml
Qt6::Core Qt6::Quick3D)

set_target_properties(demo PROPERTIES RUNTIME demo)
Expand Down
2 changes: 1 addition & 1 deletion src/LineModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import QtQuick
import QtQuick3D
import com.projectdissolve
import ProjectDissolve

Model {
id: root
Expand Down
2 changes: 1 addition & 1 deletion src/ScatterModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import QtQuick
import QtQuick3D
import com.projectdissolve
import ProjectDissolve

Model {
id: root
Expand Down
2 changes: 1 addition & 1 deletion src/axis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ void Axis::nudge(double delta)
{
minimum_ += delta;
maximum_ += delta;
emit dataChanged();
Q_EMIT(dataChanged());
}
2 changes: 1 addition & 1 deletion src/axis.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Axis : public QQuick3DGeometry
Q_SIGNALS:
void dataChanged();

public slots:
public Q_SLOTS:
/** Shift the axis bounds by a given distance */
virtual void nudge(double delta);

Expand Down
2 changes: 1 addition & 1 deletion src/logAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ void LogAxis::nudge(double delta)
{
minimum_ = pow(10.0, log10(minimum_) + delta);
maximum_ = pow(10.0, log10(maximum_) + delta);
emit Axis::dataChanged();
Q_EMIT(Axis::dataChanged());
}
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
#include "lineGeometry.h"
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml/QQmlExtensionPlugin>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("./src/main.qml")));
engine.load(QUrl(QStringLiteral("qrc:/PlotDemo/main.qml")));

return app.exec();
}
3 changes: 2 additions & 1 deletion src/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import QtQuick.Dialogs
import QtQuick3D
import QtQuick3D.Helpers
import QtQuick.Controls
import com.projectdissolve
import ProjectDissolve
import "../ProjectDissolve"

ApplicationWindow {
id: root
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_include_directories(
${Qt6Widgets_INCLUDE_DIRS} ${Qt6Quick3D_INCLUDE_DIRS})
target_link_libraries(
axis
PUBLIC unnamed
PUBLIC QuickPlot
PRIVATE # External libs
GTest::gtest_main Qt6::Core Qt6::Quick3D)

Expand Down

0 comments on commit eb534a4

Please sign in to comment.