refactor: move GOP_test to plugin system
This commit is contained in:
@@ -20,7 +20,6 @@ set(ENGINE_SOURCES
|
|||||||
src/Engine/Operator/GeometryOpDef.cpp
|
src/Engine/Operator/GeometryOpDef.cpp
|
||||||
src/Engine/Operator/OperatorTable.cpp
|
src/Engine/Operator/OperatorTable.cpp
|
||||||
src/Engine/Operator/Context.cpp
|
src/Engine/Operator/Context.cpp
|
||||||
src/Engine/Operator/GOP_test.cpp
|
|
||||||
src/Engine/Network/NetworkManager.cpp
|
src/Engine/Network/NetworkManager.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,37 +71,37 @@ target_link_libraries(${AppExec} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets
|
|||||||
target_include_directories(${AppExec} PUBLIC src)
|
target_include_directories(${AppExec} PUBLIC src)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
Include(FetchContent)
|
# Include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
# FetchContent_Declare(
|
||||||
Catch2
|
# Catch2
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
# GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
GIT_TAG v3.8.1 # or a later release
|
# GIT_TAG v3.8.1 # or a later release
|
||||||
)
|
# )
|
||||||
|
|
||||||
FetchContent_MakeAvailable(Catch2)
|
# FetchContent_MakeAvailable(Catch2)
|
||||||
|
|
||||||
add_executable(${TestExec}
|
# add_executable(${TestExec}
|
||||||
${ENGINE_SOURCES}
|
# ${ENGINE_SOURCES}
|
||||||
tests/main-tests.cpp
|
# tests/main-tests.cpp
|
||||||
tests/OperatorTests.cpp
|
# tests/OperatorTests.cpp
|
||||||
tests/NetworkTests.cpp
|
# tests/NetworkTests.cpp
|
||||||
)
|
# )
|
||||||
target_link_libraries(${TestExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb Boost::filesystem Boost::system)
|
# target_link_libraries(${TestExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb Boost::filesystem Boost::system)
|
||||||
target_compile_definitions(${TestExec} PRIVATE UNIT_TEST)
|
# target_compile_definitions(${TestExec} PRIVATE UNIT_TEST)
|
||||||
target_include_directories(${TestExec} PUBLIC
|
# target_include_directories(${TestExec} PUBLIC
|
||||||
src
|
# src
|
||||||
${BOOST_INCLUDE_DIRS}
|
# ${BOOST_INCLUDE_DIRS}
|
||||||
)
|
# )
|
||||||
|
|
||||||
# benchmarks
|
# # benchmarks
|
||||||
add_executable(${BenchExec}
|
# add_executable(${BenchExec}
|
||||||
${ENGINE_SOURCES}
|
# ${ENGINE_SOURCES}
|
||||||
|
|
||||||
tests/Benchmarks.cpp
|
# tests/Benchmarks.cpp
|
||||||
)
|
# )
|
||||||
target_link_libraries(${BenchExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb)
|
# target_link_libraries(${BenchExec} PRIVATE Catch2::Catch2WithMain Eigen3::Eigen Qt6::Core TBB::tbb)
|
||||||
target_compile_definitions(${BenchExec} PRIVATE UNIT_TEST)
|
# target_compile_definitions(${BenchExec} PRIVATE UNIT_TEST)
|
||||||
target_include_directories(${BenchExec} PUBLIC src)
|
# target_include_directories(${BenchExec} PUBLIC src)
|
||||||
|
|
||||||
add_subdirectory(src/OpDefs)
|
add_subdirectory(src/OpDefs)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#include "Engine/Network/NetworkManager.h"
|
#include "Engine/Network/NetworkManager.h"
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include "Engine/Operator/Context.h"
|
#include "Engine/Operator/Context.h"
|
||||||
#include "Engine/Operator/GOP_test.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace enzo;
|
using namespace enzo;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include <qgraphicsitem.h>
|
#include <qgraphicsitem.h>
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
#include <QLine>
|
#include <QLine>
|
||||||
#include "Engine/Operator/GOP_test.h"
|
|
||||||
#include "Gui/Network/TabMenu.h"
|
#include "Gui/Network/TabMenu.h"
|
||||||
|
|
||||||
using namespace enzo;
|
using namespace enzo;
|
||||||
@@ -315,7 +314,7 @@ void Network::keyPressEvent(QKeyEvent *event)
|
|||||||
}
|
}
|
||||||
case(Qt::Key_G):
|
case(Qt::Key_G):
|
||||||
{
|
{
|
||||||
if(auto newNode = createNode(&GOP_test::ctor))
|
if(auto newNode = createNode(op::OperatorTable::getOpConstructor(1)))
|
||||||
{
|
{
|
||||||
newNode->setPos(viewPos);
|
newNode->setPos(viewPos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ find_package (Eigen3 3.3 REQUIRED NO_MODULE)
|
|||||||
|
|
||||||
set(libName enzoOps1)
|
set(libName enzoOps1)
|
||||||
add_library(${libName} SHARED
|
add_library(${libName} SHARED
|
||||||
main.cpp
|
RegisterPlugin.cpp
|
||||||
../Engine/Operator/OperatorTable.cpp
|
../Engine/Operator/OperatorTable.cpp
|
||||||
../Engine/Operator/GeometryOpDef.cpp
|
../Engine/Operator/GeometryOpDef.cpp
|
||||||
../Engine/Operator/GeometryOperator.cpp
|
../Engine/Operator/GeometryOperator.cpp
|
||||||
@@ -17,6 +17,8 @@ add_library(${libName} SHARED
|
|||||||
../Engine/Operator/Geometry.cpp
|
../Engine/Operator/Geometry.cpp
|
||||||
../Engine/Operator/Attribute.cpp
|
../Engine/Operator/Attribute.cpp
|
||||||
../Engine/Network/NetworkManager.cpp
|
../Engine/Network/NetworkManager.cpp
|
||||||
|
GopTransform.cpp
|
||||||
|
GopHouse.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(${libName} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb)
|
target_link_libraries(${libName} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb)
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "Engine/Operator/GOP_test.h"
|
#include "OpDefs/GopHouse.h"
|
||||||
#include "Engine/Operator/AttributeHandle.h"
|
#include "Engine/Operator/AttributeHandle.h"
|
||||||
#include <oneapi/tbb/parallel_for.h>
|
#include <oneapi/tbb/parallel_for.h>
|
||||||
|
|
||||||
GOP_test::GOP_test(enzo::nt::OpId opId)
|
GOP_house::GOP_house(enzo::nt::OpId opId)
|
||||||
: enzo::nt::GeometryOpDef(opId)
|
: enzo::nt::GeometryOpDef(opId)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GOP_test::cookOp(enzo::op::Context context)
|
void GOP_house::cookOp(enzo::op::Context context)
|
||||||
{
|
{
|
||||||
using namespace enzo;
|
using namespace enzo;
|
||||||
// std::cout << "COOKING\n";
|
// std::cout << "COOKING\n";
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Engine/Operator/GeometryOpDef.h"
|
#include "Engine/Operator/GeometryOpDef.h"
|
||||||
|
|
||||||
class GOP_test
|
class GOP_house
|
||||||
: public enzo::nt::GeometryOpDef
|
: public enzo::nt::GeometryOpDef
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GOP_test(enzo::nt::OpId opId);
|
GOP_house(enzo::nt::OpId opId);
|
||||||
virtual void cookOp(enzo::op::Context context);
|
virtual void cookOp(enzo::op::Context context);
|
||||||
static enzo::nt::GeometryOpDef* ctor(enzo::nt::OpId opId)
|
static enzo::nt::GeometryOpDef* ctor(enzo::nt::OpId opId)
|
||||||
{
|
{
|
||||||
return new GOP_test(opId);
|
return new GOP_house(opId);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1,23 +1,5 @@
|
|||||||
#include "Engine/Operator/OperatorTable.h"
|
|
||||||
#include "OpDefs/GopTransform.hpp"
|
#include "OpDefs/GopTransform.hpp"
|
||||||
#include <boost/config.hpp>
|
|
||||||
#include <boost/dll.hpp>
|
|
||||||
#include <string>
|
|
||||||
#include "Engine/Operator/AttributeHandle.h"
|
#include "Engine/Operator/AttributeHandle.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
BOOST_SYMBOL_EXPORT void newSopOperator(enzo::op::addOperatorPtr addOperator)
|
|
||||||
{
|
|
||||||
addOperator(
|
|
||||||
"transform",
|
|
||||||
"Transform",
|
|
||||||
&GopTransform::ctor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GopTransform::GopTransform(enzo::nt::OpId opId)
|
GopTransform::GopTransform(enzo::nt::OpId opId)
|
||||||
: enzo::nt::GeometryOpDef(opId)
|
: enzo::nt::GeometryOpDef(opId)
|
||||||
23
src/OpDefs/RegisterPlugin.cpp
Normal file
23
src/OpDefs/RegisterPlugin.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include "Engine/Operator/OperatorTable.h"
|
||||||
|
#include "GopHouse.h"
|
||||||
|
#include "OpDefs/GopTransform.hpp"
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/dll.hpp>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
BOOST_SYMBOL_EXPORT void newSopOperator(enzo::op::addOperatorPtr addOperator)
|
||||||
|
{
|
||||||
|
addOperator(
|
||||||
|
"transform",
|
||||||
|
"Transform",
|
||||||
|
&GopTransform::ctor
|
||||||
|
);
|
||||||
|
addOperator(
|
||||||
|
"house",
|
||||||
|
"House",
|
||||||
|
&GOP_house::ctor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user