Commit 73885715 authored by Samuel Debionne's avatar Samuel Debionne

Update the build sytem to support devel conda package

parent 448222e1
stages:
- build
- 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
deploy-devel:
stage: deploy
environment:
name: devel/$CI_COMMIT_REF_NAME
url: http://bcu-ci.esrf.fr/devel
dependencies:
- build-linux
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
script:
- cp -Rf dist/* /conda/
- conda index /conda/
tags:
- conda
- linux
only:
- tags
- stable
......@@ -3,54 +3,191 @@
#
# 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/>.
############################################################################
set(NAME "espia")
set(${NAME}_srcs src/Espia.cpp src/FoclaHwInterface.cpp
src/EspiaAcq.cpp src/EspiaBufferMgr.cpp
src/EspiaDev.cpp src/EspiaFocla.cpp
src/EspiaSerialLine.cpp)
cmake_minimum_required(VERSION 3.1)
add_library(lima${NAME} SHARED ${${NAME}_srcs})
project(espia)
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(NAME "espia") # This is used by LimaTools
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include(FindEspiaDrv)
# Include additional modules that are used inconditionnaly
include(GNUInstallDirs)
include(GenerateExportHeader)
#set paths for espia driver lib and include files
target_include_directories(lima${NAME} PUBLIC "${ESPIA_DRV_INCLUDE_DIR}")
# If conda build, always set lib dir to 'lib'
if($ENV{CONDA_BUILD})
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
target_link_libraries(lima${NAME} limacore)
target_link_libraries(lima${NAME} ${ESPIA_DRV_LIB})
# 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}::")
limatools_set_library_soversion(lima${NAME} "VERSION")
install(TARGETS lima${NAME} LIBRARY DESTINATION lib)
# 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(LIMA_ENABLE_PYTHON)
limatools_run_sip_for_camera(${NAME})
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Espia")
if (CAMERA_MASTER_PROJECT)
find_package(Lima REQUIRED)
endif()
if(LIMA_ENABLE_TESTS)
add_subdirectory(test)
# 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(Espia REQUIRED)
file(GLOB_RECURSE ESPIA_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
add_library(espia SHARED
src/Espia.cpp
src/FoclaHwInterface.cpp
src/EspiaAcq.cpp
src/EspiaBufferMgr.cpp
src/EspiaDev.cpp
src/EspiaFocla.cpp
src/EspiaSerialLine.cpp
${ESPIA_INCS}
)
# Generate export macros
generate_export_header(espia)
# Add dependencies
target_include_directories(espia
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" # For export header
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
# Set version and output name
set_target_properties(espia PROPERTIES
OUTPUT_NAME "lima${PROJECT_NAME_LOWER}"
VERSION "${VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
target_link_libraries(espia PUBLIC limacore)
target_compile_definitions(espia PUBLIC ${ESPIA_DEFINITIONS})
target_include_directories(espia PUBLIC $<BUILD_INTERFACE:${ESPIA_INCLUDE_DIRS}>)
target_link_libraries(espia PUBLIC ${ESPIA_LIBRARIES})
# Binding code for python
if(CAMERA_ENABLE_PYTHON)
include(LimaTools)
limatools_run_sip_for_camera(espia)
endif()
# Generate and install package config file and version
if(CAMERA_MASTER_PROJECT)
set(PROJECT_LIBRARIES espia)
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 espia
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}/espia_export.h
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(CAMERA_ENABLE_PYTHON)
file(GLOB SIP_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/sip/*.sip"
)
install(
FILES ${SIP_SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/sip/limaespia.sip
COMPONENT devel
DESTINATION ${SIP_INSTALL_DIR}
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/
DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Espia"
)
endif()
## Tests
if(CAMERA_ENABLE_TESTS)
enable_testing()
#add_subdirectory(test)
endif()
This diff is collapsed.
set(ESPIA_INCLUDE_DIRS)
set(ESPIA_LIBRARIES)
set(ESPIA_DEFINITIONS)
find_path(ESPIA_INCLUDE_DIRS "espia_lib.h")
find_library(ESPIA_LIBRARIES espia)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Espia DEFAULT_MSG
ESPIA_LIBRARIES
ESPIA_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)
set_and_check(@PROJECT_NAME_UPPER@_SIP_INCLUDE_DIRS "@PACKAGE_SIP_INSTALL_DIR@")
set_and_check(@PROJECT_NAME_UPPER@_CMAKE_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_DIR@")
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:
- 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-common-espia
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
requirements:
build:
- git
- cmake
- {{ compiler('cxx') }}
- lima-core
host:
- python {{ python }}
- numpy
- sip 4.18* #For the SIP generator
- espia
run:
- python {{ python }}
- sip 4.18* #For the SIP module
- lima-core
- espia
test:
requires:
- cmake
imports:
- Lima.Espia
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
......@@ -48,7 +48,7 @@ namespace Focla
DEB_GLOBAL_NAMESPC(DebModFocla, "Espia::Focla");
extern const std::string
extern const std::string
TRIG_MODE,
TRIG,
CAM_SEL,
......@@ -107,7 +107,7 @@ void initSigName2IdxMap();
* @brief Focla device class
*
*******************************************************************/
class Dev
class Dev
{
DEB_CLASS_NAMESPC(DebModFocla, "Dev", "Espia::Focla");
......@@ -130,7 +130,7 @@ class Dev
void selectCamera( int cam_nb );
void getPixelPack( int cam_nb, std::string &pix_pack_str );
void setPixelPack( int cam_nb, int pix_pack=-1,
void setPixelPack( int cam_nb, int pix_pack=-1,
std::string pix_pack_str="Default" );
void getTestImage( int &val );
......@@ -147,7 +147,7 @@ class Dev
void ccPulseStart( int cam_nb, int cc_nb, int polarity, int width_us,
int delay_us=0, int nb_pulse=1 );
void ccPulseStop( int cam_nb, int cc_nb );
void ccPulseStatus( int cam_nb, int cc_nb, int &pulse_active,
void ccPulseStatus( int cam_nb, int cc_nb, int &pulse_active,
int &curr_pulse, int &curr_stage );
// XXX Do we need these three below?
......@@ -160,7 +160,7 @@ class Dev
void open();
void close();
void checkMeta() throw(Exception);
void checkMeta();
int pIdxFromName( const std::string pname );
std::string pixelPackParName( int cam_nb );
std::string ccLevelParName( int cam_nb, int cc_nb );
......@@ -199,10 +199,10 @@ class SerialLine : public HwSerialLine
virtual void getNbAvailBytes( int &nb_avail );
virtual void read( std::string& buffer, int max_len=Available,
virtual void read( std::string& buffer, int max_len=Available,
double timeout=TimeoutDefault );
virtual void readLine( std::string& buffer, int max_len,
virtual void readLine( std::string& buffer, int max_len,
double timeout=TimeoutDefault );
virtual void write( const std::string& buffer, bool no_wait=false );
......
......@@ -111,7 +111,7 @@ const map<string, int> Espia::Focla::PixelPack(C_LIST_ITERS(PixelPackList));
/* CL CC Levels: Low, High, Ext */
static const int CCLevelArray[] = {2, 3, 0};
const vector<int> Espia::Focla::CCLevel =
const vector<int> Espia::Focla::CCLevel =
vector<int>( CCLevelArray, CCLevelArray +
(sizeof(CCLevelArray)/sizeof(CCLevelArray[0])) );
......@@ -243,12 +243,12 @@ int Espia::Focla::Dev::pIdxFromName( const string pname )
}
void Espia::Focla::Dev::checkMeta() throw(Exception)
void Espia::Focla::Dev::checkMeta()
{
DEB_MEMBER_FUNCT();
if( m_edev.isMeta() )
THROW_HW_ERROR(NotSupported)
THROW_HW_ERROR(NotSupported)
<< "Operation not permitted on meta-devices!";
}
......@@ -387,14 +387,14 @@ void Espia::Focla::Dev::getPixelPack( int cam_nb, string &pix_pack_str )
*
* @see PixelPackList, EspiaAcqLib.py
*******************************************************************/
void Espia::Focla::Dev::setPixelPack( int cam_nb, int pix_pack,
void Espia::Focla::Dev::setPixelPack( int cam_nb, int pix_pack,
string pix_pack_str )
{
DEB_MEMBER_FUNCT();
string pname = pixelPackParName( cam_nb );
if( -1 == pix_pack ) {
map<string,int>::const_iterator p =
map<string,int>::const_iterator p =
Espia::Focla::PixelPack.find(pix_pack_str);
if( p != Espia::Focla::PixelPack.end() )
pix_pack = p->second;
......@@ -487,7 +487,7 @@ string Espia::Focla::Dev::ccLevelParName( int cam_nb, int cc_nb )
*
* @see CCLevel vector, EspiaAcqLib.py
*******************************************************************/
void Espia::Focla::Dev::ccLevelGet( int cam_nb, int cc_nb,
void Espia::Focla::Dev::ccLevelGet( int cam_nb, int cc_nb,
unsigned int &cc_level )
{
DEB_MEMBER_FUNCT();
......@@ -514,7 +514,7 @@ void Espia::Focla::Dev::ccLevelGet( int cam_nb, int cc_nb,
*
* @see CCLevel vector, EspiaAcqLib.py
*******************************************************************/
void Espia::Focla::Dev::ccLevelSet( int cam_nb, int cc_nb,
void Espia::Focla::Dev::ccLevelSet( int cam_nb, int cc_nb,
unsigned int cc_level )
{
DEB_MEMBER_FUNCT();
......@@ -562,7 +562,7 @@ int Espia::Focla::Dev::sigNbFromName( const string sname )
* @param[in] delay_us int
* @param[in] nb_pulse int
*******************************************************************/
void Espia::Focla::Dev::ccPulseStart( int cam_nb, int cc_nb, int polarity,
void Espia::Focla::Dev::ccPulseStart( int cam_nb, int cc_nb, int polarity,
int width_us, int delay_us, int nb_pulse )
{
DEB_MEMBER_FUNCT();
......@@ -571,7 +571,7 @@ void Espia::Focla::Dev::ccPulseStart( int cam_nb, int cc_nb, int polarity,
int sig_nb = sigNbFromName( sig_name );
int width_arr[2] = {width_us, delay_us};
int nb_stage = sizeof(width_arr) / sizeof(width_arr[0]);
CHECK_CALL( focla_sig_pulse_start( m_focla, cam_nb, sig_nb, polarity,
CHECK_CALL( focla_sig_pulse_start( m_focla, cam_nb, sig_nb, polarity,
width_arr, nb_stage, nb_pulse ) );
}
......@@ -601,14 +601,14 @@ void Espia::Focla::Dev::ccPulseStop( int cam_nb, int cc_nb )
* @param[out] curr_pulse int reference
* @param[out] curr_stage int reference
*******************************************************************/
void Espia::Focla::Dev::ccPulseStatus( int cam_nb, int cc_nb, int &pulse_active,
void Espia::Focla::Dev::ccPulseStatus( int cam_nb, int cc_nb, int &pulse_active,
int &curr_pulse, int &curr_stage )
{
DEB_MEMBER_FUNCT();
string sig_name = ccSignalName( cam_nb, cc_nb );
int sig_nb = sigNbFromName( sig_name );
CHECK_CALL( focla_sig_pulse_status( m_focla, cam_nb, sig_nb,
CHECK_CALL( focla_sig_pulse_status( m_focla, cam_nb, sig_nb,
&pulse_active, &curr_pulse, &curr_stage ) );
}
......@@ -715,7 +715,7 @@ void Espia::Focla::SerialLine::flush()
/***************************************************************//**
* @brief Get the number of bytes available for reading from Focla serial line
*
* @param[out] nb_avail int reference
* @param[out] nb_avail int reference
*******************************************************************/
void Espia::Focla::SerialLine::getNbAvailBytes( int &nb_avail )
{
......@@ -730,7 +730,7 @@ void Espia::Focla::SerialLine::getNbAvailBytes( int &nb_avail )
/***************************************************************//**
* @brief Read max_len bytest from Focla serial line
*******************************************************************/
void Espia::Focla::SerialLine::read( string& buffer, int max_len,
void Espia::Focla::SerialLine::read( string& buffer, int max_len,
double timeout )
{
DEB_MEMBER_FUNCT();
......@@ -745,7 +745,7 @@ void Espia::Focla::SerialLine::read( string& buffer, int max_len,
char *ptr = max_len ? (char *) buffer.data() : NULL;
unsigned long ret_len = max_len;
CHECK_CALL( focla_ser_read( m_fdev.getFocla(), ptr, &ret_len,
CHECK_CALL( focla_ser_read( m_fdev.getFocla(), ptr, &ret_len,
timeout_us ) );
buffer.resize( ret_len );
}
......@@ -754,7 +754,7 @@ void Espia::Focla::SerialLine::read( string& buffer, int max_len,
/***************************************************************//**
* @brief Read from Focla serial line until line terminator
*******************************************************************/
void Espia::Focla::SerialLine::readLine( std::string& buffer, int max_len,
void Espia::Focla::SerialLine::readLine( std::string& buffer, int max_len,
double timeout )
{
DEB_MEMBER_FUNCT();
......@@ -769,7 +769,7 @@ void Espia::Focla::SerialLine::readLine( std::string& buffer, int max_len,
unsigned long ret_len = max_len;
CHECK_CALL( focla_ser_read_str( m_fdev.getFocla(), ptr, &ret_len,
(char *)term.data(), term.size(),
(char *)term.data(), term.size(),
timeout_us ) );
buffer.resize( ret_len );
}
......@@ -790,7 +790,7 @@ void Espia::Focla::SerialLine::write( const std::string& buffer, bool no_wait )
double block_delay; getBlockDelay( block_delay );
CHECK_CALL( focla_ser_write( m_fdev.getFocla(), ptr, &nb_wr_bytes,
CHECK_CALL( focla_ser_write( m_fdev.getFocla(), ptr, &nb_wr_bytes,
block_size, getTimeoutUSec(block_delay),
!no_wait ) );
}
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