From 71363f769aca41421450a935af03258bbd6d9d88 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Fri, 5 Apr 2019 11:02:12 +0200 Subject: [PATCH] Add a Sphinx doc --- CMakeLists.txt | 1 + cmake/modules/DuneCodegenMacros.cmake | 7 +- cmake/modules/GeneratedSystemtests.cmake | 85 +++++++++++++++++++++++- doc/CMakeLists.txt | 1 + 4 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 doc/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e333cab7..a4961090 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ dune_register_package_flags(LIBRARIES dunecodegen) dune_enable_all_packages() +add_subdirectory(doc) add_subdirectory(dune/codegen) add_subdirectory(cmake/modules) diff --git a/cmake/modules/DuneCodegenMacros.cmake b/cmake/modules/DuneCodegenMacros.cmake index 61713109..c4734857 100644 --- a/cmake/modules/DuneCodegenMacros.cmake +++ b/cmake/modules/DuneCodegenMacros.cmake @@ -22,19 +22,20 @@ # The name given to the added executable target. # # .. cmake_param:: SOURCE +# :single: # # The cc source file to build from. If omitted, a minimal # source file and a driver file will be generated. # # .. cmake_param:: FORM_COMPILER_ARGS # :multi: -# :argname arg: +# :argname: arg # # Additional arguments as recognized by the form compiler. # # .. cmake_param:: DEPENDS # :multi: -# :argname dep: +# :argname: dep # # Additional dependencies of the generated executable (changes in those # will retrigger generation) @@ -57,7 +58,7 @@ # # .. cmake_param:: ANALYZE_GRID_COMMAND # :multi: -# :argname command: +# :argname: command # # Use this to pass a custom grid analysis command. This is necessary # if you use a custom grid generation methdod. The inifile and the diff --git a/cmake/modules/GeneratedSystemtests.cmake b/cmake/modules/GeneratedSystemtests.cmake index 206ce3bc..fd401b9f 100644 --- a/cmake/modules/GeneratedSystemtests.cmake +++ b/cmake/modules/GeneratedSystemtests.cmake @@ -1,11 +1,85 @@ -# System testing for generated executables. All ideas taken from dune-testtools. +# System testing for generated executables. All ideas taken from dune-testtools. +# +# .. cmake_function:: dune_add_formcompiler_system_test +# +# .. cmake_param:: UFLFILE +# :single: +# :required: +# +# The UFL file to create the generate code from. +# +# .. cmake_param:: INIFILE +# :single: +# :required: +# +# The ini file that controls the form compilation process. +# It is expected to contain a [formcompiler] section. This +# file may contain meta ini annotations. +# +# .. cmake_param:: BASENAME +# :single: +# :required: +# +# The basename for the generated executables. +# +# .. cmake_param:: SCRIPT +# :single: +# +# The python script that decides about test failure/success. +# Defaults to a script that simply runs the program and checks +# the exit code. More scripts to be found in dune-testtools. +# +# .. cmake_param:: SOURCE +# :single: +# +# The cc source file to build from. If omitted, a minimal +# source file and a driver file will be generated. +# +# .. cmake_param:: CREATED_TARGETS +# :single: +# +# A variable name that should be filled with the list of generated +# targets. This can be used to modify these lateron. +# +# .. cmake_param:: DEPENDS +# :multi: +# :argname: dep +# +# Additional dependencies of the generated executable (changes in those +# will retrigger generation) +# +# .. cmake_param:: NO_TESTS +# :option: +# +# If given, code will be generated and built normally, but no tests will +# be added to the test suite. +# +# .. cmake_param:: ANALYZE_GRID +# :option: +# +# Set this option to enable code generation time grid analysis. +# This is useful to reduce the variety of sum factorization kernels +# in unstructured grids. Note that the grid analysis tool needs to +# be able to construct your grid from the given inifile. If you have +# a custom grid construction method, you can use ANALYZE_GRID_COMMAND +# instead. +# +# .. cmake_param:: ANALYZE_GRID_COMMAND +# :multi: +# :argname: command +# +# Use this to pass a custom grid analysis command. This is necessary +# if you use a custom grid generation methdod. The inifile and the +# outputfile will be appended to this command. You can use the analysis code in +# dune/codegen/sumfact/analyzegrid.hh to write your own tool. +# Specifying this option will automatically set ANALYZE_GRID. # function(dune_add_formcompiler_system_test) # parse arguments set(OPTION DEBUG NO_TESTS ANALYZE_GRID) - set(SINGLE INIFILE BASENAME SCRIPT UFLFILE SOURCE) - set(MULTI CREATED_TARGETS DEPENDS) + set(SINGLE INIFILE BASENAME SCRIPT UFLFILE SOURCE CREATED_TARGETS) + set(MULTI DEPENDS ANALYZE_GRID_COMMAND) cmake_parse_arguments(SYSTEMTEST "${OPTION}" "${SINGLE}" "${MULTI}" ${ARGN}) if(SYSTEMTEST_UNPARSED_ARGUMENTS) @@ -25,6 +99,10 @@ function(dune_add_formcompiler_system_test) if(SYSTEMTEST_ANALYZE_GRID) set(ANALYZE_GRID_STR "ANALYZE_GRID") endif() + set(ANALYZE_GRID_COMMAND_STR "") + if(SYSTEMTEST_ANALYZE_GRID_COMMAND) + set(ANALYZE_GRID_COMMAND_STR "ANALYZE_GRID_COMMAND ${SYSTEMTEST_ANALYZE_GRID_COMMAND}") + endif() # set a default for the script. call_executable.py just calls the executable. # There, it is also possible to hook in things depending on the inifile @@ -62,6 +140,7 @@ function(dune_add_formcompiler_system_test) EXCLUDE_FROM_ALL ${SOURCE} ${ANALYZE_GRID_STR} + ${ANALYZE_GRID_COMMAND_STR} ) # Enrich the target with preprocessor variables from the __static section diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..956de868 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1 @@ +dune_cmake_sphinx_doc(MODULE_ONLY) -- GitLab