Newer
Older
###########################################################################
# CMake version check.
# Require CMake 3.5, required by ParaView 5.1.0
###########################################################################
# Define the project name.
project ( Mantid )
# Policy settings
if (POLICY CMP0022)
cmake_policy (SET CMP0022 NEW)
endif ()
if (POLICY CMP0072)
cmake_policy (SET CMP0072 OLD)
endif ()
# System package target is important for the windows builds as it allows us to package only the dlls and exes and exclude libs. Defaults to empty for other platforms.
set ( SYSTEM_PACKAGE_TARGET "" )
# Add the path to our custom 'find' modules
set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/buildconfig/CMake")
# Send libraries to common place, reference in several places so must be at top level
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
set ( ENABLE_MANTIDPLOT ON CACHE BOOL "Enable Qt4-based gui & components" )
set ( ENABLE_WORKBENCH OFF CACHE BOOL "Enable Qt5-based gui & components" )
set ( PACKAGE_WORKBENCH OFF CACHE BOOL "If packaging is enabled then include the Qt-5 workbench in the package" )
if ( PACKAGE_WORKBENCH AND NOT ENABLE_WORKBENCH )
message ( FATAL_ERROR "Packaging workbench requested but workbench build is disabled!" )
endif ()
set ( CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR}" "Mantid" "ALL" "/" )
###########################################################################
# Quick exit if we only want data targets
###########################################################################
if( DATA_TARGETS_ONLY )
include( SetupDataTargets )
# System test config files
add_subdirectory( Testing/SystemTests/scripts )
return()
endif()
###########################################################################
# Packaging configuration
###########################################################################
set ( CPACK_PACKAGE_SUFFIX "unstable" CACHE STRING "suffix used to determine the deployment type")
set_property(CACHE CPACK_PACKAGE_SUFFIX PROPERTY STRINGS nightly unstable "") #empty string and release are treated as the same thing
set ( CPACK_PACKAGE_NAME "mantid${CPACK_PACKAGE_SUFFIX}" )
###########################################################################
# Bootstrap any dependencies
###########################################################################
###########################################################################
###########################################################################
###########################################################################
# Set ParaView information since later items depend on it
###########################################################################
# VATES flag. Requires ParaView
set ( MAKE_VATES OFF CACHE BOOL "Switch for compiling the Vates project")
if ( ENABLE_MANTIDPLOT AND MAKE_VATES )
find_package( ParaView )
if( ParaView_FOUND )
# Poco::File throws an exception when a backslash is used.
string ( REPLACE "\\" "/" ParaView_DIR ${ParaView_DIR} )
endif ()
endif ()
if ( ENABLE_MANTIDPLOT )
include ( ParaViewSetup )
endif ()
###########################################################################
# Set expected variables for OS X
###########################################################################
if ( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
include ( DarwinSetup )
endif ()
###########################################################################
# Cross-platform setup
###########################################################################
include ( CommonSetup )
###########################################################################
# Find OpenGL
###########################################################################
find_package ( OpenGL REQUIRED )
# FindOpenGL does not (as of CMake 2.6.4) take notice of the REQUIRED
if ( NOT OPENGL_FOUND )
message ( FATAL_ERROR "OpenGL was not found." )
endif ()
# We probably don't want this to run on every build.
option(COVERALLS "Generate coveralls data" OFF)
if (COVERALLS)
include(Coveralls)
coveralls_turn_on_coverage()
endif()
Russell Taylor
committed
###########################################################################
Russell Taylor
committed
###########################################################################
if (ENABLE_MANTIDPLOT)
find_package ( Qt4 COMPONENTS QtCore QtGui QtOpenGL QtXml QtSvg REQUIRED )
find_package ( Qwt5 REQUIRED )
if( QWT5_VERSION VERSION_LESS 5.0 OR QWT5_VERSION VERSION_EQUAL 6.0 OR
QWT5_VERSION VERSION_GREATER 6.0 )
message ( FATAL_ERROR "Qwt version 5 is required, found: ${QWT5_VERSION}" )
endif()
find_package ( PyQt4 REQUIRED )
find_package ( SIP REQUIRED )
separate_arguments ( PYQT4_SIP_FLAGS )
endif()
if ( ENABLE_WORKBENCH )
find_package ( Qt5 COMPONENTS Core Gui Widgets OpenGL REQUIRED )
if ( Qt5_FOUND )
message ( STATUS "Found Qt ${Qt5_VERSION}: ${Qt5_DIR}" )
endif()
find_package ( PyQt5 REQUIRED )
find_package ( SIP REQUIRED )
separate_arguments ( PYQT5_SIP_FLAGS )
endif()
###########################################################################
# gsl is currently needed by Geometry, Algorithms, Curvefitting, & MantidPlot
###########################################################################
find_package ( GSL REQUIRED )
Russell Taylor
committed
###########################################################################
# Now add in all the components
###########################################################################
# Flag that this is a full build, i.e not framework only
set( FULL_PACKAGE_BUILD 1 )
# Set the path to the built docs directory here so that it can be used in
# the Kernel project for populating the properties file
set( DOCS_BUILDDIR ${CMAKE_BINARY_DIR}/docs )
# Framework Build options
set ( CXXTEST_SINGLE_LOGFILE CACHE BOOL "Switch to have the tests for each package run together")
set ( CXXTEST_ADD_PERFORMANCE OFF CACHE BOOL "Switch to add Performance tests to the list of tests run by ctest?")
Russell Taylor
committed
add_subdirectory ( Framework )
include_directories ( Framework/Kernel/inc )
include_directories ( Framework/HistogramData/inc )
include_directories ( Framework/Indexing/inc )
include_directories ( Framework/Parallel/inc )
include_directories ( Framework/Geometry/inc )
include_directories ( Framework/API/inc )
include_directories ( Framework/Types/inc )
include_directories ( Framework/NexusGeometry/inc )
set ( CORE_MANTIDLIBS Kernel HistogramData Indexing Beamline Geometry API Types )
if (NOT APPLE)
LIST( APPEND CPACK_INSTALL_CMAKE_PROJECTS
"${ParaView_DIR}" "ParaView Runtime Libs" "Runtime" "${INBUNDLE}/"
)
LIST( APPEND CPACK_INSTALL_CMAKE_PROJECTS
"${ParaView_DIR}" "VTK Runtime Libs" "RuntimeLibraries" "${INBUNDLE}/"
)
LIST( APPEND CPACK_INSTALL_CMAKE_PROJECTS
"${ParaView_DIR}" "HDF5 Core Library" "libraries" "${INBUNDLE}/"
)
LIST( APPEND CPACK_INSTALL_CMAKE_PROJECTS
"${ParaView_DIR}" "HDF5 HL Library" "hllibraries" "${INBUNDLE}/"
)
endif()
if ( UNIX )
#Experimental feature. Unix only at this point.
Owen Arnold
committed
set ( UNITY_BUILD OFF CACHE BOOL "Switch for utilising unity builds. Faster builds for selected components.")
Owen Arnold
committed
if ( MSVC )
add_definitions ( -DQWT_DLL )
endif ()
if ( ENABLE_MANTIDPLOT OR ENABLE_WORKBENCH )
add_custom_target ( GUITests )
add_dependencies ( check GUITests )
# Collect all tests together
add_custom_target ( AllTests )
add_dependencies ( AllTests FrameworkTests GUITests )
add_subdirectory ( MantidPlot )
endif()
add_subdirectory ( scripts )
# Docs requirements
find_package ( Sphinx 1.2 )
if ( SPHINX_FOUND )
# run python to see if the theme is installed
execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx_bootstrap_theme"
OUTPUT_VARIABLE SPHINX_BOOTSTRAP_THEME_OUT
ERROR_VARIABLE SPHINX_BOOTSTRAP_THEME_ERR
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE )
if (SPHINX_BOOTSTRAP_THEME_ERR)
message (ERROR " Did not find sphinx_bootstrap_theme")
message (STATUS "${PYTHON_EXECUTABLE} -c \"import sphinx_bootstrap_theme\"")
message (STATUS "${SPHINX_BOOTSTRAP_THEME_ERR}")
message (FATAL_ERROR " Install instructions at https://pypi.python.org/pypi/sphinx-bootstrap-theme/")
endif ()
add_subdirectory ( dev-docs )
if ( ENABLE_MANTIDPLOT )
add_subdirectory ( docs )
endif()
endif ()
# System test data target
add_subdirectory ( Testing/SystemTests/scripts )
if (COVERALLS)
get_property(ALL_SRCS GLOBAL PROPERTY COVERAGE_SRCS)
set(SRCS_FILE "")
foreach (SRC ${ALL_SRCS})
set(SRCS_FILE "${SRCS_FILE}\n${SRC}")
endforeach()
#remove initial \n
string(SUBSTRING ${SRCS_FILE} 1 -1 SRCS_FILE)
set( SRCS_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/sources.txt")
file(WRITE ${SRCS_FILENAME} ${SRCS_FILE})
"${CMAKE_SOURCE_DIR}/buildconfig/CMake"
Russell Taylor
committed
###########################################################################
# Installation settings
###########################################################################
# N.B. INBUNDLE variable is empty except on Mac (set in DarwinSetup.cmake)
install ( DIRECTORY installers/colormaps/ DESTINATION ${INBUNDLE}colormaps)
Russell Taylor
committed
# Install the files (.desktop and icon) to create a menu item, but only if installing to /opt/Mantid
if ( ENABLE_MANTIDPLOT AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND CMAKE_INSTALL_PREFIX STREQUAL "/opt/Mantid" )
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/installers/LinuxInstaller/mantidplot.desktop
DESTINATION /usr/share/applications )
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/MantidPlot_Icon_32offset.png
DESTINATION /usr/share/pixmaps
RENAME mantidplot.png )
endif()
# THIS MUST BE THE LAST SUB_DIRECTORY ADDED. See Framework/PostInstall/CMakeLists
# for an explanation
add_subdirectory( Framework/PostInstall )
# Conda
set ( ENABLE_CONDA CACHE BOOL "Switch to enable conda package generation")
if ( ENABLE_CONDA )
include ( conda )
endif ( ENABLE_CONDA )
Russell Taylor
committed
###########################################################################
# CPack settings
###########################################################################
# Keep this in a defaulted-to-off option
set ( ENABLE_CPACK CACHE BOOL "Switch to enable CPack package generation")
if ( ENABLE_CPACK )
# Mac package settings
set ( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/installers/WinInstaller/License.txt )
if(CMAKE_HOST_WIN32)
include ( WindowsNSIS )
elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
include ( CPackLinuxSetup )
########## rhel requirements - only used if package requested is rpm
set ( CPACK_RPM_PACKAGE_REQUIRES "nexus >= 4.3.1,gsl,glibc,muParser,numpy,h5py >= 2.3.1,PyCifRW >= 4.2.1,tbb,librdkafka,"
"${CPACK_RPM_PACKAGE_REQUIRES},OCE-draw,OCE-foundation,OCE-modeling,OCE-ocaf,OCE-visualization,"
"poco-crypto,poco-data,poco-mysql,poco-sqlite,poco-odbc,poco-util,poco-xml,poco-zip,poco-net,poco-netssl,poco-foundation,"
"sip >= 4.18,"
"python-six,python-ipython >= 1.1.0,python-ipython-notebook,PyYAML,"
"scipy,"
"hdf,hdf5,jsoncpp >= 0.7.0" )
if (ENABLE_MANTIDPLOT)
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},qt4 >= 4.2,PyQt4,qwtplot3d-qt4" )
endif()
if (ENABLE_WORKBENCH)
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},qt5-qtbase,python-qt5" )
if( "${UNIX_CODENAME}" MATCHES "Santiago" ) # RHEL6
if ( ENABLE_WORKBENCH )
message ( FATAL_ERROR "mantidworkbench is not supported on RHEL6" )
endif ()
# On RHEL6 we have to use an updated qscintilla to fix an auto complete bug
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},qscintilla >= 2.4.6,boost157,python-matplotlib,"
# On RHEL6 we are using SCL packages for Qt
"scl-utils,mantidlibs34,mantidlibs34-runtime,mantidlibs34-qt,mantidlibs34-qt-x11,mantidlibs34-qt-webkit,mantidlibs34-qwt5-qt4" )
else() # assumes RHEL7
# Require matplotlib >= 1.5 to fix bug in latex rendering - oddly matplotlib-qt4 contains qt5 backend as well
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},python2-QtAwesome,boost >= 1.53.0,python2-matplotlib-qt4 >= 1.5.2" )
if (ENABLE_MANTIDPLOT)
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},qscintilla,qwt5-qt4" )
endif()
if (ENABLE_WORKBENCH)
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},qscintilla-qt5" )
endif()
string ( REPLACE ";" "," CPACK_RPM_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES} ) # fix up the fact that it was made as an array
string ( REPLACE ",," "," CPACK_RPM_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES} )
########## ubuntu requirements - only used if package requested is deb
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-date-time${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libboost-regex${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libboost-python${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libboost-serialization${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libboost-filesystem${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libnexus0v5 (>= 4.3),"
"libjsoncpp1 (>=0.7.0),"
"libmuparser2v5,"
"librdkafka1,librdkafka++1,"
"libpocofoundation${POCO_SOLIB_VERSION},libpocoutil${POCO_SOLIB_VERSION},libpoconet${POCO_SOLIB_VERSION},libpoconetssl${POCO_SOLIB_VERSION},libpococrypto${POCO_SOLIB_VERSION},libpocoxml${POCO_SOLIB_VERSION}")
if (ENABLE_MANTIDPLOT)
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqtcore4 (>= 4.2),"
"libqtgui4 (>= 4.2),"
"libqt4-opengl (>= 4.2),"
"libqt4-xml (>= 4.2),"
"libqt4-svg (>= 4.2),"
"libqt4-qt3support (>= 4.2),"
"qt4-dev-tools,"
"libqwt5-qt4,"
"libqwtplot3d-qt4-0v5,"
"libqtwebkit4" )
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
if( "${UNIX_CODENAME}" STREQUAL "xenial")
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libgsl2,"
"liboce-foundation10,liboce-modeling10,"
"libqscintilla2-12v5,"
"ipython-notebook,"
"libhdf5-cpp-11" )
else() # bionic and newer
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libgsl23"
"liboce-foundation11,liboce-modeling11"
"libqscintilla2-qt4-13"
"jupyter-notebook"
"libhdf5-cpp-100" )
endif()
if ( PYTHON_VERSION_MAJOR EQUAL 3 )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},python3-h5py,"
"python3-numpy,"
"python3-sip,"
"python3-six,"
"python3-matplotlib,"
"python3-scipy,"
"python3-pycifrw (>= 4.2.1),"
"python3-yaml,"
"python3-qtawesome,"
"ipython3-qtconsole" ) # transitional package for bionic
if (ENABLE_MANTIDPLOT)
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},python3-pyqt4" )
endif()
if (ENABLE_WORKBENCH)
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},python3-qt5" )
endif()
else() # python 2
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},python-h5py,"
"python-numpy,"
"python-sip,"
"python-six,"
"python-matplotlib,"
"python-scipy,"
"python-pycifrw (>= 4.2.1),"
"python-yaml,"
"python-qtawesome,"
"ipython-qtconsole" )
if (ENABLE_MANTIDPLOT)
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},python-qt4" )
endif()
if (ENABLE_WORKBENCH)
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},python-qt5" )
endif()
endif ()
# parse list to string required for deb package
string ( REPLACE ";" "," CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS} ) # fix up the fact that it was made as an array
string ( REPLACE ",," "," CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS} )
endif()
# soft requirement of tcmalloc if selected
IF ( USE_TCMALLOC )
message ( STATUS "Adding gperftools to the package requirements" )
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},gperftools-libs >= 2.0" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libgoogle-perftools4 (>= 1.7)" )
ENDIF ( )
# run cpack configuration
include ( CPack )
# let people know what is coming out the other end - must be after cpack generates value for rpm
message ( STATUS "CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}" )