diff --git a/Makefile b/Makefile index c005d8f..e8b3912 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ DIRS := configure DIRS += src src_DEPEND_DIRS = configure +DIRS += src/ioc +src/ioc_DEPEND_DIRS = src + DIRS += pvtoolsSrc pvtoolsSrc_DEPEND_DIRS = src diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 23bfdd2..d90f1e8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,8 @@ Release 5.x.x ========== -* +* Add new library pvAccessIOC for use with PVAClientRegister.dbd and PVAServerRegister.dbd. + Necessary to avoid having pvAccess library depend on all IOC core libraries. Release 5.0.0 ========== diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 40db1d7..452b1eb 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -23,6 +23,13 @@ CHECK_RELEASE = YES -include $(TOP)/../CONFIG_SITE.local -include $(TOP)/configure/CONFIG_SITE.local +EPICS_PVA_MAJOR_VERSION = 5 +EPICS_PVA_MINOR_VERSION = 0 +EPICS_PVA_MAINTENANCE_VERSION = 1 +EPICS_PVA_DEVELOPMENT_FLAG = 1 + +SHRLIB_VERSION ?= $(EPICS_PVA_MAJOR_VERSION).$(EPICS_PVA_MINOR_VERSION).$(EPICS_PVA_MAINTENANCE_VERSION) + ifdef WITH_COVERAGE USR_CPPFLAGS += --coverage USR_LDFLAGS += --coverage diff --git a/src/Makefile b/src/Makefile index e00365e..631c60e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,11 +3,6 @@ TOP = .. include $(TOP)/configure/CONFIG -EPICS_PVA_MAJOR_VERSION = 5 -EPICS_PVA_MINOR_VERSION = 0 -EPICS_PVA_MAINTENANCE_VERSION = 1 -EPICS_PVA_DEVELOPMENT_FLAG = 1 - EXPANDVARS += EPICS_PVA_MAJOR_VERSION EXPANDVARS += EPICS_PVA_MINOR_VERSION EXPANDVARS += EPICS_PVA_MAINTENANCE_VERSION @@ -29,12 +24,9 @@ include $(PVACCESS_SRC)/rpcClient/Makefile include $(PVACCESS_SRC)/pipelineService/Makefile include $(PVACCESS_SRC)/ca/Makefile include $(PVACCESS_SRC)/mb/Makefile -include $(PVACCESS_SRC)/ioc/Makefile LIBRARY = pvAccess -SHRLIB_VERSION = $(EPICS_PVA_MAJOR_VERSION).$(EPICS_PVA_MINOR_VERSION).$(EPICS_PVA_MAINTENANCE_VERSION) - pvAccess_LIBS += pvData ifdef WITH_MICROBENCH pvAccess_LIBS += pvMB diff --git a/src/ioc/Makefile b/src/ioc/Makefile index 3873271..4812ae8 100644 --- a/src/ioc/Makefile +++ b/src/ioc/Makefile @@ -1,6 +1,7 @@ -# This is a Makefile fragment, see ../Makefile +TOP = ../.. +include $(TOP)/configure/CONFIG -SRC_DIRS += $(PVACCESS_SRC)/ioc +LIBRARY += pvAccessIOC INC += pv/syncChannelFind.h @@ -9,3 +10,7 @@ DBD += PVAClientRegister.dbd LIBSRCS += PVAServerRegister.cpp LIBSRCS += PVAClientRegister.cpp + +pvAccessIOC_LIBS += $(EPICS_BASE_IOC_LIBS) + +include $(TOP)/configure/RULES diff --git a/src/ioc/PVAServerRegister.cpp b/src/ioc/PVAServerRegister.cpp index c2cf898..e566ec0 100644 --- a/src/ioc/PVAServerRegister.cpp +++ b/src/ioc/PVAServerRegister.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -37,8 +38,21 @@ using std::endl; namespace pvd = epics::pvData; namespace pva = epics::pvAccess; +static pvd::Mutex the_server_lock; static pva::ServerContext::shared_pointer the_server; +static void startitup() { + the_server = pva::ServerContext::create(pva::ServerContext::Config() + .config(pva::ConfigurationBuilder() + // default to all providers instead of just "local" + .add("EPICS_PVA_PROVIDER_NAMES", pva::PVACCESS_ALL_PROVIDERS) + .push_map() + // prefer to use EPICS_PVA_PROVIDER_NAMES or EPICS_PVAS_PROVIDER_NAMES + // from environment + .push_env() + .build())); +} + static const iocshArg startPVAServerArg0 = { "providerNames", iocshArgString }; static const iocshArg *startPVAServerArgs[] = { &startPVAServerArg0}; @@ -49,17 +63,19 @@ static const iocshFuncDef startPVAServerFuncDef = { static void startPVAServer(const iocshArgBuf *args) { try { + char *names = args[0].sval; + if(names && names[0]!='\0') { + printf("Warning: startPVAServer() no longer accepts provider list as argument.\n" + " Instead place the following before calling startPVAServer() and iocInit()\n" + " epicsEnvSet(\"EPICS_PVAS_PROVIDER_NAMES\", \"%s\")\n", + names); + } + pvd::Lock G(the_server_lock); if(the_server) { std::cout<<"PVA server already running\n"; return; } - char *names = args[0].sval; - if(!names) { - the_server = pva::startPVAServer(pva::PVACCESS_ALL_PROVIDERS,0,true,true); - } else { - std::string providerNames(names); - the_server = pva::startPVAServer(providerNames,0,true,true); - } + startitup(); }catch(std::exception& e){ std::cout<<"Error: "<printInfo(); + } + }catch(std::exception& e){ + std::cout<<"Error: "<