VS2015 + CMake + shared build?

18 views
Skip to first unread message

James Turner

unread,
Jun 14, 2016, 9:08:43 AM6/14/16
to fltk.general
Hello,

I'm trying to create a shared build of FLTK, using VS2015. Since I am most familiar and comfortable with CMake, I used that to generate the VS solution and projects. The CMake step runs correctly, but when building the solution I encounter many linker errors (thousands!), suggesting maybe some or many symbols are not being exported from the DLLs correctly.

Currently I'm testing with the stable 1.3.3 release - is myconfiguration supported, perhaps in a more recent 1.3.3 snapshot version? Or do I need to switch to some other build system, and if so, which one is recommended on Window for VS2015 support?

Thanks,
James

Albrecht Schlosser

unread,
Jun 14, 2016, 9:41:03 AM6/14/16
to fltkg...@googlegroups.com
On 14.06.2016 13:40 James Turner wrote:

> I'm trying to create a shared build of FLTK, using VS2015. Since I am
> most familiar and comfortable with CMake, I used that to generate the VS
> solution and projects. The CMake step runs correctly, but when building
> the solution I encounter many linker errors (thousands!), suggesting
> maybe some or many symbols are not being exported from the DLLs correctly.

Yep, that's a known problem, but it doesn't seem to be as simple as
missing exported symbols, unfortunately. CMake is not yet officially
supported in FLTK 1.3.x, so this is likely not going to change in the
next release as well (FLTK 1.3.4). Please see below for options.

CMake will be the only supported build system for Windows IDE solutions
in FLTK 1.4.0 and later (no bundled IDE files).

> Currently I'm testing with the stable 1.3.3 release - is myconfiguration
> supported, perhaps in a more recent 1.3.3 snapshot version? Or do I need
> to switch to some other build system, and if so, which one is
> recommended on Window for VS2015 support?

There are several options.

VS2015 works well with the provided ide files in folder ide/VS2010. Here
are the last lines of my builds in Debug and Release mode (just tested):

79> demo.cxx
79> demo.vcxproj -> C:\git\fltk\ide\VisualC2010\..\..\test\demod.exe
========== Rebuild All: 79 succeeded, 0 failed, 0 skipped ==========

79> demo.cxx
79> demo.vcxproj -> C:\git\fltk\ide\VisualC2010\..\..\test\demo.exe
79> demo.vcxproj -> .\demo_release\demo.pdb (Full PDB)
========== Rebuild All: 79 succeeded, 0 failed, 0 skipped ==========

This IDE solution builds object and shared libraries (dll's).


As said before, CMake is not yet fully supported in fltk 1.3.x. If you
want to build with CMake and VS 2015 you should deactivate
OPTION_BUILD_SHARED_LIBS, and your build should succeed, like mine:


88>------ Skipped Rebuild All: Project: INSTALL, Configuration: Debug
x64 ------
88>Project not selected to build for this solution configuration
========== Rebuild All: 86 succeeded, 0 failed, 2 skipped ==========


Of course, there will be no FLTK dll's.

Under Windows you could also try the MinGW build with or w/o CMake.

That said, if you are familiar with CMake and VS, then you might want to
test why the shared build doesn't work. Patches and other hints are
always welcome.

Note: just adding FL_EXPORT to some missing symbol definitions is not
the way to go, since the provided IDE solutions build dll's correctly. I
assume that there must be something awry with the CMake files so that we
don't generate the correct dependencies. One difference is that the
bundled IDE files link all test programs statically, whereas the CMake
generated IDE tries to link them with the shared libs. We'd like to link
with the static libs though, as it is done in the supplied IDE
solutions. If you know how to do that patches would be appreciated.

Reply all
Reply to author
Forward
0 new messages