mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 18:40:01 +02:00
Merge pull request #1164 from slsdetectorgroup/dev/scikitbuild
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 10s
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 10s
Dev/scikitbuild
This commit is contained in:
commit
884e17f0c4
@ -1,4 +1,4 @@
|
||||
name: CMake
|
||||
name: Native CMake Build
|
||||
|
||||
on: [push, pull_request]
|
||||
|
42
.github/workflows/conda_library.yaml
vendored
Normal file
42
.github/workflows/conda_library.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: Build slsdetlib
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, ] # macos-12, windows-2019]
|
||||
python-version: ["3.12",]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
# The setup-miniconda action needs this to activate miniconda
|
||||
defaults:
|
||||
run:
|
||||
shell: "bash -l {0}"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get conda
|
||||
uses: conda-incubator/setup-miniconda@v3.0.4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
channels: conda-forge
|
||||
|
||||
- name: Prepare
|
||||
run: conda install conda-build conda-verify pytest anaconda-client
|
||||
|
||||
- name: Disable upload
|
||||
run: conda config --set anaconda_upload no
|
||||
|
||||
- name: Build
|
||||
run: conda build conda-recipes/main-library --output-folder build_output
|
||||
|
||||
- name: Upload all Conda packages
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: conda-packages
|
||||
path: build_output/** # Uploads all packages
|
42
.github/workflows/conda_python.yaml
vendored
Normal file
42
.github/workflows/conda_python.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: slsdet
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, ] # macos-12, windows-2019]
|
||||
python-version: ["3.12",]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
# The setup-miniconda action needs this to activate miniconda
|
||||
defaults:
|
||||
run:
|
||||
shell: "bash -l {0}"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get conda
|
||||
uses: conda-incubator/setup-miniconda@v3.0.4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
channels: conda-forge
|
||||
|
||||
- name: Prepare
|
||||
run: conda install conda-build conda-verify pytest anaconda-client
|
||||
|
||||
- name: Disable upload
|
||||
run: conda config --set anaconda_upload no
|
||||
|
||||
- name: Build
|
||||
run: conda build conda-recipes/python-client --output-folder build_output
|
||||
|
||||
- name: Upload all Conda packages
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: conda-packages
|
||||
path: build_output/** # Uploads all packages
|
@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(slsDetectorPackage)
|
||||
|
||||
# Read VERSION file into project version
|
||||
@ -29,20 +29,40 @@ include(FetchContent)
|
||||
option(SLS_FETCH_ZMQ_FROM_GITHUB "Fetch zmq from github" OFF)
|
||||
option(SLS_FETCH_PYBIND11_FROM_GITHUB "Fetch pybind11 from github" OFF)
|
||||
|
||||
|
||||
|
||||
# Allow FetchContent_Populate to be called with a single argument
|
||||
# otherwise deprecated warning is issued
|
||||
# Note: From cmake 3.28 we can pass EXCLUDE_FROM_ALL to FetchContent_Declare
|
||||
# and avoid direct use of Populate
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.30")
|
||||
cmake_policy(SET CMP0169 OLD)
|
||||
endif()
|
||||
|
||||
# Patch libzmq to set minimum cmake version to 3.15 to avoid warnings
|
||||
# with newer cmake versions
|
||||
# Patch is applied in the FetchContent_Declare
|
||||
set(SLS_LIBZMQ_VERSION "4.3.4")
|
||||
|
||||
|
||||
if(SLS_FETCH_ZMQ_FROM_GITHUB)
|
||||
# Opt in to pull down a zmq version from github instead of
|
||||
# using the bundled verison
|
||||
# using the bundled version
|
||||
FetchContent_Declare(
|
||||
libzmq
|
||||
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
|
||||
GIT_TAG v4.3.4
|
||||
GIT_TAG v${SLS_LIBZMQ_VERSION}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
|
||||
UPDATE_DISCONNECTED 1
|
||||
)
|
||||
else()
|
||||
# Standard behaviour use libzmq included in this repo (libs/libzmq)
|
||||
FetchContent_Declare(
|
||||
libzmq
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-4.3.4.tar.gz
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-${SLS_LIBZMQ_VERSION}.tar.gz
|
||||
URL_HASH MD5=cc20b769ac10afa352e5ed2769bb23b3
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
|
||||
UPDATE_DISCONNECTED 1
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -54,6 +74,11 @@ set(ENABLE_CPACK OFF CACHE BOOL "")
|
||||
set(ENABLE_CLANG OFF CACHE BOOL "")
|
||||
set(ENABLE_CURVE OFF CACHE BOOL "")
|
||||
set(ENABLE_DRAFTS OFF CACHE BOOL "")
|
||||
set(ENABLE_PRECOMPILED OFF CACHE BOOL "")
|
||||
set(WITH_DOC OFF CACHE BOOL "")
|
||||
set(WITH_DOCS OFF CACHE BOOL "")
|
||||
|
||||
|
||||
|
||||
# Using GetProperties and Populate to be able to exclude zmq
|
||||
# from install (not possible with FetchContent_MakeAvailable(libzmq))
|
||||
@ -191,7 +216,7 @@ endif()
|
||||
# to control options for the libraries
|
||||
if(NOT TARGET slsProjectOptions)
|
||||
add_library(slsProjectOptions INTERFACE)
|
||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET slsProjectWarnings)
|
||||
@ -329,9 +354,15 @@ if (SLS_USE_CTBGUI)
|
||||
add_subdirectory(pyctbgui)
|
||||
endif(SLS_USE_CTBGUI)
|
||||
|
||||
configure_file( .clang-tidy
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy
|
||||
)
|
||||
# Workaround for file note being copied to build directory
|
||||
# when issuing a python -m build
|
||||
# TODO! Proper fix
|
||||
if(EXISTS ".clang-tidy")
|
||||
configure_file(.clang-tidy
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if (SLS_BUILD_EXAMPLES)
|
||||
add_subdirectory(sample)
|
||||
|
@ -1,11 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
echo "|<-------- starting python build"
|
||||
|
||||
cd python
|
||||
|
||||
# copy VERSION into slsdet for installation
|
||||
cp ../VERSION slsdet/VERSION
|
||||
|
||||
${PYTHON} setup.py install
|
@ -1,8 +0,0 @@
|
||||
python:
|
||||
- 3.8
|
||||
- 3.9
|
||||
- 3.10
|
||||
- 3.11
|
||||
- 3.12
|
||||
- 3.13
|
||||
|
@ -1,11 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
mkdir $PREFIX/lib
|
||||
mkdir $PREFIX/bin
|
||||
mkdir $PREFIX/include
|
||||
|
||||
|
||||
|
||||
cp build/bin/ctbGui $PREFIX/bin/.
|
||||
cp build/bin/libctbRootLib.so $PREFIX/lib/.
|
||||
|
@ -1,125 +0,0 @@
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||
|
||||
|
||||
source:
|
||||
path: ..
|
||||
|
||||
build:
|
||||
number: 0
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- cmake
|
||||
- qt 5.*
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
- xorg-libsm
|
||||
- xorg-libxau
|
||||
- xorg-libxrender
|
||||
- xorg-libxfixes
|
||||
- {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||
- {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||
- {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||
- {{ cdt('libselinux') }} # [linux]
|
||||
- {{ cdt('libxdamage') }} # [linux]
|
||||
- {{ cdt('libxxf86vm') }} # [linux]
|
||||
- expat
|
||||
|
||||
host:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
- xorg-libsm
|
||||
- xorg-libxau
|
||||
- xorg-libxrender
|
||||
- xorg-libxfixes
|
||||
- expat
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
|
||||
outputs:
|
||||
- name: slsdetlib
|
||||
script: copy_lib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
- name: slsdet
|
||||
script: build_pylib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- setuptools
|
||||
- pybind11=2.13
|
||||
|
||||
host:
|
||||
- python
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- setuptools
|
||||
- pybind11=2.13
|
||||
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- python
|
||||
- numpy
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
test:
|
||||
imports:
|
||||
- slsdet
|
||||
|
||||
|
||||
- name: slsdetgui
|
||||
script: copy_gui.sh
|
||||
requirements:
|
||||
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- qt 5.*
|
||||
- expat
|
||||
|
||||
- name: moenchzmq
|
||||
script: copy_moench.sh
|
||||
requirements:
|
||||
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- expat
|
@ -1,3 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
ctest -j2
|
@ -8,7 +8,7 @@ if [ ! -d "install" ]; then
|
||||
mkdir install
|
||||
fi
|
||||
cd build
|
||||
cmake .. \
|
||||
cmake .. -G Ninja \
|
||||
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
|
||||
-DCMAKE_INSTALL_PREFIX=install \
|
||||
-DSLS_USE_TEXTCLIENT=ON \
|
||||
@ -18,7 +18,7 @@ cmake .. \
|
||||
-DSLS_USE_TESTS=ON \
|
||||
-DSLS_USE_PYTHON=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DSLS_USE_HDF5=OFF\
|
||||
-DSLS_USE_HDF5=OFF \
|
||||
|
||||
NCORES=$(getconf _NPROCESSORS_ONLN)
|
||||
echo "Building using: ${NCORES} cores"
|
13
conda-recipes/main-library/conda_build_config.yaml
Normal file
13
conda-recipes/main-library/conda_build_config.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
c_compiler:
|
||||
- gcc # [linux]
|
||||
|
||||
c_stdlib:
|
||||
- sysroot # [linux]
|
||||
|
||||
cxx_compiler:
|
||||
- gxx # [linux]
|
||||
|
||||
|
||||
c_stdlib_version: # [linux]
|
||||
- 2.17 # [linux]
|
@ -4,7 +4,6 @@
|
||||
mkdir -p $PREFIX/lib
|
||||
mkdir -p $PREFIX/bin
|
||||
mkdir -p $PREFIX/include/sls
|
||||
# mkdir $PREFIX/include/slsDetectorPackage
|
||||
|
||||
#Shared and static libraries
|
||||
cp build/install/lib/* $PREFIX/lib/
|
||||
@ -15,8 +14,10 @@ cp build/install/bin/sls_detector_acquire_zmq $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_get $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_put $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector_help $PREFIX/bin/.
|
||||
cp build/install/bin/sls_detector $PREFIX/bin/.
|
||||
cp build/install/bin/slsReceiver $PREFIX/bin/.
|
||||
cp build/install/bin/slsMultiReceiver $PREFIX/bin/.
|
||||
cp build/install/bin/slsFrameSynchronizer $PREFIX/bin/.
|
||||
|
||||
|
||||
cp build/install/include/sls/* $PREFIX/include/sls
|
79
conda-recipes/main-library/meta.yaml
Executable file
79
conda-recipes/main-library/meta.yaml
Executable file
@ -0,0 +1,79 @@
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: 2025.3.19
|
||||
|
||||
|
||||
source:
|
||||
path: ../..
|
||||
|
||||
build:
|
||||
number: 0
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{ stdlib("c") }}
|
||||
- {{ compiler('cxx') }}
|
||||
- git
|
||||
- cmake
|
||||
- ninja
|
||||
- qt 5.*
|
||||
|
||||
host:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- libgl-devel # [linux]
|
||||
- libtiff
|
||||
- zlib
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
|
||||
outputs:
|
||||
- name: slsdetlib
|
||||
script: copy_lib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{ stdlib("c") }}
|
||||
- {{ compiler('cxx') }}
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
||||
|
||||
|
||||
|
||||
- name: slsdetgui
|
||||
script: copy_gui.sh
|
||||
requirements:
|
||||
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- qt 5.*
|
||||
|
||||
|
||||
- name: moenchzmq
|
||||
script: copy_moench.sh
|
||||
requirements:
|
||||
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
16
conda-recipes/python-client/conda_build_config.yaml
Normal file
16
conda-recipes/python-client/conda_build_config.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
python:
|
||||
- 3.11
|
||||
- 3.12
|
||||
- 3.13
|
||||
|
||||
c_compiler:
|
||||
- gcc # [linux]
|
||||
|
||||
c_stdlib:
|
||||
- sysroot # [linux]
|
||||
|
||||
cxx_compiler:
|
||||
- gxx # [linux]
|
||||
|
||||
c_stdlib_version: # [linux]
|
||||
- 2.17 # [linux]
|
45
conda-recipes/python-client/meta.yaml
Normal file
45
conda-recipes/python-client/meta.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
package:
|
||||
name: slsdet
|
||||
version: 2025.3.19 #TODO! how to not duplicate this?
|
||||
|
||||
source:
|
||||
path: ../..
|
||||
|
||||
build:
|
||||
number: 0
|
||||
script:
|
||||
- unset CMAKE_GENERATOR && {{ PYTHON }} -m pip install . -vv # [not win]
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python {{python}}
|
||||
- {{ compiler('c') }}
|
||||
- {{ stdlib("c") }}
|
||||
- {{ compiler('cxx') }}
|
||||
|
||||
|
||||
host:
|
||||
- cmake
|
||||
- ninja
|
||||
- python {{python}}
|
||||
- pip
|
||||
- scikit-build-core
|
||||
- pybind11 >=2.13.0
|
||||
- fmt
|
||||
- zeromq
|
||||
- nlohmann_json
|
||||
- catch2
|
||||
|
||||
run:
|
||||
- python {{python}}
|
||||
- numpy
|
||||
|
||||
|
||||
test:
|
||||
imports:
|
||||
- slsdet
|
||||
|
||||
|
||||
about:
|
||||
summary: An example project built with pybind11 and scikit-build.
|
||||
# license_file: LICENSE
|
18
libs/libzmq/libzmq_cmake_version.patch
Normal file
18
libs/libzmq/libzmq_cmake_version.patch
Normal file
@ -0,0 +1,18 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index dd3d8eb9..c0187747 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,11 +1,8 @@
|
||||
# CMake build script for ZeroMQ
|
||||
project(ZeroMQ)
|
||||
|
||||
-if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
||||
- cmake_minimum_required(VERSION 3.0.2)
|
||||
-else()
|
||||
- cmake_minimum_required(VERSION 2.8.12)
|
||||
-endif()
|
||||
+cmake_minimum_required(VERSION 3.15)
|
||||
+message(STATUS "Patched cmake version")
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckCCompilerFlag)
|
27
pyproject.toml
Normal file
27
pyproject.toml
Normal file
@ -0,0 +1,27 @@
|
||||
[build-system]
|
||||
requires = ["scikit-build-core>=0.10", "pybind11", "numpy"]
|
||||
build-backend = "scikit_build_core.build"
|
||||
|
||||
[project]
|
||||
name = "slsdet"
|
||||
version = "2025.3.19"
|
||||
|
||||
|
||||
[tool.cibuildwheel]
|
||||
before-all = "uname -a"
|
||||
|
||||
[tool.scikit-build]
|
||||
build.verbose = true
|
||||
cmake.build-type = "Release"
|
||||
install.components = ["python"]
|
||||
|
||||
|
||||
[tool.scikit-build.cmake.define]
|
||||
#Only build the control software and python ext
|
||||
SLS_USE_RECEIVER = "OFF"
|
||||
SLS_USE_RECEIVER_BINARIES = "OFF"
|
||||
SLS_USE_TEXTCLIENT = "OFF"
|
||||
SLS_BUILD_SHARED_LIBRARIES = "OFF"
|
||||
|
||||
SLS_USE_PYTHON = "ON"
|
||||
SLS_INSTALL_PYTHONEXT = "ON"
|
@ -20,7 +20,7 @@ target_link_libraries(_slsdet PUBLIC
|
||||
|
||||
|
||||
set_target_properties(_slsdet PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/slsdet
|
||||
)
|
||||
|
||||
#Copy Python code
|
||||
@ -72,9 +72,18 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION
|
||||
if(SLS_INSTALL_PYTHONEXT)
|
||||
install(TARGETS _slsdet
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/python
|
||||
LIBRARY DESTINATION slsdet
|
||||
COMPONENT python
|
||||
)
|
||||
install(
|
||||
FILES ${PYTHON_FILES}
|
||||
DESTINATION slsdet
|
||||
COMPONENT python
|
||||
)
|
||||
install(
|
||||
FILES ../VERSION
|
||||
DESTINATION slsdet
|
||||
COMPONENT python
|
||||
)
|
||||
|
||||
install(FILES ${PYTHON_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/python/slsdet)
|
||||
install(FILES ../VERSION DESTINATION ${CMAKE_INSTALL_PREFIX}/python/slsdet)
|
||||
endif()
|
@ -1,77 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
"""
|
||||
Setup file for slsdet
|
||||
Build upon the pybind11 example found here: https://github.com/pybind/python_example
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from setuptools import setup, find_packages
|
||||
from pybind11.setup_helpers import Pybind11Extension, build_ext
|
||||
|
||||
def read_version():
|
||||
try:
|
||||
version_file = os.path.join(os.path.dirname(__file__), 'slsdet', 'VERSION')
|
||||
with open(version_file, "r") as f:
|
||||
return f.read().strip()
|
||||
except:
|
||||
raise RuntimeError("VERSION file not found in slsdet package from setup.py.")
|
||||
|
||||
__version__ = read_version()
|
||||
|
||||
|
||||
def get_conda_path():
|
||||
"""
|
||||
Keep this a function if we need some fancier logic later
|
||||
"""
|
||||
print('Prefix: ', os.environ['CONDA_PREFIX'])
|
||||
return os.environ['CONDA_PREFIX']
|
||||
|
||||
|
||||
#TODO migrate to CMake build or fetch files from cmake?
|
||||
ext_modules = [
|
||||
Pybind11Extension(
|
||||
'_slsdet',
|
||||
['src/main.cpp',
|
||||
'src/enums.cpp',
|
||||
'src/current.cpp',
|
||||
'src/detector.cpp',
|
||||
'src/network.cpp',
|
||||
'src/pattern.cpp',
|
||||
'src/scan.cpp',
|
||||
'src/duration.cpp',
|
||||
'src/DurationWrapper.cpp',
|
||||
'src/pedestal.cpp',
|
||||
]
|
||||
|
||||
|
||||
,
|
||||
include_dirs=[
|
||||
os.path.join(get_conda_path(), 'include'),
|
||||
|
||||
],
|
||||
libraries=['SlsDetector', 'SlsSupport', 'SlsReceiver'],
|
||||
library_dirs=[
|
||||
os.path.join(get_conda_path(), 'lib'),
|
||||
],
|
||||
language='c++'
|
||||
),
|
||||
]
|
||||
|
||||
setup(
|
||||
name='slsdet',
|
||||
version=__version__,
|
||||
author='Erik Frojdh',
|
||||
author_email='erik.frojdh@psi.ch',
|
||||
url='https://github.com/slsdetectorgroup/slsDetectorPackage',
|
||||
description='Detector API for SLS Detector Group detectors',
|
||||
long_description='',
|
||||
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
||||
package_data={
|
||||
'slsdet': ['VERSION'],
|
||||
},
|
||||
ext_modules=ext_modules,
|
||||
cmdclass={"build_ext": build_ext},
|
||||
zip_safe=False,
|
||||
)
|
@ -14,7 +14,7 @@ from .pattern import Pattern, patternParameters
|
||||
from .gaincaps import Mythen3GainCapsWrapper
|
||||
from .PatternGenerator import PatternGenerator
|
||||
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
xy = _slsdet.xy
|
||||
defs = _slsdet.slsDetectorDefs
|
||||
|
||||
|
@ -4,7 +4,7 @@ from .detector import Detector, freeze
|
||||
from .utils import element_if_equal
|
||||
from .dacs import DetectorDacs, NamedDacs
|
||||
from .powers import DetectorPowers, NamedPowers
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
from .detector_property import DetectorProperty
|
||||
from functools import partial
|
||||
import numpy as np
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
from .detector import freeze
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
class Dac(DetectorProperty):
|
||||
|
@ -1,8 +1,8 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
from _slsdet import CppDetectorApi
|
||||
from _slsdet import slsDetectorDefs
|
||||
from _slsdet import IpAddr, MacAddr
|
||||
from ._slsdet import CppDetectorApi
|
||||
from ._slsdet import slsDetectorDefs
|
||||
from ._slsdet import IpAddr, MacAddr
|
||||
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
timingMode = slsDetectorDefs.timingMode
|
||||
@ -15,7 +15,7 @@ defs = slsDetectorDefs
|
||||
|
||||
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||
from .utils import Geometry, to_geo, element, reduce_time, is_iterable, hostname_list
|
||||
from _slsdet import xy
|
||||
from ._slsdet import xy
|
||||
from .gaincaps import Mythen3GainCapsWrapper
|
||||
from . import utils as ut
|
||||
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
||||
|
@ -11,7 +11,7 @@ Created on Wed Dec 6 11:51:18 2017
|
||||
from .detector import Detector
|
||||
from .temperature import Temperature, DetectorTemperature
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
|
@ -15,8 +15,8 @@ if dt === detectorType.EIGER:
|
||||
"""
|
||||
|
||||
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
for name, cls in _slsdet.slsDetectorDefs.__dict__.items():
|
||||
if isinstance(cls, type):
|
||||
exec(f'{name} = {cls.__module__}.{cls.__qualname__}')
|
||||
exec(f'{name} = _slsdet.{cls.__qualname__}')
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
gc = _slsdet.slsDetectorDefs.M3_GainCaps
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@ from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
|
@ -11,7 +11,7 @@ from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
|
@ -9,7 +9,7 @@ This file contains the specialization for the Moench detector
|
||||
|
||||
from .detector import Detector, freeze
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
|
@ -11,7 +11,7 @@ from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
gc_enums = _slsdet.slsDetectorDefs.M3_GainCaps
|
||||
from .detector_property import DetectorProperty
|
||||
|
@ -1,8 +1,8 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
|
||||
from _slsdet import Pattern
|
||||
from ._slsdet import Pattern
|
||||
|
||||
|
||||
class patternParameters(_slsdet.patternParameters):
|
||||
|
@ -3,7 +3,7 @@
|
||||
from .detector_property import DetectorProperty
|
||||
from functools import partial
|
||||
import numpy as np
|
||||
import _slsdet
|
||||
from . import _slsdet
|
||||
from .detector import freeze
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
class Power(DetectorProperty):
|
||||
|
@ -3,7 +3,7 @@
|
||||
from .utils import element_if_equal
|
||||
from .enums import dacIndex
|
||||
from .defines import M3_MAX_PATTERN_LEVELS, MAX_PATTERN_LEVELS
|
||||
from _slsdet import slsDetectorDefs
|
||||
from ._slsdet import slsDetectorDefs
|
||||
detectorType = slsDetectorDefs.detectorType
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ but not directly used in controlling the detector
|
||||
"""
|
||||
|
||||
from collections import namedtuple
|
||||
import _slsdet #C++ lib
|
||||
from . import _slsdet #C++ lib
|
||||
import functools
|
||||
import datetime as dt
|
||||
import pathlib
|
||||
|
Loading…
x
Reference in New Issue
Block a user