From 78210f348031f88a4384cd7c35a604ee35084392 Mon Sep 17 00:00:00 2001 From: Gerry Chen Date: Thu, 8 Apr 2021 04:34:23 -0400 Subject: [PATCH] Squashed 'wrap/' changes from 5ddaff8ba..b43f7c6d7 b43f7c6d7 Merge pull request #80 from borglab/feature/multiple_interface_files 7b9d080f5 Revert "unit test for printing with keyformatter" 45e203195 Revert "funcitonal print passes unit test" 8b5d66f03 Revert "include functional and iostream" 34bfbec21 Revert "delete debug statement" dbe661c93 Revert "add includes to the example tpl file." f47e23f1a Revert "Revert "function to concatenate multiple header files together"" e667e2095 Revert "function to concatenate multiple header files together" 600c77bf4 add includes to the example tpl file. d5caca20e delete debug statement 4a554edb8 include functional and iostream e8ad2c26f funcitonal print passes unit test 077d5c4e7 unit test for printing with keyformatter d5a1e6dff function to concatenate multiple header files together git-subtree-dir: wrap git-subtree-split: b43f7c6d7d6cb50ebe585d7e38390e2bfeb51dde --- cmake/GtwrapUtils.cmake | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cmake/GtwrapUtils.cmake b/cmake/GtwrapUtils.cmake index 8479015dc..3c26e70ae 100644 --- a/cmake/GtwrapUtils.cmake +++ b/cmake/GtwrapUtils.cmake @@ -103,3 +103,37 @@ macro(gtwrap_get_python_version) configure_python_variables() endmacro() + +# Concatenate multiple wrapper interface headers into one. +# The concatenation will be (re)performed if and only if any interface files +# change. +# +# Arguments: +# ~~~ +# destination: The concatenated master interface header file will be placed here. +# inputs (optional): All the input interface header files +function(combine_interface_headers + destination + #inputs + ) + # check if any interface headers changed + foreach(INTERFACE_FILE ${ARGN}) + if(NOT EXISTS ${destination} OR + ${INTERFACE_FILE} IS_NEWER_THAN ${destination}) + set(UPDATE_INTERFACE TRUE) + endif() + # trigger cmake on file change + set_property(DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS ${INTERFACE_FILE}) + endforeach() + # if so, then update the overall interface file + if (UPDATE_INTERFACE) + file(WRITE ${destination} "") + # append additional interface headers to end of gtdynamics.i + foreach(INTERFACE_FILE ${ARGN}) + file(READ ${INTERFACE_FILE} interface_contents) + file(APPEND ${destination} "${interface_contents}") + endforeach() + endif() +endfunction()