Commit 96b4b5a4 authored by ahoms's avatar ahoms

* Finished spliting of liblima.so

* Split SIP liblima wrapping
* Created global 'make install' target (in install.inc)
  creating a (Python) installation directory structure



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@263 45c4679d-1946-429d-baad-37912b19538b
parent 12a777e4
......@@ -15,3 +15,6 @@ config.inc:
config:
cd third-party/Processlib/sip; python configure.py
$(MAKE) -C sip config
include install.inc
import os, sys, string, time, re
import numpy as N
from TacoServer import *
from lima import *
from Debug import *
from Lima.Core import *
DevCcdBase = 0xc180000
......
from TacoCcd import *
from FrelonAcq import FrelonAcq
from Lima.Frelon import FrelonAcq
from processlib import Tasks
import gc
......
......@@ -5,8 +5,8 @@ include ../config.inc
# LIMA - CORE
############################
CORE_LDFLAGS = -fPIC -L../third-party/Processlib/build
CORE_LDLIBS = -lprocesslib
CORE_LDFLAGS := -L../third-party/Processlib/build
CORE_LDLIBS := -lprocesslib
ifneq ($(COMPILE_CBF_SAVING),0)
ct-objs += CtSaving_Cbf.o
......@@ -16,19 +16,33 @@ endif
ifneq ($(COMPILE_CORE),0)
core-objs := ../common/src/Common.o \
../hardware/src/Hw.o \
../control/src/Ct.o
name := core
core-objs := ../common/src/Common.o \
../hardware/src/Hw.o \
../control/src/Ct.o
version-file := ../common/VERSION
core-flags := $(CORE_LDFLAGS)
core-deps := $(CORE_LDLIBS)
liblimacore.so: $(core-objs)
$(CXX) -shared -o $@ $(CORE_LDFLAGS) $+ $(CORE_LDLIBS)
full-version := $(shell cat $(version-file))
maj-version := $(shell echo $(full-version) | cut -f1 -d.)
build_targets += liblimacore.so
core-base := liblima$(name).so
core-full := $(core-base).$(full-version)
core-maj := $(core-base).$(maj-version)
core-flags += -fPIC -Wl,-soname,$(core-maj)
$(core-full): $(core-objs)
$(CXX) -shared -o $@ $(core-flags) $+ $(core-deps)
rm -f $(core-maj); ln -s $(core-full) $(core-maj)
rm -f $(core-base); ln -s $(core-maj) $(core-base)
build_targets := $(core-full)
endif
LDFLAGS = $(CORE_LDFLAGS) -L.
LDLIBS = $(CORE_LDLIBS) -llimacore
LDFLAGS := $(CORE_LDFLAGS) -L.
LDLIBS := $(CORE_LDLIBS) -llimacore
############################
......@@ -37,32 +51,60 @@ LDLIBS = $(CORE_LDLIBS) -llimacore
ifneq ($(COMPILE_SIMULATOR),0)
simu-objs = ../camera/simulator/src/Simu.o
name := simulator
simu-objs := ../camera/simulator/src/Simu.o
version-file := ../camera/simulator/VERSION
simu-flags := $(LDFLAGS)
simu-deps := $(LDLIBS)
full-version := $(shell cat $(version-file))
maj-version := $(shell echo $(full-version) | cut -f1 -d.)
liblimasimulator.so: $(simu-objs)
$(CXX) -shared -o $@ $(LDFLAGS) $+ $(LDLIBS)
simu-base := liblima$(name).so
simu-full := $(simu-base).$(full-version)
simu-maj := $(simu-base).$(maj-version)
simu-flags += -fPIC -Wl,-soname,$(simu-maj)
build_targets += liblimasimulator.so
$(simu-full): $(simu-objs)
$(CXX) -shared -o $@ $(simu-flags) $+ $(simu-deps)
rm -f $(simu-maj); ln -s $(simu-full) $(simu-maj)
rm -f $(simu-base); ln -s $(simu-maj) $(simu-base)
build_targets += $(simu-full)
endif
############################
# LIMA - ESPIA
############################
include ../camera/common/espia/include/espia.inc
ESPIA_LDFLAGS = $(LDFLAGS) -L$(ESPIA_DRV_LIB)
ESPIA_LDLIBS = $(LDLIBS) -lespia
ESPIA_LDFLAGS := $(LDFLAGS) -L$(ESPIA_DRV_LIB)
ESPIA_LDLIBS := $(LDLIBS) -lespia
ifneq ($(COMPILE_ESPIA),0)
espia-objs = ../camera/common/espia/src/Espia.o
name := espia
espia-objs := ../camera/common/espia/src/Espia.o
version-file := ../camera/common/espia/VERSION
espia-flags := $(ESPIA_LDFLAGS)
espia-deps := $(ESPIA_LDLIBS)
full-version := $(shell cat $(version-file))
maj-version := $(shell echo $(full-version) | cut -f1 -d.)
liblimaespia.so: $(espia-objs)
$(CXX) -shared -o $@ $(ESPIA_LDFLAGS) $+ $(ESPIA_LDLIBS)
espia-base := liblima$(name).so
espia-full := $(espia-base).$(full-version)
espia-maj := $(espia-base).$(maj-version)
espia-flags += -fPIC -Wl,-soname,$(espia-maj)
build_targets += liblimaespia.so
$(espia-full): $(espia-objs)
$(CXX) -shared -o $@ $(espia-flags) $+ $(espia-deps)
rm -f $(espia-maj); ln -s $(espia-full) $(espia-maj)
rm -f $(espia-base); ln -s $(espia-maj) $(espia-base)
build_targets += $(espia-full)
endif
......@@ -73,15 +115,29 @@ endif
ifneq ($(COMPILE_FRELON),0)
frelon-objs = ../camera/frelon/src/Frelon.o
FRELON_LDFLAGS := $(ESPIA_LDFLAGS) -L.
FRELON_LDLIBS := $(ESPIA_LDLIBS) -llimaespia
name := frelon
frelon-objs := ../camera/frelon/src/Frelon.o
version-file := ../camera/frelon/VERSION
frelon-flags := $(FRELON_LDFLAGS)
frelon-deps := $(FRELON_LDLIBS)
full-version := $(shell cat $(version-file))
maj-version := $(shell echo $(full-version) | cut -f1 -d.)
FRELON_LDFLAGS = $(ESPIA_LDFLAGS) -L.
FRELON_LDLIBS = $(ESPIA_LDLIBS) -llimaespia
frelon-base := liblima$(name).so
frelon-full := $(frelon-base).$(full-version)
frelon-maj := $(frelon-base).$(maj-version)
frelon-flags += -fPIC -Wl,-soname,$(frelon-maj)
liblimafrelon.so: $(frelon-objs)
$(CXX) -shared -o $@ $(FRELON_LDFLAGS) $+ $(FRELON_LDLIBS)
$(frelon-full): $(frelon-objs)
$(CXX) -shared -o $@ $(frelon-flags) $+ $(frelon-deps)
rm -f $(frelon-maj); ln -s $(frelon-full) $(frelon-maj)
rm -f $(frelon-base); ln -s $(frelon-maj) $(frelon-base)
build_targets += liblimafrelon.so
build_targets += $(frelon-full)
endif
......@@ -92,15 +148,29 @@ endif
ifneq ($(COMPILE_MAXIPIX),0)
maxipix-objs += ../camera/maxipix/src/Maxipix.o
MAXIPIX_LDFLAGS := $(ESPIA_LDFLAGS) -L.
MAXIPIX_LDLIBS := $(ESPIA_LDLIBS) -llimaespia
name := maxipix
maxipix-objs := ../camera/maxipix/src/Maxipix.o
version-file := ../camera/maxipix/VERSION
maxipix-flags := $(MAXIPIX_LDFLAGS)
maxipix-deps := $(MAXIPIX_LDLIBS)
full-version := $(shell cat $(version-file))
maj-version := $(shell echo $(full-version) | cut -f1 -d.)
MAXIPIX_LDFLAGS = $(ESPIA_LDFLAGS) -L.
MAXIPIX_LDLIBS = $(ESPIA_LDLIBS) -llimaespia
maxipix-base := liblima$(name).so
maxipix-full := $(maxipix-base).$(full-version)
maxipix-maj := $(maxipix-base).$(maj-version)
maxipix-flags += -fPIC -Wl,-soname,$(maxipix-maj)
liblimamaxipix.so: $(maxipix-objs)
$(CXX) -shared -o $@ $(MAXIPIX_LDFLAGS) $+ $(MAXIPIX_LDLIBS)
$(maxipix-full): $(maxipix-objs)
$(CXX) -shared -o $@ $(maxipix-flags) $+ $(maxipix-deps)
rm -f $(maxipix-maj); ln -s $(maxipix-full) $(maxipix-maj)
rm -f $(maxipix-base); ln -s $(maxipix-maj) $(maxipix-base)
build_targets += liblimamaxipix.so
build_targets += $(maxipix-full)
endif
......@@ -110,4 +180,4 @@ test:
@true
clean:
rm -f *.o liblima*.so
rm -f *.o liblima*.so*
import os, sys, imp, glob
root_name = __path__[0]
mod_name = os.path.basename(root_name)
from Lima import Core
def version_code(s):
return map(int, s.strip('v').split('.'))
def version_cmp(x, y):
return cmp(version_code(x), version_code(y))
env_var_name = 'LIMA_%s_VERSION' % mod_name.upper()
try:
version = os.environ[env_var_name]
except KeyError:
version = 'LAST'
req_version = version
if version.upper() == 'LAST':
version_dirs = [x for x in os.listdir(root_name) if x.startswith('v')]
version_dirs.sort(version_cmp)
version = version_dirs[-1]
else:
if version[0] != 'v':
version = 'v' + version
mod_path = os.path.join(root_name, version)
if not (os.path.isdir(mod_path) or os.path.islink(mod_path)):
raise ImportError('Invalid %s: %s' % (env_var_name, req_version))
sys.path.insert(0, mod_path)
from limaespia import *
globals().update(Espia.__dict__)
sys.path.remove(mod_path)
del root_name, mod_name, mod_path, x, env_var_name
del version, req_version, version_dirs, version_code, version_cmp
del os, sys, imp, glob
from lima import *
from Debug import *
from Lima.Core import *
from Lima import Espia
from limafrelon import *
class FrelonAcq:
......
import os, sys, imp, glob
root_name = __path__[0]
mod_name = os.path.basename(root_name)
from Lima import Espia
def version_code(s):
return map(int, s.strip('v').split('.'))
def version_cmp(x, y):
return cmp(version_code(x), version_code(y))
env_var_name = 'LIMA_%s_VERSION' % mod_name.upper()
try:
version = os.environ[env_var_name]
except KeyError:
version = 'LAST'
req_version = version
if version.upper() == 'LAST':
version_dirs = [x for x in os.listdir(root_name) if x.startswith('v')]
version_dirs.sort(version_cmp)
version = version_dirs[-1]
else:
if version[0] != 'v':
version = 'v' + version
mod_path = os.path.join(root_name, version)
if not (os.path.isdir(mod_path) or os.path.islink(mod_path)):
raise ImportError('Invalid %s: %s' % (env_var_name, req_version))
sys.path.insert(0, mod_path)
from limafrelon import *
globals().update(Frelon.__dict__)
from FrelonAcq import FrelonAcq
sys.path.remove(mod_path)
del root_name, mod_name, mod_path, x, env_var_name
del version, req_version, version_dirs, version_code, version_cmp
del os, sys, imp, glob
import os.path
import gc
from lima import *
from Lima.Core import *
from Lima import Espia
from MpxCommon import *
import MpxDacs
import MpxDetConfig
import MpxChipConfig
......
......@@ -2,7 +2,7 @@ import os, os.path
import string
import numpy
import EdfFile
from lima import Maxipix
from MpxCommon import *
......
from lima import Maxipix
from limamaxipix import Maxipix
import types
MpxVersion= [ Maxipix.MaxipixDet.DUMMY,
......
import os, sys, imp, glob
root_name = __path__[0]
mod_name = os.path.basename(root_name)
from Lima import Espia
def version_code(s):
return map(int, s.strip('v').split('.'))
def version_cmp(x, y):
return cmp(version_code(x), version_code(y))
env_var_name = 'LIMA_%s_VERSION' % mod_name.upper()
try:
version = os.environ[env_var_name]
except KeyError:
version = 'LAST'
req_version = version
if version.upper() == 'LAST':
version_dirs = [x for x in os.listdir(root_name) if x.startswith('v')]
version_dirs.sort(version_cmp)
version = version_dirs[-1]
else:
if version[0] != 'v':
version = 'v' + version
mod_path = os.path.join(root_name, version)
if not (os.path.isdir(mod_path) or os.path.islink(mod_path)):
raise ImportError('Invalid %s: %s' % (env_var_name, req_version))
sys.path.insert(0, mod_path)
from limamaxipix import *
globals().update(Maxipix.__dict__)
from MpxAcq import MpxAcq
sys.path.remove(mod_path)
del root_name, mod_name, mod_path, x, env_var_name
del version, req_version, version_dirs, version_code, version_cmp
del os, sys, imp, glob
import os, sys, imp, glob
root_name = __path__[0]
mod_name = os.path.basename(root_name)
from Lima import Core
def version_code(s):
return map(int, s.strip('v').split('.'))
def version_cmp(x, y):
return cmp(version_code(x), version_code(y))
env_var_name = 'LIMA_%s_VERSION' % mod_name.upper()
try:
version = os.environ[env_var_name]
except KeyError:
version = 'LAST'
req_version = version
if version.upper() == 'LAST':
version_dirs = [x for x in os.listdir(root_name) if x.startswith('v')]
version_dirs.sort(version_cmp)
version = version_dirs[-1]
else:
if version[0] != 'v':
version = 'v' + version
mod_path = os.path.join(root_name, version)
if not (os.path.isdir(mod_path) or os.path.islink(mod_path)):
raise ImportError('Invalid %s: %s' % (env_var_name, req_version))
sys.path.insert(0, mod_path)
from limasimulator import *
sys.path.remove(mod_path)
del root_name, mod_name, mod_path, x, env_var_name
del version, req_version, version_dirs, version_code, version_cmp
del os, sys, imp, glob
from lima import DebParams, DebObj
from limacore import DebParams, DebObj
import os, sys, new
......
import os, sys, imp, glob
root_name = __path__[0]
mod_name = os.path.basename(root_name)
def version_code(s):
return map(int, s.strip('v').split('.'))
def version_cmp(x, y):
return cmp(version_code(x), version_code(y))
env_var_name = 'LIMA_%s_VERSION' % mod_name.upper()
try:
version = os.environ[env_var_name]
except KeyError:
version = 'LAST'
req_version = version
if version.upper() == 'LAST':
version_dirs = [x for x in os.listdir(root_name) if x.startswith('v')]
version_dirs.sort(version_cmp)
version = version_dirs[-1]
else:
if version[0] != 'v':
version = 'v' + version
mod_path = os.path.join(root_name, version)
if not (os.path.isdir(mod_path) or os.path.islink(mod_path)):
raise ImportError('Invalid %s: %s' % (env_var_name, req_version))
sys.path.insert(0, mod_path)
import processlib as Processlib
from limacore import *
from Debug import *
sys.path.remove(mod_path)
del root_name, mod_name, mod_path, x, env_var_name
del version, req_version, version_dirs, version_code, version_cmp
del os, sys, imp, glob
ifndef INSTALL_DIR
INSTALL_DIR = install
endif
ifndef INSTALL_LIMA_DIR
INSTALL_LIMA_DIR = $(INSTALL_DIR)/Lima
endif
ifndef INSTALL_PLAT
INSTALL_PLAT = $(shell /csadmin/common/scripts/get_os.share)
endif
ifndef INSTALL_PLAT_DIR
INSTALL_PLAT_DIR = $(INSTALL_LIMA_DIR)/$(INSTALL_PLAT)
endif
INSTALL_LIB_DIR = $(INSTALL_PLAT_DIR)/Lib
ifneq ($(COMPILE_CORE), 0)
INSTALL_CORE_DIR = $(INSTALL_PLAT_DIR)/Core
CORE_FULL_VERSION = $(shell cat common/VERSION)
CORE_MAJ_VERSION = $(shell echo $(CORE_FULL_VERSION) | cut -d. -f1)
INSTALL_CORE_VDIR = $(INSTALL_CORE_DIR)/v$(CORE_FULL_VERSION)
endif
ifneq ($(COMPILE_SIMULATOR), 0)
INSTALL_SIMU_DIR = $(INSTALL_PLAT_DIR)/Simulator
SIMU_FULL_VERSION = $(shell cat camera/simulator/VERSION)
SIMU_MAJ_VERSION = $(shell echo $(SIMU_FULL_VERSION) | cut -d. -f1)
INSTALL_SIMU_VDIR = $(INSTALL_SIMU_DIR)/v$(SIMU_FULL_VERSION)
endif
ifneq ($(COMPILE_ESPIA), 0)
INSTALL_ESPIA_DIR = $(INSTALL_PLAT_DIR)/Espia
ESPIA_FULL_VERSION = $(shell cat camera/common/espia/VERSION)
ESPIA_MAJ_VERSION = $(shell echo $(ESPIA_FULL_VERSION) | cut -d. -f1)
INSTALL_ESPIA_VDIR = $(INSTALL_ESPIA_DIR)/v$(ESPIA_FULL_VERSION)
endif
ifneq ($(COMPILE_FRELON), 0)
INSTALL_FRELON_DIR = $(INSTALL_PLAT_DIR)/Frelon
FRELON_FULL_VERSION = $(shell cat camera/frelon/VERSION)
FRELON_MAJ_VERSION = $(shell echo $(FRELON_FULL_VERSION) | cut -d. -f1)
INSTALL_FRELON_VDIR = $(INSTALL_FRELON_DIR)/v$(FRELON_FULL_VERSION)
endif
ifneq ($(COMPILE_MAXIPIX), 0)
INSTALL_MAXIPIX_DIR = $(INSTALL_PLAT_DIR)/Maxipix
MAXIPIX_FULL_VERSION = $(shell cat camera/maxipix/VERSION)
MAXIPIX_MAJ_VERSION = $(shell echo $(MAXIPIX_FULL_VERSION) | cut -d. -f1)
INSTALL_MAXIPIX_VDIR = $(INSTALL_MAXIPIX_DIR)/v$(MAXIPIX_FULL_VERSION)
endif
.PHONY: install
install:
mkdir -p $(INSTALL_LIMA_DIR)
cp python/__init__.py $(INSTALL_LIMA_DIR)
mkdir -p $(INSTALL_LIB_DIR)
ifneq ($(COMPILE_CORE), 0)
mkdir -p $(INSTALL_CORE_VDIR)
cp common/python/__init__.py $(INSTALL_CORE_DIR)
cp third-party/Processlib/build/libprocesslib.so $(INSTALL_LIB_DIR)
cp third-party/Processlib/sip/processlib.so $(INSTALL_CORE_VDIR)
rm -rf $(INSTALL_LIB_DIR)/liblimacore.so*
cp build/liblimacore.so.$(CORE_FULL_VERSION) $(INSTALL_LIB_DIR)
cp -d build/liblimacore.so.$(CORE_MAJ_VERSION) $(INSTALL_LIB_DIR)
cp sip/core/limacore.so $(INSTALL_CORE_VDIR)
cp common/python/Debug.py $(INSTALL_CORE_VDIR)
endif
ifneq ($(COMPILE_SIMULATOR), 0)
mkdir -p $(INSTALL_SIMU_VDIR)
cp camera/simulator/python/__init__.py $(INSTALL_SIMU_DIR)
rm -rf $(INSTALL_LIB_DIR)/liblimasimulator.so*
cp build/liblimasimulator.so.$(SIMU_FULL_VERSION) $(INSTALL_LIB_DIR)
cp -d build/liblimasimulator.so.$(SIMU_MAJ_VERSION) $(INSTALL_LIB_DIR)
cp sip/simulator/limasimulator.so $(INSTALL_SIMU_VDIR)
endif
ifneq ($(COMPILE_ESPIA), 0)
mkdir -p $(INSTALL_ESPIA_VDIR)
cp camera/common/espia/python/__init__.py $(INSTALL_ESPIA_DIR)
rm -rf $(INSTALL_LIB_DIR)/liblimaespia.so*
cp build/liblimaespia.so.$(ESPIA_FULL_VERSION) $(INSTALL_LIB_DIR)
cp -d build/liblimaespia.so.$(ESPIA_MAJ_VERSION) $(INSTALL_LIB_DIR)
cp sip/espia/limaespia.so $(INSTALL_ESPIA_VDIR)
endif
ifneq ($(COMPILE_FRELON), 0)
mkdir -p $(INSTALL_FRELON_VDIR)
cp camera/frelon/python/__init__.py $(INSTALL_FRELON_DIR)
rm -rf $(INSTALL_LIB_DIR)/liblimafrelon.so*
cp build/liblimafrelon.so.$(FRELON_FULL_VERSION) $(INSTALL_LIB_DIR)
cp -d build/liblimafrelon.so.$(FRELON_MAJ_VERSION) $(INSTALL_LIB_DIR)
cp sip/frelon/limafrelon.so $(INSTALL_FRELON_VDIR)
cp camera/frelon/python/FrelonAcq.py $(INSTALL_FRELON_VDIR)
endif
ifneq ($(COMPILE_MAXIPIX), 0)
mkdir -p $(INSTALL_MAXIPIX_VDIR)
cp camera/maxipix/python/__init__.py $(INSTALL_MAXIPIX_DIR)
rm -rf $(INSTALL_LIB_DIR)/liblimamaxipix.so*
cp build/liblimamaxipix.so.$(MAXIPIX_FULL_VERSION) $(INSTALL_LIB_DIR)
cp -d build/liblimamaxipix.so.$(MAXIPIX_MAJ_VERSION) $(INSTALL_LIB_DIR)
cp sip/maxipix/limamaxipix.so $(INSTALL_MAXIPIX_VDIR)
cp camera/maxipix/python/Mpx*.py $(INSTALL_MAXIPIX_VDIR)
endif
import os
root_name = __path__[0]
csadmin_dirs = ['/csadmin/local', '/csadmin/commmon']
script_get_os = 'scripts/get_compat_os.share'
for d in csadmin_dirs:
aux_get_os = os.path.join(d, script_get_os)
if os.path.exists(aux_get_os):
get_os = aux_get_os
break
compat_plat = os.popen(get_os).readline().strip()
for aux_plat in compat_plat.split():
if aux_plat.strip() in os.listdir(root_name):
plat = aux_plat
break
lima_plat = os.path.join(root_name, plat)
__path__.insert(0, lima_plat)