From 672e5c135722a557d7d5aa5455f57ae8cfc1e549 Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Tue, 18 Feb 2025 17:08:20 -0600 Subject: [PATCH] Make Shamrock support optional because it does not work on recent Linux systems --- andorApp/src/Makefile | 17 +++++----- andorApp/src/andorCCD.cpp | 49 ++++++++++++++++------------- configure/CONFIG_SITE | 4 +++ iocs/andorIOC/andorApp/src/Makefile | 10 ++++-- iocs/andorIOC/configure/CONFIG_SITE | 4 +++ 5 files changed, 52 insertions(+), 32 deletions(-) diff --git a/andorApp/src/Makefile b/andorApp/src/Makefile index bcd64f0..e7856d3 100755 --- a/andorApp/src/Makefile +++ b/andorApp/src/Makefile @@ -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)) diff --git a/andorApp/src/andorCCD.cpp b/andorApp/src/andorCCD.cpp index f7cb4e4..4ac57cb 100755 --- a/andorApp/src/andorCCD.cpp +++ b/andorApp/src/andorCCD.cpp @@ -31,7 +31,9 @@ #else #include "atmcdLXd.h" #endif -#include "ShamrockCIF.h" +#ifdef USE_SHAMROCK + #include "ShamrockCIF.h" +#endif #include "SPEHeader.h" #include @@ -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 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 0) strcat(calibrationString, ","); + sprintf(tempString, "%.6f", calibration[i]); + strcat(calibrationString, tempString); + } noSpectrometers: - - // Create the calibration string - for (i=0; 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) { diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 4df968f..37d9392 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -32,6 +32,10 @@ CHECK_RELEASE = YES # take effect. #IOCS_APPL_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) diff --git a/iocs/andorIOC/andorApp/src/Makefile b/iocs/andorIOC/andorApp/src/Makefile index 0311fe8..f8ece17 100755 --- a/iocs/andorIOC/andorApp/src/Makefile +++ b/iocs/andorIOC/andorApp/src/Makefile @@ -15,7 +15,6 @@ PROD_IOC_Linux += $(PROD_NAME) # .dbd will be created from 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 \ No newline at end of file diff --git a/iocs/andorIOC/configure/CONFIG_SITE b/iocs/andorIOC/configure/CONFIG_SITE index 4df968f..37d9392 100644 --- a/iocs/andorIOC/configure/CONFIG_SITE +++ b/iocs/andorIOC/configure/CONFIG_SITE @@ -32,6 +32,10 @@ CHECK_RELEASE = YES # take effect. #IOCS_APPL_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)