diff --git a/.travis.yml b/.travis.yml index 9278ed6c1..9780f1d79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: trusty +dist: xenial sudo: required language: cpp @@ -19,7 +19,7 @@ env: # versions of VTK for each OS # - On Ubuntu, use default version installed by apt-get # - On macOS, build recent VTK version from sources and cache installation - - LINUX_VTK_VERSION=6.0.0 + - LINUX_VTK_VERSION=6.2.0 - MACOS_VTK_VERSION=8.1.0 - WITH_CCACHE=ON # speed up MIRTK build itself using ccache - WITH_ARPACK=OFF # requires time consuming build of gcc on macOS diff --git a/BasisProject.cmake b/BasisProject.cmake index 6173d0420..8eaa0d46b 100644 --- a/BasisProject.cmake +++ b/BasisProject.cmake @@ -1,8 +1,8 @@ # ============================================================================ # Medical Image Registration ToolKit (MIRTK) # -# Copyright 2013-2017 Imperial College London -# Copyright 2013-2018 Andreas Schuh +# Copyright 2013-2019 Imperial College London +# Copyright 2013-2019 Andreas Schuh # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -56,11 +56,11 @@ basis_project ( SOVERSION "0" # API yet unstable AUTHORS "Andreas Schuh" DESCRIPTION "Medical Image Registration ToolKit" - COPYRIGHT "2013-2018 Imperial College London, Andreas Schuh" + COPYRIGHT "2013-2019 Imperial College London, Andreas Schuh" LICENSE "Apache License Version 2.0" CONTACT "Andreas Schuh " TEMPLATE "with-basis-submodule/1.0" - LANGUAGES C CXX-11 + LANGUAGES C CXX-14 # -------------------------------------------------------------------------- # directories diff --git a/CMakeLists.txt b/CMakeLists.txt index da17f39ab..db627e669 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ # ============================================================================ # Medical Image Registration ToolKit (MIRTK) # -# Copyright 2013-2016 Imperial College London -# Copyright 2013-2016 Andreas Schuh +# Copyright 2013-2019 Imperial College London +# Copyright 2013-2019 Andreas Schuh # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ # ---------------------------------------------------------------------------- # Minimum required CMake version -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.4 FATAL_ERROR) # ---------------------------------------------------------------------------- # Include BASIS policies, settings, macros, and functions @@ -97,11 +97,7 @@ if (WITH_CCACHE) message(STATUS "Using ccache for compilation of C++ code") mark_as_advanced(CCACHE_COMMAND) # For Unix Makefiles and Ninja generators - if (CMAKE_VERSION VERSION_LESS 3.4) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_COMMAND}") - else () - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_COMMAND}") - endif () + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_COMMAND}") if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options("-Qunused-arguments") endif () diff --git a/Docker/Ubuntu/Dockerfile b/Docker/Ubuntu/Dockerfile index 288eba4da..79ac0ebf2 100644 --- a/Docker/Ubuntu/Dockerfile +++ b/Docker/Ubuntu/Dockerfile @@ -13,9 +13,9 @@ ## ## https://hub.docker.com/r/biomedia/ubuntu/ -FROM ubuntu:14.04 +FROM ubuntu:18.04 -MAINTAINER Andreas Schuh +LABEL Maintainer="Andreas Schuh " LABEL Description="Ubuntu with prerequisits for MIRTK installed" Vendor="BioMedIA" # No. of threads to use for build (--build-arg THREADS=8) @@ -23,32 +23,28 @@ LABEL Description="Ubuntu with prerequisits for MIRTK installed" Vendor="BioMedI # set the number of CPUs in the VirtualBox VM Settings. ARG THREADS -# When VTK_VERSION='', the official libvtk6-dev package is used. +# When VTK_VERSION='', the official libvtk7-dev package is used. # Note, however, that this results in a Docker image that is about twice # the size of the image when a custom VTK build without Qt, wrappers, # and unused VTK modules is used instead! -ARG VTK_VERSION=7.0.0 +ARG VTK_VERSION=8.2.0 -ARG EIGEN_VERSION=3.2.8 +ARG EIGEN_VERSION=3.3.7 + +ARG CXX_STANDARD=c++14 # Install prerequisites for MIRTK build -# -# The bzindovic/suitesparse-bugfix-1319687 PPA is required for building -# shared libraries which link with the static SuiteSparse libraries due -# to a bug in the official Ubuntu package: -# https://bugs.launchpad.net/ubuntu/+source/suitesparse/+bug/1333214 RUN NUM_CPUS=${THREADS:-`cat /proc/cpuinfo | grep processor | wc -l`} \ && echo "Maximum number of build threads = $NUM_CPUS" \ && apt-get update && apt-get install -y --no-install-recommends \ software-properties-common \ - && add-apt-repository -y ppa:bzindovic/suitesparse-bugfix-1319687 \ && apt-get update && apt-get install -y --no-install-recommends \ wget \ gcc \ g++ \ make \ cmake \ - python \ + python3 \ freeglut3-dev \ libarpack2-dev \ libboost-math-dev \ @@ -77,13 +73,13 @@ RUN NUM_CPUS=${THREADS:-`cat /proc/cpuinfo | grep processor | wc -l`} \ && wget -O archive.tar.bz2 http://bitbucket.org/eigen/eigen/get/${EIGEN_VERSION}.tar.bz2 \ && tar vxjf archive.tar.bz2 --strip 1 \ && mv signature_of_eigen3_matrix_library Eigen /usr/include/eigen3/ \ - && mv cmake/FindEigen3.cmake /usr/share/cmake-2.8/Modules/ \ + && mv cmake/FindEigen3.cmake /usr/share/cmake-3.10/Modules/ \ && cd /usr/src \ && rm -rf ${EIGEN_SOURCE_DIR}; \ fi \ && \ if [ -z ${VTK_VERSION} ]; then \ - apt-get install -y libvtk6-dev; \ + apt-get install -y libvtk7-dev; \ else \ VTK_RELEASE=`echo ${VTK_VERSION} | sed s/\.[0-9]*$//` \ && cd /usr/src \ @@ -95,7 +91,7 @@ RUN NUM_CPUS=${THREADS:-`cat /proc/cpuinfo | grep processor | wc -l`} \ && cmake \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D CMAKE_BUILD_TYPE=Release \ - -D CMAKE_CXX_FLAGS=-std=c++11 \ + -D CMAKE_CXX_STANDARD=${CXX_STANDARD} \ -D VTK_USE_SYSTEM_PNG=ON \ -D VTK_USE_SYSTEM_ZLIB=ON \ -D BUILD_SHARED_LIBS=ON \ diff --git a/Dockerfile b/Dockerfile index 0c3c3ee09..a2ef97d69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,9 +18,9 @@ ## https://hub.docker.com/r/biomedia/mirtk/ # Pre-made Ubuntu system with all MIRTK dependencies installed -FROM biomedia/ubuntu:mirtk +FROM biomedia/ubuntu:18.04-mirtk -MAINTAINER Andreas Schuh +LABEL Maintainer="Andreas Schuh " LABEL Description="Medical Image Registration ToolKit (MIRTK)" Vendor="BioMedIA" # Git repository and commit SHA from which this Docker image was built @@ -39,12 +39,12 @@ ARG THREADS ARG BUILD_TESTING=OFF # Build and install MIRTK -COPY . /usr/src/MIRTK -RUN ls /usr/src/MIRTK \ +COPY . /usr/src/mirtk +RUN ls /usr/src/mirtk \ && NUM_CPUS=${THREADS:-`cat /proc/cpuinfo | grep processor | wc -l`} \ && echo "Maximum number of build threads = $NUM_CPUS" \ - && mkdir /usr/src/MIRTK/Build \ - && cd /usr/src/MIRTK/Build \ + && mkdir /usr/src/mirtk/Build \ + && cd /usr/src/mirtk/Build \ && cmake \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D CMAKE_BUILD_TYPE=Release \ @@ -64,6 +64,7 @@ RUN ls /usr/src/MIRTK \ -D MODULE_DrawEM=ON \ -D MODULE_Mapping=ON \ -D MODULE_Scripting=ON \ + -D MODULE_Viewer=ON \ -D WITH_ARPACK=ON \ -D WITH_FLANN=ON \ -D WITH_MATLAB=OFF \ @@ -78,10 +79,10 @@ RUN ls /usr/src/MIRTK \ && if [ ${BUILD_TESTING} = ON ]; then make -j $NUM_CPUS && make test; fi \ && make -j $NUM_CPUS install \ && cd /usr/src \ - && rm -rf /usr/src/MIRTK + && rm -rf /usr/src/mirtk # Make "mirtk" the default executable for application containers -ENTRYPOINT ["python", "/usr/local/bin/mirtk"] +ENTRYPOINT ["python3", "/usr/local/bin/mirtk"] CMD ["help"] # Assume user data volume to be mounted at /data diff --git a/Documentation/install.rst b/Documentation/install.rst index 5495133d4..8b2a3c151 100644 --- a/Documentation/install.rst +++ b/Documentation/install.rst @@ -17,7 +17,7 @@ the Cross-platform Make tool named CMake_ is needed. The minimum required versio for Linux and OS X is 2.8.12, while version 3.4 or newer is needed on Windows. For the compilation of the MIRTK source code, a C++ compiler with support for the -`C++11`_ standard is required. On Windows, the minimum required Visual Studio compiler +`C++14`_ standard is required. On Windows, the minimum required Visual Studio compiler version is 18.0. A compatible compiler is shipped with Visual Studio 2013 or newer. For Unix operation systems, we recommend the use of the `GNU Compiler Collection`_ (GCC). diff --git a/Scripts/install_depends.sh b/Scripts/install_depends.sh index 58e276946..698935c25 100755 --- a/Scripts/install_depends.sh +++ b/Scripts/install_depends.sh @@ -13,6 +13,7 @@ norm_option_value() fi } +CXX_STANDARD=c++14 TRAVIS=`norm_option_value "$TRAVIS" OFF` TESTING=`norm_option_value "$TESTING" OFF` WITH_ARPACK=`norm_option_value "$WITH_ARPACK" OFF` @@ -65,6 +66,10 @@ if [ $os = linux ] || [ $os = Linux ]; then [ $WITH_FLANN = OFF ] || deps=(${deps[@]} libflann-dev) [ $WITH_ARPACK = OFF ] || deps=(${deps[@]} libarpack2-dev) + if [ -f /etc/lsb-release ]; then + source /etc/lsb-release + fi + if [ $WITH_UMFPACK = ON ]; then # see https://bugs.launchpad.net/ubuntu/+source/suitesparse/+bug/1333214 # sudo add-apt-repository -y ppa:bzindovic/suitesparse-bugfix-1319687 || exit 1 @@ -75,9 +80,30 @@ if [ $os = linux ] || [ $os = Linux ]; then if [ -n "$LINUX_VTK_VERSION" ]; then VTK_VERSION="$LINUX_VTK_VERSION" fi - if [ -z "$VTK_VERSION" ] || [ $VTK_VERSION = '6.0.0' ]; then + if [ "$DISTRIB_ID" = "Ubuntu" ]; then + if [ "$DISTRIB_CODENAME" = "trusty" ]; then + if [ -z "$VTK_VERSION" ] || [ $VTK_VERSION = '6.0.0' ]; then + deps=(${deps[@]} libvtk6-dev) + VTK_VERSION='' + fi + elif [ "$DISTRIB_CODENAME" = "xenial" ]; then + if [ -z "$VTK_VERSION" ] || [ $VTK_VERSION = '6.2.0' ]; then + deps=(${deps[@]} libvtk6-dev) + VTK_VERSION='' + fi + elif [ "$DISTRIB_CODENAME" = "bionic" ]; then + if [ $VTK_VERSION = '6.3.0' ]; then + deps=(${deps[@]} libvtk6-dev) + VTK_VERSION='' + elif [ -z "$VTK_VERSION" ] || [ $VTK_VERSION = '7.1.1' ]; then + deps=(${deps[@]} libvtk7-dev) + VTK_VERSION='' + fi + elif [ -z "$VTK_VERSION" ]; then + deps=(${deps[@]} libvtk7-dev) + fi + elif [ -z "$VTK_VERSION" ]; then deps=(${deps[@]} libvtk6-dev) - VTK_VERSION='' fi if [ $WITH_FLTK = ON ]; then deps=(${deps[@]} libxi-dev libxmu-dev libxinerama-dev libxcursor-dev libcairo-dev libfltk1.3-dev) @@ -143,7 +169,7 @@ if [ $os = osx ] || [ $os = Darwin ]; then run git clone --depth=1 https://github.com/google/googletest.git /tmp/gtest-source mkdir /tmp/gtest-build && cd /tmp/gtest-build [ $? -eq 0 ] || exit 1 - run cmake -DCMAKE_CXX_FLAGS=-std=c++11 -DBUILD_GMOCK=OFF -DBUILD_GTEST=ON ../gtest-source + run cmake -DCMAKE_CXX_STANDARD=$CXX_STANDARD -DBUILD_GMOCK=OFF -DBUILD_GTEST=ON ../gtest-source run make -j $cpu_cores run sudo make install cd || exit 1 @@ -195,6 +221,7 @@ if [ $WITH_VTK = ON ] && [ -n "$VTK_VERSION" ]; then [ $? -eq 0 ] || exit 1 echo "Configuring VTK $VTK_VERSION..." cmake_args=("${cmake_args[@]}" + -DCMAKE_CXX_STANDARD=$CXX_STANDARD -DVTK_Group_StandAlone=OFF -DVTK_Group_Rendering=OFF -DModule_vtkCommonCore=ON