diff --git a/qsrv/Makefile b/qsrv/Makefile index e8033f6..6faf927 100644 --- a/qsrv/Makefile +++ b/qsrv/Makefile @@ -9,28 +9,25 @@ include $(TOP)/configure/CONFIG_PVXS_VERSION # ADD MACRO DEFINITIONS AFTER THIS LINE #============================= -PROD_IOC = qsrv +PROD_IOC += softIocPVX -DBDDEPENDS_FILES += qsrv.dbd$(DEP) -qsrv_DBD = base.dbd pvxsIoc.dbd -DBD_INSTALLS = $(COMMON_DIR)/qsrv.dbd +softIocPVX_SRCS += softMain.cpp +softIocPVX_SRCS += softIocPVX_registerRecordDeviceDriver.cpp -qsrv_DB = qsrvExit.db +softIocPVX_LIBS += pvxsIoc +softIocPVX_LIBS += pvxs +softIocPVX_LIBS += $(EPICS_BASE_IOC_LIBS) +DBD += softIocPVX.dbd + +softIocPVX_DBD += softIoc.dbd +softIocPVX_DBD += pvxsIoc.dbd + +DB += softIocPVXExit.db + +# used with Base < 7.0.5 FINAL_LOCATION ?= $(shell $(PERL) $(TOOLS)/fullPathName.pl $(INSTALL_LOCATION)) -# EPICS_BASE macro for our location -USR_CPPFLAGS += -DEPICS_BASE="\"$(FINAL_LOCATION)\"" - -qsrv_SRCS_DEFAULT += qsrvMain.cpp -qsrv_SRCS += qsrv_registerRecordDeviceDriver.cpp -qsrv_SRCS_vxWorks += -nil- - -# Finally link IOC to the EPICS Base libraries -qsrv_LIBS += pvxsIoc -qsrv_LIBS += pvxs -qsrv_LIBS += $(EPICS_BASE_IOC_LIBS) - #=========================== include $(TOP)/configure/RULES @@ -38,3 +35,8 @@ include $(TOP)/configure/RULES_PVXS_MODULE #---------------------------------------- # ADD RULES AFTER THIS LINE +softMain$(DEP): epicsInstallDir.h + +epicsInstallDir.h: $(TOP)/configure/CONFIG_SITE* + $(ECHO) "FINAL_LOCATION=$(FINAL_LOCATION)" + $(PERL) ../makeInstallDir.pl "$(FINAL_LOCATION)" > $@ diff --git a/qsrv/softMain.cpp b/qsrv/softMain.cpp index 11eb761..c5e3d17 100644 --- a/qsrv/softMain.cpp +++ b/qsrv/softMain.cpp @@ -15,7 +15,10 @@ #include #include +#include + #include +#include #include "registryFunction.h" #include "epicsThread.h" #include "epicsExit.h" @@ -30,7 +33,9 @@ #include "osiFileName.h" #include "epicsInstallDir.h" -extern "C" int softIoc_registerRecordDeviceDriver(struct dbBase *pdbbase); +#include + +extern "C" int softIocPVX_registerRecordDeviceDriver(struct dbBase *pdbbase); #ifndef EPICS_BASE // so IDEs knows EPICS_BASE is a string constant @@ -38,8 +43,8 @@ extern "C" int softIoc_registerRecordDeviceDriver(struct dbBase *pdbbase); # error -DEPICS_BASE required #endif -#define DBD_BASE "dbd" OSI_PATH_SEPARATOR "softIoc.dbd" -#define EXIT_BASE "db" OSI_PATH_SEPARATOR "softIocExit.db" +#define DBD_BASE "dbd" OSI_PATH_SEPARATOR "softIocPVX.dbd" +#define EXIT_BASE "db" OSI_PATH_SEPARATOR "softIocPVXExit.db" #define DBD_FILE_REL ".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR DBD_BASE #define EXIT_FILE_REL ".." OSI_PATH_SEPARATOR ".." OSI_PATH_SEPARATOR EXIT_BASE #define DBD_FILE EPICS_BASE OSI_PATH_SEPARATOR DBD_BASE @@ -64,6 +69,8 @@ void usage(const char *arg0, const std::string& base_dbd) { "\n" " -h Print this mesage and exit.\n" "\n" + " -V Print version and exit.\n" + "\n" " -S Prevents an interactive shell being started.\n" "\n" " -s Previously caused a shell to be started. Now accepted and ignored.\n" @@ -82,6 +89,8 @@ void usage(const char *arg0, const std::string& base_dbd) { " -x Load softIocExit.db. Provides a record \":exit\".\n" " Put 0 to exit with success, or non-zero to exit with an error.\n" "\n" + " -G DB Group definition file in JSON format.\n" + "\n" "Any number of -m and -d arguments can be interspersed; the macros are applied\n" "to the following .db files. Each later -m option causes earlier macros to be\n" "discarded.\n" @@ -113,8 +122,8 @@ void lazy_dbd(const std::string& dbd_file) { std::string("Failed to load DBD file: ")+dbd_file); if (verbose) - std::cout<<"softIoc_registerRecordDeviceDriver(pdbbase)\n"; - errIf(softIoc_registerRecordDeviceDriver(pdbbase), + std::cout<<"softIocPVX_registerRecordDeviceDriver(pdbbase)\n"; + errIf(softIocPVX_registerRecordDeviceDriver(pdbbase), "Failed to initialize database"); registryFunctionAdd("exit", (REGISTRYFUNCTION) exitSubroutine); } @@ -132,6 +141,10 @@ int main(int argc, char *argv[]) bool loadedDb = false; bool ranScript = false; + if(!getenv("PVXS_QSRV_ENABLE")) + epicsEnvSet("PVXS_QSRV_ENABLE","YES"); + +#if EPICS_VERSION_INT >= VERSION_INT(7, 0, 3, 1) // attempt to compute relative paths { std::string prefix; @@ -149,15 +162,21 @@ int main(int argc, char *argv[]) dbd_file = prefix + DBD_FILE_REL; exit_file = prefix + EXIT_FILE_REL; } +#endif int opt; - while ((opt = getopt(argc, argv, "ha:D:d:m:Ssx:v")) != -1) { + while ((opt = getopt(argc, argv, "hVa:D:d:m:Ssx:vG:")) != -1) { switch (opt) { case 'h': /* Print usage */ usage(argv[0], dbd_file); epicsExit(0); return 0; + case 'V': + std::cout<