From 20f85e6da4e8e5253c840f4ac6065c0f94c2c6c7 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 12 Nov 2024 18:43:44 +0100 Subject: [PATCH 1/9] Only include simd.cmake if AVX is on --- CMakeLists.txt | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cc4b8a7..cc2e9b13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ ADD_DEFINITIONS(-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") MESSAGE(STATUS "CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'") -INCLUDE(simd) ################################################################################ # BUILD OPTIONS ################################################################################ @@ -33,13 +32,14 @@ IF((NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") OR APPLE) set(WITH_AVX OFF CACHE STRING "Disable AVX when compiling WITH_AVX=OFF." FORCE) ENDIF() IF(WITH_AVX) - IF (MSVC) - # https://devblogs.microsoft.com/cppblog/simd-extension-to-c-openmp-in-visual-studio/ - # /Oi is for intrinsics - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX -openmp:experimental /Oi") - ELSE(MSVC) - STRING(APPEND CMAKE_CXX_FLAGS " -O3 -mavx -mfma") - ENDIF () + INCLUDE(simd) + IF (MSVC) + # https://devblogs.microsoft.com/cppblog/simd-extension-to-c-openmp-in-visual-studio/ + # /Oi is for intrinsics + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Oi") + ELSE(MSVC) + STRING(APPEND CMAKE_CXX_FLAGS " -O3 -mfma") + ENDIF () ENDIF() # Debug build @@ -88,13 +88,8 @@ endif() # INCLUDES AND LIBRARIES ####################################### -# Conda -####################################### -FIND_PACKAGE(Conda) - ## Boost ########################### -FIND_PACKAGE(CondaBoost) IF(Boost_USE_STATIC_LIBS) SET(Boost_USE_STATIC_LIBS ON) ENDIF(Boost_USE_STATIC_LIBS) From f479045bd1552d89bd15c3202ce8d140051cc68f Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Tue, 12 Nov 2024 18:44:51 +0100 Subject: [PATCH 2/9] Use new Boost find mechanism --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc2e9b13..7ad0e21d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,7 @@ +if(POLICY CMP0167) + cmake_policy(SET CMP0167 NEW) +endif() + CMAKE_MINIMUM_REQUIRED(VERSION 3.13) SET(PROJECT_NAME tttrlib) PROJECT(${PROJECT_NAME}) From 8c12459dab7c08deea43b53492767994f746b0bf Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 17:04:39 +0100 Subject: [PATCH 3/9] Disable unneeded build options * Disable build of libraries * AVX code path off by default * Do not static link against boost --- conda-recipe/bld.bat | 5 ++++- conda-recipe/build.sh | 32 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index c214bcb6..6bf04df0 100755 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -25,7 +25,10 @@ cmake .. -G "NMake Makefiles" ^ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ -DPYTHON_VERSION="%PYTHON_VERSION_NUMERIC%" ^ - -DBUILD_LIBRARY=ON + -DBUILD_LIBRARY=OFF ^ + -DWITH_AVX=OFF ^ + -DBoost_USE_STATIC_LIBS=OFF + nmake install :: Add wrappers to path for each Python command line tool diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index d0d2e258..80f5b4e1 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -3,24 +3,24 @@ mkdir b2 && cd b2 if [[ "${target_platform}" == osx-* ]]; then # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" +else + export CONFIG_ARGS="" fi -cmake \ - -DCMAKE_INSTALL_PREFIX="$PREFIX" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DBUILD_PYTHON_INTERFACE=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$SP_DIR" \ - -DCMAKE_SWIG_OUTDIR="$SP_DIR" \ - -DBUILD_LIBRARY=ON \ - -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ - -G Ninja .. +cmake -S .. -B . \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DBUILD_PYTHON_INTERFACE=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_LIBRARY=OFF \ + -DWITH_AVX=OFF \ + -Boost_USE_STATIC_LIBS=OFF \ + -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ + -G Ninja \ + "${CONFIG_ARGS}" -# On some platforms (notably aarch64 with Drone) builds can fail due to -# running out of memory. If this happens, try the build again; if it -# still fails, restrict to one core. -ninja install -k 0 || ninja install -k 0 || ninja install -j 1 +ninja install -j ${CPU_COUNT} # Copy programs to bin -cd $PREFIX/bin -cp $SRC_DIR/bin/* . \ No newline at end of file +chmod 0755 $SRC_DIR/bin/* +cp -f $SRC_DIR/bin/* $PREFIX/bin From 5cff736aea20c52a3ab6e6fba3675356481e1856 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 17:06:16 +0100 Subject: [PATCH 4/9] Remove unneeded packages --- conda-recipe/meta.yaml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index fc5f3d04..29ad0027 100755 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -17,26 +17,19 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} - - llvm-openmp # [osx] - - libgomp # [linux] - - pkg-config # [not win] - cmake - ninja - - make # [linux] - doxygen - - swig 4.2.* - - python - - numpy host: + - swig <4.3.0 - boost-cpp - hdf5 + - pip - python - - setuptools - numpy run: - python - - {{ pin_compatible('numpy', max_pin='x.x') }} - - boost-cpp + - {{ pin_compatible('numpy') }} - hdf5 - tqdm - click From 4fca3a427b198aae6482573004dd7b7e900c612c Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 17:15:46 +0100 Subject: [PATCH 5/9] Fix typo --- conda-recipe/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 80f5b4e1..057e2734 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -14,7 +14,7 @@ cmake -S .. -B . \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_LIBRARY=OFF \ -DWITH_AVX=OFF \ - -Boost_USE_STATIC_LIBS=OFF \ + -DBoost_USE_STATIC_LIBS=OFF \ -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ -G Ninja \ "${CONFIG_ARGS}" From 53edb05d5345de3967109d4206b26714b8a33419 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 20:33:39 +0100 Subject: [PATCH 6/9] Add Python_ROOT_DIR as argument cmake can have issues finding the python distro> add Python_ROOT_DIR parameter --- conda-recipe/bld.bat | 1 + conda-recipe/build.sh | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 6bf04df0..24e71ee1 100755 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -24,6 +24,7 @@ cmake .. -G "NMake Makefiles" ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ + -DPython_ROOT_DIR="%PREFIX%\bin" ^ -DPYTHON_VERSION="%PYTHON_VERSION_NUMERIC%" ^ -DBUILD_LIBRARY=OFF ^ -DWITH_AVX=OFF ^ diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 057e2734..5e76aff7 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -3,8 +3,6 @@ mkdir b2 && cd b2 if [[ "${target_platform}" == osx-* ]]; then # See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" -else - export CONFIG_ARGS="" fi cmake -S .. -B . \ @@ -15,9 +13,10 @@ cmake -S .. -B . \ -DBUILD_LIBRARY=OFF \ -DWITH_AVX=OFF \ -DBoost_USE_STATIC_LIBS=OFF \ + -DPython_ROOT_DIR="${PREFIX}/bin" \ -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ -G Ninja \ - "${CONFIG_ARGS}" + ${CONFIG_ARGS} ninja install -j ${CPU_COUNT} From 7fd397f8d98ae503f66b79234583290df1621e7c Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 21:24:25 +0100 Subject: [PATCH 7/9] Simplify build Set Python_ROOT_DIR to find python. Should not require exact python version anymore. --- conda-recipe/bld.bat | 7 ------- conda-recipe/build.sh | 1 - ext/CMakeLists.txt | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 24e71ee1..b8b75124 100755 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -10,12 +10,6 @@ rmdir b2 /s /q mkdir b2 cd b2 -REM Call Python with the --version flag to get the version information -for /f "tokens=2 delims= " %%v in ('%PYTHON% --version 2^>^&1') do set PYTHON_VERSION=%%v - -REM Extract only the numeric part of the version -for /f "tokens=1-3 delims=." %%a in ("%PYTHON_VERSION%") do set PYTHON_VERSION_NUMERIC=%%a.%%b.%%c - echo Python version: %PYTHON_VERSION_NUMERIC% cmake .. -G "NMake Makefiles" ^ -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ @@ -25,7 +19,6 @@ cmake .. -G "NMake Makefiles" ^ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ -DPython_ROOT_DIR="%PREFIX%\bin" ^ - -DPYTHON_VERSION="%PYTHON_VERSION_NUMERIC%" ^ -DBUILD_LIBRARY=OFF ^ -DWITH_AVX=OFF ^ -DBoost_USE_STATIC_LIBS=OFF diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 5e76aff7..20ceea0d 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -14,7 +14,6 @@ cmake -S .. -B . \ -DWITH_AVX=OFF \ -DBoost_USE_STATIC_LIBS=OFF \ -DPython_ROOT_DIR="${PREFIX}/bin" \ - -DPYTHON_VERSION=$(python -c 'import platform; print(platform.python_version())')\ -G Ninja \ ${CONFIG_ARGS} diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index f588c563..982f41be 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -26,7 +26,7 @@ IF(BUILD_PYTHON_INTERFACE) MESSAGE(STATUS "Python version: '${PYTHON_VERSION}'") cmake_policy(SET CMP0094 NEW) - FIND_PACKAGE(Python ${PYTHON_VERSION} EXACT COMPONENTS Interpreter Development.Module NumPy) + FIND_PACKAGE(Python COMPONENTS Interpreter Development.Module NumPy) INCLUDE_DIRECTORIES(BEFORE ${Python_NumPy_PATH} ${Python_INCLUDE_DIRS}) LINK_LIBRARIES(${Python_LIBRARY} Python::NumPy) From da496227cd55eefb5b8010931bb877d13192f872 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Thu, 14 Nov 2024 21:57:24 +0100 Subject: [PATCH 8/9] Build Python docstrings --- conda-recipe/bld.bat | 1 + conda-recipe/build.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index b8b75124..e0421546 100755 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -20,6 +20,7 @@ cmake .. -G "NMake Makefiles" ^ -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ -DPython_ROOT_DIR="%PREFIX%\bin" ^ -DBUILD_LIBRARY=OFF ^ + -DBUILD_PYTHON_DOCS=ON ^ -DWITH_AVX=OFF ^ -DBoost_USE_STATIC_LIBS=OFF diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 20ceea0d..7033d887 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -14,6 +14,7 @@ cmake -S .. -B . \ -DWITH_AVX=OFF \ -DBoost_USE_STATIC_LIBS=OFF \ -DPython_ROOT_DIR="${PREFIX}/bin" \ + -DBUILD_PYTHON_DOCS=ON \ -G Ninja \ ${CONFIG_ARGS} From b3be20d10426bdb7b34fb007e9fe3319f6f2efb1 Mon Sep 17 00:00:00 2001 From: Thomas-Otavio Peulen Date: Fri, 15 Nov 2024 10:47:55 +0100 Subject: [PATCH 9/9] Include bioconda changes --- conda-recipe/meta.yaml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 29ad0027..2b7b1b1e 100755 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -11,31 +11,39 @@ source: build: number: 1 detect_binary_files_with_prefix: True # [not win] + run_exports: '{{ pin_subpackage("tttrlib", max_pin="x.x") }}' requirements: requirements: build: - {{ compiler('c') }} - {{ compiler('cxx') }} + - pkg-config # [not win] - cmake - ninja - - doxygen + - make # [not win] host: - swig <4.3.0 + - doxygen + - llvm-openmp # [osx] + - libgomp # [linux] - boost-cpp - hdf5 - - pip - python + - pip - numpy run: - python - - {{ pin_compatible('numpy') }} - - hdf5 + - llvm-openmp # [osx] + - libgomp # [linux] + - boost-cpp - tqdm + - numpy - click - click-didyoumean - scikit-image - matplotlib-base + - hdf5 test: imports: @@ -45,11 +53,18 @@ test: about: home: https://github.com/fluorescence-tools/tttrlib + summary: 'A file format agnostic library for time-resolved imaging and spectroscopic data.' + description: | + tttrlib is a simple, fast, libray to read, write and process + time-resolved imaging and spectroscopic data. For speed, it + is written in C++ and wrapped for Python via SWIG. license: BSD-3-Clause - summary: | - {{ data.get('description') }} + license_family: BSD + license_file: LICENSE.txt + doc_url: https://tttrlib.readthedocs.io + dev_url: https://github.com/fluorescence-tools/tttrlib extra: recipe-maintainers: - tpeulen - - khemmen + - khemmen \ No newline at end of file