diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cc4b8a7..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}) @@ -12,7 +16,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 +36,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 +92,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) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index c214bcb6..e0421546 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%" ^ @@ -24,8 +18,12 @@ cmake .. -G "NMake Makefiles" ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%SP_DIR%" ^ -DCMAKE_SWIG_OUTDIR="%SP_DIR%" ^ - -DPYTHON_VERSION="%PYTHON_VERSION_NUMERIC%" ^ - -DBUILD_LIBRARY=ON + -DPython_ROOT_DIR="%PREFIX%\bin" ^ + -DBUILD_LIBRARY=OFF ^ + -DBUILD_PYTHON_DOCS=ON ^ + -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..7033d887 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -5,22 +5,21 @@ if [[ "${target_platform}" == osx-* ]]; then CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" 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 \ + -DBoost_USE_STATIC_LIBS=OFF \ + -DPython_ROOT_DIR="${PREFIX}/bin" \ + -DBUILD_PYTHON_DOCS=ON \ + -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 diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index fc5f3d04..2b7b1b1e 100755 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -11,38 +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') }} - - llvm-openmp # [osx] - - libgomp # [linux] - - pkg-config # [not win] + - pkg-config # [not win] - cmake - ninja - - make # [linux] - - doxygen - - swig 4.2.* - - python - - numpy + - make # [not win] host: + - swig <4.3.0 + - doxygen + - llvm-openmp # [osx] + - libgomp # [linux] - boost-cpp - hdf5 - python - - setuptools + - pip - numpy run: - python - - {{ pin_compatible('numpy', max_pin='x.x') }} + - llvm-openmp # [osx] + - libgomp # [linux] - boost-cpp - - hdf5 - tqdm + - numpy - click - click-didyoumean - scikit-image - matplotlib-base + - hdf5 test: imports: @@ -52,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 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)