Skip to content

Commit

Permalink
Add export header to data example (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxvth authored Mar 18, 2024
1 parent fbce9db commit 3a9c0f7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
16 changes: 13 additions & 3 deletions ExampleData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(EXAMPLEDATA "ExampleDataPlugin")
PROJECT(${EXAMPLEDATA})

# -----------------------------------------------------------------------------
# CMake Options
# CMake Options and Setup
# -----------------------------------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
Expand All @@ -20,6 +20,9 @@ if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
endif(MSVC)

# Include cmake tools
include(GenerateExportHeader)

# -----------------------------------------------------------------------------
# Set install directory
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -57,8 +60,15 @@ source_group( Plugin FILES ${EXAMPLEDATA_SOURCES})
# Create dynamic library for the plugin
add_library(${EXAMPLEDATA} SHARED ${EXAMPLEDATA_SOURCES})

qt_wrap_cpp(EXAMPLEDATA_MOC ${EXAMPLE_DATA_HEADERS} TARGET ${EXAMPLEDATA})
target_sources(${EXAMPLEDATA} PRIVATE ${EXAMPLEDATA_MOC})
target_sources(${EXAMPLEDATA} PRIVATE
${EXAMPLEDATA_SOURCES}
)

# Generate a header file that contains the EXPORT macro for this library.
generate_export_header(${EXAMPLEDATA} EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLEDATA}_export.h)

# Add the generated header to the plugin's header files
list(APPEND EXAMPLE_DATA_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLEDATA}_export.h)

# -----------------------------------------------------------------------------
# Target include directories
Expand Down
1 change: 1 addition & 0 deletions ExampleData/src/ExampleDataPlugin.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ExampleDataPlugin.h"

#include "Application.h"

#include <QtCore>
Expand Down
15 changes: 12 additions & 3 deletions ExampleData/src/ExampleDataPlugin.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once

#include "ExampleDataPlugin_export.h"

#include "RawData.h"
#include "Set.h"
#include "CoreInterface.h"

#include <QImage>
#include <QString>
Expand All @@ -12,7 +13,11 @@ using namespace mv::plugin;

const mv::DataType ExampleType = mv::DataType(QString("Example"));

class ExampleDataPlugin : public RawData
// =============================================================================
// Raw Data
// =============================================================================

class EXAMPLEDATAPLUGIN_EXPORT ExampleDataPlugin : public RawData
{
public:
ExampleDataPlugin(const PluginFactory* factory) : RawData(factory, ExampleType) { }
Expand All @@ -39,7 +44,7 @@ class ExampleDataPlugin : public RawData
// Data Set
// =============================================================================

class PixelSet : public mv::DatasetImpl
class EXAMPLEDATAPLUGIN_EXPORT PixelSet : public mv::DatasetImpl
{
public:
PixelSet(QString dataName, const QString& guid = "");
Expand Down Expand Up @@ -103,6 +108,10 @@ class PixelSet : public mv::DatasetImpl
std::vector<unsigned int> _indices; /** Indices into the raw data, if this dataset is just a subset */
};

// =============================================================================
// Factory
// =============================================================================

class ExampleDataPluginFactory : public RawDataFactory
{
Q_INTERFACES(mv::plugin::RawDataFactory mv::plugin::PluginFactory)
Expand Down

0 comments on commit 3a9c0f7

Please sign in to comment.