From e8b38f899c792565de4bbb09b14f7962d441faee Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 12 Jan 2018 08:57:08 -0500 Subject: [PATCH] [build] Improve and document MSVC build. * include/freetype/config/ftconfig.h: Guard dllexport/dllimport attributes with _DLL and FT2_DLLIMPORT. * builds/windows/vc2010/index.html: Update documentation. --- ChangeLog | 8 ++++++ builds/windows/vc2010/index.html | 40 +++++++++++------------------- include/freetype/config/ftconfig.h | 5 ++-- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4dd399e5d..ab6d4218b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-01-12 Alexei Podtelezhnikov + + [build] Improve and document MSVC build. + + * include/freetype/config/ftconfig.h: Guard dllexport/dllimport + attributes with _DLL and FT2_DLLIMPORT. + * builds/windows/vc2010/index.html: Update documentation. + 2018-01-10 Steve Robinson * CMakeLists.txt [win32]: Suppress warnings for POSIX functions. diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html index 7433ce835..8677511dc 100644 --- a/builds/windows/vc2010/index.html +++ b/builds/windows/vc2010/index.html @@ -1,42 +1,26 @@
- FreeType 2 Project Files for VS.NET 2010 or newer + FreeType 2 Project Files for Visual C++ 2010 or newer

- FreeType 2 Project Files for VS.NET 2010 or newer + FreeType 2 Project Files for Visual C++ 2010 or newer

-

This directory contains a project file for Visual C++ (VS.NET 2010 -or newer), named freetype.vcxproj, and Visual Studio, called -freetype.sln. It compiles the following libraries from the -FreeType 2.9 sources:

+

This directory contains solution and project files for +Visual C++ 2010 or newer, named freetype.sln, +and freetype.vcxproj. It compiles the following libraries +from the FreeType 2.9 sources:

    -
    -    freetype29.lib    - release build
    -    freetype29d.lib   - debug build
    -    freetype29ST.lib  - release build; single threaded
    -    freetype29STd.lib - debug build;   single threaded
    -    freetype29MT.lib  - release build; multi-threaded
    -    freetype29MTd.lib - debug build;   multi-threaded
    +
  • freetype.dll using 'Release' or 'Debug' configurations
  • +
  • freetype.lib using 'Release Static' or 'Debug Static' configurations
-

Both Win32 and x64 builds are supported.

- -

Be sure to extract the files with the Windows (CR+LF) line endings. ZIP -archives are already stored this way, so no further action is required. If -you use some .tar.*z archives, be sure to configure your extracting -tool to convert the line endings. For example, with WinZip, you should activate the TAR -file smart CR/LF Conversion option. Alternatively, you may consider -using the unix2dos or u2d utilities that are floating -around, which specifically deal with this particular problem. - -

Build directories are placed in the top-level objs\vc2010 -directory.

+

Both Win32 and x64 builds are supported. Build directories and target +files are placed in the top-level objs directory.

Customization of the FreeType library is done by editing the ftoption.h header file in the top-level devel path. @@ -48,5 +32,9 @@ edit the freetype.users.props file in this directory. It also simplifies automated (command-line) builds using msbuild.

+

To link your executable with FreeType DLL, you may want to define +FT2_DLLIMPORT so that the imported functions are appropriately +attributed with dllimport.

+ diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index f539e9a17..009c70f18 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -462,10 +462,11 @@ FT_BEGIN_HEADER #endif #ifdef _MSC_VER +#if defined( FT2_BUILD_LIBRARY ) && defined( _DLL ) #undef FT_EXPORT -#ifdef _DLL #define FT_EXPORT( x ) __declspec( dllexport ) x -#else +#elif defined( FT2_DLLIMPORT ) +#undef FT_EXPORT #define FT_EXPORT( x ) __declspec( dllimport ) x #endif #endif