Make Shamrock support optional because it does not work on recent Linux systems

This commit is contained in:
Mark Rivers
2025-02-18 17:08:20 -06:00
parent be78d0ddfe
commit 672e5c1357
5 changed files with 52 additions and 32 deletions

View File

@@ -6,18 +6,21 @@ include $(TOP)/configure/CONFIG
LIBRARY_IOC_WIN32 += andorCCD
LIBRARY_IOC_Linux += andorCCD
LIB_SRCS += andorCCD.cpp
LIB_SRCS += shamrock.cpp
ifeq (win32-x86, $(findstring win32-x86, $(T_A)))
LIB_LIBS_WIN32 += atmcd32m
else ifeq (windows-x64, $(findstring windows-x64, $(T_A)))
LIB_LIBS_WIN32 += atmcd64m
ifeq ($(WITH_SHAMROCK), YES)
LIB_SRCS += shamrock.cpp
USR_CPPFLAGS += -DUSE_SHAMROCK
LIB_LIBS_WIN32 += ShamrockCIFm
DBD += shamrockSupport.dbd
endif
ifeq (win32-x86, $(findstring win32-x86, $(T_A)))
LIB_LIBS_WIN32 += atmcd32m
else ifeq (windows-x64, $(findstring windows-x64, $(T_A)))
LIB_LIBS_WIN32 += atmcd64m
endif
LIB_LIBS_WIN32 += ShamrockCIFm
DATA+=GREY.PAL
DBD += andorCCDSupport.dbd
DBD += shamrockSupport.dbd
ifdef XML2_INCLUDE
USR_INCLUDES += $(addprefix -I, $(XML2_INCLUDE))

View File

@@ -31,7 +31,9 @@
#else
#include "atmcdLXd.h"
#endif
#include "ShamrockCIF.h"
#ifdef USE_SHAMROCK
#include "ShamrockCIF.h"
#endif
#include "SPEHeader.h"
#include <epicsExport.h>
@@ -781,16 +783,17 @@ asynStatus AndorCCD::writeInt32(asynUser *pasynUser, epicsInt32 value)
epicsEventSignal(dataEvent);
}
if (status)
if (status) {
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s: error, status=%d function=%d, value=%d\n",
driverName, functionName, status, function, value);
else
} else {
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
"%s:%s: function=%d, value=%d\n",
driverName, functionName, function, value);
// For a successful write, clear the error message.
setStringParam(AndorMessage, " ");
}
return status;
}
@@ -1882,26 +1885,28 @@ unsigned int AndorCCD::SaveAsSPE(char *fullFileName)
for (i=0; i<nx; i++) calibration[i] = (float) i;
// If there is a valid Shamrock spectrometer get the calibration
int error;
int numSpectrometers;
error = ShamrockGetNumberDevices(&numSpectrometers);
if (error != SHAMROCK_SUCCESS) goto noSpectrometers;
if (numSpectrometers < 1) goto noSpectrometers;
if ((mShamrockId < 0) || (mShamrockId > numSpectrometers-1)) goto noSpectrometers;
error = ShamrockGetCalibration(mShamrockId, calibration, nx);
if (error != SHAMROCK_SUCCESS) {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s::%s error reading Shamrock spectrometer calibration\n",
driverName, functionName);
}
#ifdef USE_SHAMROCK
int error;
int numSpectrometers;
error = ShamrockGetNumberDevices(&numSpectrometers);
if (error != SHAMROCK_SUCCESS) goto noSpectrometers;
if (numSpectrometers < 1) goto noSpectrometers;
if ((mShamrockId < 0) || (mShamrockId > numSpectrometers-1)) goto noSpectrometers;
error = ShamrockGetCalibration(mShamrockId, calibration, nx);
if (error != SHAMROCK_SUCCESS) {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s::%s error reading Shamrock spectrometer calibration\n",
driverName, functionName);
}
// Create the calibration string
for (i=0; i<nx; i++) {
if (i > 0) strcat(calibrationString, ",");
sprintf(tempString, "%.6f", calibration[i]);
strcat(calibrationString, tempString);
}
noSpectrometers:
// Create the calibration string
for (i=0; i<nx; i++) {
if (i > 0) strcat(calibrationString, ",");
sprintf(tempString, "%.6f", calibration[i]);
strcat(calibrationString, tempString);
}
#endif //USE_SHAMROCK
// Create the XML data using SPETemplate.xml in the current directory as a template
if (mSPEDoc == 0) {

View File

@@ -32,6 +32,10 @@ CHECK_RELEASE = YES
# take effect.
#IOCS_APPL_TOP = </IOC/path/to/application/top>
# Define whether to build the Shamrock spectrometer support.
# Shamrock is not supported on recent Linux systems
WITH_SHAMROCK = YES
# Get settings from AREA_DETECTOR, so we only have to configure once for all detectors if we want to
-include $(AREA_DETECTOR)/configure/CONFIG_SITE
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH)

View File

@@ -15,7 +15,6 @@ PROD_IOC_Linux += $(PROD_NAME)
# <name>.dbd will be created from <name>Include.dbd
DBD += $(PROD_NAME).dbd
$(PROD_NAME)_DBD += andorCCDSupport.dbd
$(PROD_NAME)_DBD += shamrockSupport.dbd
$(PROD_NAME)_SRCS += $(PROD_NAME)_registerRecordDeviceDriver.cpp $(PROD_NAME)Main.cpp
@@ -32,7 +31,6 @@ else ifneq (, $(findstring windows-x64, $(T_A)))
WITH_GRAPHICSMAGICK=NO
PROD_LIBS += atmcd64m
endif
PROD_LIBS_WIN32 += ShamrockCIFm
# Test application
#PROD_IOC_WIN32 += test_xml
@@ -42,7 +40,12 @@ PROD_LIBS_WIN32 += ShamrockCIFm
# Note: we use PROD_SYS_LIBS because we are building statically but this library is only provided in dynamic
# format (.so)
PROD_SYS_LIBS_Linux += andor
PROD_SYS_LIBS_Linux += shamrockcif
ifeq ($(WITH_SHAMROCK), YES)
$(PROD_NAME)_DBD += shamrockSupport.dbd
PROD_LIBS_WIN32 += ShamrockCIFm
PROD_SYS_LIBS_Linux += shamrockcif
endif
include $(ADCORE)/ADApp/commonDriverMakefile
@@ -52,3 +55,4 @@ include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE
PROD_LIBS_WIN32 += ShamrockCIFm

View File

@@ -32,6 +32,10 @@ CHECK_RELEASE = YES
# take effect.
#IOCS_APPL_TOP = </IOC/path/to/application/top>
# Define whether to build the Shamrock spectrometer support.
# Shamrock is not supported on recent Linux systems
WITH_SHAMROCK = YES
# Get settings from AREA_DETECTOR, so we only have to configure once for all detectors if we want to
-include $(AREA_DETECTOR)/configure/CONFIG_SITE
-include $(AREA_DETECTOR)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH)