[petsc-users] Build PETSc as shared library on Windows ("traditional" build or CMake)

E. Tadeu e.tadeu at gmail.com
Wed Mar 16 15:48:01 CDT 2016


Of course, this is what I did (I'm building it for MSVC 2010, but it should
be similar for other versions):

 - call `setenv.cmd` (or `vcvarsall`) to configure the compiler environment
(this should be configured at all steps)
 - enter Cygwin, call `configure` normally from inside Cygwin, adding
`--with-shared-libraries=1`  (the output says "shared libraries: disabled",
but no problem)
 - modify PETScConfig.cmake to replace `/cygdrive/c/` with `C:/`
 - if needed, change `iomp5md` to `libiomp5md`
 - add `add_definitions(-DPETSC_USE_SHARED_LIBRARIES=1)` after the project
line of CMakeLists.txt
 - outside of Cygwin, call cmake like this, from inside the
"arch-mswin-c-opt" directory:

    cmake .. -G "Visual Studio 10 2010 Win64"
-DPETSC_CMAKE_ARCH=arch-mswin-c-opt -DCMAKE_C_FLAGS="-wd4996"
-DBUILD_SHARED_LIBS:BOOL=ON

 - build the generated PETSc.sln from inside Visual Studio


On Wed, Mar 16, 2016 at 5:27 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
> > On Mar 16, 2016, at 3:22 PM, E. Tadeu <e.tadeu at gmail.com> wrote:
> >
> > Thanks Satish,
> >
> >   Just to let you know, with a few minor modifications and extra
> parameters, I've managed to build it using configure under Cygwin, and
> then, outside cygwin, running non-cygwin cmake inside the "arch-..."
> folder, targeting MSVC.
>
>   Awesome, can you send any changes you needed to make to PETSc so other
> users can benefit?
>
>   Barry
>
> >
> >
> > On Mon, Mar 14, 2016 at 6:31 PM, Satish Balay <balay at mcs.anl.gov> wrote:
> > you could try precompiled petsc from
> > http://www.msic.ch/Downloads/Software
> > [its old 3.5 version though]
> >
> > We don't have any changes wrt .dlls or cmake on windows..
> >
> > Satish
> >
> > On Mon, 14 Mar 2016, E. Tadeu wrote:
> >
> > > Hi,
> > >
> > >   What is the current status of building PETSc as a shared library on
> > > Windows? It seems non-trivial: `--with-shared-libraries=1` won't work,
> > > since Cygwin's `ld` fails, and `win32fe` also fails.
> > >
> > >   Also, what is the status of building PETSc with CMake on Windows?
> Perhaps
> > > through using CMake it would be easier to generate the .DLL's, but I
> > > couldn't find documentation on how to do this.
> > >
> > >
> > >  Thanks!
> > > Edson
> > >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160316/cc078cb6/attachment.html>


More information about the petsc-users mailing list