Commit afb5d19e authored by Laurent Claustre's avatar Laurent Claustre
Browse files

Merge branch '56-build-standalone-camera-packages' into 'master'

Update the build sytem to support devel conda package

See merge request !5
parents 4245cfbe 06bf9969
Pipeline #5564 passed with stages
in 3 minutes and 36 seconds
stages:
- build
- test
- deploy
build :
.build-conda: &build-conda
stage: build
script:
- cd ..
- cp -R /root/* .
- ./install_lima_submodule
- cd lima/camera/pilatus
- cp -R ../../../lima-camera-pilatus/* .
- cd ../..
- ./install.sh camera/pilatus python tests cbf fits tiff hdf5 config
- cd ../lima-camera-pilatus
- cp -R ../lima .
artifacts:
paths:
- lima/
- dist/
tags:
- conda
build-linux:
<<: *build-conda
script:
- conda build ./conda/camera --prefix-length=80 --output-folder=dist/ --channel=http://bcu-ci.esrf.fr/stable
tags:
- linux
build-noarch:
<<: *build-conda
script:
- conda build ./conda/tango --prefix-length=80 --output-folder=dist/ --channel=http://bcu-ci.esrf.fr/stable
deploy-devel:
stage: deploy
environment:
name: devel/$CI_COMMIT_REF_NAME
url: http://bcu-ci.esrf.fr/devel
dependencies:
- build-linux
- build-noarch
script:
- cp -Rf dist/* /conda-devel/
- conda index /conda-devel/
tags:
- conda
- linux
only:
- cmake
test :
stage: test
- branches
except:
- stable
when: manual
deploy-stable:
stage: deploy
environment:
name: production
url: http://bcu-ci.esrf.fr/stable
dependencies:
- build
- build-linux
- build-noarch
script:
- cd ..
- cp -R lima-camera-pilatus/lima .
- cd lima/build/
- ctest --timeout 10
- cp -Rf dist/* /conda/
- conda index /conda/
tags:
- conda
- linux
only:
- cmake
- tags
- stable
sudo: required
language: cpp
git:
submodules: false
services:
- docker
before_install:
- docker pull esrfbliss/lima-ci-debian8
- docker run --name lima-ci-docker -v $(pwd):/src-ci/ -dit esrfbliss/lima-ci-debian8
script:
- echo "Unset esrf proxy from docker and cloning GitHub repositories"
- docker exec lima-ci-docker /bin/sh -c 'unset https_proxy && unset http_proxy && cd /root && ./install_lima_submodule'
- echo "copy the camera code from the pull request"
- docker exec lima-ci-docker /bin/sh -c 'cd /root/Lima/camera/pilatus && cp -R /src-ci/* .'
- echo "Compiling Lima and camera pilatus with options"
- docker exec lima-ci-docker /bin/sh -c 'cd /root/Lima/ && ./install.sh camera/pilatus python tests cbf fits tiff hdf5 config'
- echo "Executing tests in build repository"
- docker exec lima-ci-docker /bin/sh -c 'cd /root/Lima/build/ && ctest --timeout 10'
after-script:
- docker stop lima-ci-docker
- docker rm lima-ci-docker
branches:
only:
- cmake
......@@ -3,47 +3,184 @@
#
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# CS40220 38043 Grenoble Cedex 9
# CS40220 38043 Grenoble Cedex 9
# FRANCE
#
#
# Contact: lima@esrf.fr
#
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
cmake_minimum_required(VERSION 3.1)
project(pilatus)
set(NAME "pilatus")
set(${NAME}_srcs src/PilatusCamera.cpp src/PilatusInterface.cpp
src/PilatusSaving.cpp)
add_library(lima${NAME} SHARED ${${NAME}_srcs})
# Include additional modules that are used inconditionnaly
include(GNUInstallDirs)
include(GenerateExportHeader)
# If conda build, always set lib dir to 'lib'
if($ENV{CONDA_BUILD})
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
#INCLUDES
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
# Set lower / upper case project names
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
#LIBRARIES
find_library(PILATUS_CBF_LIB cbf)
if("${PILATUS_CBF_LIB}" STREQUAL "PILATUS_CBF_LIB-NOTFOUND")
message(FATAL_ERROR "${NAME} : CBF library not found, you can search it in cmake-gui or try to install it if it isn't here.")
# Set targets export name (used by lima and dependencies)
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
#set(namespace "${PROJECT_NAME}::")
# Check if project is being used directly or via add_subdirectory
set(CAMERA_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CAMERA_MASTER_PROJECT ON)
endif()
target_link_libraries(lima${NAME} limacore)
target_link_libraries(lima${NAME} ${PILATUS_CBF_LIB})
if (CAMERA_MASTER_PROJECT)
find_package(Lima REQUIRED)
endif()
# CMake additional macros
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${LIMA_CMAKE_INCLUDE_DIRS} ${CMAKE_MODULE_PATH})
# Set version
include(project_version)
# Enable python binding code compilation using sip generator
option(CAMERA_ENABLE_PYTHON "compile python binding code?" LIMA_ENABLE_PYTHON)
if (CAMERA_ENABLE_PYTHON)
# Find python interpreter and libs
find_package(PythonInterp)
find_package(PythonLibs)
if(${PYTHONINTERP_FOUND})
# python site-packages folder
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
OUTPUT_VARIABLE _PYTHON_SITE_PACKAGES_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
set(PYTHON_SITE_PACKAGES_DIR ${_PYTHON_SITE_PACKAGES_DIR} CACHE PATH "where should python modules be installed?")
find_package(SIP REQUIRED)
include(SIPMacros)
if(WIN32)
set(SIP_TAGS WIN32_PLATFORM)
elseif(UNIX)
set(SIP_TAGS POSIX_PLATFORM)
endif(WIN32)
set(SIP_EXTRA_OPTIONS -e -g)
find_package(NumPy REQUIRED)
endif()
find_package(CBF REQUIRED)
file(GLOB_RECURSE PILATUS_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
add_library(pilatus SHARED
src/PilatusCamera.cpp
src/PilatusInterface.cpp
src/PilatusSaving.cpp
${PILATUS_INCS}
)
# Generate export macros
generate_export_header(pilatus)
# Set version and output name
set_target_properties(pilatus PROPERTIES
OUTPUT_NAME "lima${PROJECT_NAME_LOWER}"
VERSION "${VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
# Add dependencies
target_include_directories(pilatus
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" # For export header
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(pilatus PUBLIC limacore)
target_compile_definitions(pilatus PUBLIC ${CBF_DEFINITIONS})
target_include_directories(pilatus PUBLIC $<BUILD_INTERFACE:${CBF_INCLUDE_DIRS}>)
target_link_libraries(pilatus PUBLIC ${CBF_LIBRARIES})
if(WIN32)
target_compile_definitions(pilatus
PRIVATE pilatus_EXPORTS
PUBLIC NOMINMAX)
set_target_properties(pilatus PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib")
endif()
# Binding code for python
if(CAMERA_ENABLE_PYTHON)
include(LimaTools)
limatools_run_sip_for_camera(pilatus)
endif()
# Generate and install package config file and version
if(CAMERA_MASTER_PROJECT)
set(PROJECT_LIBRARIES pilatus)
set(SIP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/sip/lima)
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/lima)
include(package_config)
endif()
## Installation
install(
TARGETS pilatus
EXPORT "${TARGETS_EXPORT_NAME}"
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # import library
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so files are libraries
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # .dll files are binaries
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # this does not actually install anything (but used by downstream projects)
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/project_version.h
${PROJECT_BINARY_DIR}/pilatus_export.h
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(CAMERA_ENABLE_PYTHON)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/
DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Pilatus"
)
endif()
limatools_set_library_soversion(lima${NAME} "VERSION")
install(TARGETS lima${NAME} LIBRARY DESTINATION lib)
## Tests
if(LIMA_ENABLE_PYTHON)
limatools_run_sip_for_camera(${NAME})
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Pilatus")
if(CAMERA_ENABLE_TESTS)
enable_testing()
#add_subdirectory(test)
endif()
This diff is collapsed.
find_path(CBF_INCLUDE_DIRS cbflib/cbf.h)
find_library(CBF_LIBRARIES cbf)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CBF
DEFAULT_MSG
CBF_LIBRARIES
CBF_INCLUDE_DIRS)
# Config file for @PROJECT_NAME_LOWER@
#
# It defines the following variables:
#
# @PROJECT_NAME_UPPER@_INCLUDE_DIRS - include directory
# @PROJECT_NAME_UPPER@_LIBRARIES - all dynamic libraries
# @PROJECT_NAME_UPPER@_STATIC_LIBRARIES - all static libraries
@PACKAGE_INIT@
# Add dependencies here
include(CMakeFindDependencyMacro)
find_dependency(Lima)
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")
check_required_components(@PROJECT_NAME_LOWER@)
#!/bin/bash
cmake -Bbuild -H. -DCAMERA_ENABLE_PYTHON=1 -DCAMERA_ENABLE_TESTS=1 -DCMAKE_INSTALL_PREFIX=$PREFIX -DPYTHON_SITE_PACKAGES_DIR=$SP_DIR -DCMAKE_FIND_ROOT_PATH=$PREFIX
cmake --build build --target install
blas_impl:
- mkl # [x86_64]
c_compiler:
- vs2017 # [win]
cxx_compiler:
- vs2017 # [win]
python:
- 3.6
# This differs from target_platform in that it determines what subdir the compiler
# will target, not what subdir the compiler package will be itself.
# For example, we need a win-64 vs2008_win-32 package, so that we compile win-32
# code on win-64 miniconda.
cross_compiler_target_platform:
- win-64 # [win]
target_platform:
- win-64 # [win]
vc:
- 14
zip_keys:
- # [win]
- vc # [win]
- c_compiler # [win]
- cxx_compiler # [win]
{% set version = GIT_DESCRIBE_TAG[1:] %}
package:
name: lima-camera-pilatus
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
requirements:
build:
- git
- cmake
- {{ compiler('cxx') }}
- cbflib
- lima-core
host:
- python {{ python }}
- numpy
- sip 4.18* #For the SIP generator
run:
- python {{ python }}
- sip 4.18* #For the SIP module
- cbflib
- lima-core
test:
requires:
- cmake
imports:
- Lima.Pilatus
commands:
- cmake --version
- ctest --version
- cpack --version
about:
home: https://github.com/esrf-bliss/Lima
license: GPL
license_file: COPYING
summary: a library for the unified control of 2D detectors
xcopy tango\*.* %SP_DIR%\Lima\Server\camera\
mkdir -p $SP_DIR/Lima/Server/camera && cp tango/*.* $SP_DIR/Lima/Server/camera
{% set version = GIT_DESCRIBE_TAG[1:] %}
package:
name: lima-camera-pilatus-tango
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
noarch: python
requirements:
run:
- lima-tango-server
- lima-camera-pilatus
about:
home: https://github.com/esrf-bliss/Lima
license: GPL
license_file: COPYING
summary: a library for the unified control of 2D detectors
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
#=============================================================================
#
# file : Pilatus.py
#
# description : Python source for the Pilatus and its commands.
# The class is derived from Device. It represents the
# CORBA servant object which will be accessed from the
# network. All commands which can be executed on the
# Pilatus are implemented in this file.
#
# project : TANGO Device Server
#
# copyleft : European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
#=============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
#
# (c) - Software Engineering Group - ESRF
#=============================================================================
#
import PyTango
import sys
from Lima import Core
from Lima.Server import AttrHelper
#==================================================================
# Pilatus Class Description:
#
#
#==================================================================
class Pilatus(PyTango.Device_4Impl):
#--------- Add you global variables here --------------------------
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
self.init_device()
self.__FillMode = {'ON':True,
'OFF':False}
self.__ThresholdGain = {'DEFAULT' : 0,
'LOW' : 1,
'MID' : 2,
'HIGH' : 3,
'ULTRA HIGH' : 4}
self.__CamStatus = {'ERROR' : 0,
'DISCONNECTED' : 1,
'STANDBY' : 2,
'SETTING_ENERGY' :3,
'SETTING_THRESHOLD' : 4,
'SETTING_EXPOSURE' : 5,
'SETTING_NB_IMAGE_IN_SEQUENCE' :6,
'SETTING_EXPOSURE_PERIOD' :7,
'SETTING_HARDWARE_TRIGGER_DELAY' : 8,
'SETTING_EXPOSURE_PER_FRAME' : 9,
'SETTING_ROI' : 10,
'KILL_ACQUISITION' : 11,
'RUNNING' : 12,
'ANYCMD' : 13
}
self.__ReadoutRoi = {'C60': Core.Roi(0,0,0,0), #Full frame for 6M (0,0,2463,2527)
'C2' : Core.Roi(988,1060,487,407), #C2 for 6M
'C18': Core.Roi(494,636,1475,1255) #C18 for 6M
}
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
if self.TmpfsSize:
buffer = _PilatusInterface.buffer()
buffer.setTmpfsSize(self.TmpfsSize * 1024 * 1024)
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
return AttrHelper.get_attr_string_value_list(self, attr_name)
#------------------------------------------------------------------
# resetHighVoltage command:
#
# Description: resets high voltage
# argin: sleep time (s) (-1 to not sleep)
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def resetHighVoltage(self, sleep_time):
_PilatusCamera.resetHighVoltage(sleep_time)
#==================================================================
#
# Pilatus read/write attribute methods
#
#==================================================================
#------------------------------------------------------------------
# Read threshold_gain attribute
#------------------------------------------------------------------
def read_threshold_gain(self, attr):
gain = _PilatusCamera.gain()
if gain is None:
gain = "not set"
else:
gain = AttrHelper.getDictKey(self.__ThresholdGain,gain)
attr.set_value(gain)
#------------------------------------------------------------------
# Write threshold_gain attribute
#------------------------------------------------------------------
def write_threshold_gain(self, attr):
data = attr.get_write_value()
gain = AttrHelper.getDictValue(self.__ThresholdGain,data)
threshold = _PilatusCamera.threshold()
_PilatusCamera.setThresholdGain(threshold,gain)
#------------------------------------------------------------------
# Read threshold attribute
#------------------------------------------------------------------
def read_threshold(self, attr):