Skip to content

Commit

Permalink
Merge pull request #20 from Fluorescence-Tools/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tpeulen authored Jun 22, 2020
2 parents 564754d + 3757f97 commit 5c46141
Show file tree
Hide file tree
Showing 150 changed files with 11,274 additions and 2,021 deletions.
9 changes: 5 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
##################################################
# Build conda package
- git submodule update --init --recursive
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda create -n build python=3.7 git conda-build anaconda-client numpy conda-verify ripgrep
Expand All @@ -37,10 +38,10 @@ test_script:
- nosetests
- cd ..

#### scripts to run after tests
#deploy_script:
# - if not "%APPVEYOR_REPO_BRANCH%" == "master" exit 0
# - anaconda upload C:\Miniconda3-x64\envs\build\conda-bld\win-64\tttrlib-*.tar.bz2
# scripts to run after tests
deploy_script:
- if "%APPVEYOR_REPO_BRANCH%" == "master" exit 0
- anaconda -t %ANACONDA_API_TOKEN% upload -u %CONDA_USER% -l nightly C:\Miniconda3-x64\envs\build\conda-bld\win-64\tttrlib-*.tar.bz2 --force

build: off

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ playground
temp
*.egg-info
docs/_build
test/stage

# Documentation and tools
doc/_*
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "thirdparty/CRoaringUnityBuild"]
path = thirdparty/CRoaringUnityBuild
url = https://github.com/lemire/CRoaringUnityBuild
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ matrix:
include:
- os: linux
dist: bionic
addons:
apt:
packages:
- doxygen
- os: osx
osx_image: xcode9.4
addons:
homebrew:
packages:
- doxygen
- libomp
update: true

# The Sphinx C++ docs are build with doxygen and breathe
addons:
Expand All @@ -16,6 +26,7 @@ addons:
homebrew:
packages:
- doxygen
update: true

env:
# Build and test package on all supported python versions
Expand Down Expand Up @@ -47,7 +58,7 @@ script:
- ln -sf $(which nosetests) $(pwd)/test/
- cd $(pwd)/test/
- echo $PWD
- nosetests --with-coverage test_*.py
- nosetests --nocapture --with-coverage test_*.py
- cd ..

after_success:
Expand Down
83 changes: 67 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,84 +11,135 @@ OPTION(BUILD_R_INTERFACE "Build R interface" OFF)

SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")

## Optimize compiler flags
############################
#INCLUDE(CMakeHostSystemInformationExtra)
#INCLUDE(GetCPUSIMDFeatures)
#INCLUDE(CMakeCompilerMachineOption)
#SET(TARGET_ARCHITECTURE skylake)
#CMAKE_COMPILER_MACHINE_OPTION(ARCHITECTURE_FLAG ${TARGET_ARCHITECTURE})
#MESSAGE(STATUS "Use compiler option: ${ARCHITECTURE_FLAG}")
#ADD_COMPILE_OPTIONS(${ARCHITECTURE_FLAG})


# Debug build detection
###########################
IF(CMAKE_BUILD_TYPE STREQUAL "Release")
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
MESSAGE("Release build")
ADD_DEFINITIONS("-DVERBOSE=0")
ELSE(CMAKE_BUILD_TYPE STREQUAL "Debug")
ELSE (CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE("Debug build")
ADD_DEFINITIONS("-DVERBOSE=1")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF (CMAKE_BUILD_TYPE STREQUAL "Release")

# Windows
if(MSVC)
##############
if (MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
add_definitions(-DMS_WIN64)
endif(MSVC)
ADD_DEFINITIONS(-DMS_WIN64)
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
endif (MSVC)

# MACOSX
##############
FIND_PACKAGE(Threads)
if(APPLE)
if (APPLE)
# explicit link to libc++ for recent osx versions
MESSAGE(STATUS "Explicitly link to libc++ on modern osx versions")
ADD_DEFINITIONS(-stdlib=libc++)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
# Don't set MACOSX_RPATH by default
set(CMAKE_MACOSX_RPATH 0)
endif(APPLE)
endif (APPLE)

### CRoaring
###############
#INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/thirdparty/CRoaringUnityBuild)

## FFTW
##############
FIND_PACKAGE(FFTW REQUIRED)
LINK_LIBRARIES(${FFTW_LIBRARIES})
INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIRS})

# Does not work on Windows and conda mkl
# maybe the pytorch people will resolve this issue in the future.
### Intel MKL
###############
#find_package(MKL REQUIRED)
#if (MKL_FOUND)
# INCLUDE_DIRECTORIES(${MKL_INCLUDE_DIRS})
# LINK_LIBRARIES(${MKL_CORE_LIBRARY})
#else ()
# message(WARNING "MKL libs not found")
#endif ()

## Boost
if(WIN32)
###########################
if (WIN32)
# use static Boost in Windows
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC ON)
set(Boost_USE_MULTITHREAD)
endif(WIN32)
endif (WIN32)
FIND_PACKAGE(Boost 1.36 REQUIRED COMPONENTS date_time filesystem iostreams)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_LIBRARIES(${Boost_LIBRARIES})
MESSAGE(${Boost_INCLUDE_DIRS})

## HDF5
###########################
FIND_PACKAGE(HDF5 1.10 REQUIRED COMPONENTS C)
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
LINK_LIBRARIES(${HDF5_LIBRARIES})
ADD_DEFINITIONS(-DH5_BUILT_AS_DYNAMIC_LIB)

## OpenMP
# FIND_PACKAGE(OpenMP REQUIRED)
###########################
if (APPLE)
# dirty hack to make OpenMP work see:
# https://gitlab.kitware.com/cmake/cmake/issues/18098
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_CXX_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
endif ()
FIND_PACKAGE(OpenMP REQUIRED)
LINK_LIBRARIES(OpenMP::OpenMP_CXX)

# Doxygen
IF(BUILD_DOC)
###########################
IF (BUILD_DOC)
FIND_PACKAGE(Doxygen REQUIRED)
IF (DOXYGEN_FOUND)
ELSE (DOXYGEN_FOUND)
MESSAGE("Doxygen need to be installed to generate the doxygen documentation")
ENDIF (DOXYGEN_FOUND)
ENDIF()
ENDIF ()

FILE(
GLOB
SRC_files
"../src/*.cpp"
"../src/correlation/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/correlation/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lbfgs/*.cpp"
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
ADD_SUBDIRECTORY(ext)

# Add install target
##############
INSTALL(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
PUBLIC_HEADER DESTINATION include)
PUBLIC_HEADER DESTINATION include
)

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ Scilab and R. Currently, tttrlib is wrapped for the use in Python.

![tttrlib FLIM][3]

tttrlib is NOT intended as ready-to-use software for specific application
purposes.
tttrlib is a library that facilitates the interaction with TTTR data that can be
used to develop data analysis pipelines e.g. for single-molecule and image
spectroscopy. tttrlib is not intended as end-user software for specific application
purposes.

## Supported file formats
### PicoQuant (PQ)
Expand Down
28 changes: 28 additions & 0 deletions cmake/CMakeCompilerMachineOption.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
CMakeCompilerMachineOption
--------------------------
Get march flags for target Intel micro architecture
.. command:: cmake_compiler_machine_option
cmake_compiler_machine_option(<output variable>
[TARGET_ARCHITECTURE <target architecture>]
[FEATURES <feature> ...])
#]=======================================================================]

include("${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerMachineOption/X64CompilerOptions.cmake")

function(CMAKE_COMPILER_MACHINE_OPTION outvar tarch)
set(compiler_options)
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(x86|AMD64)")
x64_compiler_options(compiler_options ${tarch})
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(ARM|aarch64)")
arm_compiler_options(compiler_options ${tarch})
endif()
set(${outvar} ${compiler_options} PARENT_SCOPE)
endfunction()
121 changes: 121 additions & 0 deletions cmake/CMakeCompilerMachineOption/ArmCompilerOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
GetArmMarchCompilerOptions
--------------------------
Get march flags for target Intel micro architecture
.. command:: arm_compiler_options
arm_compiler_options(<output variable> <target SoC name>)
#]=======================================================================]

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckIncludeFileCXX)
include(CheckIncludeFile)

function(ARM_COMPILER_OPTIONS outvar tarch)
set(ARCHITECTURE_FLAGS)

if(tarch STREQUAL "none")
message(WARNING "Unsupported target architecture. No flag is added.")
else()
# -mfpu= VFP NEON
#--------------------------------
# vfpv3 VFPv3 -
# neon VFPv3 Y
# vfpv3-d16 VFPv3 -
# vfpv3-fp16 VFPv3 -
# neon-fp16 VFPv3 Y
# vfpv3xd VFPv3 -
# vfpv3xd-fp16 VFPv3 -
# vfpv4 VFPv4 -
# vfpv4-d16 VFPv4 -
# neon-vfpv4 VFPv4 Y
# fpv4-sp-d16 VFPv4 -
# fp-armv8 AA64 -
# neon-fp-armv8 AA64 Y
# crypto-neon-fp-armv8 AA64 Y
#
# on gcc armv7A neon, -funsafe-math-optimizations is necessary.
#
# Tegra2 ARMv7 A9
# Tegra3 ARMv7 A9
# Tegra4 ARMv7 A15
# TegraK1-T124 ARMv7 A15
# TegraK1-T132 ARMv8 Denver
# TegraX1-T210 ARMv8 A53+A57
# TegraX1-T186 ARMv8 Denver2+A57
# Xavier-T194 ARMv8 custom-carnel
#
# XScale
# https://en.wikipedia.org/wiki/XScale
# PXA25x Cotulla ARMv5TE
# PXA26x Dalhart ARMv5TE
# PXA27x Bulverde Wireless-MMX ARMv5TE
# PXA3xx Monahans ARMv5TE
# PXA90x
# PXA16x
#
# PXA930 Sheeva
# PXA935 Sheeva
# PXA940 Cortex-A8
# PXA986/988 Cortex-A9
# PXA1088 Cortex-A7
#
set(ARMv7-core-list Cortex-A8 Cortex-A9 Cortex-A12 Cortex-A15 Cortex-A7 )
set(ARMv8A-core-list Denver Dever2 ThunderX Kyro Kyro2 M1 M2 M3)
set(ARMv8.0A-core-list Cortex-A32 Cortex-A35 Cortex-A53 Cortex-A55 Cortex-A57 Cortex-A72 Cortex-A73 Hurricane )
set(ARMv8.1A-core-list ThunderX2 Falkor)
set(ARMv8.2A-core-list Cortex-A75 Cortex-A76 Monsoon Kyro3)
set(ARMv8.3A-core-list Vortex )

if(MSVC)
# TODO implement me
elseif(CMAKE_CXX_COMPILER MATCHES "/(icpc|icc)$") # ICC (on Linux)
# TODO implement me
else() # not MSVC and not ICC => GCC, Clang, Open64
set(soc-core-map
Tegra2 Cortex-A9 Tegra3 Cortex-A9 Tegra4 Cortex-A15
PXA25x ARMv5TE PXA26x ARMv5TE PXA27x ARMv5TE
PXA3xx ARMv5TE PXA940 Cortex-A8 PXA986 Cortex-A9
PXA988 Cortex-A9 PXA1088 Cortex-A7
)
set(core-mfpu-map
ARMv5TE ""
Cortex-A8 neon-vfpv3
Cortex-A9 "neon,vfpv3-d16"
Cortex-A5 "neon-vfpv4,vfpv4-d16"
Cortex-A15 neon-vfpv4
Cortex-A7 neon-vfpv4
Cortex-A53 neon-fp-armv8
Cortex-A57 neon-fp-armv8
)
list(FIND soc-core-map ${tarch} _res)
if(_res GREATER -1)
math(EXPR _index "${_res} + 1")
list(GET soc-core-map ${_index} _ARMCORE)
list(FIND core-mfpu-map ${_ARMCORE} _res)
if(_res GREATER -1)
math(EXPR _index "${_res} + 1")
list(GET soc-mfpu-map ${_index} _flags)
if(_flags)
string(REPLACE "," ";" _flag_list "${_flags}")
foreach(flag IN ITEMS ${_flag_list})
__check_compiler_flag("-m${_flag}" test_${_flag})
if(test_${_flag})
list(APPEND ARCHITECTURE_FLAGS "-m${_flag}")
break()
endif()
endforeach()
endif()
endif()
endif()
endif()
endif()
set(${outvar} "${ARCHITECTURE_FLAGS}" PARENT_SCOPE)
endfunction()
Loading

0 comments on commit 5c46141

Please sign in to comment.