Commit 60e00ccf authored by Laurent Claustre's avatar Laurent Claustre Committed by Sebastien Petitdemange

Update main CMakeList.txt for naming convention and fixed only compile python if option is enabled

This is a combination of 5 commits.
* Created cmake functions instead of using include()
* Change flag name for camera to LIMACAMERA_<camera>
Should be the last update for CMake:
* fixed missing sip feature declaration and use for WITH_SPS_IMAGE
* move checksipexc.py (set exception scope) to cmake/ directory
* deteled obsolete Makefile files and python scripts
final version of limatools.cmake
parent 13e5262d
This diff is collapsed.
############################################################################
###########################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2017
# 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/>.
# Copyright (C) : 2009-2017
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# 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 "simulator")
set(simu_srcs src/SimulatorFrameBuilder.cpp src/SimulatorCamera.cpp src/SimulatorInterface.cpp
src/SimulatorSyncCtrlObj.cpp src/SimulatorDetInfoCtrlObj.cpp src/SimulatorShutterCtrlObj.cpp)
file(STRINGS "VERSION" simu_ver)
add_library(limasimulator SHARED ${simu_srcs})
add_library(lima${NAME} SHARED ${simu_srcs})
limatools_set_library_soversion(lima${NAME} "VERSION")
target_include_directories(lima${NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories(limasimulator PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories(limasimulator PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../common/include")
target_include_directories(limasimulator PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../hardware/include")
target_link_libraries(limasimulator limacore)
target_link_libraries(lima${NAME} limacore)
if(WIN32)
target_compile_definitions(limasimulator PRIVATE LIBSIMULATOR_EXPORTS)
target_compile_definitions(lima${NAME} PRIVATE LIBSIMULATOR_EXPORTS)
endif()
set_target_properties(limasimulator PROPERTIES VERSION ${simu_ver} SOVERSION "1")
if(WIN32)
set_target_properties(limasimulator PROPERTIES PREFIX "lib")
set_target_properties(lima${NAME} PROPERTIES PREFIX "lib")
endif()
if(WIN32)
install(TARGETS limasimulator
install(TARGETS lima${NAME}
DESTINATION lib)
else()
install(TARGETS limasimulator
install(TARGETS lima${NAME}
LIBRARY DESTINATION lib)
endif()
if (COMPILE_SIP)
set(NAME "simulator")
include(CameraRunSIP)
if (LIMA_ENABLE_PYTHON)
limatools_run_sip_for_camera(${NAME})
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Simulator")
endif()
if(COMPILE_TEST)
add_subdirectory(test/)
if(LIMA_ENABLE_TESTS)
add_subdirectory(test)
endif()
......@@ -22,4 +22,4 @@
set(test_src test_simulator_framebuilder test_simulator_hwbuffersave) #test_simulator_hwinterface (test not finishing)
include(TestCamera)
limatools_run_camera_tests("${test_src}" ${NAME})
This diff is collapsed.
set(INCLUDES)
file(GLOB sipfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/sip" "${CMAKE_CURRENT_SOURCE_DIR}/sip/*.sip")
foreach(sipfile ${sipfiles})
set(INCLUDES
"${INCLUDES}
%Include ${sipfile}")
endforeach()
set(IMPORTS
"${IMPORTS}
%Import limacore.sip")
if(SIP_VERSION_STR VERSION_LESS "4.12")
configure_file(${CMAKE_SOURCE_DIR}/sip/limamodules_before_4_12.sip.in sip/lima${NAME}.sip)
else()
configure_file(${CMAKE_SOURCE_DIR}/sip/limamodules.sip.in sip/lima${NAME}.sip)
endif()
set(SIP_CONCAT_PARTS 1)
set(SIP_INCLUDES ${SIP_INCLUDES}
"${CMAKE_SOURCE_DIR}/third-party/Processlib/sip"
"${CMAKE_BINARY_DIR}/sip/core"
"${CMAKE_SOURCE_DIR}/third-party/Processlib/tasks/sip"
"${CMAKE_SOURCE_DIR}/common/sip"
"${CMAKE_SOURCE_DIR}/hardware/sip"
"${CMAKE_SOURCE_DIR}/control/sip"
"${CMAKE_SOURCE_DIR}/control/software_operation/sip"
"${CMAKE_CURRENT_SOURCE_DIR}/sip")
set(SIP_DISABLE_FEATURES WITH_CONFIG)
set(SIP_CHECK_EXC ON)
ADD_SIP_PYTHON_MODULE(lima${NAME} ${CMAKE_CURRENT_BINARY_DIR}/sip/lima${NAME}.sip)
target_include_directories(python_module_lima${NAME} PRIVATE
${PYTHON_INCLUDE_DIRS}
"${CMAKE_SOURCE_DIR}/sip"
"${CMAKE_SOURCE_DIR}/sip/core"
"${CMAKE_SOURCE_DIR}/third-party/Processlib/sip")
target_link_libraries(python_module_lima${NAME} lima${NAME})
......@@ -31,9 +31,9 @@ if(SIP_VERSION)
set(SIP_FOUND TRUE)
else(SIP_VERSION)
find_file(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH})
set(find_sip_py ${CMAKE_SOURCE_DIR}/cmake/FindSIP.py)
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config)
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${find_sip_py} OUTPUT_VARIABLE sip_config)
if(sip_config)
string(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
string(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
......
......@@ -22,7 +22,63 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
file(STRINGS "VERSION" ${NAME}_vers)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" ${NAME}_sovers "${${NAME}_vers}")
function(limatools_set_library_soversion lib_name version_file)
file(STRINGS ${version_file} version)
# for lib version as 1.2.3 soverion is fixed to 1.2
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" soversion "${version}")
set_target_properties(${lib_name} PROPERTIES VERSION "${version}" SOVERSION "${soversion}")
endfunction()
set_target_properties(lima${NAME} PROPERTIES VERSION "${${NAME}_vers}" SOVERSION "${${NAME}_sovers}")
function(limatools_run_camera_tests test_src cam_name)
foreach(file ${test_src})
add_executable(${file} "${file}.cpp")
target_link_libraries(${file} limacore lima${cam_name})
add_test(NAME ${file} COMMAND ${file})
endforeach(file)
endfunction()
function(limatools_run_sip_for_camera cam_name)
set(INCLUDES)
file(GLOB sipfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/sip" "${CMAKE_CURRENT_SOURCE_DIR}/sip/*.sip")
foreach(sipfile ${sipfiles})
set(INCLUDES
"${INCLUDES}
%Include ${sipfile}")
endforeach()
set(IMPORTS
"${IMPORTS}
%Import limacore.sip")
if(SIP_VERSION_STR VERSION_LESS "4.12")
configure_file(${CMAKE_SOURCE_DIR}/sip/limamodules_before_4_12.sip.in sip/lima${cam_name}.sip)
else()
configure_file(${CMAKE_SOURCE_DIR}/sip/limamodules.sip.in sip/lima${cam_name}.sip)
endif()
set(SIP_CONCAT_PARTS 1)
set(SIP_INCLUDES ${SIP_INCLUDES}
"${CMAKE_SOURCE_DIR}/third-party/Processlib/sip"
"${CMAKE_BINARY_DIR}/sip/core"
"${CMAKE_SOURCE_DIR}/third-party/Processlib/tasks/sip"
"${CMAKE_SOURCE_DIR}/common/sip"
"${CMAKE_SOURCE_DIR}/hardware/sip"
"${CMAKE_SOURCE_DIR}/control/sip"
"${CMAKE_SOURCE_DIR}/control/software_operation/sip"
"${CMAKE_CURRENT_SOURCE_DIR}/sip")
add_sip_python_module(lima${cam_name} ${CMAKE_CURRENT_BINARY_DIR}/sip/lima${cam_name}.sip)
target_include_directories(python_module_lima${cam_name} PRIVATE
${PYTHON_INCLUDE_DIRS}
"${CMAKE_SOURCE_DIR}/sip"
"${CMAKE_SOURCE_DIR}/sip/core"
"${CMAKE_SOURCE_DIR}/third-party/Processlib/sip")
target_link_libraries(python_module_lima${cam_name} lima${cam_name})
endfunction()
......@@ -100,7 +100,7 @@ macro(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${TOUCH_COMMAND} ${_sip_output_files}
COMMAND ${SIP_EXECUTABLE} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${_module_path} ${_sip_includes} ${_abs_module_sip}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/sip/checksipexc.py ${_sip_output_files}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/checksipexc.py ${_sip_output_files}
DEPENDS ${_abs_module_sip} ${SIP_EXTRA_FILES_DEPEND}
)
# not sure if type MODULE could be uses anywhere, limit to cygwin for now
......
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2017
# 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/>.
############################################################################
foreach(file ${test_src})
add_executable(${file} "${file}.cpp")
target_link_libraries(${file} limacore lima${NAME})
add_test(NAME ${file} COMMAND ${file})
endforeach(file)
......@@ -134,8 +134,10 @@ using namespace lima;
CtAcquisition* acquisition();
CtSaving* saving();
%If (WITH_SPS_IMAGE)
%If (POSIX_PLATFORM)
CtSpsImage* display();
%End
%End
CtImage* image();
CtBuffer* buffer();
......
......@@ -19,6 +19,7 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
%If (WITH_SPS_IMAGE)
%If (POSIX_PLATFORM)
class CtSpsImage
{
......@@ -42,3 +43,4 @@ using namespace lima;
bool isActive() const;
};
%End
%End
############################################################################
# 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/>.
############################################################################
include ../config.inc
ifneq ($(COMPILE_CORE), 0)
sip-modules += core
endif
ifneq ($(COMPILE_SIMULATOR), 0)
sip-modules += simulator
endif
ifneq ($(COMPILE_ESPIA), 0)
sip-modules += espia
endif
ifneq ($(COMPILE_FRELON), 0)
sip-modules += frelon
endif
ifneq ($(COMPILE_MAXIPIX), 0)
sip-modules += maxipix
endif
ifneq ($(COMPILE_BASLER), 0)
ifndef PYLON_ROOT
export PYLON_ROOT = /opt/pylon
endif
ifndef GENICAM_ROOT_V2_1
export GENICAM_ROOT_V2_1 = $(PYLON_ROOT)/genicam
endif
sip-modules += basler
endif
ifneq ($(COMPILE_PROSILICA), 0)
sip-modules += prosilica
endif
ifneq ($(COMPILE_ROPERSCIENTIFIC), 0)
sip-modules += roperscientific
endif
ifneq ($(COMPILE_ADSC), 0)
sip-modules += adsc
endif
ifneq ($(COMPILE_MYTHEN), 0)
sip-modules += mythen
endif
ifneq ($(COMPILE_MYTHEN3), 0)
sip-modules += mythen3
endif
ifneq ($(COMPILE_UEYE), 0)
sip-modules += ueye
endif
ifneq ($(COMPILE_ANDOR), 0)
sip-modules += andor
endif
ifneq ($(COMPILE_ANDOR3), 0)
sip-modules += andor3
endif
ifneq ($(COMPILE_XH), 0)
sip-modules += xh
endif
ifneq ($(COMPILE_XSPRESS3), 0)
sip-modules += xspress3
endif
ifneq ($(COMPILE_ULTRA), 0)
sip-modules += ultra
endif
ifneq ($(COMPILE_XPAD), 0)
sip-modules += xpad
endif
ifneq ($(COMPILE_MARCCD), 0)
sip-modules += marccd
endif
ifneq ($(COMPILE_PILATUS), 0)
sip-modules += pilatus
endif
ifneq ($(COMPILE_POINTGREY), 0)
sip-modules += pointgrey
endif
ifneq ($(COMPILE_IMXPAD), 0)
sip-modules += imxpad
endif
ifneq ($(COMPILE_RAYONIXHS), 0)
sip-modules += rayonixhs
endif
ifneq ($(COMPILE_AVIEX), 0)
sip-modules += aviex
endif
ifneq ($(COMPILE_META), 0)
sip-modules += meta
endif
ifneq ($(COMPILE_MERLIN), 0)
sip-modules += merlin
endif
ifneq ($(COMPILE_V4l2), 0)
sip-modules += v4l2
endif
ifneq ($(COMPILE_EIGER), 0)
sip-modules += eiger
endif
ifneq ($(COMPILE_DEXELA), 0)
sip-modules += dexela
endif
ifneq ($(COMPILE_PIXIRAD), 0)
sip-modules += pixirad
endif
ifneq ($(COMPILE_HEXITEC), 0)
sip-modules += hexitec
endif
ifneq ($(COMPILE_SLSDETECTOR), 0)
sip-modules += slsdetector
endif
all: src
src:
$(MAKE) -C ../third-party prelima.sip
for d in $(sip-modules); do \
$(MAKE) -C $$d || break; \
done
$(MAKE) -C ../third-party postlima.sip
config: clean mrproper
python configure.py
clean:
for d in $(sip-modules); do \
$(MAKE) -C $$d clean || break; \
done
mrproper:
python mrproper.py
test:
@true
This diff is collapsed.
......@@ -24,6 +24,7 @@
%Platforms {WIN32_PLATFORM WIN64_PLATFORM POSIX_PLATFORM}
%Feature WITH_CONFIG
%Feature WITH_SPS_IMAGE
%ModuleHeaderCode
#include "lima/SoftOpId.h"
......
......@@ -24,6 +24,7 @@
%Platforms {WIN32_PLATFORM WIN64_PLATFORM POSIX_PLATFORM}
%Feature WITH_CONFIG
%Feature WITH_SPS_IMAGE
%ModuleHeaderCode
#include "lima/SoftOpId.h"
......
import sipconfig
# These are installation specific values created when lima was configured.
# The following line will be replaced when this template is used to create
# the final configuration module.
# @SIP_CONFIGURATION@
class Configuration(sipconfig.Configuration):
"""The class that represents lima configuration values.
"""
def __init__(self, sub_cfg=None):
"""Initialise an instance of the class.
sub_cfg is the list of sub-class configurations. It should be None
when called normally.
"""
# This is all standard code to be copied verbatim except for the
# name of the module containing the super-class.
if sub_cfg:
cfg = sub_cfg
else:
cfg = []
cfg.append(_pkg_config)
sipconfig.Configuration.__init__(self, cfg)
class limaModuleMakefile(sipconfig.ModuleMakefile):
"""The Makefile class for modules that %Import lima.
"""
def finalise(self):
"""Finalise the macros.
"""
# In case a C++ library is needed for link.
# Not necessary here, it's done in the configure.py script
# self.extra_libs.append("lima")
# Let the super-class do what it needs to.
sipconfig.ModuleMakefile.finalise(self)
############################################################################
# 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/>.
############################################################################
#!/usr/bin/env python
import os
import os.path
import glob
import shutil
from configure import modules
f = open('.gitignore')
patterns = [x.strip() for x in f]
rmList = []
for pat in patterns:
if pat.find('*') > -1:
rmList.extend(glob.glob(os.path.join('*',pat)))
rmList.extend(glob.glob(pat))
for filename in rmList :
if os.path.isdir(filename):
print(("exec: rmtree %s" % filename))
shutil.rmtree(filename)
else:
print(("exec: rm %s" % filename))
os.remove(filename)
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