Skip to content

Commit

Permalink
allow PCAS module path outside of epics base
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoqiangwang committed Feb 9, 2024
1 parent ca1bbef commit ae786cc
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ def paths_exist(paths):
if os.path.exists(os.path.join(EPICSBASE, 'include', 'compiler')):
PRE315 = False

# check whether PCAS is part of EPICS base installation
PCAS = None
if not os.path.exists(os.path.join(EPICSBASE, 'include', 'casdef.h')):
PCAS = os.environ.get('PCAS')
if not PCAS:
raise IOError('It looks like PCAS module is not part of EPICS base installation. '
'Please define PCAS environment variable to the module path.')

# common libraries to link
libraries = ['cas', 'ca', 'gdd', 'Com']
if PRE315:
Expand Down Expand Up @@ -150,16 +158,24 @@ def paths_exist(paths):
else:
raise IOError("Unsupported OS {0}".format(UNAME))

include_dirs = [ os.path.join(EPICSBASE, 'include'),
os.path.join(EPICSBASE, 'include', 'os', UNAME),
os.path.join(EPICSBASE, 'include', 'compiler', CMPL)]

library_dirs = [ os.path.join(EPICSBASE, 'lib', HOSTARCH) ]

if PCAS:
include_dirs.append(os.path.join(PCAS, 'include'))
library_dirs.append(os.path.join(PCAS, 'lib', HOSTARCH))

cas_module = Extension('pcaspy._cas',
sources =[os.path.join('pcaspy','casdef.i'),
os.path.join('pcaspy','pv.cpp'),
os.path.join('pcaspy','channel.cpp'),],
swig_opts=['-c++','-threads','-nodefaultdtor','-I%s'% os.path.join(EPICSBASE, 'include')],
extra_compile_args=cflags,
include_dirs = [ os.path.join(EPICSBASE, 'include'),
os.path.join(EPICSBASE, 'include', 'os', UNAME),
os.path.join(EPICSBASE, 'include', 'compiler', CMPL)],
library_dirs = [ os.path.join(EPICSBASE, 'lib', HOSTARCH),],
include_dirs = include_dirs,
library_dirs = library_dirs,
libraries = libraries,
extra_link_args = lflags,
extra_objects = extra_objects,
Expand Down

0 comments on commit ae786cc

Please sign in to comment.