diff --git a/.gitignore b/.gitignore index 0a79fe941..e627f185f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ bin/ *.out *.toc *.o +*.so .* build RELEASE.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 45649687e..93868fc62 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.12) project(slsDetectorPackage) set(PROJECT_VERSION 5.0.0) include(CheckIPOSupported) @@ -126,7 +126,7 @@ install(TARGETS slsProjectOptions slsProjectWarnings rapidjson ) 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 FALSE) diff --git a/conda-recepie/build.sh b/conda-recepie/build.sh index 5791635b4..931003312 100755 --- a/conda-recepie/build.sh +++ b/conda-recepie/build.sh @@ -8,7 +8,7 @@ cmake .. \ -DSLS_USE_RECEIVER=ON \ -DSLS_USE_GUI=OFF \ -DSLS_USE_TESTS=ON \ - -DSLS_USE_PYTHON=OFF \ + -DSLS_USE_PYTHON=ON \ -DCMAKE_BUILD_TYPE=Release \ -DSLS_USE_HDF5=OFF\ diff --git a/conda-recepie/build_pylib.sh b/conda-recepie/build_pylib.sh index 0a423dbef..2a76776ee 100755 --- a/conda-recepie/build_pylib.sh +++ b/conda-recepie/build_pylib.sh @@ -10,5 +10,8 @@ # #Binaries # cp -r build/bin/sls_detector $PREFIX/lib/. +#copy shared lib +cp build/bin/_sls_detector* python/. + cd python -${PYTHON} setup.py install \ No newline at end of file +$PYTHON setup.py install \ No newline at end of file diff --git a/conda-recepie/copy_ctbgui.sh b/conda-recepie/copy_ctbgui.sh new file mode 100644 index 000000000..91ebc1a6d --- /dev/null +++ b/conda-recepie/copy_ctbgui.sh @@ -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/. + diff --git a/conda-recepie/meta.yaml b/conda-recepie/meta.yaml index a5189b4d8..e91c9eef1 100755 --- a/conda-recepie/meta.yaml +++ b/conda-recepie/meta.yaml @@ -16,7 +16,7 @@ requirements: - {{ compiler('c') }} - {{compiler('cxx')}} - cmake - # - qwt 6.* #require qt5 investigate befor activating gui + # - qwt 6.* #require qt5 investigate before activating gui # - qt=4.8.7=7 - zeromq=4.2.5=hfc679d8_5 - pyzmq @@ -65,10 +65,10 @@ outputs: - setuptools - sls_detector_lib - pyzmq - - pybind11 2.4 + # - pybind11 2.4 host: - python - - pybind11 2.4 + # - pybind11 2.4 - pyzmq - sls_detector_lib - libstdcxx-ng @@ -84,13 +84,13 @@ outputs: imports: - sls_detector - # requirements: - # build: - # - {{ compiler('c') }} - # - {{compiler('cxx')}} + requirements: + build: + - {{ compiler('c') }} + - {{compiler('cxx')}} # - name: sls_detector_gui - # version: "refactor" + # version: "developer" # script: copy_gui.sh # requirements: # build: @@ -98,7 +98,7 @@ outputs: # - {{compiler('cxx')}} # - cmake # - qwt 6.* - # - qt=4.8.7=7 + # - qt=4.8.* # - zeromq=4.2.5=hfc679d8_5 # - pyzmq # - xorg-libx11 @@ -117,4 +117,4 @@ outputs: # run: # - sls_detector_lib=refactor # - qwt 6.* - # - qt=4.8.7=7 + # - qt=4.8.* diff --git a/ctbGui/CMakeLists.txt b/ctbGui/CMakeLists.txt index 79cc58177..1d2e43f56 100644 --- a/ctbGui/CMakeLists.txt +++ b/ctbGui/CMakeLists.txt @@ -71,6 +71,11 @@ target_link_libraries(ctbRootLib PUBLIC ${ROOT_EXE_LINKER_FLAGS} ) +set_target_properties( + ctbRootLib PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + target_link_libraries(ctbGui PUBLIC slsDetectorShared slsSupportLib @@ -80,4 +85,5 @@ target_link_libraries(ctbGui PUBLIC set_target_properties(ctbGui PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + ) \ No newline at end of file diff --git a/libs/pybind11 b/libs/pybind11 index 80d452484..4f72ef846 160000 --- a/libs/pybind11 +++ b/libs/pybind11 @@ -1 +1 @@ -Subproject commit 80d452484c5409444b0ec19383faa84bb7a4d351 +Subproject commit 4f72ef846fe8453596230ac285eeaa0ce3278bb4 diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index df3dd5637..203ed90b7 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,6 @@ +# find_package (Python COMPONENTS Interpreter Development) + pybind11_add_module(_sls_detector src/main.cpp src/enums.cpp @@ -10,7 +12,7 @@ target_link_libraries(_sls_detector PUBLIC slsDetectorShared slsReceiverShared slsSupportLib - zmq ) + ) diff --git a/python/setup.py b/python/setup.py index e09b4b59f..6961ca835 100755 --- a/python/setup.py +++ b/python/setup.py @@ -8,7 +8,7 @@ import sys import setuptools import os -__version__ = 'refactor' +__version__ = 'developer' def get_conda_path(): @@ -19,43 +19,44 @@ def get_conda_path(): return os.environ['CONDA_PREFIX'] -class get_pybind_include(object): - """Helper class to determine the pybind11 include path - The purpose of this class is to postpone importing pybind11 - until it is actually installed, so that the ``get_include()`` - method can be invoked. """ +# class get_pybind_include(object): +# """Helper class to determine the pybind11 include path +# The purpose of this class is to postpone importing pybind11 +# until it is actually installed, so that the ``get_include()`` +# method can be invoked. """ - def __init__(self, user=False): - self.user = user +# def __init__(self, user=False): +# self.user = user - def __str__(self): - import pybind11 - return pybind11.get_include(self.user) +# def __str__(self): +# import pybind11 +# return pybind11.get_include(self.user) -ext_modules = [ - Extension( - '_sls_detector', - ['src/main.cpp', - 'src/enums.cpp', - 'src/detector.cpp', - 'src/network.cpp'], - include_dirs=[ - # Path to pybind11 headers - get_pybind_include(), - get_pybind_include(user=True), - os.path.join(get_conda_path(), 'include/slsDetectorPackage'), +# ext_modules = [ +# Extension( +# '_sls_detector', +# ['src/main.cpp', +# 'src/enums.cpp', +# 'src/detector.cpp', +# 'src/network.cpp'], +# include_dirs=[ +# # Path to pybind11 headers +# # get_pybind_include(), +# # get_pybind_include(user=True), +# os.path.join(get_conda_path(), 'include/slsDetectorPackage/libs/pybind11'), +# os.path.join(get_conda_path(), 'include/slsDetectorPackage'), - ], - libraries=['SlsDetector', 'SlsReceiver', 'zmq'], - library_dirs=[ - os.path.join(get_conda_path(), 'lib'), - os.path.join(get_conda_path(), 'bin'), - ], +# ], +# libraries=['SlsDetector', 'SlsReceiver', 'zmq'], +# library_dirs=[ +# os.path.join(get_conda_path(), 'lib'), +# os.path.join(get_conda_path(), 'bin'), +# ], - language='c++' - ), -] +# language='c++' +# ), +# ] # As of Python 3.6, CCompiler has a `has_flag` method. @@ -112,6 +113,9 @@ class BuildExt(build_ext): build_ext.build_extensions(self) +def get_shared_lib(): + return [f for f in os.listdir('.') if '_sls_detector' in f] + setup( name='sls_detector', version=__version__, @@ -121,8 +125,10 @@ setup( description='Detector API for SLS Detector Group detectors', long_description='', packages=find_packages(exclude=['contrib', 'docs', 'tests']), - ext_modules=ext_modules, - install_requires=['pybind11>=2.2'], - cmdclass={'build_ext': BuildExt}, + # ext_modules=ext_modules, + data_files = [('', get_shared_lib())], + # 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, ) diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt index 9e125e845..a5183ef79 100755 --- a/slsDetectorSoftware/CMakeLists.txt +++ b/slsDetectorSoftware/CMakeLists.txt @@ -32,7 +32,9 @@ target_link_libraries(slsDetectorShared PUBLIC slsProjectOptions slsProjectWarnings slsSupportLib - ${ZeroMQ_LIBRARIES} + ${ZeroMQ_LIBRARIES} + pthread + rt ) set(PUBLICHEADERS diff --git a/slsSupportLib/CMakeLists.txt b/slsSupportLib/CMakeLists.txt index ae6d73ce4..a068f786d 100755 --- a/slsSupportLib/CMakeLists.txt +++ b/slsSupportLib/CMakeLists.txt @@ -58,6 +58,7 @@ set_target_properties(slsSupportLib PROPERTIES target_link_libraries(slsSupportLib slsProjectOptions slsProjectWarnings + ${ZeroMQ_LIBRARIES} rapidjson) if (SLS_USE_TESTS)