diff options
author | Karl Wette <karl.wette@ligo.org> | 2020-05-29 17:05:01 +1000 |
---|---|---|
committer | Karl Wette <karl.wette@ligo.org> | 2020-05-31 22:11:51 +1000 |
commit | d11e29615d43a5962129724b4097422282ebd8fa (patch) | |
tree | 9e2766baf557a734d76ba55d0ac94a1625f9c152 /Lib/octave | |
parent | df8bb1feeb200caf718b53168c056ad0e61bb8ab (diff) | |
download | swig-d11e29615d43a5962129724b4097422282ebd8fa.tar.gz |
Octave: use pre-compiled headers to speed up test suite, if supported
Diffstat (limited to 'Lib/octave')
-rw-r--r-- | Lib/octave/director.swg | 2 | ||||
-rw-r--r-- | Lib/octave/extra-install.list | 2 | ||||
-rw-r--r-- | Lib/octave/octcontainer.swg | 7 | ||||
-rw-r--r-- | Lib/octave/octheaders.hpp | 130 | ||||
-rw-r--r-- | Lib/octave/octrun.swg | 4 | ||||
-rw-r--r-- | Lib/octave/octruntime.swg | 109 | ||||
-rw-r--r-- | Lib/octave/std_complex.i | 4 |
7 files changed, 136 insertions, 122 deletions
diff --git a/Lib/octave/director.swg b/Lib/octave/director.swg index bf71d18e8..5b9cd86e0 100644 --- a/Lib/octave/director.swg +++ b/Lib/octave/director.swg @@ -7,8 +7,6 @@ # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) -#include <exception> - namespace Swig { class Director { diff --git a/Lib/octave/extra-install.list b/Lib/octave/extra-install.list new file mode 100644 index 000000000..41ef94778 --- /dev/null +++ b/Lib/octave/extra-install.list @@ -0,0 +1,2 @@ +# see top-level Makefile.in +octheaders.hpp diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg index 310a849d9..80d593f4f 100644 --- a/Lib/octave/octcontainer.swg +++ b/Lib/octave/octcontainer.swg @@ -11,12 +11,6 @@ * be the case. * ----------------------------------------------------------------------------- */ -%{ -#include <climits> -#include <iostream> -%} - - #if !defined(SWIG_NO_EXPORT_ITERATOR_METHODS) # if !defined(SWIG_EXPORT_ITERATOR_METHODS) # define SWIG_EXPORT_ITERATOR_METHODS SWIG_EXPORT_ITERATOR_METHODS @@ -64,7 +58,6 @@ namespace swig { %fragment("OctSequence_Base","header",fragment="<stddef.h>") { -%#include <functional> namespace std { template <> diff --git a/Lib/octave/octheaders.hpp b/Lib/octave/octheaders.hpp new file mode 100644 index 000000000..abf6428e7 --- /dev/null +++ b/Lib/octave/octheaders.hpp @@ -0,0 +1,130 @@ +// +// This header includes all C++ headers required for generated Octave wrapper code. +// Using a single header file allows pre-compilation of Octave headers, as follows: +// * Check out this header file: +// swig -octave -co octheaders.hpp +// * Pre-compile header file into octheaders.hpp.gch: +// g++ -c ... octheaders.hpp +// * Use pre-compiled header file: +// g++ -c -include octheaders.hpp ... +// + +#if !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) +#define _SWIG_OCTAVE_OCTHEADERS_HPP + +// Required C++ headers +#include <cstdlib> +#include <climits> +#include <iostream> +#include <exception> +#include <functional> +#include <complex> +#include <string> +#include <vector> +#include <map> + +// Minimal headers to define Octave version +#include <octave/oct.h> +#include <octave/version.h> + +// Macro for enabling features which require Octave version >= major.minor.patch +// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers +#define SWIG_OCTAVE_PREREQ(major, minor, patch) \ + ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) ) + +// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1 +#if !defined(OCTAVE_MAJOR_VERSION) + +# if !defined(OCTAVE_API_VERSION_NUMBER) + +// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet +// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER +# include <octave/ov.h> +# if defined(octave_ov_h) +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 8 +# define OCTAVE_PATCH_VERSION 0 +# else + +// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed +# define ComplexLU __ignore +# include <octave/CmplxLU.h> +# undef ComplexLU +# if defined(octave_Complex_LU_h) + +// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 1 +# define OCTAVE_PATCH_VERSION 99 + +# else + +// OCTAVE_API_VERSION_NUMBER == 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 2 +# define OCTAVE_PATCH_VERSION 0 + +# endif // defined(octave_Complex_LU_h) + +# endif // defined(octave_ov_h) + +// Correlation between Octave API and version numbers extracted from Octave's +// ChangeLogs; version is the *earliest* released Octave with that API number +# elif OCTAVE_API_VERSION_NUMBER >= 48 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 6 +# define OCTAVE_PATCH_VERSION 0 + +# elif OCTAVE_API_VERSION_NUMBER >= 45 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 4 +# define OCTAVE_PATCH_VERSION 1 + +# elif OCTAVE_API_VERSION_NUMBER >= 42 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 54 + +# elif OCTAVE_API_VERSION_NUMBER >= 41 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 53 + +# elif OCTAVE_API_VERSION_NUMBER >= 40 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 52 + +# elif OCTAVE_API_VERSION_NUMBER >= 39 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 51 + +# else // OCTAVE_API_VERSION_NUMBER == 38 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 50 + +# endif // !defined(OCTAVE_API_VERSION_NUMBER) + +#endif // !defined(OCTAVE_MAJOR_VERSION) + +// Required Octave headers +#include <octave/Cell.h> +#include <octave/dynamic-ld.h> +#include <octave/oct-env.h> +#include <octave/oct-map.h> +#include <octave/ov-scalar.h> +#include <octave/ov-fcn-handle.h> +#include <octave/parse.h> +#if SWIG_OCTAVE_PREREQ(4,2,0) +#include <octave/interpreter.h> +#else +#include <octave/toplev.h> +#endif +#include <octave/unwind-prot.h> +#if SWIG_OCTAVE_PREREQ(4,2,0) +#include <octave/call-stack.h> +#endif + +#endif // !defined(_SWIG_OCTAVE_OCTHEADERS_HPP) diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg index 162772d98..944b72a63 100644 --- a/Lib/octave/octrun.swg +++ b/Lib/octave/octrun.swg @@ -89,10 +89,6 @@ SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *point // Runtime API implementation -#include <map> -#include <vector> -#include <string> - typedef octave_value_list(*octave_func) (const octave_value_list &, int); class octave_swig_type; diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg index 2f0cf58aa..a397fb7c1 100644 --- a/Lib/octave/octruntime.swg +++ b/Lib/octave/octruntime.swg @@ -1,111 +1,10 @@ +#ifdef SWIG_OCTAVE_EXTERNAL_OCTHEADERS %insert(runtime) %{ - -#include <cstdlib> -#include <iostream> - -#include <octave/oct.h> -#include <octave/version.h> - -// Macro for enabling features which require Octave version >= major.minor.patch -// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers -#define SWIG_OCTAVE_PREREQ(major, minor, patch) \ - ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) ) - -// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1 -#if !defined(OCTAVE_MAJOR_VERSION) - -# if !defined(OCTAVE_API_VERSION_NUMBER) - -// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet -// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER -# include <octave/ov.h> -# if defined(octave_ov_h) -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 8 -# define OCTAVE_PATCH_VERSION 0 -# else - -// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed -# define ComplexLU __ignore -# include <octave/CmplxLU.h> -# undef ComplexLU -# if defined(octave_Complex_LU_h) - -// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 1 -# define OCTAVE_PATCH_VERSION 99 - -# else - -// OCTAVE_API_VERSION_NUMBER == 37 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 2 -# define OCTAVE_PATCH_VERSION 0 - -# endif // defined(octave_Complex_LU_h) - -# endif // defined(octave_ov_h) - -// Correlation between Octave API and version numbers extracted from Octave's -// ChangeLogs; version is the *earliest* released Octave with that API number -# elif OCTAVE_API_VERSION_NUMBER >= 48 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 6 -# define OCTAVE_PATCH_VERSION 0 - -# elif OCTAVE_API_VERSION_NUMBER >= 45 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 4 -# define OCTAVE_PATCH_VERSION 1 - -# elif OCTAVE_API_VERSION_NUMBER >= 42 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 54 - -# elif OCTAVE_API_VERSION_NUMBER >= 41 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 53 - -# elif OCTAVE_API_VERSION_NUMBER >= 40 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 52 - -# elif OCTAVE_API_VERSION_NUMBER >= 39 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 51 - -# else // OCTAVE_API_VERSION_NUMBER == 38 -# define OCTAVE_MAJOR_VERSION 3 -# define OCTAVE_MINOR_VERSION 3 -# define OCTAVE_PATCH_VERSION 50 - -# endif // !defined(OCTAVE_API_VERSION_NUMBER) - -#endif // !defined(OCTAVE_MAJOR_VERSION) - -#include <octave/Cell.h> -#include <octave/dynamic-ld.h> -#include <octave/oct-env.h> -#include <octave/oct-map.h> -#include <octave/ov-scalar.h> -#include <octave/ov-fcn-handle.h> -#include <octave/parse.h> -#if SWIG_OCTAVE_PREREQ(4,2,0) -#include <octave/interpreter.h> +#include "octheaders.hpp" +%} #else -#include <octave/toplev.h> +%insert(runtime) "octheaders.hpp"; #endif -#include <octave/unwind-prot.h> -#if SWIG_OCTAVE_PREREQ(4,2,0) -#include <octave/call-stack.h> -#endif - -%} %insert(runtime) "swigrun.swg"; %insert(runtime) "swigerrors.swg"; diff --git a/Lib/octave/std_complex.i b/Lib/octave/std_complex.i index 30c188244..461e2fdfc 100644 --- a/Lib/octave/std_complex.i +++ b/Lib/octave/std_complex.i @@ -4,10 +4,6 @@ %include <octcomplex.swg> -%{ -#include <complex> -%} - namespace std { %naturalvar complex; template<typename T> class complex; |