I am not sure this is the way we want to do it. get_swig_binary() relies
on check_and_set_swig_binary() has been called previously. The latter can
cause problems on clusters. The logic for the generated CMake file is that
it should contain all information needed to compile the extension module
and that it should get that from including the DOLFIN_USE_FILE. In that
file we do not store any SWIG information. Instead we just call:
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
essentially re-configuring SWIG. We cannot avoid that, as we need to load
the swig specific cmake macros from the SWIG_USE_FILE, but we could for
example set SWIG_EXECUTABLE in the DOLFINConfig.cmake file, which is
generated during configuration of DOLFIN?
Johan
On Thu, Jan 16, 2014 at 9:47 AM, Johannes Ring <[email protected]> wrote:
> On Wed, Jan 15, 2014 at 2:20 PM, Jan Blechta <[email protected]>
> wrote:
> > On Tue, 14 Jan 2014 17:42:42 +0100
> > Johannes Ring <[email protected]> wrote:
> >
> >> On Tue, Jan 14, 2014 at 5:06 PM, Jan Blechta
> >> <[email protected]> wrote:
> >> > Is there a way choosing a SWIG installation if there are multiple of
> >> > them on the system? It seems that CMake-built-in FindSWIG, say
> >> >
> >> > $CMAKE_ROOT/share/cmake-2.8/Modules/FindSWIG.cmake
> >> >
> >> > picks one regardless of preset values SWIG_DIR and SWIG_EXECUTABLE.
> >>
> >> You should be able to force this by running cmake with
> >> -DSWIG_EXECUTABLE:FILEPATH=/path/to/swig. Doesn't that work for you?
> >
> > Ok, this works. But generated code uses wrong swig version and
> > ffc/jitcompiler.py:check_swig_version(compiled_module) raises.
> >
> > I guess that possible reason is that one my SWIGs has both swig2.0 and
> > swig executables while another has only swig. FindSWIG.cmake prefers
> > swig2.0 executable. So can -DSWIG_EXECUTABLE be passed to cmake when
> > configuring an extension module?
>
> See attached patch for Instant. I haven't tested it but maybe
> something like that will fix this problem? Not sure it is a good fix
> though.
>
> Setting CMAKE_PREFIX_PATH might also help CMake pick the correct swig
> binary.
>
> Johannes
>
> _______________________________________________
> fenics-support mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics-support
>
>
_______________________________________________
fenics-support mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics-support