This commit is contained in:
Erik Frojdh 2020-02-11 16:01:32 +01:00
parent 4dc14bf9d6
commit 3523de8ba9
12 changed files with 82 additions and 52 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ bin/
*.out *.out
*.toc *.toc
*.o *.o
*.so
.* .*
build build
RELEASE.txt RELEASE.txt

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11) cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage) project(slsDetectorPackage)
set(PROJECT_VERSION 5.0.0) set(PROJECT_VERSION 5.0.0)
include(CheckIPOSupported) include(CheckIPOSupported)
@ -126,7 +126,7 @@ install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
) )
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH "$ORIGIN") set(CMAKE_INSTALL_RPATH $ORIGIN)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) # set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

View File

@ -8,7 +8,7 @@ cmake .. \
-DSLS_USE_RECEIVER=ON \ -DSLS_USE_RECEIVER=ON \
-DSLS_USE_GUI=OFF \ -DSLS_USE_GUI=OFF \
-DSLS_USE_TESTS=ON \ -DSLS_USE_TESTS=ON \
-DSLS_USE_PYTHON=OFF \ -DSLS_USE_PYTHON=ON \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_HDF5=OFF\ -DSLS_USE_HDF5=OFF\

View File

@ -10,5 +10,8 @@
# #Binaries # #Binaries
# cp -r build/bin/sls_detector $PREFIX/lib/. # cp -r build/bin/sls_detector $PREFIX/lib/.
#copy shared lib
cp build/bin/_sls_detector* python/.
cd python cd python
${PYTHON} setup.py install $PYTHON setup.py install

View File

@ -0,0 +1,9 @@
mkdir $PREFIX/lib
mkdir $PREFIX/bin
mkdir $PREFIX/include
cp build/bin/ctbGui $PREFIX/bin/.
cp build/bin/libctbRootLib.so $PREFIX/lib/.

View File

@ -16,7 +16,7 @@ requirements:
- {{ compiler('c') }} - {{ compiler('c') }}
- {{compiler('cxx')}} - {{compiler('cxx')}}
- cmake - cmake
# - qwt 6.* #require qt5 investigate befor activating gui # - qwt 6.* #require qt5 investigate before activating gui
# - qt=4.8.7=7 # - qt=4.8.7=7
- zeromq=4.2.5=hfc679d8_5 - zeromq=4.2.5=hfc679d8_5
- pyzmq - pyzmq
@ -65,10 +65,10 @@ outputs:
- setuptools - setuptools
- sls_detector_lib - sls_detector_lib
- pyzmq - pyzmq
- pybind11 2.4 # - pybind11 2.4
host: host:
- python - python
- pybind11 2.4 # - pybind11 2.4
- pyzmq - pyzmq
- sls_detector_lib - sls_detector_lib
- libstdcxx-ng - libstdcxx-ng
@ -84,13 +84,13 @@ outputs:
imports: imports:
- sls_detector - sls_detector
# requirements: requirements:
# build: build:
# - {{ compiler('c') }} - {{ compiler('c') }}
# - {{compiler('cxx')}} - {{compiler('cxx')}}
# - name: sls_detector_gui # - name: sls_detector_gui
# version: "refactor" # version: "developer"
# script: copy_gui.sh # script: copy_gui.sh
# requirements: # requirements:
# build: # build:
@ -98,7 +98,7 @@ outputs:
# - {{compiler('cxx')}} # - {{compiler('cxx')}}
# - cmake # - cmake
# - qwt 6.* # - qwt 6.*
# - qt=4.8.7=7 # - qt=4.8.*
# - zeromq=4.2.5=hfc679d8_5 # - zeromq=4.2.5=hfc679d8_5
# - pyzmq # - pyzmq
# - xorg-libx11 # - xorg-libx11
@ -117,4 +117,4 @@ outputs:
# run: # run:
# - sls_detector_lib=refactor # - sls_detector_lib=refactor
# - qwt 6.* # - qwt 6.*
# - qt=4.8.7=7 # - qt=4.8.*

View File

@ -71,6 +71,11 @@ target_link_libraries(ctbRootLib PUBLIC
${ROOT_EXE_LINKER_FLAGS} ${ROOT_EXE_LINKER_FLAGS}
) )
set_target_properties(
ctbRootLib PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(ctbGui PUBLIC target_link_libraries(ctbGui PUBLIC
slsDetectorShared slsDetectorShared
slsSupportLib slsSupportLib
@ -80,4 +85,5 @@ target_link_libraries(ctbGui PUBLIC
set_target_properties(ctbGui PROPERTIES set_target_properties(ctbGui PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
) )

@ -1 +1 @@
Subproject commit 80d452484c5409444b0ec19383faa84bb7a4d351 Subproject commit 4f72ef846fe8453596230ac285eeaa0ce3278bb4

View File

@ -1,4 +1,6 @@
# find_package (Python COMPONENTS Interpreter Development)
pybind11_add_module(_sls_detector pybind11_add_module(_sls_detector
src/main.cpp src/main.cpp
src/enums.cpp src/enums.cpp
@ -10,7 +12,7 @@ target_link_libraries(_sls_detector PUBLIC
slsDetectorShared slsDetectorShared
slsReceiverShared slsReceiverShared
slsSupportLib slsSupportLib
zmq ) )

View File

@ -8,7 +8,7 @@ import sys
import setuptools import setuptools
import os import os
__version__ = 'refactor' __version__ = 'developer'
def get_conda_path(): def get_conda_path():
@ -19,43 +19,44 @@ def get_conda_path():
return os.environ['CONDA_PREFIX'] return os.environ['CONDA_PREFIX']
class get_pybind_include(object): # class get_pybind_include(object):
"""Helper class to determine the pybind11 include path # """Helper class to determine the pybind11 include path
The purpose of this class is to postpone importing pybind11 # The purpose of this class is to postpone importing pybind11
until it is actually installed, so that the ``get_include()`` # until it is actually installed, so that the ``get_include()``
method can be invoked. """ # method can be invoked. """
def __init__(self, user=False): # def __init__(self, user=False):
self.user = user # self.user = user
def __str__(self): # def __str__(self):
import pybind11 # import pybind11
return pybind11.get_include(self.user) # return pybind11.get_include(self.user)
ext_modules = [ # ext_modules = [
Extension( # Extension(
'_sls_detector', # '_sls_detector',
['src/main.cpp', # ['src/main.cpp',
'src/enums.cpp', # 'src/enums.cpp',
'src/detector.cpp', # 'src/detector.cpp',
'src/network.cpp'], # 'src/network.cpp'],
include_dirs=[ # include_dirs=[
# Path to pybind11 headers # # Path to pybind11 headers
get_pybind_include(), # # get_pybind_include(),
get_pybind_include(user=True), # # get_pybind_include(user=True),
os.path.join(get_conda_path(), 'include/slsDetectorPackage'), # os.path.join(get_conda_path(), 'include/slsDetectorPackage/libs/pybind11'),
# os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
], # ],
libraries=['SlsDetector', 'SlsReceiver', 'zmq'], # libraries=['SlsDetector', 'SlsReceiver', 'zmq'],
library_dirs=[ # library_dirs=[
os.path.join(get_conda_path(), 'lib'), # os.path.join(get_conda_path(), 'lib'),
os.path.join(get_conda_path(), 'bin'), # os.path.join(get_conda_path(), 'bin'),
], # ],
language='c++' # language='c++'
), # ),
] # ]
# As of Python 3.6, CCompiler has a `has_flag` method. # As of Python 3.6, CCompiler has a `has_flag` method.
@ -112,6 +113,9 @@ class BuildExt(build_ext):
build_ext.build_extensions(self) build_ext.build_extensions(self)
def get_shared_lib():
return [f for f in os.listdir('.') if '_sls_detector' in f]
setup( setup(
name='sls_detector', name='sls_detector',
version=__version__, version=__version__,
@ -121,8 +125,10 @@ setup(
description='Detector API for SLS Detector Group detectors', description='Detector API for SLS Detector Group detectors',
long_description='', long_description='',
packages=find_packages(exclude=['contrib', 'docs', 'tests']), packages=find_packages(exclude=['contrib', 'docs', 'tests']),
ext_modules=ext_modules, # ext_modules=ext_modules,
install_requires=['pybind11>=2.2'], data_files = [('', get_shared_lib())],
cmdclass={'build_ext': BuildExt}, # package_data={'sls_detector': ['../build/bin/_sls_detector.cpython-38-x86_64-linux-gnu.so']},
# install_requires=['pybind11>=2.2'],
# cmdclass={'build_ext': BuildExt},
zip_safe=False, zip_safe=False,
) )

View File

@ -32,7 +32,9 @@ target_link_libraries(slsDetectorShared PUBLIC
slsProjectOptions slsProjectOptions
slsProjectWarnings slsProjectWarnings
slsSupportLib slsSupportLib
${ZeroMQ_LIBRARIES} ${ZeroMQ_LIBRARIES}
pthread
rt
) )
set(PUBLICHEADERS set(PUBLICHEADERS

View File

@ -58,6 +58,7 @@ set_target_properties(slsSupportLib PROPERTIES
target_link_libraries(slsSupportLib target_link_libraries(slsSupportLib
slsProjectOptions slsProjectOptions
slsProjectWarnings slsProjectWarnings
${ZeroMQ_LIBRARIES}
rapidjson) rapidjson)
if (SLS_USE_TESTS) if (SLS_USE_TESTS)