diff --git a/.gitignore b/.gitignore index 9ecdf95..09d9735 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ python_modules/**/*.pyd python_modules/**/.ipynb_checkpoints .idea +.DS_Store diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile deleted file mode 100644 index db75279..0000000 --- a/Builds/Linux/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -PYTHON_HOME := $(CONDA_HOME) -PYTHON_INCDIR := $(CONDA_HOME)/include/python3.5m -PYTHON_LIBDIR := $(CONDA_HOME)/lib -PYTHON_RTLIBDIR := $(PYTHON_LIBDIR) - -LIBNAME := $(notdir $(CURDIR)) -OBJDIR := $(OBJDIR)/$(LIBNAME) -TARGET := $(LIBNAME).so -OS := $(shell uname) - -SRC_DIR := ${shell find ./ -type d -print} -VPATH := $(SOURCE_DIRS) - -SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp)) -OBJ := $(addprefix $(OBJDIR)/,$(notdir $(SRC:.cpp=.o))) - - - -#Extra macros and libraries needed by the plugin -#CXXFLAGS := $(CXXFLAGS) -D "PYTHON_HOME=$(PYTHON_HOME)" -I $(PYTHON_INCDIR) -CXXFLAGS := $(CXXFLAGS) -D "PYTHON_HOME=$(PYTHON_HOME)" -I $(PYTHON_INCDIR) -LDFLAGS := $(LDFLAGS) -lpython3.5m -L$(PYTHON_LIBDIR) -Wl,-rpath=$(PYTHON_RTLIBDIR) - - -BLDCMD := $(CXX) -shared -o $(OUTDIR)/$(TARGET) $(OBJ) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) - -VPATH = $(SRC_DIR) - -.PHONY: objdir - -$(OUTDIR)/$(TARGET): objdir $(OBJ) - -@mkdir -p $(BINDIR) - -@mkdir -p $(LIBDIR) - -@mkdir -p $(OUTDIR) - @echo "Building $(TARGET)" - @$(BLDCMD) - -$(OBJDIR)/%.o : %.cpp - @echo "Compiling $<" - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - - -objdir: - -@mkdir -p $(OBJDIR) - -clean: - @echo "Cleaning $(LIBNAME)" - -@rm -rf $(OBJDIR) - -@rm -f $(OUTDIR)/$(TARGET) - --include $(OBJ:%.o=%.d) diff --git a/Builds/MacOSX/Config/Plugin.xcconfig b/Builds/MacOSX/Config/Plugin.xcconfig deleted file mode 100644 index b567290..0000000 --- a/Builds/MacOSX/Config/Plugin.xcconfig +++ /dev/null @@ -1,55 +0,0 @@ -PYTHON_DIR = /usr/local/anaconda/envs/oeEnv -PYTHON_VERSION = python3.6m - -OPENEPHYS_SOURCE_DIR = $(PROJECT_DIR)/../../../plugin-GUI - -ALWAYS_SEARCH_USER_PATHS = NO -CLANG_CXX_LANGUAGE_STANDARD = c++0x -CLANG_CXX_LIBRARY = libc++ -CLANG_ENABLE_MODULES = NO -CLANG_ENABLE_OBJC_ARC = NO -CLANG_LINK_OBJC_RUNTIME = NO -CLANG_WARN_BOOL_CONVERSION = YES -CLANG_WARN_CONSTANT_CONVERSION = YES -CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR -CLANG_WARN_EMPTY_BODY = YES -CLANG_WARN_ENUM_CONVERSION = YES -CLANG_WARN_INT_CONVERSION = YES -CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR -CLANG_WARN_UNREACHABLE_CODE = YES -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CODE_SIGN_IDENTITY = -COMBINE_HIDPI_IMAGES = YES -CONFIGURATION_BUILD_DIR = $(PROJECT_DIR)/../../build/$(CONFIGURATION)/open-ephys.app/Contents/PlugIns -COPY_PHASE_STRIP = NO -DEBUG_INFORMATION_FORMAT = dwarf -ENABLE_STRICT_OBJC_MSGSEND = YES -GCC_C_LANGUAGE_STANDARD = c99 -GCC_GENERATE_DEBUGGING_SYMBOLS = YES -GCC_INLINES_ARE_PRIVATE_EXTERN = YES -GCC_NO_COMMON_BLOCKS = YES -GCC_OPTIMIZATION_LEVEL = 3 -COMMON_PREPROCESSOR_DEFINITIONS = $(inherited) OEPLUGIN JUCER_XCODE_MAC_F6D2F4CF=1 JUCE_APP_VERSION=0.3.5 JUCE_APP_VERSION_HEX=0x305 PYTHON_HOME=$(PYTHON_DIR) - -GCC_VERSION = com.apple.compilers.llvm.clang.1_0 -GCC_WARN_64_TO_32_BIT_CONVERSION = NO -GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR -GCC_WARN_CHECK_SWITCH_STATEMENTS = YES -GCC_WARN_MISSING_PARENTHESES = YES -GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES -GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES -GCC_WARN_UNDECLARED_SELECTOR = YES -GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_VARIABLE = YES -HEADER_SEARCH_PATHS = $(OPENEPHYS_SOURCE_DIR)/Source/Plugins/Headers $(OPENEPHYS_SOURCE_DIR)/JuceLibraryCode $(PYTHON_DIR)/include/$(PYTHON_VERSION) $(inherited) -LIBRARY_SEARCH_PATHS = $(PYTHON_DIR)/lib -OTHER_LDFLAGS = -l$(PYTHON_VERSION) $(inherited) -undefined dynamic_lookup -LD_RUNPATH_SEARCH_PATHS = $(PYTHON_DIR)/lib -INSTALL_PATH = $(HOME)/Applications/open-ephys.app/Contents/PlugIns - -OTHER_LDFLAGS = $(inherited) -undefined dynamic_lookup -L$(PYTHON_DIR)/lib -SDKROOT = macosx -SKIP_INSTALL = YES -WARNING_CFLAGS = $(inherited) -Wpartial-availability -Wreorder -Wno-inconsistent-missing-override -WRAPPER_EXTENSION = bundle diff --git a/Builds/MacOSX/Config/Plugin.xcconfig.tmpl b/Builds/MacOSX/Config/Plugin.xcconfig.tmpl deleted file mode 100644 index a220ca7..0000000 --- a/Builds/MacOSX/Config/Plugin.xcconfig.tmpl +++ /dev/null @@ -1,55 +0,0 @@ -PYTHON_DIR = #PYTHON_DIR# -PYTHON_VERSION = #PYTHON_VERSION# - -OPENEPHYS_SOURCE_DIR = $(PROJECT_DIR)/../../../plugin-GUI - -ALWAYS_SEARCH_USER_PATHS = NO -CLANG_CXX_LANGUAGE_STANDARD = c++0x -CLANG_CXX_LIBRARY = libc++ -CLANG_ENABLE_MODULES = NO -CLANG_ENABLE_OBJC_ARC = NO -CLANG_LINK_OBJC_RUNTIME = NO -CLANG_WARN_BOOL_CONVERSION = YES -CLANG_WARN_CONSTANT_CONVERSION = YES -CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR -CLANG_WARN_EMPTY_BODY = YES -CLANG_WARN_ENUM_CONVERSION = YES -CLANG_WARN_INT_CONVERSION = YES -CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR -CLANG_WARN_UNREACHABLE_CODE = YES -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CODE_SIGN_IDENTITY = -COMBINE_HIDPI_IMAGES = YES -CONFIGURATION_BUILD_DIR = $(PROJECT_DIR)/../../build/$(CONFIGURATION)/open-ephys.app/Contents/PlugIns -COPY_PHASE_STRIP = NO -DEBUG_INFORMATION_FORMAT = dwarf -ENABLE_STRICT_OBJC_MSGSEND = YES -GCC_C_LANGUAGE_STANDARD = c99 -GCC_GENERATE_DEBUGGING_SYMBOLS = YES -GCC_INLINES_ARE_PRIVATE_EXTERN = YES -GCC_NO_COMMON_BLOCKS = YES -GCC_OPTIMIZATION_LEVEL = 3 -COMMON_PREPROCESSOR_DEFINITIONS = $(inherited) OEPLUGIN JUCER_XCODE_MAC_F6D2F4CF=1 JUCE_APP_VERSION=0.3.5 JUCE_APP_VERSION_HEX=0x305 PYTHON_HOME=$(PYTHON_DIR) - -GCC_VERSION = com.apple.compilers.llvm.clang.1_0 -GCC_WARN_64_TO_32_BIT_CONVERSION = NO -GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR -GCC_WARN_CHECK_SWITCH_STATEMENTS = YES -GCC_WARN_MISSING_PARENTHESES = YES -GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES -GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES -GCC_WARN_UNDECLARED_SELECTOR = YES -GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_VARIABLE = YES -HEADER_SEARCH_PATHS = $(OPENEPHYS_SOURCE_DIR)/Source/Plugins/Headers $(OPENEPHYS_SOURCE_DIR)/JuceLibraryCode $(PYTHON_DIR)/include/$(PYTHON_VERSION) $(inherited) -LIBRARY_SEARCH_PATHS = $(PYTHON_DIR)/lib -OTHER_LDFLAGS = -l$(PYTHON_VERSION) $(inherited) -undefined dynamic_lookup -LD_RUNPATH_SEARCH_PATHS = $(PYTHON_DIR)/lib -INSTALL_PATH = $(HOME)/Applications/open-ephys.app/Contents/PlugIns - -OTHER_LDFLAGS = $(inherited) -undefined dynamic_lookup -L$(PYTHON_DIR)/lib -SDKROOT = macosx -SKIP_INSTALL = YES -WARNING_CFLAGS = $(inherited) -Wpartial-availability -Wreorder -Wno-inconsistent-missing-override -WRAPPER_EXTENSION = bundle diff --git a/Builds/MacOSX/Config/Plugin_Debug.xcconfig b/Builds/MacOSX/Config/Plugin_Debug.xcconfig deleted file mode 100644 index ff72115..0000000 --- a/Builds/MacOSX/Config/Plugin_Debug.xcconfig +++ /dev/null @@ -1,9 +0,0 @@ -#include "Plugin.xcconfig" - -ENABLE_TESTABILITY = YES -GCC_DYNAMIC_NO_PIC = NO -//GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1 _DEBUG=1 -GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_PREPROCESSOR_DEFINITIONS) DEBUG=1 _DEBUG=1 - -MTL_ENABLE_DEBUG_INFO = YES -ONLY_ACTIVE_ARCH = YES diff --git a/Builds/MacOSX/Config/Plugin_Release.xcconfig b/Builds/MacOSX/Config/Plugin_Release.xcconfig deleted file mode 100644 index b82a5f4..0000000 --- a/Builds/MacOSX/Config/Plugin_Release.xcconfig +++ /dev/null @@ -1,7 +0,0 @@ -#include "Plugin.xcconfig" - -DEAD_CODE_STRIPPING = YES -ENABLE_NS_ASSERTIONS = NO -GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_PREPROCESSOR_DEFINITIONS) NDEBUG=1 _NDEBUG=1 -GCC_SYMBOLS_PRIVATE_EXTERN = YES -MTL_ENABLE_DEBUG_INFO = NO diff --git a/Builds/MacOSX/Config/get_depends.sh b/Builds/MacOSX/Config/get_depends.sh deleted file mode 100755 index 7e8a5cb..0000000 --- a/Builds/MacOSX/Config/get_depends.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - - -. ~/.bash_profile -. activate oeEnv - -CONFIG_DIR=${PROJECT_DIR}/Config - -PYTHON_DIR=$(python -c "from distutils import sysconfig; \ -import re; \ -z = sysconfig.get_config_var('prefix'); \ -print(z)") - -PYTHON_VERSION=$(python -c "from distutils import sysconfig; \ -import re; \ -z = sysconfig.get_config_var('BLDLIBRARY'); \ -m = re.search(r'-l(.*)', z); \ -print(m.group(1))") - -echo $PYTHON_DIR -echo $PYTHON_VERSION - -sed -e "s%#PYTHON_DIR#%${PYTHON_DIR}%" -e "s%#PYTHON_VERSION#%${PYTHON_VERSION}%" <${CONFIG_DIR}/Plugin.xcconfig.tmpl >${CONFIG_DIR}/Plugin.xcconfig diff --git a/Builds/MacOSX/PythonPlugin.xcodeproj/project.pbxproj b/Builds/MacOSX/PythonPlugin.xcodeproj/project.pbxproj deleted file mode 100644 index 0ecf21c..0000000 --- a/Builds/MacOSX/PythonPlugin.xcodeproj/project.pbxproj +++ /dev/null @@ -1,436 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 48; - objects = { - -/* Begin PBXBuildFile section */ - F7804A9121707A2E00401274 /* get_depends.sh in Resources */ = {isa = PBXBuildFile; fileRef = F7804A9021707A2E00401274 /* get_depends.sh */; }; - F7956D431D58C04C00C2EF56 /* OpenEphysLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7956D421D58C04C00C2EF56 /* OpenEphysLib.cpp */; }; - F7F7D1671D58C55E00DCF6CF /* PythonEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7F7D1571D58C55E00DCF6CF /* PythonEditor.cpp */; }; - F7F7D16A1D58C55E00DCF6CF /* PythonPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7F7D15F1D58C55E00DCF6CF /* PythonPlugin.cpp */; }; - F7F7D16B1D58C55E00DCF6CF /* PythonSink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7F7D1611D58C55E00DCF6CF /* PythonSink.cpp */; }; - F7F7D16C1D58C55E00DCF6CF /* PythonSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7F7D1631D58C55E00DCF6CF /* PythonSource.cpp */; }; - F7F7D16E1D58C5D000DCF6CF /* PythonFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7F7D16D1D58C5D000DCF6CF /* PythonFilter.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 3CB430A8215819B600F21E3C /* en */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = en; path = en.lproj/PythonPlugin.bundle; sourceTree = ""; }; - 3CB430AA21581E6E00F21E3C /* PythonPlugin.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PythonPlugin.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - F7804A9021707A2E00401274 /* get_depends.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = get_depends.sh; sourceTree = ""; }; - F7956D381D58BBA100C2EF56 /* Plugin_Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Plugin_Debug.xcconfig; sourceTree = ""; }; - F7956D391D58BBA100C2EF56 /* Plugin_Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Plugin_Release.xcconfig; sourceTree = ""; }; - F7956D3A1D58BBA100C2EF56 /* Plugin.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Plugin.xcconfig; sourceTree = ""; }; - F7956D421D58C04C00C2EF56 /* OpenEphysLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenEphysLib.cpp; path = ../../PythonPlugin/OpenEphysLib.cpp; sourceTree = SOURCE_ROOT; }; - F7F7D1571D58C55E00DCF6CF /* PythonEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonEditor.cpp; path = ../../PythonPlugin/PythonEditor.cpp; sourceTree = SOURCE_ROOT; }; - F7F7D1581D58C55E00DCF6CF /* PythonEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonEditor.h; path = ../../PythonPlugin/PythonEditor.h; sourceTree = SOURCE_ROOT; }; - F7F7D1591D58C55E00DCF6CF /* PythonEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonEvent.h; path = ../../PythonPlugin/PythonEvent.h; sourceTree = SOURCE_ROOT; }; - F7F7D15D1D58C55E00DCF6CF /* PythonFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonFilter.h; path = ../../PythonPlugin/PythonFilter.h; sourceTree = SOURCE_ROOT; }; - F7F7D15E1D58C55E00DCF6CF /* PythonParamConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonParamConfig.h; path = ../../PythonPlugin/PythonParamConfig.h; sourceTree = SOURCE_ROOT; }; - F7F7D15F1D58C55E00DCF6CF /* PythonPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonPlugin.cpp; path = ../../PythonPlugin/PythonPlugin.cpp; sourceTree = SOURCE_ROOT; }; - F7F7D1601D58C55E00DCF6CF /* PythonPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonPlugin.h; path = ../../PythonPlugin/PythonPlugin.h; sourceTree = SOURCE_ROOT; }; - F7F7D1611D58C55E00DCF6CF /* PythonSink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonSink.cpp; path = ../../PythonPlugin/PythonSink.cpp; sourceTree = SOURCE_ROOT; }; - F7F7D1621D58C55E00DCF6CF /* PythonSink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonSink.h; path = ../../PythonPlugin/PythonSink.h; sourceTree = SOURCE_ROOT; }; - F7F7D1631D58C55E00DCF6CF /* PythonSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonSource.cpp; path = ../../PythonPlugin/PythonSource.cpp; sourceTree = SOURCE_ROOT; }; - F7F7D1641D58C55E00DCF6CF /* PythonSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PythonSource.h; path = ../../PythonPlugin/PythonSource.h; sourceTree = SOURCE_ROOT; }; - F7F7D16D1D58C5D000DCF6CF /* PythonFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PythonFilter.cpp; path = ../../PythonPlugin/PythonFilter.cpp; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - F7956D251D579E1900C2EF56 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - F7956D1D1D579DDF00C2EF56 = { - isa = PBXGroup; - children = ( - F7956D311D58BB2600C2EF56 /* Config */, - F7956D2A1D579E1900C2EF56 /* PythonPlugin */, - F7956D291D579E1900C2EF56 /* Products */, - ); - sourceTree = ""; - }; - F7956D291D579E1900C2EF56 /* Products */ = { - isa = PBXGroup; - children = ( - 3CB430A9215819B600F21E3C /* PythonPlugin.bundle */, - 3CB430AA21581E6E00F21E3C /* PythonPlugin.bundle */, - ); - name = Products; - sourceTree = ""; - }; - F7956D2A1D579E1900C2EF56 /* PythonPlugin */ = { - isa = PBXGroup; - children = ( - F7F7D1571D58C55E00DCF6CF /* PythonEditor.cpp */, - F7F7D1581D58C55E00DCF6CF /* PythonEditor.h */, - F7F7D1591D58C55E00DCF6CF /* PythonEvent.h */, - F7F7D16D1D58C5D000DCF6CF /* PythonFilter.cpp */, - F7F7D15D1D58C55E00DCF6CF /* PythonFilter.h */, - F7F7D15E1D58C55E00DCF6CF /* PythonParamConfig.h */, - F7F7D15F1D58C55E00DCF6CF /* PythonPlugin.cpp */, - F7F7D1601D58C55E00DCF6CF /* PythonPlugin.h */, - F7F7D1611D58C55E00DCF6CF /* PythonSink.cpp */, - F7F7D1621D58C55E00DCF6CF /* PythonSink.h */, - F7F7D1631D58C55E00DCF6CF /* PythonSource.cpp */, - F7F7D1641D58C55E00DCF6CF /* PythonSource.h */, - F7956D421D58C04C00C2EF56 /* OpenEphysLib.cpp */, - ); - path = PythonPlugin; - sourceTree = ""; - }; - F7956D311D58BB2600C2EF56 /* Config */ = { - isa = PBXGroup; - children = ( - F7804A9021707A2E00401274 /* get_depends.sh */, - F7956D381D58BBA100C2EF56 /* Plugin_Debug.xcconfig */, - F7956D391D58BBA100C2EF56 /* Plugin_Release.xcconfig */, - F7956D3A1D58BBA100C2EF56 /* Plugin.xcconfig */, - ); - path = Config; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - F7956D271D579E1900C2EF56 /* PythonPlugin */ = { - isa = PBXNativeTarget; - buildConfigurationList = F7956D2C1D579E1900C2EF56 /* Build configuration list for PBXNativeTarget "PythonPlugin" */; - buildPhases = ( - F76C0DB8216FD73B000197D9 /* ShellScript */, - F7956D241D579E1900C2EF56 /* Sources */, - F7956D251D579E1900C2EF56 /* Frameworks */, - F7956D261D579E1900C2EF56 /* Resources */, - F7F7D16F1D58E44D00DCF6CF /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PythonPlugin; - productName = PythonPlugin; - productReference = 3CB430AA21581E6E00F21E3C /* PythonPlugin.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - F7956D1E1D579DDF00C2EF56 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1020; - TargetAttributes = { - F7956D271D579E1900C2EF56 = { - CreatedOnToolsVersion = 7.3.1; - }; - }; - }; - buildConfigurationList = F7956D211D579DDF00C2EF56 /* Build configuration list for PBXProject "PythonPlugin" */; - compatibilityVersion = "Xcode 8.0"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = F7956D1D1D579DDF00C2EF56; - productRefGroup = F7956D291D579E1900C2EF56 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - F7956D271D579E1900C2EF56 /* PythonPlugin */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - F7956D261D579E1900C2EF56 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F7804A9121707A2E00401274 /* get_depends.sh in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - F76C0DB8216FD73B000197D9 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "${PROJECT_DIR}/Config/get_depends.sh\n"; - }; - F7F7D16F1D58E44D00DCF6CF /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cp -R ${PROJECT_DIR}/../../build/Debug/open-ephys.app/Contents/PlugIns/PythonPlugin.bundle ${PROJECT_DIR}/../../../plugin-GUI/Builds/MacOSX/build/Debug/open-ephys.app/Contents/PlugIns\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - F7956D241D579E1900C2EF56 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F7F7D16B1D58C55E00DCF6CF /* PythonSink.cpp in Sources */, - F7F7D16E1D58C5D000DCF6CF /* PythonFilter.cpp in Sources */, - F7F7D16A1D58C55E00DCF6CF /* PythonPlugin.cpp in Sources */, - F7956D431D58C04C00C2EF56 /* OpenEphysLib.cpp in Sources */, - F7F7D16C1D58C55E00DCF6CF /* PythonSource.cpp in Sources */, - F7F7D1671D58C55E00DCF6CF /* PythonEditor.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 3CB430A9215819B600F21E3C /* PythonPlugin.bundle */ = { - isa = PBXVariantGroup; - children = ( - 3CB430A8215819B600F21E3C /* en */, - ); - name = PythonPlugin.bundle; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - F7956D221D579DDF00C2EF56 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F7956D381D58BBA100C2EF56 /* Plugin_Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - LD_RUNPATH_SEARCH_PATHS = ""; - }; - name = Debug; - }; - F7956D231D579DDF00C2EF56 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F7956D391D58BBA100C2EF56 /* Plugin_Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - LD_RUNPATH_SEARCH_PATHS = ""; - }; - name = Release; - }; - F7956D2D1D579E1900C2EF56 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F7956D381D58BBA100C2EF56 /* Plugin_Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = NO; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "DEBUG=1", - "_DEBUG=1", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(OPENEPHYS_SOURCE_DIR)/JuceLibraryCode/modules/**", - "(OPENEPHYS_SOURCE_DIR)/JuceLibraryCode", - "$(OPENEPHYS_SOURCE_DIR)/Source/Plugins/Headers/**", - ); - INFOPLIST_FILE = PythonPlugin/Info.plist; - INSTALL_PATH = "$(HOME)/Applications/open-ephys.app/Contents/PlugIns"; - LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - "-bundle", - "-undefined", - dynamic_lookup, - ); - PRODUCT_BUNDLE_IDENTIFIER = nl.battaglia.PythonPlugin; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Wreorder", - "-Wpartial-availability", - "-Wno-inconsistent-missing-override", - ); - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - F7956D2E1D579E1900C2EF56 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F7956D391D58BBA100C2EF56 /* Plugin_Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = NO; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - "DEAD_CODE_STRIPPING[arch=*]" = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "_NDEBUG=1", - "NDEBUG=1", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(OPENEPHYS_SOURCE_DIR)/JuceLibraryCode/modules/**", - "(OPENEPHYS_SOURCE_DIR)/JuceLibraryCode", - "$(OPENEPHYS_SOURCE_DIR)/Source/Plugins/Headers/**", - ); - INFOPLIST_FILE = PythonPlugin/Info.plist; - INSTALL_PATH = "$(HOME)/Applications/open-ephys.app/Contents/PlugIns"; - LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ( - "$(inherited)", - "-bundle", - "-undefined", - dynamic_lookup, - ); - PRODUCT_BUNDLE_IDENTIFIER = nl.battaglia.PythonPlugin; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - WARNING_CFLAGS = ( - "-Wreorder", - "-Wpartial-availability", - "-Wno-inconsistent-missing-override", - ); - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - F7956D211D579DDF00C2EF56 /* Build configuration list for PBXProject "PythonPlugin" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F7956D221D579DDF00C2EF56 /* Debug */, - F7956D231D579DDF00C2EF56 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F7956D2C1D579E1900C2EF56 /* Build configuration list for PBXNativeTarget "PythonPlugin" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F7956D2D1D579E1900C2EF56 /* Debug */, - F7956D2E1D579E1900C2EF56 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = F7956D1E1D579DDF00C2EF56 /* Project object */; -} diff --git a/Builds/MacOSX/PythonPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Builds/MacOSX/PythonPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index d2518b3..0000000 --- a/Builds/MacOSX/PythonPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Builds/MacOSX/PythonPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Builds/MacOSX/PythonPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Builds/MacOSX/PythonPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/PythonPlugin/CMAKE_README.txt b/PythonPlugin/CMAKE_README.txt new file mode 100644 index 0000000..e748297 --- /dev/null +++ b/PythonPlugin/CMAKE_README.txt @@ -0,0 +1,22 @@ + +To generate build files for your platform run in a command terminal: +cd Build +cmake -G GENERATOR .. + +Valid generators are: +Windows: +"Visual Studio 12 2013 Win64" +"Visual Studio 14 2015 Win64" +"Visual Studio 15 2017 Win64" +Mac: +"Xcode" +Linux: (see note below) +"Unix Makefiles" + +Example: cmake -G "Visual Studio 12 2013 Win64" .. + +For Linux Only: +On linux, Debug and Release options are generated by cmake and must be specified like so: +cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. +or +cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. \ No newline at end of file diff --git a/PythonPlugin/CMakeLists.txt b/PythonPlugin/CMakeLists.txt new file mode 100644 index 0000000..20a058e --- /dev/null +++ b/PythonPlugin/CMakeLists.txt @@ -0,0 +1,350 @@ +cmake_minimum_required(VERSION 3.5.0) +# MS: Updated to follow the regular cmake format (11/5/19) +# Needed to change some paths to follow new cmake file structure. If using old GUI build you may need to change them back. Also needs to be tested to make sure the changes didn't break apple/linux building. + +# Get GUI Base Dir +if (NOT DEFINED GUI_BASE_DIR) + if (DEFINED ENV{GUI_BASE_DIR}) + set(GUI_BASE_DIR $ENV{GUI_BASE_DIR}) + else() + set(GUI_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../plugin-GUI) + endif() +endif() + +# Get plugin info +get_filename_component(PROJECT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) +get_filename_component(PLUGIN_NAME ${PROJECT_FOLDER} NAME) +# Set plugin info +project(OE_PLUGIN_${PLUGIN_NAME}) +set(CMAKE_SHARED_LIBRARY_PREFIX "") +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(LINUX 1) + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) + endif() +endif() + +# Compiler definitions +set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS + OEPLUGIN + "$<$:JUCE_API=__declspec(dllimport)>" + $<$:_CRT_SECURE_NO_WARNINGS> + $<$:JUCE_DISABLE_NATIVE_FILECHOOSERS=1> + $<$:DEBUG=1> + $<$:_DEBUG=1> + $<$>:NDEBUG=1> + ) + +# Get source files +set(SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Source) +file(GLOB_RECURSE SRC_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/*.cpp" "${SOURCE_PATH}/*.h") +set(GUI_COMMONLIB_DIR ${GUI_BASE_DIR}/installed_libs) + +# set build type to debug by default +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) +endif() +if(NOT (CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL Release)) + message(FATAL_ERROR, "Unsupported CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE}) +endif() +message(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) + +# Find Python. Users can specify by providing the following in the call to cmake: + # -DPYTHON_EXECUTABLE + # -DPYTHON_LIBRARIES + # -DPYTHON_INCLUDE_DIRS + # -DPYTHON_HOME +find_package(PythonInterp REQUIRED) +find_package(PythonLibs REQUIRED) +set(PYTHON_HOME $ENV{CONDA_HOME} CACHE PATH "Where is the root of your python installation?") +get_filename_component(PYTHON_LIB_DIR ${PYTHON_LIBRARIES} DIRECTORY) +message(STATUS "Python home: " ${PYTHON_HOME}) +message(STATUS "Python executable: " ${PYTHON_EXECUTABLE}) +message(STATUS "Python library: " ${PYTHON_LIBRARIES}) +message(STATUS "Python lib dir: " ${PYTHON_LIB_DIR}) +message(STATUS "Python include dir: " ${PYTHON_INCLUDE_DIRS}) + +# extend PYTHONPATH to include python_modules +if(WIN32) + set(PY_PATH_SEP ;) +else() + set(PY_PATH_SEP :) +endif() + +# put together path for common plugin libraries +#get_filename_component(COMMON_DIR ${GUI_BASE_DIR}/Source/Plugins/CommonLibs ABSOLUTE) +# MS: Above looks like old GUI file format? +get_filename_component(COMMON_DIR ${GUI_BASE_DIR}/installed_libs ABSOLUTE) +message("CommonLibs: " ${COMMON_DIR}) + +# add project dir to module path so the library finding .cmake files are found +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + + +# generate shared library +if (APPLE) + add_library(${PLUGIN_NAME} MODULE ${SRC_FILES}) +else() + add_library(${PLUGIN_NAME} SHARED ${SRC_FILES}) +endif() + +set(CMAKE_SHARED_LIBRARY_PREFIX "") + + +target_compile_features(${PLUGIN_NAME} PUBLIC cxx_auto_type cxx_generalized_initializers) + +# MS: I believe this can be deleted +# compiler flags +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1") +#set(CMAKE_CXX_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG=1") + +# cross-platform CFLAGS +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1") +#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG=1") + +# link libraries +target_link_libraries(${PLUGIN_NAME} ${PYTHON_LIBRARIES}) +#target_link_directories(${PLUGIN_NAME} PUBLIC ${PYTHON_INCLUDE_DIRS}) + +# preprocessor definitions +add_definitions(-DOEPLUGIN) +add_definitions(-DJUCE_APP_VERSION=0.4.2) +add_definitions(-DJUCE_APP_VERSION_HEX=0x402) +add_definitions(-DJUCE_APP_VERSION_HEX=0x402) +add_definitions(-DPYTHON_HOME=${PYTHON_HOME}) +add_definitions(-DPYTHON_PATH=${PYTHON_PATH}) + +# include directories +target_include_directories(${PLUGIN_NAME} PUBLIC + ${GUI_BASE_DIR}/JuceLibraryCode + ${GUI_BASE_DIR}/JuceLibraryCode/modules + ${GUI_BASE_DIR}/Plugins/Headers + ${GUI_COMMONLIB_DIR}/include + ${PYTHON_INCLUDE_DIRS}) + +# Check if configuration types are set up by GUI and common libs are installed. +set(GUI_BIN_DIR ${GUI_BASE_DIR}/Build/$) +foreach(config ${CMAKE_CONFIGURATION_TYPES}) + if (NOT EXISTS ${GUI_BASE_DIR}/Build/${config}) + if (EXISTS ${GUI_BASE_DIR}/Build/Release) + # default to release + message(WARNING "${config} ${PLUGIN_NAME} build will link to Release GUI build") + set(GUI_BIN_DIR $,${GUI_BASE_DIR}/Build/Release,${GUI_BIN_DIR}>) + else() + message(WARNING "${config} ${PLUGIN_NAME} build will not be available") + endif() + endif() +endforeach() + +# Check for 64bit compiler +if (NOT CMAKE_LIBRARY_ARCHITECTURE) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CMAKE_LIBRARY_ARCHITECTURE "x64") + else() + set(CMAKE_LIBRARY_ARCHITECTURE "x86") + endif() +endif() + +# platform specific stuff +if(APPLE) + set_target_properties(${PLUGIN_NAME} PROPERTIES BUNDLE TRUE) + # macros for working with apple stuff + macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) + set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} + ${XCODE_VALUE}) + endmacro (set_xcode_property) + + # we need to know where the package dir is + set(MAC_PACKAGE_DIR "/usr/local" CACHE PATH "Where do you install custom libs on this mac?") + string(STRIP "${MAC_PACKAGE_DIR}" MAC_PACKAGE_DIR) + if(NOT MAC_PACKAGE_DIR) + message(FATAL_ERROR, "MAC_PACKAGE_DIR not specified... please set using ccmake or use -DMAC_PACKAGE_DIR.") + endif() + get_filename_component(MAC_PACKAGE_DIR ${MAC_PACKAGE_DIR} ABSOLUTE) + + # install location + SET(CMAKE_INSTALL_PREFIX + "$ENV{HOME}/Library/Application Support/open-ephys/PlugIns" + CACHE PATH + "Plugin install location. See Open Ephys docs for details." + FORCE) + + set_xcode_property(${PLUGIN_NAME} INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) + set_xcode_property(${PLUGIN_NAME} GCC_INLINES_ARE_PRIVATE_EXTERN NO) + + # rpath stuff + # see: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling + set_target_properties(${PLUGIN_NAME} PROPERTIES MACOSX_RPATH TRUE) + set_target_properties(${PLUGIN_NAME} PROPERTIES SKIP_BUILD_RPATH FALSE) + set_target_properties(${PLUGIN_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE) + set_target_properties(${PLUGIN_NAME} PROPERTIES INSTALL_RPATH "${PYTHON_LIB_DIR}") + set_target_properties(${PLUGIN_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${PYTHON_LIB_DIR}" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") + set_target_properties(${PLUGIN_NAME} PROPERTIES INSTALL_RPATH "${PYTHON_LIB_DIR}") + endif() + message("install rpath: " ${CMAKE_INSTALL_RPATH}) + + # link the IOKit framework + target_link_libraries(${PLUGIN_NAME} debug "-framework IOKit") + target_link_libraries(${PLUGIN_NAME} optimized "-framework IOKit") + + # mac-specific preprocessor definitions + add_definitions(-DMAC_PACKAGE_DIR=${MAC_PACKAGE_DIR}) + add_definitions(-DJUCER_XCODE_MAC_F6D2F4CF=1) + # add_definitions(-D_ANSI_SOURCE) # needed for nanosleep() + + # mac-specific cxx flags + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override") + + # mac-specific c flags + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-inconsistent-missing-override") + + # # mac-specific library include directories + # target_include_directories(${PLUGIN_NAME} PUBLIC + # ${MAC_PACKAGE_DIR}/include + # ) + + # mac-specific library search paths + link_directories(${MAC_PACKAGE_DIR}/lib) + + # mac-specific linker flags + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup") + + # xcode properties + set_xcode_property(${PLUGIN_NAME} WRAPPER_EXTENSION bundle) + +elseif(LINUX) + set_target_properties(${PLUGIN_NAME} PROPERTIES LINKER_LANGUAGE CXX) + # MS: Don't know anything about how Linux building is different, but the regular cmake file format is much more condensed. Can probably use it as a baseline. + if(TARGET_ARCH) + # (this disables dependency generation if multiple architectures are set) + list(LENGTH TARGET_ARCH ARCH_COUNT) + if(${ARCH_COUNT} GREATER 1) + message("ARCH_COUNT = " ${ARCH_COUNT}) + set(DEPFLAGS "") + else() + set(DEPFLAGS -MMD) + endif() + else() + # -march=native really only supported on for GCC, Clang and ICC on i386 and x86_64. + # ... fix this, if ever needed + set(TARGET_ARCH -march=native) + set(DEPFLAGS -MMD) + endif() + + # find freetype (needed on linux only) + find_package(LibFreetype2 REQUIRED) + file(GLOB LIBFREETYPE2_HEADER_FILES "${LIBFREETYPE2_INCLUDE_DIRS}/libserialport.h") + + # install into the open ephy plugins directory + get_filename_component(OE_PLUGIN_DIR ${GUI_BASE_DIR}/Build/${CMAKE_BUILD_TYPE}/plugins/ ABSOLUTE) + SET(CMAKE_INSTALL_PREFIX + ${OE_PLUGIN_DIR} + CACHE PATH + "Plugin install location. See Open Ephys docs for details." + FORCE) + + # no 'lib' prefix, please... the other plugins will laugh + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "") + + # linux-specific c flags + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEPFLAGS} -O3 -fPIC -rdynamic -lcap") + + # linux-specific preprocessor definitions + add_definitions(-DLINUX=1) + add_definitions(-DJUCER_LINUX_MAKE_7346DA2A=1) + add_definitions(-DJUCE_DISABLE_NATIVE_FILECHOOSERS=1) + add_definitions(-D_XOPEN_SOURCE=700) + + # linux-specific include directories + target_include_directories(${PLUGIN_NAME} PUBLIC + /usr/include # TODO: always right? + ${COMMON_DIR} + ) + + # linker flags + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pg -fPIC -rdynamic") + set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} -L/usr/local/include") # is this really needed? + + # STRONGLY consider removing fvisibility call... + # https://github.com/open-ephys/plugin-GUI/issues/89 + set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -fvisibility=hidden") + + ## + ## TODO LATER: there's a more robust way to link libs using add_library() w/SHARED, but + ## we'll do that later if there's time / a need + ## + + # look for libraries in build dirs first + link_directories(${CMAKE_BINARY_DIR}) + link_directories(${CMAKE_CURRENT_BINARY_DIR}) + + # add standard library locations + link_directories("/usr/X11R6/lib") + + # link libraries that "should" be in standard locations + target_link_libraries(${PLUGIN_NAME} GL) + target_link_libraries(${PLUGIN_NAME} X11) + target_link_libraries(${PLUGIN_NAME} Xext) + target_link_libraries(${PLUGIN_NAME} Xinerama) + target_link_libraries(${PLUGIN_NAME} asound) + target_link_libraries(${PLUGIN_NAME} dl) + target_link_libraries(${PLUGIN_NAME} rt) + target_link_libraries(${PLUGIN_NAME} dl) + target_link_libraries(${PLUGIN_NAME} Xext) + target_link_libraries(${PLUGIN_NAME} GLU) + + # link freetype + if(LIBFREETYPE2_FOUND) + target_include_directories(${PLUGIN_NAME} PUBLIC ${LIBFREETYPE2_INCLUDE_DIRS}) + target_link_libraries(${PLUGIN_NAME} ${LIBFREETYPE2_LIBRARIES}) + endif() + + # rpath stuff + # see: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling + set(CMAKE_SKIP_BUILD_RPATH FALSE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + set(CMAKE_INSTALL_RPATH "${PYTHON_LIB_DIR}") # TODO: can I delete this as long as I have the line below? + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${PYTHON_LIB_DIR}" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${PYTHON_LIB_DIR}") + endif() +elseif(MSVC) + # MS: Working! + + # install into the open ephy plugins directory + get_filename_component(OE_PLUGIN_DIR ${GUI_BASE_DIR}/Build/Plugins ABSOLUTE) + SET(CMAKE_INSTALL_PREFIX + ${OE_PLUGIN_DIR} + CACHE PATH + "Plugin install location. See Open Ephys docs for details." + FORCE) + + # no 'lib' prefix, please... + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "") + + target_link_libraries(${PLUGIN_NAME} ${GUI_BIN_DIR}/open-ephys.lib) + target_compile_options(${PLUGIN_NAME} PRIVATE /sdl-) + + install(TARGETS ${PLUGIN_NAME} RUNTIME DESTINATION ${GUI_BIN_DIR}/plugins) + + # also install dependency DLLs for runtime loading + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../libs/bin/${CMAKE_LIBRARY_ARCHITECTURE}/ + DESTINATION ${GUI_BIN_DIR}/shared OPTIONAL) + + list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../libs) + +else() + # maybe non-apple unix + message(FATAL_ERROR, "Build Platform Not Recognized: Aborting...") + return() +endif() + +message("Install location: " ${CMAKE_INSTALL_PREFIX}) + +# Set the library installation location +install(TARGETS ${PLUGIN_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/PythonPlugin/FindLibFreetype2.cmake b/PythonPlugin/FindLibFreetype2.cmake new file mode 100644 index 0000000..4b46a48 --- /dev/null +++ b/PythonPlugin/FindLibFreetype2.cmake @@ -0,0 +1,72 @@ +# - Try to find libfreetype2 +# Once done this will define +# +# LIBFREETYPE2_FOUND - system has libfreetype2 +# LIBFREETYPE2_INCLUDE_DIRS - the libfreetype2 include directory +# LIBFREETYPE2_LIBRARIES - Link these to use libfreetype2 +# LIBFREETYPE2_DEFINITIONS - Compiler switches required for using libfreetype2 +# +# Adapted from cmake-modules Google Code project +# +# Copyright (c) 2006 Andreas Schneider +# +# (Changes for libfreetype2) Copyright (c) 2018 Ben Acland +# +# Redistribution and use is allowed according to the terms of the New BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +if (LIBFREETYPE2_LIBRARIES AND LIBFREETYPE2_INCLUDE_DIRS) + # in cache already + set(LIBFREETYPE2_FOUND TRUE) +else (LIBFREETYPE2_LIBRARIES AND LIBFREETYPE2_INCLUDE_DIRS) + find_path(LIBFREETYPE2_INCLUDE_DIR + NAMES + freetype.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + /usr/include/freetype2/freetype + ) + + set(CMAKE_FIND_LIBRARY_PREFIXES lib) + find_library(LIBFREETYPE2_LIBRARY + NAMES + freetype + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + /usr/lib/x86_64-linux-gnu + ) + + set(LIBFREETYPE2_INCLUDE_DIRS + ${LIBFREETYPE2_INCLUDE_DIR} + ) + set(LIBFREETYPE2_LIBRARIES + ${LIBFREETYPE2_LIBRARY} +) + + if (LIBFREETYPE2_INCLUDE_DIRS AND LIBFREETYPE2_LIBRARIES) + set(LIBFREETYPE2_FOUND TRUE) + endif (LIBFREETYPE2_INCLUDE_DIRS AND LIBFREETYPE2_LIBRARIES) + + if (LIBFREETYPE2_FOUND) + if (NOT libfreetype2_FIND_QUIETLY) + message(STATUS "Found libfreetype2:") + message(STATUS " - Includes: ${LIBFREETYPE2_INCLUDE_DIRS}") + message(STATUS " - Libraries: ${LIBFREETYPE2_LIBRARIES}") + endif (NOT libfreetype2_FIND_QUIETLY) + else (LIBFREETYPE2_FOUND) + if (libfreetype2_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libfreetype2") + endif (libfreetype2_FIND_REQUIRED) + endif (LIBFREETYPE2_FOUND) + + # show the LIBFREETYPE2_INCLUDE_DIRS and LIBFREETYPE2_LIBRARIES variables only in the advanced view + mark_as_advanced(LIBFREETYPE2_INCLUDE_DIRS LIBFREETYPE2_LIBRARIES) + +endif (LIBFREETYPE2_LIBRARIES AND LIBFREETYPE2_INCLUDE_DIRS) diff --git a/PythonPlugin/FindLibZMQ.cmake b/PythonPlugin/FindLibZMQ.cmake new file mode 100644 index 0000000..3700ac4 --- /dev/null +++ b/PythonPlugin/FindLibZMQ.cmake @@ -0,0 +1,78 @@ +# - Try to find libzmq +# Once done this will define +# +# LIBZMQ_FOUND - system has libzmq +# LIBZMQ_INCLUDE_DIRS - the libzmq include directory +# LIBZMQ_LIBRARIES - Link these to use libzmq +# LIBZMQ_DEFINITIONS - Compiler switches required for using libzmq +# +# Adapted from cmake-modules Google Code project +# +# Copyright (c) 2006 Andreas Schneider +# +# (Changes for libzmq) Copyright (c) 2018 Ben Acland +# +# Redistribution and use is allowed according to the terms of the New BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +# first we'll try with pkg-config +if (PKG_CONFIG_FOUND) + pkg_check_modules(LIBZMQ libzmq) +else (PKG_CONFIG_FOUND) + if (NOT libzmq_FIND_QUIETLY) + message(STATUS "Could not find pkg-config!!") + endif (NOT libzmq_FIND_QUIETLY) +endif (PKG_CONFIG_FOUND) + +if (LIBZMQ_LIBRARIES AND LIBZMQ_INCLUDE_DIRS) + # in cache already + set(LIBZMQ_FOUND TRUE) +else (LIBZMQ_LIBRARIES AND LIBZMQ_INCLUDE_DIRS) + find_path(LIBZMQ_INCLUDE_DIR + NAMES + zmq.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + set(CMAKE_FIND_LIBRARY_PREFIXES lib l) + find_library(LIBZMQ_LIBRARY + NAMES + zmq + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + set(LIBZMQ_INCLUDE_DIRS + ${LIBZMQ_INCLUDE_DIR} + ) + set(LIBZMQ_LIBRARIES + ${LIBZMQ_LIBRARY} +) + + if (LIBZMQ_INCLUDE_DIRS AND LIBZMQ_LIBRARIES) + set(LIBZMQ_FOUND TRUE) + endif (LIBZMQ_INCLUDE_DIRS AND LIBZMQ_LIBRARIES) +endif (LIBZMQ_LIBRARIES AND LIBZMQ_INCLUDE_DIRS) + +if (LIBZMQ_FOUND) + if (NOT libzmq_FIND_QUIETLY) + message(STATUS "Found libzmq:") + message(STATUS " - Includes: ${LIBZMQ_INCLUDE_DIRS}") + message(STATUS " - Libraries: ${LIBZMQ_LIBRARIES}") + endif (NOT libzmq_FIND_QUIETLY) +else (LIBZMQ_FOUND) + if (libzmq_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libzmq") + endif (libzmq_FIND_REQUIRED) +endif (LIBZMQ_FOUND) + +# show the LIBZMQ_INCLUDE_DIRS and LIBZMQ_LIBRARIES variables only in the advanced view +mark_as_advanced(LIBZMQ_INCLUDE_DIRS LIBZMQ_LIBRARIES) diff --git a/PythonPlugin/Info.plist b/PythonPlugin/Info.plist deleted file mode 100644 index 95e09f8..0000000 --- a/PythonPlugin/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - NSPrincipalClass - - - diff --git a/PythonPlugin/PythonPlugin b/PythonPlugin/PythonPlugin deleted file mode 120000 index 4237948..0000000 --- a/PythonPlugin/PythonPlugin +++ /dev/null @@ -1 +0,0 @@ -../../../PythonPlugin/PythonPlugin/ \ No newline at end of file diff --git a/Builds/MacOSX/PythonPlugin/Info.plist b/PythonPlugin/Source/Info.plist similarity index 100% rename from Builds/MacOSX/PythonPlugin/Info.plist rename to PythonPlugin/Source/Info.plist diff --git a/PythonPlugin/Makefile b/PythonPlugin/Source/Makefile similarity index 100% rename from PythonPlugin/Makefile rename to PythonPlugin/Source/Makefile diff --git a/PythonPlugin/OpenEphysLib.cpp b/PythonPlugin/Source/OpenEphysLib.cpp similarity index 100% rename from PythonPlugin/OpenEphysLib.cpp rename to PythonPlugin/Source/OpenEphysLib.cpp diff --git a/PythonPlugin/PythonEditor.cpp b/PythonPlugin/Source/PythonEditor.cpp similarity index 100% rename from PythonPlugin/PythonEditor.cpp rename to PythonPlugin/Source/PythonEditor.cpp diff --git a/PythonPlugin/PythonEditor.h b/PythonPlugin/Source/PythonEditor.h similarity index 100% rename from PythonPlugin/PythonEditor.h rename to PythonPlugin/Source/PythonEditor.h diff --git a/PythonPlugin/PythonEvent.h b/PythonPlugin/Source/PythonEvent.h similarity index 100% rename from PythonPlugin/PythonEvent.h rename to PythonPlugin/Source/PythonEvent.h diff --git a/PythonPlugin/PythonFilter.cpp b/PythonPlugin/Source/PythonFilter.cpp similarity index 100% rename from PythonPlugin/PythonFilter.cpp rename to PythonPlugin/Source/PythonFilter.cpp diff --git a/PythonPlugin/PythonFilter.h b/PythonPlugin/Source/PythonFilter.h similarity index 100% rename from PythonPlugin/PythonFilter.h rename to PythonPlugin/Source/PythonFilter.h diff --git a/PythonPlugin/PythonParamConfig.h b/PythonPlugin/Source/PythonParamConfig.h similarity index 100% rename from PythonPlugin/PythonParamConfig.h rename to PythonPlugin/Source/PythonParamConfig.h diff --git a/PythonPlugin/Source/PythonPlugin b/PythonPlugin/Source/PythonPlugin new file mode 100644 index 0000000..4237948 --- /dev/null +++ b/PythonPlugin/Source/PythonPlugin @@ -0,0 +1 @@ +../../../PythonPlugin/PythonPlugin/ \ No newline at end of file diff --git a/PythonPlugin/PythonPlugin.cpp b/PythonPlugin/Source/PythonPlugin.cpp similarity index 98% rename from PythonPlugin/PythonPlugin.cpp rename to PythonPlugin/Source/PythonPlugin.cpp index 2bd26ed..d30b2be 100644 --- a/PythonPlugin/PythonPlugin.cpp +++ b/PythonPlugin/Source/PythonPlugin.cpp @@ -1,28 +1,28 @@ /* ------------------------------------------------------------------ - + Python Plugin Copyright (C) 2016 FP Battaglia - + based on Open Ephys GUI Copyright (C) 2013, 2015 Open Ephys - + ------------------------------------------------------------------ -v +v This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . - + */ /* ============================================================================== @@ -56,7 +56,7 @@ v #include #include #elif !defined(_WIN32) -#include +#include #endif #endif @@ -124,6 +124,7 @@ bool PythonPlugin::isReady() else { const PythonLock pyLock; + if (pluginIsReady && !(*pluginIsReady)()) { CoreServices::sendStatusMessage("Python Plugin is not ready"); @@ -159,19 +160,19 @@ void PythonPlugin::process(AudioSampleBuffer& buffer) { lastChan = (uint16)pyEvents->eventId; uint8 ttlData = 1 << lastChan; - + // std::cout << "in Python plugin ts is " << getTimestamp(0) + pyEvents->sampleNum << " and sampleNum is " << // pyEvents->sampleNum << " eventId: " << uint16(pyEvents->eventId) << " ttlData: " << int(ttlData) << std::endl; // FIXME now we set the ts at the first samble in the block TTLEventPtr event = TTLEvent::createTTLEvent(ttlChannel, getTimestamp(0) + pyEvents->sampleNum, &ttlData, sizeof(uint8), lastChan); addEvent(ttlChannel, event, pyEvents->sampleNum); - + PythonEvent *lastEvent = pyEvents; PythonEvent *nextEvent = lastEvent->nextEvent; free((void *)lastEvent); wasTriggered = true; - + // std::cout << "lastChan is " << lastChan << std::endl; while (nextEvent) { lastChan = (uint16)nextEvent->eventId; @@ -185,7 +186,7 @@ void PythonPlugin::process(AudioSampleBuffer& buffer) lastEvent = nextEvent; nextEvent = nextEvent->nextEvent; free((void *)lastEvent); - + wasTriggered = true; } } @@ -200,12 +201,12 @@ void PythonPlugin::handleEvent(const EventChannel* eventInfo, const MidiMessage& double timestamp; int sourceIndex; const void* ptr; - + if (eventInfo->getChannelType() == EventChannel::TTL) { - + TTLEventPtr ttl = TTLEvent::deserializeFromMessage(event, eventInfo); - + eventType = int(ttl->getEventType()); sourceID = int(ttl->getSourceID()); subProcessorIdx = int(ttl->getSubProcessorIdx()); @@ -216,7 +217,7 @@ void PythonPlugin::handleEvent(const EventChannel* eventInfo, const MidiMessage& } else if (eventInfo->getChannelType() == EventChannel::TEXT) { - + TextEventPtr txt = TextEvent::deserializeFromMessage(event, eventInfo); eventType = int(txt->getEventType()); sourceID = int(txt->getSourceID()); @@ -228,7 +229,7 @@ void PythonPlugin::handleEvent(const EventChannel* eventInfo, const MidiMessage& } else if (eventInfo->getChannelType() == EventChannel::TEXT) { - + BinaryEventPtr bi = BinaryEvent::deserializeFromMessage(event, eventInfo); eventType = int(bi->getEventType()); sourceID = int(bi->getSourceID()); @@ -243,7 +244,7 @@ void PythonPlugin::handleEvent(const EventChannel* eventInfo, const MidiMessage& void PythonPlugin::sendEventPlugin(int eventType, int sourceID, int subProcessorIdx, double timestamp, int sourceIndex) { LOG_ENTER("sendEventPlugin"); - + const PythonLock pyLock; (*eventFunction)(eventType, sourceID, subProcessorIdx,timestamp,sourceIndex); } @@ -275,7 +276,7 @@ void PythonPlugin::handleSpike(const SpikeChannel* spikeInfo, const MidiMessage& ParamConfig *getParamConfig(void) this will allow generating the editor GUI TODO void setIntParameter(char *name, int value) set integer parameter void set FloatParameter(char *name, float value) set float parameter - + */ String lastError() @@ -305,7 +306,7 @@ String lastError() void PythonPlugin::setFile(String fullpath) { LOG_ENTER("setFile"); - + filePath = fullpath; if (!plugin.open(filePath)) { @@ -316,16 +317,16 @@ void PythonPlugin::setFile(String fullpath) } String pluginName = File(filePath).getFileName().upToFirstOccurrenceOf(".", false, true); - + #if PY_MAJOR_VERSION>=3 String initPluginName = String("PyInit_"); #else String initPluginName = String("init"); #endif initPluginName.append(pluginName, 200); - + std::cout << "init function is: " << initPluginName << std::endl; - + void *initializer = plugin.getFunction(initPluginName); DEBUG_LOG("initializer: " << initializer); if (!initializer) @@ -359,7 +360,6 @@ void PythonPlugin::setFile(String fullpath) return; } pluginStartupFunction = (startupfunc_t)cfunc; - std::cout << "loaded pluginStartup \n \n \n \n \n "; cfunc = plugin.getFunction("getParamNum"); if (!cfunc) @@ -486,17 +486,16 @@ void PythonPlugin::setFile(String fullpath) getFloatParamFunction = (getfloatparamfunc_t)cfunc; // now the API should be fully loaded - + const PythonLock pyLock; + // initialize the plugin DEBUG_LOG("before initplugin"); (*initF)(); - DEBUG_LOG("after initplugin"); - (*pluginStartupFunction)(nChans, dataSampleRate, chanEnabled.getRawDataPointer()); // load the parameter configuration @@ -505,10 +504,10 @@ void PythonPlugin::setFile(String fullpath) params = (ParamConfig *)calloc(numPythonParams, sizeof(ParamConfig)); paramsControl = (Component **)calloc(numPythonParams, sizeof(Component *)); - + (*getParamConfigFunction)(params); DEBUG_LOG("release paramconfig"); - + auto ed = static_cast(getEditor()); for(int i = 0; i < numPythonParams; i++) { @@ -582,7 +581,7 @@ void PythonPlugin::channelChanged(int chan, bool state) void PythonPlugin::setIntPythonParameter(String name, int value) { LOG_ENTER("setIntPythonParameter"); - + const PythonLock pyLock; (*setIntParamFunction)(name.getCharPointer().getAddress(), value); } @@ -608,7 +607,7 @@ int PythonPlugin::getIntPythonParameter(String name) float PythonPlugin::getFloatPythonParameter(String name) { LOG_ENTER("getFloatPythonParameter"); - + float value; const PythonLock pyLock; value = (*getFloatParamFunction)(name.getCharPointer().getAddress()); @@ -671,6 +670,7 @@ static PyThreadState* startInterpreter() #define QUOTE(name) #name #define STR(macro) QUOTE(macro) #define PYTHON_HOME_NAME STR(PYTHON_HOME) +#define PYTHON_PATH_NAME STR(PYTHON_PATH) #endif char * old_python_home = getenv("PYTHONHOME"); @@ -694,6 +694,13 @@ static PyThreadState* startInterpreter() #ifdef _WIN32 // set PYTHONPATH to avoid error described here: https://stackoverflow.com/questions/5694706/py-initialize-fails-unable-to-load-the-file-system-codec _putenv_s("PYTHONPATH", PYTHON_HOME_NAME "\\DLLs;" PYTHON_HOME_NAME "\\Lib;" PYTHON_HOME_NAME "\\Lib\\site-packages"); +#else + setenv("PYTHONPATH", PYTHON_PATH_NAME, 1); +#endif + +#ifdef PYTHON_DEBUG + std::cout << "PYTHONPATH: " << getenv("PYTHONPATH") << std::endl; + std::cout << "PYTHON VERSION: " << Py_GetVersion() << std::endl; #endif #if PY_MAJOR_VERSION==3 diff --git a/PythonPlugin/PythonPlugin.h b/PythonPlugin/Source/PythonPlugin.h similarity index 100% rename from PythonPlugin/PythonPlugin.h rename to PythonPlugin/Source/PythonPlugin.h diff --git a/PythonPlugin/PythonSink.cpp b/PythonPlugin/Source/PythonSink.cpp similarity index 100% rename from PythonPlugin/PythonSink.cpp rename to PythonPlugin/Source/PythonSink.cpp diff --git a/PythonPlugin/PythonSink.h b/PythonPlugin/Source/PythonSink.h similarity index 100% rename from PythonPlugin/PythonSink.h rename to PythonPlugin/Source/PythonSink.h diff --git a/PythonPlugin/PythonSource.cpp b/PythonPlugin/Source/PythonSource.cpp similarity index 100% rename from PythonPlugin/PythonSource.cpp rename to PythonPlugin/Source/PythonSource.cpp diff --git a/PythonPlugin/PythonSource.h b/PythonPlugin/Source/PythonSource.h similarity index 100% rename from PythonPlugin/PythonSource.h rename to PythonPlugin/Source/PythonSource.h diff --git a/WindowsPlugin/Python.vcxproj b/WindowsPlugin/Python.vcxproj deleted file mode 100644 index ec0729c..0000000 --- a/WindowsPlugin/Python.vcxproj +++ /dev/null @@ -1,172 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {03F9F201-3F09-48C1-B4EC-73C5904632F6} - Win32Proj - Python - PythonPlugin - - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - - - Console - true - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - - - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - - - Console - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - - - Console - true - true - true - %(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WindowsPlugin/Python.vcxproj.filters b/WindowsPlugin/Python.vcxproj.filters deleted file mode 100644 index bfcf981..0000000 --- a/WindowsPlugin/Python.vcxproj.filters +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/build-linux.sh b/build-linux.sh deleted file mode 100755 index f5da5ff..0000000 --- a/build-linux.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -if hash python 2>/dev/null; then - PYTHON_COMMAND=python -else - PYTHON_COMMAND=python3 -fi - -export CONDA_HOME=$(${PYTHON_COMMAND} -c "from distutils import sysconfig; \ -import re; \ -z = sysconfig.get_config_var('prefix'); \ -print(z)") - -export PYTHON_VERSION=$(${PYTHON_COMMAND} -c "from distutils import sysconfig; \ -import re; \ -z = sysconfig.get_config_var('BLDLIBRARY'); \ -m = re.search(r'-l(.*)', z); \ -print(m.group(1))") - -export CONFIG=Debug -ln -s ../../../PythonPlugin/PythonPlugin/ ../plugin-GUI/Source/Plugins/PythonPlugin -cd ../plugin-GUI/Builds/Linux/ -make -f Makefile.plugins - diff --git a/python_modules/.config.py b/python_modules/.config.py index 2c7c68a..62fa54e 100644 --- a/python_modules/.config.py +++ b/python_modules/.config.py @@ -1,2 +1,2 @@ # Location of Python Plugin source (absolute or relative to the location of setup.py) -PYTHON_PLUGIN_SRC_DIR = "../../PythonPlugin" +PYTHON_PLUGIN_SRC_DIR = "../../PythonPlugin/Source" diff --git a/python_modules/.gitignore b/python_modules/.gitignore new file mode 100644 index 0000000..bdf7e13 --- /dev/null +++ b/python_modules/.gitignore @@ -0,0 +1 @@ +magnitudeThreshold/ diff --git a/python_modules/test/test.pyx b/python_modules/test/test.pyx index d15c0d2..3c67764 100644 --- a/python_modules/test/test.pyx +++ b/python_modules/test/test.pyx @@ -3,7 +3,7 @@ import numpy as np cimport numpy as np from cython cimport view -isDebug = False +isDebug = True class test(object): def __init__(self): diff --git a/python_modules/test2/test2.pyx b/python_modules/test2/test2.pyx index 106c928..edc9079 100644 --- a/python_modules/test2/test2.pyx +++ b/python_modules/test2/test2.pyx @@ -30,7 +30,7 @@ class test2(object): def param_config(self): """return button, sliders, etc to be present in the editor OE side""" - return [] + return [("toggle", "enabled", True)] def update_settings(self, nchans, srate): """handle changing number of channels and sample rates"""