Initial sketch for plugins.

This commit is contained in:
James Grogan 2022-12-11 19:50:34 +00:00
parent b101a5f87c
commit ab3ffc77dc
16 changed files with 96 additions and 6 deletions

View file

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10)
# set the project name # set the project name
project(NotesTK) project(NotesTK)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)
set_property( GLOBAL PROPERTY USE_FOLDERS ON) set_property( GLOBAL PROPERTY USE_FOLDERS ON)
set (CMAKE_MODULE_PATH infra/cmake) set (CMAKE_MODULE_PATH infra/cmake)
@ -14,11 +14,12 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(FALSE) if(FALSE)
set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage") set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
set(GCC_COVERAGE_LINK_FLAGS "-lgcov") set(GCC_COVERAGE_LINK_FLAGS "-lgcov")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
endif() endif()
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(plugins)
add_subdirectory(apps) add_subdirectory(apps)
add_subdirectory(test)

4
plugins/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
add_subdirectory(circuits)
add_subdirectory(machine_learning)
add_subdirectory(physics_simulation)
add_subdirectory(quantum_computing)

View file

@ -0,0 +1,15 @@
set(PLUGIN_NAME circuits)
list(APPEND client_HEADERS
ElectronicCircuit.h)
list(APPEND client_LIB_INCLUDES
ElectronicCircuit.cpp)
add_library(${PLUGIN_NAME} SHARED ${client_LIB_INCLUDES})
target_include_directories(${PLUGIN_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(${PLUGIN_NAME} PUBLIC core)
set_property(TARGET ${PLUGIN_NAME} PROPERTY FOLDER plugins)

View file

View file

@ -0,0 +1,24 @@
#pragma once
#include <memory>
#include <vector>
class Terminal
{
};
class Wire
{
};
class LogicGate
{
};
class ElectronicCircuit
{
};

View file

@ -0,0 +1,15 @@
set(PLUGIN_NAME machine_learning)
list(APPEND client_HEADERS
NeuralNetwork.h)
list(APPEND client_LIB_INCLUDES
NeuralNetwork.cpp)
add_library(${PLUGIN_NAME} SHARED ${client_LIB_INCLUDES})
target_include_directories(${PLUGIN_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(${PLUGIN_NAME} PUBLIC core)
set_property(TARGET ${PLUGIN_NAME} PROPERTY FOLDER plugins)

View file

View file

@ -0,0 +1,15 @@
set(PLUGIN_NAME physics_simulation)
list(APPEND client_HEADERS
FiniteElementSolver.h)
list(APPEND client_LIB_INCLUDES
FiniteElementSolver.cpp)
add_library(${PLUGIN_NAME} SHARED ${client_LIB_INCLUDES})
target_include_directories(${PLUGIN_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(${PLUGIN_NAME} PUBLIC core)
set_property(TARGET ${PLUGIN_NAME} PROPERTY FOLDER plugins)

View file

@ -0,0 +1,15 @@
set(PLUGIN_NAME quantum_computing)
list(APPEND client_HEADERS
QuantumCircuit.h)
list(APPEND client_LIB_INCLUDES
QuantumCircuit.cpp)
add_library(${PLUGIN_NAME} SHARED ${client_LIB_INCLUDES})
target_include_directories(${PLUGIN_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(${PLUGIN_NAME} PUBLIC core)
set_property(TARGET ${PLUGIN_NAME} PROPERTY FOLDER plugins)

View file

@ -45,6 +45,7 @@ std::unique_ptr<TriMesh> MeshPrimitives::buildCircleAsTriMesh(unsigned numSegmen
const double y = cos(theta); const double y = cos(theta);
locations[idx] = {x, y}; locations[idx] = {x, y};
theta += delta_theta; theta += delta_theta;
std::cout << "Adding node at: " << x << " | " << y << std::endl;
} }
EdgeIds edge_ids(2*numSegments); EdgeIds edge_ids(2*numSegments);

View file

@ -14,9 +14,9 @@
TEST_CASE(TestSvgConverter, "[publishing]") TEST_CASE(TestSvgConverter, "[publishing]")
{ {
Scene scene; Scene scene;
scene.setShowMeshOutline(true); //scene.setShowMeshOutline(true);
CircleNode circle({10, 10}, 20); CircleNode circle({40, 40}, 20);
circle.setFillColor({255, 0, 0}); circle.setFillColor({255, 0, 0});
scene.addNode(&circle); scene.addNode(&circle);
@ -26,7 +26,7 @@ TEST_CASE(TestSvgConverter, "[publishing]")
SvgConverter converter; SvgConverter converter;
auto svg_document = converter.convert(&scene); auto svg_document = converter.convert(&scene);
svg_document->setViewBox(0, 0, 100, 100); svg_document->setViewBox(0, 0, 200, 200);
SvgWriter writer; SvgWriter writer;
auto content = writer.toString(svg_document.get()); auto content = writer.toString(svg_document.get());