Commit 6295b2b1 authored by Laurent Claustre's avatar Laurent Claustre

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

Update the build sytem to support devel conda package

See merge request !2
parents 9a30312c 65829379
Pipeline #6176 passed with stages
in 5 minutes and 45 seconds
stages:
- build
- build-noarch
- deploy
.build-conda: &build-conda
stage: build
artifacts:
paths:
- 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
stage: build-noarch
script:
- conda build ./conda/tango --prefix-length=80 --output-folder=dist/ --channel=http://bcu-ci.esrf.fr/stable
dependencies:
- build-linux
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:
- branches
except:
- stable
when: manual
deploy-stable:
stage: deploy
environment:
name: production
url: http://bcu-ci.esrf.fr/stable
dependencies:
- build-linux
- build-noarch
script:
- cp -Rf dist/* /conda/
- conda index /conda/
tags:
- conda
- linux
only:
- tags
- stable
###########################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# 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/>.
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# 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/>.
############################################################################
set(NAME "pointgrey")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--add-needed")
cmake_minimum_required(VERSION 3.1)
project(pointgrey)
set(NAME "pointgrey") # This is used by LimaTools
# 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()
# Set lower / upper case project names
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
# 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()
if (CAMERA_MASTER_PROJECT)
find_package(Lima REQUIRED)
endif()
# CMake additional macros
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_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()
#SOURCEs
set(${NAME}_srcs src/PointGreyCamera.cpp src/PointGreyInterface.cpp
src/PointGreyDetInfoCtrlObj.cpp src/PointGreySyncCtrlObj.cpp)
set(PYTHON_SITE_PACKAGES_DIR ${_PYTHON_SITE_PACKAGES_DIR} CACHE PATH "where should python modules be installed?")
file(STRINGS "VERSION" pointgrey_vers)
add_library(lima${NAME} SHARED ${${NAME}_srcs})
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)
#INCLUDEs
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories(lima${NAME} PUBLIC "/usr/include/flycapture")
target_include_directories(lima${NAME} PUBLIC "/usr/include/flycapture/C")
find_package(NumPy REQUIRED)
endif()
find_package(Flycapture REQUIRED)
file(GLOB_RECURSE MYCAMERA_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
# Library definition
add_library(pointgrey SHARED
src/PointGreyCamera.cpp
src/PointGreyInterface.cpp
src/PointGreyDetInfoCtrlObj.cpp
src/PointGreySyncCtrlObj.cpp
${MYCAMERA_INCS}
)
# Generate export macros
generate_export_header(pointgrey)
# Set version and output name
set_target_properties(pointgrey PROPERTIES
OUTPUT_NAME "lima${PROJECT_NAME_LOWER}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
# Add dependencies
target_link_libraries(pointgrey ${SDK_LIBRARIES})
target_include_directories(pointgrey PRIVATE ${SDK_INCLUDE_DIRS})
target_include_directories(pointgrey
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(pointgrey PUBLIC limacore)
target_compile_definitions(pointgrey PUBLIC ${FLYCAPTURE_DEFINITIONS})
#LIBRARIES
find_library(POINTGREY_FLYCAPTURE_LIB flycapture)
if("${POINTGREY_FLYCAPTURE_LIB}" STREQUAL "POINTGREY_FLYCAPTURE_LIB-NOTFOUND")
message(FATAL_ERROR "${NAME} : flycapture not found, you can search it in cmake-gui or try to install it if it isn't here.")
target_include_directories(pointgrey PUBLIC ${FLYCAPTURE_INCLUDE_DIRS})
target_link_libraries(pointgrey PUBLIC ${FLYCAPTURE_LIBRARIES})
if(WIN32)
target_compile_definitions(pointgrey
PRIVATE pointgrey_EXPORTS
PUBLIC NOMINMAX)
set_target_properties(pointgrey PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib")
endif()
target_link_libraries(lima${NAME} limacore)
target_link_libraries(lima${NAME} ${POINTGREY_FLYCAPTURE_LIB})
# Binding code for python
if(CAMERA_ENABLE_PYTHON)
include(LimaTools)
limatools_run_sip_for_camera(pointgrey)
endif()
# Generate and install package config file and version
if(CAMERA_MASTER_PROJECT)
set (PROJECT_LIBRARIES pointgrey)
set(SIP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/sip/lima)
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/lima)
include(package_config)
endif()
## Installation
limatools_set_library_soversion(lima${NAME} "VERSION")
install(TARGETS lima${NAME} LIBRARY DESTINATION lib)
install(
TARGETS pointgrey
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}/pointgrey_export.h
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(CAMERA_ENABLE_PYTHON)
install(
FILES python/__init__.py
DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/PointGrey"
)
endif()
if(LIMA_ENABLE_PYTHON)
limatools_run_sip_for_camera(${NAME})
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/PointGrey")
## Tests
if(CAMERA_ENABLE_TESTS)
enable_testing()
#add_subdirectory(test)
endif()
This diff is collapsed.
find_path(FLYCAPTURE_INCLUDE_DIRS flycapture/FlyCapture2.h)
find_library(FLYCAPTURE_LIBRARIES flycapture)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Flycapture
DEFAULT_MSG
FLYCAPTURE_LIBRARIES
FLYCAPTURE_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@)
cmake -Bbuild -H. -G "%CMAKE_GENERATOR%" -DCAMERA_ENABLE_PYTHON=1 -DCAMERA_ENABLE_TESTS=1 -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DPYTHON_SITE_PACKAGES_DIR=%SP_DIR% -DCMAKE_FIND_ROOT_PATH=%LIBRARY_PREFIX%
IF %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
cmake --build build --config Release --target install
IF %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
#!/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:
- 2.7 # [linux]
- 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-pointgrey
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
requirements:
host:
- python {{ python }}
- numpy
- sip 4.19.8 # For compatibility with pyqt 5.9.2
- lima-core
- flycapture2-sdk 2.3.3
build:
- git
- cmake
- {{ compiler('cxx') }}
run:
- python {{ python }}
- sip >=4.19.4, <=4.19.8 # For compatibility with pyqt 5.9.2
- {{ pin_compatible('lima-core', max_pin='x.x') }}
- {{ pin_compatible('flycapture2-sdk', max_pin='x.x.x') }}
- libraw1394
- libusb
test:
requires:
- cmake
imports:
- Lima.PointGrey
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-pointgrey-tango
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
noarch: python
requirements:
run:
- lima-tango-server
- lima-camera-pointgrey
about:
home: https://github.com/esrf-bliss/Lima
license: GPL
license_file: COPYING
summary: a library for the unified control of 2D detectors
......@@ -24,10 +24,12 @@
#include <stdlib.h>
#include <limits>
#include <flycapture/FlyCapture2.h>
#include "lima/HwBufferMgr.h"
#include "lima/HwMaxImageSizeCallback.h"
#include "FlyCapture2.h"
using namespace std;
#ifdef USE_GIGE
......
############################################################################
# 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 : PointGrey.py
#
# description : Python source for the PointGrey 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 : MAX IV Laboratory
# Lund, Sweden
#
#=============================================================================
# (c) - Bliss - ESRF
#=============================================================================
#
import PyTango
from Lima import Core
from Lima import PointGrey as PointGreyAcq
from Lima.Server import AttrHelper
class PointGrey(PyTango.Device_4Impl):
Core.DEB_CLASS(Core.DebModApplication, 'LimaCCDs')
#------------------------------------------------------------------
# Device constructor
#------------------------------------------------------------------
def __init__(self,*args) :
PyTango.Device_4Impl.__init__(self,*args)
self.init_device()
self.__Attribute2FunctionBase = { 'gain' : 'Gain'
, 'auto_gain' : 'AutoGain'
, 'exp_time' : 'ExpTime'
, 'auto_exp_time' : 'AutoExpTime'
, 'frame_rate' : 'FrameRate'
, 'auto_frame_rate' : 'AutoFrameRate'
, 'packet_size' : 'PacketSize'
, 'packet_delay' : 'PacketDelay'
}
#------------------------------------------------------------------
# Device destructor
#------------------------------------------------------------------
def delete_device(self):
pass
#------------------------------------------------------------------
# Device initialization
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def init_device(self):
self.set_state(PyTango.DevState.ON)
self.get_device_properties(self.get_device_class())
#------------------------------------------------------------------
# getAttrStringValueList command:
#
# Description: return a list of authorized values if any
# argout: DevVarStringArray
#------------------------------------------------------------------
@Core.DEB_MEMBER_FUNCT
def getAttrStringValueList(self, attr_name):
#use AttrHelper
return AttrHelper.get_attr_string_value_list(self, attr_name)
#==================================================================
#
# PointGrey read/write attribute methods
#
#==================================================================
def __getattr__(self,name) :
#use AttrHelper
return AttrHelper.get_attr_4u(self, name, _PointGreyInterface)
def read_exp_time_range(self, attr):
min_, max_ = _PointGreyInterface.getExpTimeRange()
attr.set_value([min_, max_])
def read_gain_range(self, attr):
min_, max_ = _PointGreyInterface.getGainRange()
attr.set_value([min_, max_])
def read_frame_rate_range(self, attr):
min_, max_ = _PointGreyInterface.getFrameRateRange()
attr.set_value([min_, max_])
#==================================================================
#
# PointGreyClass class definition
#
#==================================================================
class PointGreyClass(PyTango.DeviceClass):
class_property_list = {}
device_property_list = {
'camera_serial':
[PyTango.DevLong,
"Camera serial number", []],
'packet_size':
[PyTango.DevLong,
"GigE packet size", [-1]],
'packet_delay':
[PyTango.DevLong,
"GigE packet delay", [-1]],
}
cmd_list = {
'getAttrStringValueList':
[[PyTango.DevString, "Attribute name"],
[PyTango.DevVarStringArray, "Authorized String value list"]],
}
attr_list = {
'gain':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'unit': "dB",
}],
'auto_gain':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'exp_time':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'unit': "ms",
}],
'auto_exp_time':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'frame_rate':
[[PyTango.DevDouble,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'unit': "fps",
}],
'auto_frame_rate':
[[PyTango.DevBoolean,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'packet_size':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'packet_delay':
[[PyTango.DevLong,
PyTango.SCALAR,
PyTango.READ_WRITE]],
'exp_time_range':
[[PyTango.DevDouble,
PyTango.SPECTRUM,
PyTango.READ,2],
{
'unit': "ms",
'description':"min exposure, max exposure",
}],
'gain_range':
[[PyTango.DevDouble,
PyTango.SPECTRUM,
PyTango.READ,2],
{
'unit': "dB",
'description':"min gain, max gain",
}],
'frame_rate_range':
[[PyTango.DevDouble,
PyTango.SPECTRUM,
PyTango.READ,2],
{
'unit': "fps",
'description':"min frame rate, max frame rate",
}],
}
def __init__(self,name) :
PyTango.DeviceClass.__init__(self,name)
self.set_type(name)
#----------------------------------------------------------------------------
# Plugins
#----------------------------------------------------------------------------
_PointGreyCam = None
_PointGreyInterface = None
def get_control(camera_serial, packet_size, packet_delay):
global _PointGreyCam, _PointGreyInterface
if _PointGreyCam is None:
_PointGreyCam = PointGreyAcq.Camera(int(camera_serial),
int(packet_size),
int(packet_delay))
_PointGreyInterface = PointGreyAcq.Interface(_PointGreyCam)
return Core.CtControl(_PointGreyInterface)
def get_tango_specific_class_n_device():
return PointGreyClass, PointGrey
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment