Thursday, June 18, 2015

build sigc++ in visual studio

Problem


I need to compile static x64 library sigc++ with static runtime in Visual Studio 2013. It's required to compile glibmm.


Tools and versions:
  • sigc++ 2.4.1 (will also note of 2.0.6 version)
  • visual studio 2013
  • cygwin (32-bits in my case)

Action


1. At http://libsigc.sourceforge.net/stable.shtml find link on ftp & download some (for today last version - 2.4.1).
2. open Cygwin.bat
3. go to dir with sigc++
4. ./configure
5. in 'sigc++config.h' comment '#  define SIGC_DLL 1'it needs only if you want to build static library. __declspec(dllimport) from defines will fail building otherwise.
be attentive - there are as minimum two files, where you must to do it:
- libsigc++-2.4.1\sigc++config.h
- libsigc++-2.4.1\MSVC_Net2010\sigc++config.h
6. open 'D:\tmp\libraries\libsigc++-2.4.1\MSVC_Net2010\libsigc++2.sln'
7. in 'project settings -> general' of the project 'libsigc++' set 'static library'
8. set runtime library /MT or /MTd in:
  • all projects properties
  • in all files in project libsigc++
  • in property sheets 'Upgrade from VC 7.1', 'Microsoft.Cpp.x64.user'
9. build
here will built a lot of exe - no one must crashes


Note for those who builds it for glibmm


You need to compile it also with cygwin (it will be required by glibmm to generate some source files). So, open x32 cygwin (don't know if x64 cygwin will works - on some another projects it didn't work), go to directory with sources (for example it's 'd:/projects/libraries/libxmlplusplus/libsig++-2.4.1'), and exec:
./configure --prefix=d:/projects/libraries/libxmlplusplus/libsigc++-2.4.1/_cygwin
make
make install

and copy
    D:\projects\libraries\libxmlplusplus\libsigc++-2.4.1\sigc++config.h
to
    D:\projects\libraries\libxmlplusplus\libsigc++-2.4.1\_cygwin\include\sigc++-2.0\sigc++config.h
and don't forget check - '#  define SIGC_DLL 1' must be commented.

Note of version 2.0.6.

After ./configure you need to make several addition steps:
  • add path to sigc++ library into 'additional include directories' in every test project
  • insert '#include <cstddef>' into the beginning of files: signal_base.h, signal.h
  • in 'test_deduce_result_type' replace "main()" to "int main()" & insert "return 0;" into the end of main function.
  • also maybe you will need to comment define 'SIGC_TYPEDEF_REDEFINE_ALLOWED'.
  • replace sig++config.h in root sig++ directory by file sig++config.h from MSVC_Net2003 directory.
Msys built 2.0.6 correctly.
Also interesting - in the internet people advices open solution file after ./configure & make, but I've found make don't change source files - so, you don't need to call 'make' - only './configure'.

1 comment: