Loading .gitignore 0 → 100644 +1 −0 Original line number Diff line number Diff line external/ CMakeLists.txt 0 → 100644 +283 −0 Original line number Diff line number Diff line cmake_minimum_required(VERSION 2.8.12) set(RELION_CMAKE_MINIMUM_REQUIRED_VERSION "2.8.12") # #if(POLICY CMP0048) # cmake_policy(SET CMP0048 NEW) #endif() project(Relion) # Use new policy for OS X @rpath if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() # Add the path to the additional Find<module>.cmake files # which are included with the distributed RLEION-code list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) add_definitions(-DINSTALL_LIBRARY_DIR=${CMAKE_INSTALL_PREFIX}/lib/) add_definitions(-DSOURCE_DIR=${CMAKE_SOURCE_DIR}/src/) # message(STATUS "INSTALL_LIBRARY_DIR set to ${CMAKE_INSTALL_PREFIX}/lib/") # message(STATUS "SOURCE_DIR set to ${CMAKE_SOURCE_DIR}/src/") # ------------------------------------------------------------------RPATH SETTINGS-- if(NOT APPLE) # use, i.e. don't skip the full RPATH for the build tree SET(CMAKE_SKIP_BUILD_RPATH FALSE) # when building, don't use the install RPATH already # (but later on when installing) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") ENDIF("${isSystemDir}" STREQUAL "-1") endif(NOT APPLE) # ---------------------------------------------------------SET SPECIFIC BUILD TYPE-- if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "") string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER ) if( ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "none" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "release" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "debug" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "relwithdebinfo" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "profiling" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "benchmarking" ) ) message( FATAL_ERROR "CMAKE_BUILD_TYPE : '${CMAKE_BUILD_TYPE}' is not a valid build type. " "Valid options are: 'None', 'Release', 'Debug', 'RelWithDebInfo', and 'Profiling'." ) endif() message(STATUS "BUILD TYPE set to '${CMAKE_BUILD_TYPE}'") SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: 'None', 'Release', 'Debug', 'RelWithDebInfo', and 'Profiling'.") else() SET(CMAKE_BUILD_TYPE "Release") message(STATUS "BUILD TYPE set to the default type: '${CMAKE_BUILD_TYPE}'") string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER ) endif() # ------------------OPTIONS WHICH ARE NEEDED TO SET BUILD-TYPES (COMPILATION FLAGS)-- # ------------------------------------------------------------------------CUDA-ARCH-- if(NOT DEFINED CUDA_ARCH) message(STATUS "Setting fallback CUDA_ARCH=35") set(CUDARCH "-arch=sm_35") else(NOT DEFINED CUDA_ARCH) message(STATUS "Using provided CUDA_ARCH=${CUDA_ARCH}") set(CUDARCH "-arch=sm_${CUDA_ARCH}") endif(NOT DEFINED CUDA_ARCH) # -------------------------------------------------------------------FURTHER OPTIONS-- option(CUDA "Enable CUDA GPU acceleration" ON) option(DoublePrec_CPU "DoublePrec_CPU" ON) option(DoublePrec_GPU "DoublePrec_GPU" OFF) option(CudaTexture "CudaTexture" ON) # -----------------------------------------------DOUBLE PRECISION (CUDA-CODE) OR NOT-- if(DoublePrec_CPU) message(STATUS "Setting cpu precision to double") else(DoublePrec_CPU) message(STATUS "Setting cpu precision to single") add_definitions(-DRELION_SINGLE_PRECISION) endif(DoublePrec_CPU) if(DoublePrec_GPU) message(STATUS "Setting gpu precision to double") add_definitions(-DCUDA_DOUBLE_PRECISION) set(CudaTexture FALSE) else(DoublePrec_GPU) message(STATUS "Setting gpu precision to single") endif(DoublePrec_GPU) # ----------------------------------------------------------INCLUDE ALL BUILD TYPES-- #This *has* to be AFTER project() include(${CMAKE_SOURCE_DIR}/cmake/BuildTypes.cmake) if(CUDA) # -----------------------------------------------------------------------------CUDA-- # DOC: http://www.cmake.org/cmake/help/v3.0/module/FindCUDA.html FIND_PACKAGE(CUDA) endif() if(CUDA_FOUND) message(STATUS "Using cuda wrapper to compile....") if( (NOT ${CUDA_VERSION} VERSION_LESS "7.5") AND (NOT DoublePrec_GPU) ) message(STATUS "Cuda version is >= 7.5 and single-precision build, enable double usage warning.") set(WARN_DBL "--ptxas-options=-warn-double-usage") # cuda>=7.5 elseif( ${CUDA_VERSION} VERSION_LESS "7.0") message(WARNING "Cuda version is less than 7.0, so relion will be compiled without GPU support.") set(CUDA OFF) endif() if(CUDA) add_definitions(-DCUDA) endif() else(CUDA_FOUND) message(STATUS "Using non-cuda compilation....") endif(CUDA_FOUND) # ---------------------------------------------------------------USE TEXTURES OR NOT-- if(NOT CudaTexture) add_definitions(-DCUDA_NO_TEXTURES) message(STATUS "Texture interpolation is omitted.") endif(NOT CudaTexture) # ------------------------------------------------------------------ALLOCATOR CHOICE-- option(CachedAlloc "CachedAlloc" ON) if(NOT CachedAlloc) add_definitions(-DCUDA_NO_CUSTOM_ALLOCATION) message(STATUS "Cashed allocation is disabled.") endif(NOT CachedAlloc) option(CustomAllocMemGuards "CustomAllocMemGuards" OFF) if(CustomAllocMemGuards) add_definitions(-DCUSTOM_ALLOCATOR_MEMGUARD) message(STATUS "Abort on out of bound write.") endif(CustomAllocMemGuards) # -------------------------------------------------------------FORCE USE OF STL-LIBS-- option(CudaForceSTL "CudaForceSTL" OFF) if(CudaForceSTL) add_definitions(-DCUDA_FORCESTL) message(STATUS "Building cuda files wusing stl-libs for sort, min and max.") endif(CudaForceSTL) # ------------------------------------------------------------------------GUI OR NOT-- # Skip FLTK/X11-dependent binaries or not option(GUI "GUI" ON) if(NOT GUI) message(STATUS "Omitting GUI targets as per your request") endif() # -------------------------------------------------------------------------------MPI-- find_package(MPI REQUIRED) include_directories("${MPI_INCLUDE_PATH}") message(STATUS "MPI_INCLUDE_PATH : ${MPI_INCLUDE_PATH}") message(STATUS "MPI_LIBRARIES : ${MPI_LIBRARIES}") message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}") message(STATUS "MPI_CXX_LIBRARIES : ${MPI_CXX_LIBRARIES}") SET(CMAKE_C_COMPILER ${MPI_C_COMPILER}) SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) option(FORCE_OWN_FLTK "FORCE_OWN_FLTK" OFF) # --------------------------------------------------------------------------X11/FLTK-- FIND_PACKAGE(X11) if(GUI) if(X11_FOUND) set(FLTK_SKIP_OPENGL TRUE) #OpenGL is not required for relion if(NOT FORCE_OWN_FLTK) FIND_PACKAGE(FLTK) if(FLTK_FOUND) message(STATUS "X11 and FLTK were found") message(STATUS "FLTK_LIBRARIES: ${FLTK_LIBRARIES}") else() message(STATUS "FLTK was NOT found") endif() endif(NOT FORCE_OWN_FLTK) if(NOT FLTK_FOUND) include(${CMAKE_SOURCE_DIR}/cmake/BuildFLTK.cmake) set(INSTALL_OWN_FLTK 1) endif(NOT FLTK_FOUND) else(X11_FOUND) message( STATUS "\n-- ------------------ YOU HAVE NO X11-LIBS ------------------") message( STATUS "CCmake found no X11-libs on your system, which are required for the GUI.") message( STATUS " You CAN add the flag -DGUI=OFF to avoid using X11" ) message(FATAL_ERROR "X11 is required for GUI.") endif(X11_FOUND) endif(GUI) # ------------------------------------------------------------------------------FFTW-- option(FORCE_OWN_FFTW "FORCE_OWN_FFTW" OFF) if(NOT FORCE_OWN_FFTW) FIND_PACKAGE(FFTW) endif(NOT FORCE_OWN_FFTW) if(NOT FFTW_FOUND) include(${CMAKE_SOURCE_DIR}/cmake/BuildFFTW.cmake) endif(NOT FFTW_FOUND) include(CheckCXXSymbolExists) check_cxx_symbol_exists(sincos math.h HAVE_SINCOS) check_cxx_symbol_exists(__sincos math.h HAVE___SINCOS) if(HAVE_SINCOS) add_definitions(-DHAVE_SINCOS) endif() if(HAVE___SINCOS) add_definitions(-DHAVE___SINCOS) endif() # ----------------------------------------------------------------------COPY SCRIPTS-- if(FORCE_OWN_FFTW) install(DIRECTORY external/fftw/lib/ DESTINATION lib FILES_MATCHING PATTERN "*") endif() list(APPEND RELION_SCRIPT_FILES star_printtable star_plottable star_loopheader star_datablock_stack star_datablock_singlefiles star_datablock_ctfdat qsub.csh) add_custom_target(copy_scripts ALL) foreach (SCRIPT_FILE ${RELION_SCRIPT_FILES}) add_custom_command(TARGET copy_scripts POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/scripts/${SCRIPT_FILE} ${CMAKE_BINARY_DIR}/bin/relion_${SCRIPT_FILE} ) endforeach() install( DIRECTORY ${CMAKE_BINARY_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*") install(FILES ${CMAKE_SOURCE_DIR}/src/gui_background.xpm DESTINATION lib) # install fltk if we built our own version if(INSTALL_OWN_FLTK) install(DIRECTORY external/fltk/lib/ DESTINATION lib FILES_MATCHING PATTERN "*") endif() # -----------------------------------------------------------------RELION COMPONENTS-- option(BUILD_SHARED_LIBS "BUILD_SHARED_LIBS" ON) if(BUILD_SHARED_LIBS) message(STATUS "Building shared libs (smaller build size and binaries)") else() message(STATUS "Building static libs (larger build size and binaries)") endif() ADD_SUBDIRECTORY(src/apps) # -----------------------------------------------------------------------------TESTS-- # Include testing flag(s) as precomiler # definitions and include test directives enable_testing() include(${CMAKE_SOURCE_DIR}/tests/RelionTests.cmake) # ----------------------------------------------------------PRINT OUT ALL CMAKE VARS-- #get_cmake_property(_variableNames VARIABLES) #foreach (_variableName ${_variableNames}) # message(STATUS "${_variableName}=${${_variableName}}") #endforeach() ChangeLogdeleted 100644 → 0 +0 −0 Empty file deleted. INSTALLdeleted 100644 → 0 +0 −268 Original line number Diff line number Diff line Specific Relion Installation Instructions ************************************************** Note that compilation of the parallel version of RELION needs an existing MPI installation on your system. We use the open-source flavour openMPI, but any flavour will probably do. Just make sure the mpi executables (e.g. mpiCC and mpirun) are in your PATH and the libraries are in your LD_LIBRARY_PATH. We use the following lines in our .cshrc: setenv PATH /public/EM/OpenMPI/bin:$PATH setenv LD_LIBRARY_PATH /public/EM/OpenMPI/lib:$LD_LIBRARY_PATH Together with the RELION source code, come tar.gz files for fftw-3.2.2 and fltk-1.3.0. These two external libraries are needed to build RELION. Standard installation of the whole package, including these external libraries is performed by executing the following command: ./INSTALL.sh -j 8 Where -j 8 indicates that 8 threads may be used in parallel for compilation. By default the package will be built inside the relion directory. Edit the PREFIX variable in the INSTALL.sh script to change this. See the RELION wiki pages (http://www2.mrc-lmb.cam.ac.uk/relion) for more details, e.g. on how to use pre-existing builds of fftw or fltk on your system. What follows is only useful if you want to configure RELION in non-standard ways. General Automake Installation Instructions ************************************************** Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. INSTALL.shdeleted 100755 → 0 +0 −91 Original line number Diff line number Diff line #!/usr/bin/env sh #Some flags variables BUILD_FFTW=true BUILD_FLTK=true BUILD_RELION=true N_THREADS=$@ # Use single-precision instead of the default of double-precision? FLOAT_PRECISION=false # do we have mpi and fltk? HAVE_MPI=true HAVE_FLTK=true #Some path variables RELION_HOME=$PWD PREFIX=$RELION_HOME #External libraries versions VFFTW=fftw-3.2.2 VFLTK=fltk-1.3.0 # Some other vars GREEN="\033[32m" ENDC="\033[0m" #################### FFTW ########################### # In case Fortran compilation fails consider adding --disable-fortran to the ./configure line below. if $BUILD_FFTW; then echo -e "$GREEN Compiling $VFFTW ...$ENDC" echo -e "See $RELION_HOME/external/fftw_build.log for details" cd external tar -zxf $VFFTW.tar.gz cd $VFFTW if $FLOAT_PRECISION; then float_option=" --enable-float " else float_option="" fi ./configure $float_option --enable-threads --enable-shared prefix=$PREFIX > $RELION_HOME/external/fftw_build.log make $N_THREADS >> $RELION_HOME/external/fftw_build.log make install >> $RELION_HOME/external/fftw_build.log cd ../.. fi #################### FLTK ########################### if $BUILD_FLTK; then echo -e "$GREEN Compiling $VFLTK ...$ENDC" echo -e "See $RELION_HOME/external/fltk_build.log for details" cd external tar -zxf $VFLTK.tar.gz cd $VFLTK ./configure --enable-shared prefix=$PREFIX > $RELION_HOME/external/fltk_build.log make $N_THREADS >> $RELION_HOME/external/fltk_build.log make install >> $RELION_HOME/external/fltk_build.log cd ../.. fi #################### RELION ########################### if $BUILD_RELION; then echo -e "$GREEN Compiling relion ...$ENDC" echo -e "See $RELION_HOME/relion_build.log for details" if $HAVE_FLTK; then fltk_cxx=`$PREFIX/bin/fltk-config --cxxflags` fltk_ld=`$PREFIX/bin/fltk-config --ldflags` else fltk_cxx="" fltk_ld="" fi if $FLOAT_PRECISION; then float_option=" --enable-float " else float_option="" fi if $HAVE_MPI; then mpi_option=" --enable-mpi " else mpi_option="" fi ./configure $mpi_option $float_option prefix=$PREFIX CPPFLAGS="-I$PREFIX/include $fltk_cxx" LDFLAGS="-L$PREFIX/lib $fltk_ld" > $RELION_HOME/relion_build.log make $N_THREADS >> $RELION_HOME/relion_build.log make install >> $RELION_HOME/relion_build.log mv $RELION_HOME/bin/relion_maingui $PREFIX/bin/relion cp $RELION_HOME/scripts/qsub.csh $PREFIX/bin/qsub.csh fi echo "Done!" Loading
CMakeLists.txt 0 → 100644 +283 −0 Original line number Diff line number Diff line cmake_minimum_required(VERSION 2.8.12) set(RELION_CMAKE_MINIMUM_REQUIRED_VERSION "2.8.12") # #if(POLICY CMP0048) # cmake_policy(SET CMP0048 NEW) #endif() project(Relion) # Use new policy for OS X @rpath if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() # Add the path to the additional Find<module>.cmake files # which are included with the distributed RLEION-code list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) add_definitions(-DINSTALL_LIBRARY_DIR=${CMAKE_INSTALL_PREFIX}/lib/) add_definitions(-DSOURCE_DIR=${CMAKE_SOURCE_DIR}/src/) # message(STATUS "INSTALL_LIBRARY_DIR set to ${CMAKE_INSTALL_PREFIX}/lib/") # message(STATUS "SOURCE_DIR set to ${CMAKE_SOURCE_DIR}/src/") # ------------------------------------------------------------------RPATH SETTINGS-- if(NOT APPLE) # use, i.e. don't skip the full RPATH for the build tree SET(CMAKE_SKIP_BUILD_RPATH FALSE) # when building, don't use the install RPATH already # (but later on when installing) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") ENDIF("${isSystemDir}" STREQUAL "-1") endif(NOT APPLE) # ---------------------------------------------------------SET SPECIFIC BUILD TYPE-- if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "") string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER ) if( ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "none" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "release" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "debug" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "relwithdebinfo" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "profiling" ) AND ( NOT ${CMAKE_BUILD_TYPE_LOWER} STREQUAL "benchmarking" ) ) message( FATAL_ERROR "CMAKE_BUILD_TYPE : '${CMAKE_BUILD_TYPE}' is not a valid build type. " "Valid options are: 'None', 'Release', 'Debug', 'RelWithDebInfo', and 'Profiling'." ) endif() message(STATUS "BUILD TYPE set to '${CMAKE_BUILD_TYPE}'") SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: 'None', 'Release', 'Debug', 'RelWithDebInfo', and 'Profiling'.") else() SET(CMAKE_BUILD_TYPE "Release") message(STATUS "BUILD TYPE set to the default type: '${CMAKE_BUILD_TYPE}'") string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER ) endif() # ------------------OPTIONS WHICH ARE NEEDED TO SET BUILD-TYPES (COMPILATION FLAGS)-- # ------------------------------------------------------------------------CUDA-ARCH-- if(NOT DEFINED CUDA_ARCH) message(STATUS "Setting fallback CUDA_ARCH=35") set(CUDARCH "-arch=sm_35") else(NOT DEFINED CUDA_ARCH) message(STATUS "Using provided CUDA_ARCH=${CUDA_ARCH}") set(CUDARCH "-arch=sm_${CUDA_ARCH}") endif(NOT DEFINED CUDA_ARCH) # -------------------------------------------------------------------FURTHER OPTIONS-- option(CUDA "Enable CUDA GPU acceleration" ON) option(DoublePrec_CPU "DoublePrec_CPU" ON) option(DoublePrec_GPU "DoublePrec_GPU" OFF) option(CudaTexture "CudaTexture" ON) # -----------------------------------------------DOUBLE PRECISION (CUDA-CODE) OR NOT-- if(DoublePrec_CPU) message(STATUS "Setting cpu precision to double") else(DoublePrec_CPU) message(STATUS "Setting cpu precision to single") add_definitions(-DRELION_SINGLE_PRECISION) endif(DoublePrec_CPU) if(DoublePrec_GPU) message(STATUS "Setting gpu precision to double") add_definitions(-DCUDA_DOUBLE_PRECISION) set(CudaTexture FALSE) else(DoublePrec_GPU) message(STATUS "Setting gpu precision to single") endif(DoublePrec_GPU) # ----------------------------------------------------------INCLUDE ALL BUILD TYPES-- #This *has* to be AFTER project() include(${CMAKE_SOURCE_DIR}/cmake/BuildTypes.cmake) if(CUDA) # -----------------------------------------------------------------------------CUDA-- # DOC: http://www.cmake.org/cmake/help/v3.0/module/FindCUDA.html FIND_PACKAGE(CUDA) endif() if(CUDA_FOUND) message(STATUS "Using cuda wrapper to compile....") if( (NOT ${CUDA_VERSION} VERSION_LESS "7.5") AND (NOT DoublePrec_GPU) ) message(STATUS "Cuda version is >= 7.5 and single-precision build, enable double usage warning.") set(WARN_DBL "--ptxas-options=-warn-double-usage") # cuda>=7.5 elseif( ${CUDA_VERSION} VERSION_LESS "7.0") message(WARNING "Cuda version is less than 7.0, so relion will be compiled without GPU support.") set(CUDA OFF) endif() if(CUDA) add_definitions(-DCUDA) endif() else(CUDA_FOUND) message(STATUS "Using non-cuda compilation....") endif(CUDA_FOUND) # ---------------------------------------------------------------USE TEXTURES OR NOT-- if(NOT CudaTexture) add_definitions(-DCUDA_NO_TEXTURES) message(STATUS "Texture interpolation is omitted.") endif(NOT CudaTexture) # ------------------------------------------------------------------ALLOCATOR CHOICE-- option(CachedAlloc "CachedAlloc" ON) if(NOT CachedAlloc) add_definitions(-DCUDA_NO_CUSTOM_ALLOCATION) message(STATUS "Cashed allocation is disabled.") endif(NOT CachedAlloc) option(CustomAllocMemGuards "CustomAllocMemGuards" OFF) if(CustomAllocMemGuards) add_definitions(-DCUSTOM_ALLOCATOR_MEMGUARD) message(STATUS "Abort on out of bound write.") endif(CustomAllocMemGuards) # -------------------------------------------------------------FORCE USE OF STL-LIBS-- option(CudaForceSTL "CudaForceSTL" OFF) if(CudaForceSTL) add_definitions(-DCUDA_FORCESTL) message(STATUS "Building cuda files wusing stl-libs for sort, min and max.") endif(CudaForceSTL) # ------------------------------------------------------------------------GUI OR NOT-- # Skip FLTK/X11-dependent binaries or not option(GUI "GUI" ON) if(NOT GUI) message(STATUS "Omitting GUI targets as per your request") endif() # -------------------------------------------------------------------------------MPI-- find_package(MPI REQUIRED) include_directories("${MPI_INCLUDE_PATH}") message(STATUS "MPI_INCLUDE_PATH : ${MPI_INCLUDE_PATH}") message(STATUS "MPI_LIBRARIES : ${MPI_LIBRARIES}") message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}") message(STATUS "MPI_CXX_LIBRARIES : ${MPI_CXX_LIBRARIES}") SET(CMAKE_C_COMPILER ${MPI_C_COMPILER}) SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) option(FORCE_OWN_FLTK "FORCE_OWN_FLTK" OFF) # --------------------------------------------------------------------------X11/FLTK-- FIND_PACKAGE(X11) if(GUI) if(X11_FOUND) set(FLTK_SKIP_OPENGL TRUE) #OpenGL is not required for relion if(NOT FORCE_OWN_FLTK) FIND_PACKAGE(FLTK) if(FLTK_FOUND) message(STATUS "X11 and FLTK were found") message(STATUS "FLTK_LIBRARIES: ${FLTK_LIBRARIES}") else() message(STATUS "FLTK was NOT found") endif() endif(NOT FORCE_OWN_FLTK) if(NOT FLTK_FOUND) include(${CMAKE_SOURCE_DIR}/cmake/BuildFLTK.cmake) set(INSTALL_OWN_FLTK 1) endif(NOT FLTK_FOUND) else(X11_FOUND) message( STATUS "\n-- ------------------ YOU HAVE NO X11-LIBS ------------------") message( STATUS "CCmake found no X11-libs on your system, which are required for the GUI.") message( STATUS " You CAN add the flag -DGUI=OFF to avoid using X11" ) message(FATAL_ERROR "X11 is required for GUI.") endif(X11_FOUND) endif(GUI) # ------------------------------------------------------------------------------FFTW-- option(FORCE_OWN_FFTW "FORCE_OWN_FFTW" OFF) if(NOT FORCE_OWN_FFTW) FIND_PACKAGE(FFTW) endif(NOT FORCE_OWN_FFTW) if(NOT FFTW_FOUND) include(${CMAKE_SOURCE_DIR}/cmake/BuildFFTW.cmake) endif(NOT FFTW_FOUND) include(CheckCXXSymbolExists) check_cxx_symbol_exists(sincos math.h HAVE_SINCOS) check_cxx_symbol_exists(__sincos math.h HAVE___SINCOS) if(HAVE_SINCOS) add_definitions(-DHAVE_SINCOS) endif() if(HAVE___SINCOS) add_definitions(-DHAVE___SINCOS) endif() # ----------------------------------------------------------------------COPY SCRIPTS-- if(FORCE_OWN_FFTW) install(DIRECTORY external/fftw/lib/ DESTINATION lib FILES_MATCHING PATTERN "*") endif() list(APPEND RELION_SCRIPT_FILES star_printtable star_plottable star_loopheader star_datablock_stack star_datablock_singlefiles star_datablock_ctfdat qsub.csh) add_custom_target(copy_scripts ALL) foreach (SCRIPT_FILE ${RELION_SCRIPT_FILES}) add_custom_command(TARGET copy_scripts POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/scripts/${SCRIPT_FILE} ${CMAKE_BINARY_DIR}/bin/relion_${SCRIPT_FILE} ) endforeach() install( DIRECTORY ${CMAKE_BINARY_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*") install(FILES ${CMAKE_SOURCE_DIR}/src/gui_background.xpm DESTINATION lib) # install fltk if we built our own version if(INSTALL_OWN_FLTK) install(DIRECTORY external/fltk/lib/ DESTINATION lib FILES_MATCHING PATTERN "*") endif() # -----------------------------------------------------------------RELION COMPONENTS-- option(BUILD_SHARED_LIBS "BUILD_SHARED_LIBS" ON) if(BUILD_SHARED_LIBS) message(STATUS "Building shared libs (smaller build size and binaries)") else() message(STATUS "Building static libs (larger build size and binaries)") endif() ADD_SUBDIRECTORY(src/apps) # -----------------------------------------------------------------------------TESTS-- # Include testing flag(s) as precomiler # definitions and include test directives enable_testing() include(${CMAKE_SOURCE_DIR}/tests/RelionTests.cmake) # ----------------------------------------------------------PRINT OUT ALL CMAKE VARS-- #get_cmake_property(_variableNames VARIABLES) #foreach (_variableName ${_variableNames}) # message(STATUS "${_variableName}=${${_variableName}}") #endforeach()
INSTALLdeleted 100644 → 0 +0 −268 Original line number Diff line number Diff line Specific Relion Installation Instructions ************************************************** Note that compilation of the parallel version of RELION needs an existing MPI installation on your system. We use the open-source flavour openMPI, but any flavour will probably do. Just make sure the mpi executables (e.g. mpiCC and mpirun) are in your PATH and the libraries are in your LD_LIBRARY_PATH. We use the following lines in our .cshrc: setenv PATH /public/EM/OpenMPI/bin:$PATH setenv LD_LIBRARY_PATH /public/EM/OpenMPI/lib:$LD_LIBRARY_PATH Together with the RELION source code, come tar.gz files for fftw-3.2.2 and fltk-1.3.0. These two external libraries are needed to build RELION. Standard installation of the whole package, including these external libraries is performed by executing the following command: ./INSTALL.sh -j 8 Where -j 8 indicates that 8 threads may be used in parallel for compilation. By default the package will be built inside the relion directory. Edit the PREFIX variable in the INSTALL.sh script to change this. See the RELION wiki pages (http://www2.mrc-lmb.cam.ac.uk/relion) for more details, e.g. on how to use pre-existing builds of fftw or fltk on your system. What follows is only useful if you want to configure RELION in non-standard ways. General Automake Installation Instructions ************************************************** Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details.
INSTALL.shdeleted 100755 → 0 +0 −91 Original line number Diff line number Diff line #!/usr/bin/env sh #Some flags variables BUILD_FFTW=true BUILD_FLTK=true BUILD_RELION=true N_THREADS=$@ # Use single-precision instead of the default of double-precision? FLOAT_PRECISION=false # do we have mpi and fltk? HAVE_MPI=true HAVE_FLTK=true #Some path variables RELION_HOME=$PWD PREFIX=$RELION_HOME #External libraries versions VFFTW=fftw-3.2.2 VFLTK=fltk-1.3.0 # Some other vars GREEN="\033[32m" ENDC="\033[0m" #################### FFTW ########################### # In case Fortran compilation fails consider adding --disable-fortran to the ./configure line below. if $BUILD_FFTW; then echo -e "$GREEN Compiling $VFFTW ...$ENDC" echo -e "See $RELION_HOME/external/fftw_build.log for details" cd external tar -zxf $VFFTW.tar.gz cd $VFFTW if $FLOAT_PRECISION; then float_option=" --enable-float " else float_option="" fi ./configure $float_option --enable-threads --enable-shared prefix=$PREFIX > $RELION_HOME/external/fftw_build.log make $N_THREADS >> $RELION_HOME/external/fftw_build.log make install >> $RELION_HOME/external/fftw_build.log cd ../.. fi #################### FLTK ########################### if $BUILD_FLTK; then echo -e "$GREEN Compiling $VFLTK ...$ENDC" echo -e "See $RELION_HOME/external/fltk_build.log for details" cd external tar -zxf $VFLTK.tar.gz cd $VFLTK ./configure --enable-shared prefix=$PREFIX > $RELION_HOME/external/fltk_build.log make $N_THREADS >> $RELION_HOME/external/fltk_build.log make install >> $RELION_HOME/external/fltk_build.log cd ../.. fi #################### RELION ########################### if $BUILD_RELION; then echo -e "$GREEN Compiling relion ...$ENDC" echo -e "See $RELION_HOME/relion_build.log for details" if $HAVE_FLTK; then fltk_cxx=`$PREFIX/bin/fltk-config --cxxflags` fltk_ld=`$PREFIX/bin/fltk-config --ldflags` else fltk_cxx="" fltk_ld="" fi if $FLOAT_PRECISION; then float_option=" --enable-float " else float_option="" fi if $HAVE_MPI; then mpi_option=" --enable-mpi " else mpi_option="" fi ./configure $mpi_option $float_option prefix=$PREFIX CPPFLAGS="-I$PREFIX/include $fltk_cxx" LDFLAGS="-L$PREFIX/lib $fltk_ld" > $RELION_HOME/relion_build.log make $N_THREADS >> $RELION_HOME/relion_build.log make install >> $RELION_HOME/relion_build.log mv $RELION_HOME/bin/relion_maingui $PREFIX/bin/relion cp $RELION_HOME/scripts/qsub.csh $PREFIX/bin/qsub.csh fi echo "Done!"