# Initial attempt of using CMake to build the spectral solver # --> CMake should be able to take care of the dependence by itself. # cmake_minimum_required (VERSION 3.1.0) project (DAMASKSpectral Fortran) # make sure that the default is a RELEASE if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: None Debug Release." FORCE) endif (NOT CMAKE_BUILD_TYPE) # The version number. set (DAMASKSpectral_VERSION_MAJOR 1) set (DAMASKSpectral_VERSION_MINOR 0) # Set up build directory set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/build) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) # setup modules find_package(petsc) find_package(hdf5) # FFLAGS depend on the compiler # need extra time to work on these get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) if (Fortran_COMPILER_NAME MATCHES "gfortran.*") # gfortran set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3") set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g") elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") # ifort (untested) set (CMAKE_Fortran_FLAGS_RELEASE "-f77rtl -O3") set (CMAKE_Fortran_FLAGS_DEBUG "-f77rtl -O0 -g") elseif (Fortran_COMPILER_NAME MATCHES "g77") # g77 set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3 -m32") set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g -m32") else (Fortran_COMPILER_NAME MATCHES "gfortran.*") message ("CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER}) message ("Fortran compiler: " ${Fortran_COMPILER_NAME}) message ("No optimized Fortran compiler flags are known, we just try -O2...") set (CMAKE_Fortran_FLAGS_RELEASE "-O2") set (CMAKE_Fortran_FLAGS_DEBUG "-O0 -g") endif (Fortran_COMPILER_NAME MATCHES "gfortran.*") # add code(source) directory add_subdirectory(code)