Commit 71d64456 authored by Roberto Arturo Homs-Regojo's avatar Roberto Arturo Homs-Regojo

Merge branch 'master-work' into 'master'

Master work

See merge request !8
parents 129000ad 8c3ddea5
Pipeline #12078 passed with stages
in 8 minutes and 52 seconds
###########################################################################
# 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
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# Contact: lima@esrf.fr
# 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 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.
# 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/>.
# 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)
......@@ -61,12 +61,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${LIMA_CMAKE_INCLUDE_DIR
# Set version
include(project_version)
# Enable git hash in the version
option(WITH_GIT_VERSION "compile python binding code?" OFF)
# Enable python binding code compilation using sip generator
if (CAMERA_MASTER_PROJECT)
option(LIMA_ENABLE_PYTHON "compile python binding code?" OFF)
endif()
option(CAMERA_ENABLE_PYTHON "compile python binding code?" LIMA_ENABLE_PYTHON)
if (LIMA_ENABLE_PYTHON)
if (CAMERA_ENABLE_PYTHON)
# Find python interpreter and libs
find_package(PythonInterp)
find_package(PythonLibs)
......@@ -95,8 +96,6 @@ find_package(Pco REQUIRED)
file(GLOB_RECURSE PCO_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
# Library definition
IF(WIN32)
add_library(pco SHARED
src/PcoBinCtrlObj.cpp
......@@ -134,12 +133,6 @@ endif()
# Generate export macros
generate_export_header(pco)
# Set version and output name
set_target_properties(pco PROPERTIES
OUTPUT_NAME "lima${PROJECT_NAME_LOWER}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
# Add dependencies
target_include_directories(pco
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
......@@ -147,11 +140,29 @@ target_include_directories(pco
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
if(WITH_GIT_VERSION)
target_compile_definitions(pco PUBLIC WITH_GIT_VERSION)
endif()
# Set LIMA_NO_DEBUG if LIMA_ENABLE_DEBUG is set
if(NOT LIMA_ENABLE_DEBUG)
target_compile_definitions(pco PUBLIC LIMA_NO_DEBUG)
endif()
# Set version and output name
set_target_properties(pco PROPERTIES
OUTPUT_NAME "lima${PROJECT_NAME_LOWER}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
target_link_libraries(pco PUBLIC limacore)
target_compile_definitions(pco PUBLIC ${PCO_DEFINITIONS})
target_include_directories(pco PUBLIC $<BUILD_INTERFACE:${PCO_INCLUDE_DIRS}>)
target_link_libraries(pco PUBLIC ${PCO_LIBRARIES})
if(WIN32)
......@@ -162,17 +173,17 @@ if(WIN32)
endif()
# Binding code for python
if(LIMA_ENABLE_PYTHON)
if(CAMERA_ENABLE_PYTHON)
include(LimaTools)
limatools_run_sip_for_camera(pco)
endif()
# Generate and install package config file and version
if(CAMERA_MASTER_PROJECT)
set (PROJECT_LIBRARIES pco)
set(SIP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/sip/lima)
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/lima)
include(package_config)
set(PROJECT_LIBRARIES pco)
set(SIP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/sip/lima)
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/lima)
include(package_config)
endif()
## Installation
......@@ -201,22 +212,13 @@ install(
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(LIMA_ENABLE_PYTHON)
if(CAMERA_ENABLE_PYTHON)
install(
FILES
python/__init__.py
FILES python/__init__.py
DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Pco"
)
endif()
if(LIMA_ENABLE_PYTANGO_SERVER)
install(
FILES
tango/Pco.py
DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Server/camera"
)
endif()
## Tests
if(CAMERA_ENABLE_TESTS)
enable_testing()
......
# 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%" -DLIMA_ENABLE_PYTHON=1 -DCAMERA_ENABLE_TESTS=1 -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DPYTHON_SITE_PACKAGES_DIR=%SP_DIR% -DCMAKE_FIND_ROOT_PATH=%LIBRARY_PREFIX%
python get_git_log.py
rem 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%
cmake -Bbuild -H. -G "%CMAKE_GENERATOR%" -DCAMERA_ENABLE_PYTHON=1 -DWITH_GIT_VERSION=1 -DLIMA_ENABLE_DEBUG=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
......
import os
import datetime
strGit = "#define PCO_GIT_VERSION \"$Id: PCO %s at [%s] $\"\n"
fnVersion = "./include/PcoGitVersion.h"
fnSdkLin="./sdkPco/PcoSdkVersion.h"
fnSdkWin="./sdkPcoLin/include/PcoSdkVersion.h"
fOut = open(fnVersion, "w")
log = os.popen('git log -n 1 --date=iso --format=format:"rev[%ad] head[%h][%H] ref[%d]" HEAD || echo "ERROR"').read()
dt = '{0:%Y/%m/%d %H:%M:%S}'.format(datetime.datetime.now())
line = strGit % (log, dt)
fOut.write(line)
try:
fIn = open(fnSdkLin, "r")
lines = fIn.readlines()
line = lines[0]
fIn.close()
except:
line = "#define PCO_SDK_LIN_VERSION \"$Id: PCOSDK_LIN [not defined] $\""
fOut.write(line)
try:
fIn = open(fnSdkWin, "r")
lines = fIn.readlines()
line = lines[0]
fIn.close()
except:
line = "#define PCO_SDK_WIN_VERSION \"$Id: PCOSDK_WIN [not defined] $\""
fOut.write(line)
line = strGit % (log, dt)
fOut.close()
......@@ -77,27 +77,38 @@ const char *_timestamp_pcocamera()
}
#ifdef WITH_GIT_VERSION
# include "PcoGitVersion.h"
#include "PcoGitVersion.h"
char *_timestamp_gitversion(char *buffVersion, int len)
char * _timestamp_gitversion(char *buffVersion, int len)
{
__sprintfSExt(buffVersion, len,
PCO_GIT_VERSION "\n" PROCLIB_GIT_VERSION
"\n" LIBCONFIG_GIT_VERSION
"\n" LIMA_GIT_VERSION "\n" TANGO_GIT_VERSION
"\n" SPEC_GIT_VERSION "\n"
# ifndef __linux__
PCO_SDK_WIN_VERSION "\n"
# else
PCO_SDK_LIN_VERSION "\n"
# endif
);
return buffVersion;
__sprintfSExt(buffVersion, len,
#ifdef PCO_GIT_VERSION
PCO_GIT_VERSION "\n"
#endif
#ifdef PCO_SDK_VERSION
PCO_SDK_VERSION "\n"
#endif
#ifdef PROCLIB_GIT_VERSION
PROCLIB_GIT_VERSION "\n"
#endif
#ifdef LIBCONFIG_GIT_VERSION
LIBCONFIG_GIT_VERSION "\n"
#endif
#ifdef LIMA_GIT_VERSION
LIMA_GIT_VERSION "\n"
#endif
#ifdef TANGO_GIT_VERSION
TANGO_GIT_VERSION "\n"
#endif
#ifdef SPEC_GIT_VERSION
SPEC_GIT_VERSION "\n"
#endif
"\n");
return buffVersion;
}
#endif
//=========================================================================================================
//=========================================================================================================
......
......@@ -1066,9 +1066,17 @@ void Camera::getGeneralCAPS1(std::string &o_sn)
char *ptr = buff;
char *ptrMax = buff + sizeof(buff);
DWORD dwGeneralCaps1 = m_pcoData->stcPcoDescription.dwGeneralCaps1;
DWORD dwGeneralCaps1;
DWORD dwVal;
#ifndef __linux__
dwGeneralCaps1 = m_pcoData->stcPcoDescription.dwGeneralCapsDESC1;
#else
dwGeneralCaps1 = m_pcoData->stcPcoDescription.dwGeneralCaps1;
#endif
int nib[8];
int i, j;
......
......@@ -2419,7 +2419,8 @@ void print_hex_dump_buff(void *ptr_buff, size_t len)
BYTE *ptr = (BYTE *)ptr_buff;
;
printf("dump buff / len: %ld\n", len);
//printf("dump buff / len: %ld\n", len);
printf("dump buff / len: %zd\n", len);
while (len > 0)
{
......
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