document modules; fixes #7

This commit is contained in:
Radovan Bast 2015-07-17 13:49:09 +02:00
parent 0292b001cc
commit e36fd4300f
8 changed files with 86 additions and 14 deletions

View File

@ -1,7 +1,12 @@
#.rst:
#
# Generates source code that echoes configuration and build
# Generates source code that echoes configuration, version, and build
# information to the program output.
#
# Example autocmake.cfg entry::
#
# [build_info]
# source: https://github.com/scisoft/autocmake/raw/master/modules/build_info.cmake
find_package(PythonInterp REQUIRED)

View File

@ -1,10 +1,32 @@
#.rst:
#
# Enables MPI support.
#
# Variables used::
#
# ENABLE_MPI
# MPI_FOUND
#
# Variables modified (provided the corresponding language is enabled)::
#
# CMAKE_Fortran_FLAGS
#
# Example autocmake.cfg entry::
#
# [mpi]
# source: https://github.com/scisoft/autocmake/raw/master/modules/mpi.cmake
# docopt: --mpi Enable MPI parallelization [default: False].
# define: '-DENABLE_MPI=%s' % arguments['--mpi']
option(ENABLE_MPI "Enable MPI parallelization" OFF)
# on Cray configure with -D MPI_FOUND=1
if(ENABLE_MPI AND NOT MPI_FOUND)
find_package(MPI)
if(MPI_FOUND)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${MPI_COMPILE_FLAGS}")
if(DEFINED CMAKE_Fortran_COMPILER_ID)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${MPI_COMPILE_FLAGS}")
endif()
include_directories(${MPI_INCLUDE_PATH})
else()
message(FATAL_ERROR "-- You asked for MPI, but CMake could not find any MPI installation, check $PATH")

View File

@ -1,9 +1,38 @@
#.rst:
#
# Enables OpenMP support.
#
# Variables used::
#
# ENABLE_OPENMP
# OPENMP_FOUND
#
# Variables modified (provided the corresponding language is enabled)::
#
# CMAKE_Fortran_FLAGS
# CMAKE_C_FLAGS
# CMAKE_CXX_FLAGS
#
# Example autocmake.cfg entry::
#
# [omp]
# source: https://github.com/scisoft/autocmake/raw/master/modules/omp.cmake
# docopt: --omp Enable OpenMP parallelization [default: False].
# define: '-DENABLE_OPENMP=%s' % arguments['--omp']
option(ENABLE_OPENMP "Enable OpenMP parallelization" OFF)
if(ENABLE_OPENMP)
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_C_FLAGS}")
if(DEFINED CMAKE_Fortran_COMPILER_ID)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_C_FLAGS}")
endif()
if(DEFINED CMAKE_C_COMPILER_ID)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
endif()
if(DEFINED CMAKE_CXX_COMPILER_ID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()
endif()

View File

@ -1,7 +0,0 @@
set(CPP)
# forward preprocessing directly to the code
if(NOT "${CPP}" STREQUAL "")
add_definitions(${CPP})
endif()

View File

@ -1 +1,14 @@
#.rst:
#
# Detects Python interpreter.
#
# Variables set::
#
# PYTHON_EXECUTABLE
#
# Example autocmake.cfg entry::
#
# [python]
# source: https://github.com/scisoft/autocmake/raw/master/modules/python.cmake
find_package(PythonInterp REQUIRED)

View File

@ -20,8 +20,8 @@ endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
if( NOT cmake_build_type_tolower STREQUAL "debug"
AND NOT cmake_build_type_tolower STREQUAL "release"
AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
if(NOT cmake_build_type_tolower STREQUAL "debug" AND
NOT cmake_build_type_tolower STREQUAL "release" AND
NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")
endif()

View File

@ -1,5 +1,10 @@
#.rst:
#
# Adds ${PROJECT_SOURCE_DIR}/src as subdirectory containing CMakeLists.txt.
#
# Example autocmake.cfg entry::
#
# [src]
# source: https://github.com/scisoft/autocmake/raw/master/modules/src.cmake
add_subdirectory(${PROJECT_SOURCE_DIR}/src)

View File

@ -9,6 +9,11 @@
# Variables defined::
#
# PROGRAM_VERSION
#
# Example autocmake.cfg entry::
#
# [version]
# source: https://github.com/scisoft/autocmake/raw/master/modules/version.cmake
if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION")
file(READ "${PROJECT_SOURCE_DIR}/VERSION" PROGRAM_VERSION)