Skip to content

Commit

Permalink
Fix Windows build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Jan 26, 2022
1 parent eec387d commit 0fe17ce
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ endif()
get_filename_component(PROJECT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
get_filename_component(PLUGIN_NAME ${PROJECT_FOLDER} NAME)

set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architecture for Mac OS X" FORCE)

project(OE_PLUGIN_${PLUGIN_NAME})
set(CMAKE_SHARED_LIBRARY_PREFIX "")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
Expand Down Expand Up @@ -68,7 +70,7 @@ if(MSVC)
elseif(LINUX)
target_link_libraries(${PLUGIN_NAME} GL X11 Xext Xinerama asound dl freetype pthread rt)
set_property(TARGET ${PLUGIN_NAME} APPEND_STRING PROPERTY LINK_FLAGS
"-fvisibility=hidden -fPIC -rdynamic -Wl,-rpath,'$ORIGIN/../shared'")
"-fvisibility=hidden -fPIC -rdynamic -Wl,-rpath='$ORIGIN/../shared' -Wl,-rpath='$ORIGIN/../shared-api8'")
target_compile_options(${PLUGIN_NAME} PRIVATE -fPIC -rdynamic)
target_compile_options(${PLUGIN_NAME} PRIVATE -O3) #enable optimization for linux debug

Expand All @@ -77,9 +79,9 @@ elseif(LINUX)
elseif(APPLE)
set_target_properties(${PLUGIN_NAME} PROPERTIES BUNDLE TRUE)
set_property(TARGET ${PLUGIN_NAME} APPEND_STRING PROPERTY LINK_FLAGS
"-undefined dynamic_lookup -rpath @loader_path/../../../../shared")
"-undefined dynamic_lookup -rpath @loader_path/../../../../shared-api8")

install(TARGETS ${PLUGIN_NAME} DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/plugins)
install(TARGETS ${PLUGIN_NAME} DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/plugins-api8)
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/macos)
endif()

Expand All @@ -98,7 +100,7 @@ if (MSVC)
elseif(LINUX)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs/linux/bin/ DESTINATION ${GUI_BIN_DIR}/shared)
elseif(APPLE)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs/macos/bin/ DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/shared)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs/macos/bin/ DESTINATION $ENV{HOME}/Library/Application\ Support/open-ephys/shared-api8)
endif()

#additional libraries, if needed
Expand Down
10 changes: 4 additions & 6 deletions Source/OpenEphysLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@
*/

#include <PluginInfo.h>
#include "ZmqInterface.h"
#include <string>
#ifdef WIN32
#ifdef _WIN32
#include <Windows.h>
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#define EXPORT __attribute__((visibility("default")))
#endif

#include "ZmqInterface.h"


using namespace Plugin;
//Number of plugins defined on the library. Can be of different types (Processors, RecordEngines, etc...)
#define NUM_PLUGINS 1
Expand All @@ -46,7 +44,7 @@ extern "C" EXPORT void getLibInfo(Plugin::LibraryInfo* info)
info->apiVersion = PLUGIN_API_VER; /*API version, defined by the GUI source.
Should not be changed to ensure it is always equal to the one used in the latest codebase. The GUI refueses to load plugins with mismatched API versions */
info->name = "ZMQ Interface"; //Name of the Library, used only for information
info->libVersion = 1; //Version of the library, used only for information
info->libVersion = "0.2.0"; //Version of the library, used only for information
info->numPlugins = NUM_PLUGINS;
}

Expand Down
18 changes: 9 additions & 9 deletions Source/ZmqInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,18 +602,18 @@ bool ZmqInterface::isReady()
return true;
}

void ZmqInterface::setParameter(int parameterIndex, float newValue)
{
// editor->updateParameterButtons(parameterIndex);
// void ZmqInterface::setParameter(int parameterIndex, float newValue)
// {
// // editor->updateParameterButtons(parameterIndex);

//Parameter& p = parameters.getReference(parameterIndex);
//p.setValue(newValue, 0);
// //Parameter& p = parameters.getReference(parameterIndex);
// //p.setValue(newValue, 0);

//threshold = newValue;
// //threshold = newValue;

//std::cout << float(p[0]) << std::endl;
// editor->updateParameterButtons(parameterIndex);
}
// //std::cout << float(p[0]) << std::endl;
// // editor->updateParameterButtons(parameterIndex);
// }


void ZmqInterface::handleEvent(const EventChannel* eventInfo, const EventPacket& packet, int samplePosition)
Expand Down
12 changes: 6 additions & 6 deletions Source/ZmqInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ZmqInterface : public GenericProcessor, public Thread
{
public:
/** The class constructor, used to initialize any members. */
ZmqInterface(const String &processorName = "Zmq Interface");
ZmqInterface(const String &processorName = "ZMQ Interface");

/** The class destructor, used to deallocate memory */
~ZmqInterface();
Expand All @@ -75,12 +75,12 @@ class ZmqInterface : public GenericProcessor, public Thread
size of the buffer).
*/
//virtual void process(AudioSampleBuffer& buffer, MidiBuffer& events);
virtual void process(AudioSampleBuffer& continuousBuffer);
void process(AudioSampleBuffer& continuousBuffer);

/** Any variables used by the "process" function _must_ be modified only through
this method while data acquisition is active. If they are modified in any
other way, the application will crash. */
void setParameter(int parameterIndex, float newValue);
// /** Any variables used by the "process" function _must_ be modified only through
// this method while data acquisition is active. If they are modified in any
// other way, the application will crash. */
// void setParameter(int parameterIndex, float newValue);

AudioProcessorEditor* createEditor();

Expand Down
9 changes: 6 additions & 3 deletions Source/ZmqInterfaceEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,18 @@ private ListBoxModel, public AsyncUpdater
ZmqInterfaceEditor::ZmqInterfaceEditor(GenericProcessor *parentNode): GenericEditor(parentNode)
{
ZmqProcessor = (ZmqInterface *)parentNode;

desiredWidth = 200;

listBox = new ZmqInterfaceEditorListBox(String("No App connected"), this);
listBox->setBounds(2,45,130,85);
listBox->setBounds(10,45,170,80);
addAndMakeVisible(listBox);

listTitle = new Label();
listTitle->setText("List of connected apps:", dontSendNotification);
listTitle->setColour(Label::textColourId, Colours::black);
listTitle->setBounds(2,27,130,15);
listTitle->setFont(Font("FiraSans Bold", 14, Font::plain));
listTitle->setBounds(10,27,170,15);
listTitle->setFont(Font("Fira Code", "SemiBold", 14.0f));
addAndMakeVisible(listTitle);
#if 0
dataPortEditor = new TextEditor("dataport");
Expand Down

0 comments on commit 0fe17ce

Please sign in to comment.