start to add cmake support for dks6 branch.
This commit is contained in:
parent
a7edb9d232
commit
78de97f498
344
CMakeLists.txt
Normal file
344
CMakeLists.txt
Normal file
@ -0,0 +1,344 @@
|
||||
# - musrfit --- DKS -----------------------------------------------------------
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
project(musrfit VERSION 1.3.0 LANGUAGES C CXX)
|
||||
|
||||
#--- musrfit specific options -------------------------------------------------
|
||||
option(dks "build musrfit with DKS (GPU/MIC) support" ON)
|
||||
option(nexus "build optional NeXus support. Needed for ISIS" OFF)
|
||||
option(ASlibs "build optional ASlibs" OFF)
|
||||
option(BMWlibs "build optional BMWlibs" OFF)
|
||||
option(BNMRlibs "build optional beta-NMR libs" OFF)
|
||||
option(qt_based_tools "try to install Qt based tools (musredit, musrWiz, musrStep, mupp)" ON)
|
||||
option(try_OpenMP "try to use OpenMP if available" ON)
|
||||
# define qt_version with possible values 'auto' or version '3', '4', '5'
|
||||
set(qt_version AUTO CACHE STRING "provide a specific Qt version to be used.")
|
||||
set_property(CACHE qt_version PROPERTY STRINGS AUTO 3 4 5)
|
||||
|
||||
#--- perform some checks and generate the config.h ----------------------------
|
||||
include(CheckTypeSize)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
check_include_files(alloca.h HAVE_ALLOCA_H)
|
||||
check_include_files("sys/ipc.h;sys/shm.h" HAVE_SHMGET)
|
||||
check_function_exists(fork HAVE_FORK)
|
||||
check_include_files(dlfcn.h HAVE_DLFCN_H)
|
||||
check_function_exists(erf HAVE_ERF)
|
||||
check_function_exists(getloadavg HAVE_GETLOADAVG)
|
||||
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_files(memory.h HAVE_MEMORY_H)
|
||||
check_function_exists(powl HAVE_POWL)
|
||||
check_include_files(memory.h HAVE_MEMORY_H)
|
||||
check_include_files(stdint.h HAVE_STDINT_H)
|
||||
check_include_files(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_files(string.h HAVE_STRING_H)
|
||||
check_include_files(strings.h HAVE_STRINGS_H)
|
||||
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_files(sys/unistd.h HAVE_UNISTD_H)
|
||||
check_type_size("long double" LONG_DOUBLE)
|
||||
check_type_size("double" DOUBLE)
|
||||
if (${LONG_DOUBLE} GREATER ${DOUBLE})
|
||||
set(HAVE_LONG_DOUBLE 1)
|
||||
set(HAVE_LONG_DOUBLE_WIDER 1)
|
||||
endif (${LONG_DOUBLE} GREATER ${DOUBLE})
|
||||
|
||||
#--- check for all the needed packages ----------------------------------------
|
||||
|
||||
#--- add path to my own find modules and other stuff
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
#--- check for git ------------------------------------------------------------
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
#--- check for ROOT -----------------------------------------------------------
|
||||
find_package(ROOT 6.06 REQUIRED COMPONENTS Gui MathMore Minuit2 XMLParser)
|
||||
if (ROOT_mathmore_FOUND)
|
||||
execute_process(COMMAND root-config --bindir OUTPUT_VARIABLE ROOT_BINDIR)
|
||||
string(STRIP ${ROOT_BINDIR} ROOT_BINDIR)
|
||||
execute_process(COMMAND root-config --version OUTPUT_VARIABLE ROOT_VERSION)
|
||||
string(STRIP ${ROOT_VERSION} ROOT_VERSION)
|
||||
message("-- Found ROOT: ${ROOT_BINDIR} (found version: ${ROOT_VERSION})")
|
||||
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
|
||||
include(${ROOT_USE_FILE})
|
||||
endif (ROOT_mathmore_FOUND)
|
||||
|
||||
#--- check for boost ----------------------------------------------------------
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
#--- check for gsl ------------------------------------------------------------
|
||||
find_package(GSL REQUIRED)
|
||||
|
||||
#--- check for fftw3 ----------------------------------------------------------
|
||||
find_package(FFTW3 REQUIRED)
|
||||
if (FFTW3_THREAD_FOUND)
|
||||
set(HAVE_LIBFFTW3_THREADS 1 CACHE INTERNAL "fftw3_threads are available")
|
||||
endif (FFTW3_THREAD_FOUND)
|
||||
if (FFTW3F_THREAD_FOUND)
|
||||
set(HAVE_LIBFFTW3F_THREADS 1 CACHE INTERNAL "fftw3f_threads are available")
|
||||
endif (FFTW3F_THREAD_FOUND)
|
||||
|
||||
#--- check for libxml2 --------------------------------------------------------
|
||||
find_package(LibXml2 REQUIRED)
|
||||
|
||||
#--- check for OpenMP ---------------------------------------------------------
|
||||
if (try_OpenMP AND NOT APPLE)
|
||||
find_package(OpenMP)
|
||||
if (OpenMP_FOUND)
|
||||
add_definitions(-DHAVE_GOMP)
|
||||
set(HAVE_GOMP 1 CACHE INTERNAL "Have GOMP")
|
||||
endif (OpenMP_FOUND)
|
||||
endif (try_OpenMP AND NOT APPLE)
|
||||
|
||||
#--- check for CUDA and/or OpenCL followed by DKS -----------------------------
|
||||
if (dks)
|
||||
find_package(CUDA)
|
||||
if (CUDA_FOUND)
|
||||
message (STATUS "CUDA include: ${CUDA_INCLUDE_DIRS}")
|
||||
message (STATUS "CUDA libs: ${CUDA_TOOLKIT_ROOT_DIR}/lib64")
|
||||
message (STATUS "CUDA version: ${CUDA_VERSION}")
|
||||
endif (CUDA_FOUND)
|
||||
|
||||
if (NOT CUDA_FOUND)
|
||||
message(STATUS "CUDA not found, looking for OpenCL")
|
||||
find_package(OpenCL)
|
||||
if (OpenCL_FOUND)
|
||||
message(STATUS "OpenCL version : ${OpenCL_VERSION_STRING}")
|
||||
message(STATUS "OpenCL include dir: ${OpenCL_INCLUDE_DIR}")
|
||||
message(STATUS "OpenCL library dir: ${OpenCL_LIBRARY}")
|
||||
endif (OpenCL_FOUND)
|
||||
endif (NOT CUDA_FOUND)
|
||||
|
||||
if (NOT CUDA_FOUND AND NOT OpenCL_FOUND)
|
||||
message(WARNING ">> Neither CUDA nor OpenCL found which are required for DKS, hence disable DKS support <<")
|
||||
else (NOT CUDA_FOUND AND NOT OpenCL_FOUND)
|
||||
find_package(DKS)
|
||||
endif (NOT CUDA_FOUND AND NOT OpenCL_FOUND)
|
||||
endif (dks)
|
||||
|
||||
#--- check for Qt -------------------------------------------------------------
|
||||
if (qt_based_tools)
|
||||
# check for any Qt, i.e. AUTO
|
||||
if (qt_version STREQUAL AUTO)
|
||||
# first try Qt5
|
||||
# Find the QtCore library
|
||||
find_package(Qt5Core)
|
||||
if (Qt5Core_FOUND)
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5Widgets CONFIG REQUIRED)
|
||||
# Find the QtXml library
|
||||
find_package(Qt5Xml CONFIG REQUIRED)
|
||||
# Find the QtNetwork library
|
||||
find_package(Qt5Network CONFIG REQUIRED)
|
||||
# Find the QtSvg library
|
||||
find_package(Qt5Svg CONFIG REQUIRED)
|
||||
# Fing the QtPrintSupport
|
||||
find_package(Qt5PrintSupport CONFIG REQUIRED)
|
||||
endif (Qt5Core_FOUND)
|
||||
|
||||
# if Qt5 is not found, try Qt4
|
||||
if (NOT Qt5Core_FOUND)
|
||||
find_package(Qt4 COMPONENTS QtGui QtWebKit QtXml)
|
||||
endif (NOT Qt5Core_FOUND)
|
||||
|
||||
# if Qt5 and Qt4 is not found try Qt3. Hopefully you never reach this point
|
||||
if (NOT Qt5Core_FOUND)
|
||||
if (NOT Qt4_FOUND)
|
||||
find_package(Qt3)
|
||||
endif (NOT Qt4_FOUND)
|
||||
endif (NOT Qt5Core_FOUND)
|
||||
endif (qt_version STREQUAL AUTO)
|
||||
|
||||
# check specifically for Qt5
|
||||
if (qt_version STREQUAL 5)
|
||||
# Find the QtCore library
|
||||
find_package(Qt5Core)
|
||||
if (Qt5Core_FOUND)
|
||||
# Find the QtWidgets library
|
||||
find_package(Qt5Widgets CONFIG REQUIRED)
|
||||
# Find the QtXml library
|
||||
find_package(Qt5Xml CONFIG REQUIRED)
|
||||
# Find the QtNetwork library
|
||||
find_package(Qt5Network CONFIG REQUIRED)
|
||||
# Find the QtSvg library
|
||||
find_package(Qt5Svg CONFIG REQUIRED)
|
||||
# Fing the QtPrintSupport
|
||||
find_package(Qt5PrintSupport CONFIG REQUIRED)
|
||||
else (Qt5Core_FOUND)
|
||||
message(FATAL_ERROR "Couldn't find the specifically requested Qt5 version.")
|
||||
endif (Qt5Core_FOUND)
|
||||
endif (qt_version STREQUAL 5)
|
||||
|
||||
# check specifically for Qt4
|
||||
if (qt_version STREQUAL 4)
|
||||
find_package(Qt4 COMPONENTS QtGui QtWebKit QtXml)
|
||||
if (NOT Qt4_FOUND)
|
||||
message(FATAL_ERROR "Couldn't find the specifically requested Qt4 version.")
|
||||
endif (NOT Qt4_FOUND)
|
||||
endif (qt_version STREQUAL 4)
|
||||
|
||||
# check specifically for Qt3
|
||||
if (qt_version STREQUAL 3)
|
||||
find_package(Qt3)
|
||||
if (NOT QT_FOUND)
|
||||
message(FATAL_ERROR "Couldn't find the specifically requested Qt3 version.")
|
||||
endif (NOT QT_FOUND)
|
||||
endif (qt_version STREQUAL 3)
|
||||
endif (qt_based_tools)
|
||||
|
||||
#--- if NeXus check also for HDF4, HDF5, and MXML -----------------------------
|
||||
if (nexus)
|
||||
find_package(HDF5 COMPONENTS CXX REQUIRED )
|
||||
#//as35 - STILL NEEDED?? -> find_package(HDF4 REQUIRED)
|
||||
find_package(MXML REQUIRED)
|
||||
find_package(NeXus REQUIRED)
|
||||
add_definitions(-DPNEXUS_ENABLED)
|
||||
endif (nexus)
|
||||
|
||||
#--- check for Cuba lib if BMWlibs are enabled --------------------------------
|
||||
#//as35 probably always stick to the internal one ...
|
||||
|
||||
#--- all checks done -> feed config.h -----------------------------------------
|
||||
set(HAVE_CONFIG_H 1 CACHE INTERNAL "config.h is available")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
#--- propagate to the sub-directories -----------------------------------------
|
||||
## as35 add_subdirectory(src)
|
||||
|
||||
#--- write summary of the installation
|
||||
message("")
|
||||
message("|-----------------------------------------------------------------------|")
|
||||
message("| |")
|
||||
message("| Summary |")
|
||||
message("| |")
|
||||
message("|-----------------------------------------------------------------------|")
|
||||
message("")
|
||||
message(" System:")
|
||||
message(" -------")
|
||||
message("")
|
||||
message(" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} - ${CMAKE_HOST_SYSTEM_VERSION}")
|
||||
message("")
|
||||
message(" Requirements:")
|
||||
message(" -------------")
|
||||
message("")
|
||||
message(" FFTW3 found in ${FFTW3_INCLUDE_DIR}")
|
||||
message(" GSL found in ${GSL_INCLUDE_DIRS} (Version: ${GSL_VERSION})")
|
||||
message(" BOOST found in ${Boost_INCLUDE_DIRS}")
|
||||
message(" LibXML2 found in ${LIBXML2_INCLUDE_DIR}")
|
||||
message(" ROOT found in ${ROOT_INCLUDE_DIRS} (Version: ${ROOT_VERSION})")
|
||||
if (OpenMP_FOUND)
|
||||
if (OpenMP_CXX_VERSION)
|
||||
message(" OpenMP found (version ${OpenMP_CXX_VERSION})")
|
||||
else (OpenMP_CXX_VERSION)
|
||||
message(" OpenMP found")
|
||||
endif (OpenMP_CXX_VERSION)
|
||||
endif (OpenMP_FOUND)
|
||||
message("")
|
||||
|
||||
if (CUDA_FOUND)
|
||||
message(" CUDA found in ${CUDA_INCLUDE_DIRECTORIES} (Version: ${CUDA_VERSION})")
|
||||
endif (CUDA_FOUND)
|
||||
if (OpenCL_FOUND)
|
||||
message(" OpenCL found in ${OpenCL_INCLUDE_DIR} (Version: ${OpenCL_VERSION_STRING})")
|
||||
endif (OpenCL_FOUND)
|
||||
if (DKS_FOUND)
|
||||
message(" DKS found in ${DKS_INCLUDE_DIR} (Version: ${DKS_VERSION})")
|
||||
endif (DKS_FOUND)
|
||||
|
||||
if (NOT CUDA_FOUND AND NOT OpenCL_FOUND AND NOT DKS_FOUND)
|
||||
message(" **WARNING** configured without DKS support! DKS, CUDA, OpenCL not found?")
|
||||
endif (NOT CUDA_FOUND AND NOT OpenCL_FOUND AND NOT DKS_FOUND)
|
||||
|
||||
|
||||
if (nexus)
|
||||
message("")
|
||||
#//as35 message(" HDF4 found in ${HDF4_INCLUDE_DIRS}")
|
||||
message(" HDF5 found in ${HDF5_INCLUDE_DIRS}")
|
||||
message(" NeXus found in ${NEXUS_INCLUDE_DIR}")
|
||||
endif (nexus)
|
||||
|
||||
message("")
|
||||
if (qt_based_tools)
|
||||
if (Qt5Core_FOUND)
|
||||
message(" Qt found in ${Qt5Core_INCLUDE_DIRS} (Version: ${Qt5Core_VERSION})")
|
||||
else (Qt5Core_FOUND)
|
||||
if (Qt4_FOUND)
|
||||
message(" Qt found (Version: ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})")
|
||||
else (Qt4_FOUND)
|
||||
if (QT_FOUND)
|
||||
message(" Qt found (Version: ${QT_VERSION})")
|
||||
endif (QT_FOUND)
|
||||
endif (Qt4_FOUND)
|
||||
endif (Qt5Core_FOUND)
|
||||
endif (qt_based_tools)
|
||||
message("")
|
||||
message(" Features:")
|
||||
message(" ---------")
|
||||
message("")
|
||||
message(" Supported muSR file formates:")
|
||||
message(" MusrRoot : yes")
|
||||
message(" ROOT (LEM) : yes")
|
||||
message(" MUD (triumf) : yes")
|
||||
message(" PSI-BIN : yes")
|
||||
message(" PSI-MDU : yes")
|
||||
message(" WKM (deprecated) : yes")
|
||||
if (nexus)
|
||||
message(" NeXus : yes")
|
||||
else (nexus)
|
||||
message(" NeXus : no")
|
||||
endif (nexus)
|
||||
|
||||
message("")
|
||||
message(" External user-function libraries:")
|
||||
if (ASlibs)
|
||||
message(" ASlibs : yes")
|
||||
else (ASlibs)
|
||||
message(" ASlibs : no")
|
||||
endif (ASlibs)
|
||||
if (BMWlibs)
|
||||
message(" BMWlibs : yes")
|
||||
else (BMWlibs)
|
||||
message(" BMWlibs : no")
|
||||
endif (BMWlibs)
|
||||
if (BNMRlibs)
|
||||
message(" BNMRlibs : yes")
|
||||
else (BNMRlibs)
|
||||
message(" BNMRlibs : no")
|
||||
endif (BNMRlibs)
|
||||
|
||||
if (qt_based_tools)
|
||||
if (Qt5Core_FOUND)
|
||||
message("")
|
||||
message(" Qt5 based tools:")
|
||||
message(" musredit, musrStep, musrWiz, mupp : yes")
|
||||
endif (Qt5Core_FOUND)
|
||||
if (Qt4_FOUND)
|
||||
message("")
|
||||
message(" Qt4 based tools (deprecated):")
|
||||
message(" musredit : yes")
|
||||
endif (Qt4_FOUND)
|
||||
if (QT_FOUND)
|
||||
message("")
|
||||
message(" Qt3 based tools (outdated):")
|
||||
message(" musrgui : yes")
|
||||
endif (QT_FOUND)
|
||||
if (NOT Qt5Core_FOUND AND NOT Qt4_FOUND AND NOT QT_FOUND)
|
||||
message("")
|
||||
message(" NO Qt based tools will be installed since Qt is not found or not installed on the system")
|
||||
endif (NOT Qt5Core_FOUND AND NOT Qt4_FOUND AND NOT QT_FOUND)
|
||||
else (qt_based_tools)
|
||||
message("")
|
||||
message(" Qt based tools (musredit, musrStep, musrWiz, mupp) have been disabled")
|
||||
endif (qt_based_tools)
|
||||
message("")
|
||||
message(" Installation directories:")
|
||||
message(" -------------------------")
|
||||
message("")
|
||||
message(" Programs : ${CMAKE_INSTALL_PREFIX}/bin")
|
||||
message(" XML configuration files : " $ENV{HOME} "/.musrfit")
|
||||
message(" Documentation : ${CMAKE_INSTALL_PREFIX}/share/doc/musrfit")
|
||||
message("")
|
||||
message("-------------------------------------------------------------------------")
|
||||
message("")
|
||||
|
||||
#--- end ----------------------------------------------------------------------
|
45
cmake/FindDKS.cmake
Normal file
45
cmake/FindDKS.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
#--- FindDKS ------------------------------------------------------------------
|
||||
#
|
||||
# This module defines:
|
||||
# DKS_INCLUDE_DIR, where to find DKSBaseMuSR.h
|
||||
# DKS_LIBRARY, shared library to be linked against if using DKS
|
||||
#
|
||||
# **as35** since I currently also maintaing the DKS library, it should add
|
||||
# a DKSConfig.cmake which eventually will make this module obsolate. This
|
||||
# means this module is only a kick starter.
|
||||
|
||||
find_path(DKS_INCLUDE_DIR DKSBaseMuSR.h
|
||||
HINTS "/usr/include" "/opt/local/include" "$ENV{HOME}/Apps/DKS/exec/include"
|
||||
)
|
||||
|
||||
# find position of DKSBaseMuSR.h from the end
|
||||
string(FIND "${DKS_INCLUDE_DIR}" "/DKSBaseMuSR.h" pos REVERSE)
|
||||
# truncate the string
|
||||
string(SUBSTRING "${DKS_INCLUDE_DIR}" 0 ${pos} substr)
|
||||
set(DKS_INCLUDE_DIR ${substr})
|
||||
unset(substr)
|
||||
|
||||
find_library(DKS_LIBRARY dksshared
|
||||
HINTS "/usr/lib" "/usr/lib64" "/opt/local/lib" "$ENV{HOME}/Apps/DKS/exec/lib"
|
||||
)
|
||||
|
||||
# as35 set here the DKS version explicitly. This is VERY ugly and should be fixed
|
||||
# asap by using a package
|
||||
set(DKS_VERSION "1.1.3")
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set DKS_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
find_package_handle_standard_args(DKS
|
||||
REQUIRED_VARS DKS_LIBRARY DKS_INCLUDE_DIR
|
||||
VERSION_VAR DKS_VERSION)
|
||||
|
||||
if (NOT DKS_FOUND)
|
||||
unset(DKS_LIBRARY)
|
||||
endif (NOT DKS_FOUND)
|
||||
|
||||
mark_as_advanced(
|
||||
DKS_INCLUDE_DIR
|
||||
DKS_LIBRARY
|
||||
)
|
||||
|
151
cmake/FindFFTW3.cmake
Normal file
151
cmake/FindFFTW3.cmake
Normal file
@ -0,0 +1,151 @@
|
||||
# - Find fftw3 library
|
||||
# Find the native FFTW3 includes and library
|
||||
# This module defines
|
||||
# FFTW3_INCLUDE_DIR, where to find fftw3.h, etc.
|
||||
# ---
|
||||
# FFTW3_LIBRARY, library to link against to use FFTW3
|
||||
# FFTW3_OMP_LIBRARY, library to link against to use FFTW3_omp
|
||||
# FFTW3_THREADS_LIBRARY, library to link against to use FFTW3_threads
|
||||
# FFTW3_FOUND, if false, do not try to use FFTW3.
|
||||
# FFTW3_OMP_FOUND, if false, do not try to use OpenMP FFTW3.
|
||||
# FFTW3_THREADS_FOUND, if false, do not try to use threaded FFTW3.
|
||||
# ---
|
||||
# FFTW3L_LIBRARY, library to link against to use FFTW3l
|
||||
# FFTW3L_OMP_LIBRARY, library to link against to use FFTW3l_omp
|
||||
# FFTW3L_THREADS_LIBRARY, library to link against to use FFTW3l_threads
|
||||
# FFTW3L_FOUND, if false, do not try to use FFTW3l.
|
||||
# FFTW3L_OMP_FOUND, if false, do not try to use OpenMP FFTW3l.
|
||||
# FFTW3L_THREADS_FOUND, if false, do not try to use threaded FFTW3l.
|
||||
# ---
|
||||
# FFTW3F_LIBRARY, library to link against to use FFTW3f
|
||||
# FFTW3F_OMP_LIBRARY, library to link against to use FFTW3f_omp
|
||||
# FFTW3F_THREADS_LIBRARY, library to link against to use FFTW3f_threads
|
||||
# FFTW3F_FOUND, if false, do not try to use FFTW3f.
|
||||
# FFTW3F_OMP_FOUND, if false, do not try to use OpenMP FFTW3f.
|
||||
# FFTW3F_THREADS_FOUND, if false, do not try to use threaded FFTW3f.
|
||||
# ---
|
||||
# FFTW3Q_LIBRARY, library to link against to use FFTW3q
|
||||
# FFTW3Q_OMP_LIBRARY, library to link against to use FFTW3q_omp
|
||||
# FFTW3Q_THREADS_LIBRARY, library to link against to use FFTW3q_threads
|
||||
# FFTW3Q_FOUND, if false, do not try to use FFTW3q.
|
||||
# FFTW3Q_OMP_FOUND, if false, do not try to use OpenMP FFTW3q.
|
||||
# FFTW3Q_THREADS_FOUND, if false, do not try to use threaded FFTW3q.
|
||||
|
||||
find_path(FFTW3_INCLUDE_DIR fftw3.h
|
||||
HINTS "/usr/include" "/opt/local/include"
|
||||
)
|
||||
|
||||
# find position of fftw3.h from the end
|
||||
string(FIND "${FFTW3_INCLUDE_DIR}" "/fftw3.h" pos REVERSE)
|
||||
# truncate the string
|
||||
string(SUBSTRING "${FFTW3_INCLUDE_DIR}" 0 ${pos} substr)
|
||||
set(FFTW3_INCLUDE_DIR ${substr})
|
||||
unset(substr)
|
||||
|
||||
find_library(FFTW3_LIBRARY fftw3)
|
||||
find_library(FFTW3_OMP_LIBRARY fftw3_omp)
|
||||
find_library(FFTW3_THREAD_LIBRARY fftw3_threads)
|
||||
find_library(FFTW3L_LIBRARY fftw3l)
|
||||
find_library(FFTW3L_OMP_LIBRARY fftw3l_omp)
|
||||
find_library(FFTW3L_THREAD_LIBRARY fftw3l_threads)
|
||||
find_library(FFTW3F_LIBRARY fftw3f)
|
||||
find_library(FFTW3F_OMP_LIBRARY fftw3f_omp)
|
||||
find_library(FFTW3F_THREAD_LIBRARY fftw3f_threads)
|
||||
find_library(FFTW3Q_LIBRARY fftw3q)
|
||||
find_library(FFTW3Q_OMP_LIBRARY fftw3q_omp)
|
||||
find_library(FFTW3Q_THREAD_LIBRARY fftw3q_threads)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
find_package_handle_standard_args(FFTW3
|
||||
REQUIRED_VARS FFTW3_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3_OMP
|
||||
REQUIRED_VARS FFTW3_OMP_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3_THREAD
|
||||
REQUIRED_VARS FFTW3_THREAD_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
|
||||
find_package_handle_standard_args(FFTW3L
|
||||
REQUIRED_VARS FFTW3L_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3L_OMP
|
||||
REQUIRED_VARS FFTW3L_OMP_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3L_THREAD
|
||||
REQUIRED_VARS FFTW3L_THREAD_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
|
||||
find_package_handle_standard_args(FFTW3F
|
||||
REQUIRED_VARS FFTW3F_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3F_OMP
|
||||
REQUIRED_VARS FFTW3F_OMP_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3F_THREAD
|
||||
REQUIRED_VARS FFTW3F_THREAD_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
|
||||
find_package_handle_standard_args(FFTW3Q
|
||||
REQUIRED_VARS FFTW3Q_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3Q_OMP
|
||||
REQUIRED_VARS FFTW3Q_OMP_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
find_package_handle_standard_args(FFTW3Q_THREAD
|
||||
REQUIRED_VARS FFTW3Q_THREAD_LIBRARY FFTW3_INCLUDE_DIR
|
||||
VERSION_VAR "3")
|
||||
|
||||
if (NOT FFTW3_FOUND)
|
||||
unset(FFTW3_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3_OMP_FOUND)
|
||||
unset(FFTW3_OMP_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3_THREAD_FOUND)
|
||||
unset(FFTW3_THREAD_LIBRARY)
|
||||
endif()
|
||||
|
||||
if (NOT FFTW3L_FOUND)
|
||||
unset(FFTW3L_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3L_OMP_FOUND)
|
||||
unset(FFTW3L_OMP_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3L_THREAD_FOUND)
|
||||
unset(FFTW3L_THREAD_LIBRARY)
|
||||
endif()
|
||||
|
||||
if (NOT FFTW3F_FOUND)
|
||||
unset(FFTW3F_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3F_OMP_FOUND)
|
||||
unset(FFTW3F_OMP_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3F_THREAD_FOUND)
|
||||
unset(FFTW3F_THREAD_LIBRARY)
|
||||
endif()
|
||||
|
||||
if (NOT FFTW3Q_FOUND)
|
||||
unset(FFTW3Q_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3Q_OMP_FOUND)
|
||||
unset(FFTW3Q_OMP_LIBRARY)
|
||||
endif()
|
||||
if (NOT FFTW3Q_THREAD_FOUND)
|
||||
unset(FFTW3Q_THREAD_LIBRARY)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
FFTW3_INCLUDE_DIR
|
||||
FFTW3_LIBRARY FFTW3_OMP_LIBRARY FFTW3_THREAD_LIBRARY
|
||||
FFTW3L_LIBRARY FFTW3L_OMP_LIBRARY FFTW3L_THREAD_LIBRARY
|
||||
FFTW3F_LIBRARY FFTW3F_OMP_LIBRARY FFTW3F_THREAD_LIBRARY
|
||||
FFTW3Q_LIBRARY FFTW3Q_OMP_LIBRARY FFTW3Q_THREAD_LIBRARY
|
||||
)
|
||||
|
||||
if (FFTW3_FOUND)
|
||||
message("-- Found FFTW3: ${FFTW3_INCLUDE_DIR}")
|
||||
endif (FFTW3_FOUND)
|
34
cmake/FindMXML.cmake
Normal file
34
cmake/FindMXML.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
# - find MXML
|
||||
# find the MXML lib and includes
|
||||
# This module defines
|
||||
# LIBMXML_INCLUDE_DIR, where to find mxml.h
|
||||
# LIBMXML_LIBRARY, library to link against
|
||||
# LIBMXML_FOUND, if false, do not try to use the MXML lib
|
||||
|
||||
find_path(LIBMXML_INCLUDE_DIR mxml.h
|
||||
HINT "/usr/include"
|
||||
)
|
||||
# find position of mxml.h from the end
|
||||
string(FIND "${LIBMXML_INCLUDE_DIR}" "/mxml.h" pos REVERSE)
|
||||
# truncate the string
|
||||
string(SUBSTRING "${LIBMXML_INCLUDE_DIR}" 0 ${pos} substr)
|
||||
set(LIBMXML_INCLUDE_DIR ${substr})
|
||||
unset(substr)
|
||||
|
||||
find_library(LIBMXML_LIBRARY mxml)
|
||||
|
||||
# get version string
|
||||
# currently do not know from where to get it automatically
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBMXML_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MXML
|
||||
REQUIRED_VARS LIBMXML_LIBRARY LIBMXML_INCLUDE_DIR)
|
||||
|
||||
if (NOT LIBMXML_FOUND)
|
||||
unset(LIBMXML_LIBRARY)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBMXML_INCLUDE_DIR LIBMXML_LIBRARY)
|
||||
|
45
cmake/FindNeXus.cmake
Normal file
45
cmake/FindNeXus.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
# - Find NeXus library
|
||||
# Find the native NEXUS includes and library
|
||||
# This module defines
|
||||
# NEXUS_INCLUDE_DIR, where to find NeXus.h, etc.
|
||||
# NEXUS_LIBRARY, library to link against to use NEXUS
|
||||
# NEXUS_FOUND, if false, do not try to use NEXUS.
|
||||
|
||||
find_path(NEXUS_INCLUDE_DIR napi.h
|
||||
HINTS "/usr/local/include" "/opt/nexus/include" "/usr/local/include/nexus"
|
||||
)
|
||||
# find position of napi.h from the end
|
||||
string(FIND "${NEXUS_INCLUDE_DIR}" "/napi.h" pos REVERSE)
|
||||
# truncate the string
|
||||
string(SUBSTRING "${NEXUS_INCLUDE_DIR}" 0 ${pos} substr)
|
||||
set(NEXUS_INCLUDE_DIR ${substr})
|
||||
unset(substr)
|
||||
|
||||
find_library(NEXUS_LIBRARY NeXus
|
||||
HINTS "/usr/lib" "/usr/lib64" "/usr/local/lib" "/usr/local/lib64" "/opt/nexus/lib")
|
||||
|
||||
# get version string
|
||||
if (NEXUS_INCLUDE_DIR AND EXISTS ${NEXUS_INCLUDE_DIR}/napi.h)
|
||||
file(STRINGS "${NEXUS_INCLUDE_DIR}/napi.h" NEXUS_version_str
|
||||
REGEX "^#define[\t ]+NEXUS_VERSION[\t ].*")
|
||||
|
||||
string(REGEX REPLACE "^#define[\t ]+NEXUS_VERSION[\t ]+\"([^\"]*).*"
|
||||
"\\1" NEXUS_VERSION_STRING "${NEXUS_version_str}")
|
||||
unset(NEXUS_version_str)
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set NEXUS_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NEXUS
|
||||
REQUIRED_VARS NEXUS_LIBRARY NEXUS_INCLUDE_DIR
|
||||
VERSION_VAR NEXUS_VERSION_STRING)
|
||||
|
||||
if (NOT NEXUS_FOUND)
|
||||
unset(NEXUS_LIBRARY)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(NEXUS_INCLUDE_DIR NEXUS_LIBRARY)
|
||||
|
||||
|
||||
|
67
cmake/config.h.in
Normal file
67
cmake/config.h.in
Normal file
@ -0,0 +1,67 @@
|
||||
// config.h
|
||||
|
||||
#define PACKAGE_VERSION "@PROJECT_VERSION@"
|
||||
|
||||
// define to 1 if you have fork and it should be used
|
||||
#cmakedefine HAVE_FORK 1
|
||||
|
||||
// define to 1 if you have <alloca.h> and it should be used
|
||||
#cmakedefine HAVE_ALLOCA_H 1
|
||||
|
||||
// Define to 1 if you have the <dlfcn.h> header file.
|
||||
#cmakedefine HAVE_DLFCN_H 1
|
||||
|
||||
// Define to 1 if you have the `erf' function.
|
||||
#cmakedefine HAVE_ERF 1
|
||||
|
||||
// Define to 1 if you have the `getloadavg' function.
|
||||
#cmakedefine HAVE_GETLOADAVG 1
|
||||
|
||||
// Define to 1 if gomp is available */
|
||||
#cmakedefine HAVE_GOMP 1
|
||||
|
||||
// Define to 1 if you have the <inttypes.h> header file.
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
// Define to 1 if the type `long double' works and has more range or precision than `double'.
|
||||
#cmakedefine HAVE_LONG_DOUBLE 1
|
||||
|
||||
// Define to 1 if the type `long double' works and has more range or precision than `double'.
|
||||
#cmakedefine HAVE_LONG_DOUBLE_WIDER 1
|
||||
|
||||
// Define to 1 if fftw3f_threads are available
|
||||
#cmakedefine HAVE_LIBFFTW3F_THREADS 1
|
||||
|
||||
// Define to 1 if fftw3_threads are available
|
||||
#cmakedefine HAVE_LIBFFTW3_THREADS 1
|
||||
|
||||
// Define to 1 if you have the <memory.h> header file.
|
||||
#cmakedefine HAVE_MEMORY_H 1
|
||||
|
||||
// Define to 1 if you have the `powl' function.
|
||||
#cmakedefine HAVE_POWL 1
|
||||
|
||||
// Define to 1 if you have the `shmget' function.
|
||||
#cmakedefine HAVE_SHMGET 1
|
||||
|
||||
// Define to 1 if you have the <stdint.h> header file.
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
|
||||
// Define to 1 if you have the <stdlib.h> header file.
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
|
||||
// Define to 1 if you have the <string.h> header file.
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
|
||||
// Define to 1 if you have the <strings.h> header file.
|
||||
#cmakedefine HAVE_STRINGS_H 1
|
||||
|
||||
// Define to 1 if you have the <sys/stat.h> header file.
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
|
||||
// Define to 1 if you have the <sys/types.h> header file.
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
|
||||
// Define to 1 if you have the <unistd.h> header file.
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
30
cmake/configure_musrfit_version_file.cmake.in
Normal file
30
cmake/configure_musrfit_version_file.cmake.in
Normal file
@ -0,0 +1,30 @@
|
||||
# configure_musrfit_version_file.cmake.in:
|
||||
set(SRC_DIR "@CMAKE_SOURCE_DIR@")
|
||||
set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
|
||||
# Set variables
|
||||
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
|
||||
set(MUSRFIT_VERSION "@MUSRFIT_VERSION@")
|
||||
|
||||
# Get the current working branch
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Get the latest abbreviated commit hash of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --pretty="%h, %ci"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_CURRENT_SHA1
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${SRC_DIR}/cmake/git-revision.h.in
|
||||
${BIN_DIR}/git-revision.h
|
||||
@ONLY
|
||||
)
|
||||
# EOF
|
8
cmake/git-revision.h.in
Normal file
8
cmake/git-revision.h.in
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GIT_VERSION_H
|
||||
#define GIT_VERSION_H
|
||||
|
||||
#define GIT_BRANCH "@GIT_BRANCH@"
|
||||
#define GIT_CURRENT_SHA1 @GIT_CURRENT_SHA1@
|
||||
|
||||
#endif // GIT_VERSION_H
|
||||
|
4
cmake/musrfit-info.h.in
Normal file
4
cmake/musrfit-info.h.in
Normal file
@ -0,0 +1,4 @@
|
||||
//--- This file is generated by cmake -----------------------------------------
|
||||
|
||||
#define MUSRFIT_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||
#define MUSRFIT_DOC_DIR "@CMAKE_INSTALL_PREFIX@/share/doc/musrfit"
|
Loading…
x
Reference in New Issue
Block a user