[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
diff --git a/ChangeLog b/ChangeLog
index 4dd399e..ab6d421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-12 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [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 <ssrobins@gmail.com>
* CMakeLists.txt [win32]: Suppress warnings for POSIX functions.
diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html
index 7433ce8..8677511 100644
--- a/builds/windows/vc2010/index.html
+++ b/builds/windows/vc2010/index.html
@@ -1,42 +1,26 @@
<html>
<header>
<title>
- FreeType 2 Project Files for VS.NET 2010 or newer
+ FreeType 2 Project Files for Visual C++ 2010 or newer
</title>
<body>
<h1>
- FreeType 2 Project Files for VS.NET 2010 or newer
+ FreeType 2 Project Files for Visual C++ 2010 or newer
</h1>
-<p>This directory contains a project file for Visual C++ (VS.NET 2010
-or newer), named <tt>freetype.vcxproj</tt>, and Visual Studio, called
-<tt>freetype.sln</tt>. It compiles the following libraries from the
-FreeType 2.9 sources:</p>
+<p>This directory contains solution and project files for
+Visual C++ 2010 or newer, named <tt>freetype.sln</tt>,
+and <tt>freetype.vcxproj</tt>. It compiles the following libraries
+from the FreeType 2.9 sources:</p>
<ul>
- <pre>
- 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</pre>
+ <li>freetype.dll using 'Release' or 'Debug' configurations</li>
+ <li>freetype.lib using 'Release Static' or 'Debug Static' configurations</li>
</ul>
-<p>Both Win32 and x64 builds are supported.</p>
-
-<p>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 <tt>.tar.*z</tt> archives, be sure to configure your extracting
-tool to convert the line endings. For example, with <a
-href="http://www.winzip.com">WinZip</a>, you should activate the <em>TAR
-file smart CR/LF Conversion</em> option. Alternatively, you may consider
-using the <tt>unix2dos</tt> or <tt>u2d</tt> utilities that are floating
-around, which specifically deal with this particular problem.
-
-<p>Build directories are placed in the top-level <tt>objs\vc2010</tt>
-directory.</p>
+<p>Both Win32 and x64 builds are supported. Build directories and target
+files are placed in the top-level <tt>objs</tt> directory.</p>
<p>Customization of the FreeType library is done by editing the
<tt>ftoption.h</tt> header file in the top-level <tt>devel</tt> path.
@@ -48,5 +32,9 @@ edit the <tt>freetype.users.props</tt> file in this directory. It also
simplifies automated (command-line) builds using <a
href="http://msdn.microsoft.com/library/dd393574%28v=vs.100%29.aspx">msbuild</a>.</p>
+<p>To link your executable with FreeType DLL, you may want to define
+FT2_DLLIMPORT so that the imported functions are appropriately
+attributed with <tt>dllimport<tt>.</p>
+
</body>
</html>
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index f539e9a..009c70f 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