Static compilation of taglib_c / wchar_t setting

View: New views
2 Messages — Rating Filter:   Alert me  

Static compilation of taglib_c / wchar_t setting

by Lars Wehmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

we believe we have found a minor issue in both the CMakeLists.txt and in
tag_c.cpp which prevents taglib_c from being built as a static library
by simply setting ENABLE_STATIC. Please review the patches below. They
appear to be working for both Windows and Linux.


Also, when using a statically compiled taglib lbrary in conjunction with
boost stuff and wide characters using Visual Studio 2005, we got linker
  errors. They are caused bsy a define in the top-level CMakeLists.txt:

add_definitions(/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
/Zc:wchar_t-)

It seems the changed default behavior of VS2005 to have wchar_t
activated leads to an incompatibility with the precompiled boost
libraries we are using. Maybe this should go somewhere in the FAQ
(couldn't find any mention of this issue)-

Keep up the good work!

Matthias Eichner
Lars Wehmeyer

----------------------------------------------------------------------

--- taglib-1.6/bindings/c/CMakeLists.txt 2009-09-08 10:52:57.000000000 +0200
+++ NEW/taglib-1.6/bindings/c/CMakeLists.txt 2009-10-02
11:36:46.000000000 +0200
@@ -18,9 +18,11 @@
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc )
  ########### next target ###############

-ADD_LIBRARY(tag_c SHARED tag_c.cpp)
  if(ENABLE_STATIC)
+    ADD_LIBRARY(tag_c STATIC tag_c.cpp)
      set_target_properties(tag_c PROPERTIES COMPILE_DEFINITIONS
TAGLIB_STATIC)
+else(ENABLE_STATIC)
+    ADD_LIBRARY(tag_c SHARED tag_c.cpp)
  endif(ENABLE_STATIC)

  TARGET_LINK_LIBRARIES(tag_c  tag )

----------------------------------------------------------------------

--- taglib-1.6/bindings/c/tag_c.h 2008-11-12 09:17:11.000000000 +0100
+++ NEW/taglib-1.6/bindings/c/tag_c.h 2009-10-02 11:35:11.000000000 +0200
@@ -29,7 +29,7 @@
  extern "C" {
  #endif

-#if defined(_WIN32) || defined(_WIN64)
+#if !defined(TAGLIB_STATIC) && (defined(_WIN32) || defined(_WIN64))
  #ifdef MAKE_TAGLIB_C_LIB
  #define TAGLIB_C_EXPORT __declspec(dllexport)
  #else

----------------------------------------------------------------------


_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel

Re: Static compilation of taglib_c / wchar_t setting

by Bugzilla from lalinsky@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 2, 2009 at 1:28 PM, Lars Wehmeyer <Lars.Wehmeyer@...> wrote:
> we believe we have found a minor issue in both the CMakeLists.txt and in
> tag_c.cpp which prevents taglib_c from being built as a static library
> by simply setting ENABLE_STATIC. Please review the patches below. They
> appear to be working for both Windows and Linux.

I've found this while working on ENABLE_STATIC, but I wasn't sure
whether to include it. The thing is that if you build the C bindings
in static mode, you need to link the application to the standard C++
libraries (for example, the patch as it is fails to build the C
example).

> Also, when using a statically compiled taglib lbrary in conjunction with
> boost stuff and wide characters using Visual Studio 2005, we got linker
>  errors. They are caused bsy a define in the top-level CMakeLists.txt:
>
> add_definitions(/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
> /Zc:wchar_t-)
>
> It seems the changed default behavior of VS2005 to have wchar_t
> activated leads to an incompatibility with the precompiled boost
> libraries we are using. Maybe this should go somewhere in the FAQ
> (couldn't find any mention of this issue)-

I'm not sure why these options are there. I think changing the default
behavior of wchar_t is a bad idea, so I'll remove it. The next TagLib
release is not going to be binary compatible anyway, so that shouldn't
be a problem.

--
Lukas Lalinsky
lalinsky@...
_______________________________________________
taglib-devel mailing list
taglib-devel@...
https://mail.kde.org/mailman/listinfo/taglib-devel