freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 4b97ab9: [build] Fortify dllexport/dllimport attribut


From: Alexei Podtelezhnikov
Subject: [freetype2] master 4b97ab9: [build] Fortify dllexport/dllimport attributes (#53969, #54330).
Date: Tue, 24 Jul 2018 23:02:11 -0400 (EDT)

branch: master
commit 4b97ab98a8e90ae5403058b73c345974247bf01e
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [build] Fortify dllexport/dllimport attributes (#53969,#54330).
    
    We no longer use predefined _DLL, which can be defined for static
    builds too with /MD. We use DLL_EXPORT and DLL_IMPORT instead,
    following libtool convention.
    
    * CMakeLists.txt [WIN32], builds/windows/vc2010/freetype.vcxproj:
    Define DLL_EXPORT manually.
    
    * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in,
    builds/vms/ftconfig.h, builds/windows/vc2010/index.html,
    src/base/ftver.rc: /_DLL/d, s/FT2_DLLIMPORT/DLL_IMPORT/.
---
 CMakeLists.txt                         |  4 ++++
 ChangeLog                              | 15 +++++++++++++++
 builds/unix/ftconfig.in                |  4 ++--
 builds/vms/ftconfig.h                  |  4 ++--
 builds/windows/vc2010/freetype.vcxproj | 16 ++++++++--------
 builds/windows/vc2010/index.html       |  2 +-
 include/freetype/config/ftconfig.h     |  4 ++--
 src/base/ftver.rc                      |  2 +-
 8 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f54e688..3f58337 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -353,6 +353,10 @@ target_compile_definitions(
 if (WIN32)
   target_compile_definitions(
     freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
+  if (BUILD_SHARED_LIBS)
+    target_compile_definitions(
+      freetype PRIVATE DLL_EXPORT)
+  endif ()
 endif ()
 
 if (BUILD_SHARED_LIBS)
diff --git a/ChangeLog b/ChangeLog
index bdfb41c..0096724 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2018-07-24  Alexei Podtelezhnikov  <address@hidden>
+
+       [build] Fortify dllexport/dllimport attributes (#53969,#54330).
+
+       We no longer use predefined _DLL, which can be defined for static
+       builds too with /MD. We use DLL_EXPORT and DLL_IMPORT instead,
+       following libtool convention.
+
+       * CMakeLists.txt [WIN32], builds/windows/vc2010/freetype.vcxproj:
+       Define DLL_EXPORT manually.
+
+       * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in,
+       builds/vms/ftconfig.h, builds/windows/vc2010/index.html,
+       src/base/ftver.rc: /_DLL/d, s/FT2_DLLIMPORT/DLL_IMPORT/.
+
 2018-07-24  Werner Lemberg  <address@hidden>
 
        [type1] Check relationship between number of axes and designs.
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index dc4aff7..cdb7f22 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -489,7 +489,7 @@ FT_BEGIN_HEADER
 
 #ifdef FT2_BUILD_LIBRARY
 
-#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
+#if defined( _WIN32 ) && defined( DLL_EXPORT )
 #define FT_EXPORT( x )  __declspec( dllexport )  x
 #elif defined( __GNUC__ ) && __GNUC__ >= 4
 #define FT_EXPORT( x )  __attribute__(( visibility( "default" ) ))  x
@@ -503,7 +503,7 @@ FT_BEGIN_HEADER
 
 #else
 
-#if defined( FT2_DLLIMPORT )
+#if defined( _WIN32 ) && defined( DLL_IMPORT )
 #define FT_EXPORT( x )  __declspec( dllimport )  x
 #elif defined( __cplusplus )
 #define FT_EXPORT( x )  extern "C"  x
diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h
index 77bca54..733b09b 100644
--- a/builds/vms/ftconfig.h
+++ b/builds/vms/ftconfig.h
@@ -441,7 +441,7 @@ FT_BEGIN_HEADER
 
 #ifdef FT2_BUILD_LIBRARY
 
-#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
+#if defined( _WIN32 ) && defined( DLL_EXPORT )
 #define FT_EXPORT( x )  __declspec( dllexport )  x
 #elif defined( __GNUC__ ) && __GNUC__ >= 4
 #define FT_EXPORT( x )  __attribute__(( visibility( "default" ) ))  x
@@ -455,7 +455,7 @@ FT_BEGIN_HEADER
 
 #else
 
-#if defined( FT2_DLLIMPORT )
+#if defined( _WIN32 ) && defined( DLL_IMPORT )
 #define FT_EXPORT( x )  __declspec( dllimport )  x
 #elif defined( __cplusplus )
 #define FT_EXPORT( x )  extern "C"  x
diff --git a/builds/windows/vc2010/freetype.vcxproj 
b/builds/windows/vc2010/freetype.vcxproj
index fe2fe68..7052c6c 100644
--- a/builds/windows/vc2010/freetype.vcxproj
+++ b/builds/windows/vc2010/freetype.vcxproj
@@ -121,7 +121,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <DisableLanguageExtensions>true</DisableLanguageExtensions>
@@ -135,7 +135,7 @@
       <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
     </ClCompile>
     <ResourceCompile>
-      
<PreprocessorDefinitions>_DEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>_DEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
@@ -149,7 +149,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <DisableLanguageExtensions>true</DisableLanguageExtensions>
@@ -163,7 +163,7 @@
       <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
     </ClCompile>
     <ResourceCompile>
-      
<PreprocessorDefinitions>_DEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>_DEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
@@ -234,7 +234,7 @@
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
       
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -258,7 +258,7 @@
       <OmitFramePointers>true</OmitFramePointers>
     </ClCompile>
     <ResourceCompile>
-      
<PreprocessorDefinitions>NDEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>NDEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
@@ -274,7 +274,7 @@
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
       
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -298,7 +298,7 @@
       <OmitFramePointers>true</OmitFramePointers>
     </ClCompile>
     <ResourceCompile>
-      
<PreprocessorDefinitions>NDEBUG;_DLL;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>NDEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html
index c3e6040..634ea93 100644
--- a/builds/windows/vc2010/index.html
+++ b/builds/windows/vc2010/index.html
@@ -33,7 +33,7 @@ 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
+DLL_IMPORT so that the imported functions are appropriately
 attributed with <tt>dllimport<tt>.</p>
 
 </body>
diff --git a/include/freetype/config/ftconfig.h 
b/include/freetype/config/ftconfig.h
index b093f6f..3d127f8 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -457,7 +457,7 @@ FT_BEGIN_HEADER
 
 #ifdef FT2_BUILD_LIBRARY
 
-#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
+#if defined( _WIN32 ) && defined( DLL_EXPORT )
 #define FT_EXPORT( x )  __declspec( dllexport )  x
 #elif defined( __GNUC__ ) && __GNUC__ >= 4
 #define FT_EXPORT( x )  __attribute__(( visibility( "default" ) ))  x
@@ -471,7 +471,7 @@ FT_BEGIN_HEADER
 
 #else
 
-#if defined( FT2_DLLIMPORT )
+#if defined( _WIN32 ) && defined( DLL_IMPORT )
 #define FT_EXPORT( x )  __declspec( dllimport )  x
 #elif defined( __cplusplus )
 #define FT_EXPORT( x )  extern "C"  x
diff --git a/src/base/ftver.rc b/src/base/ftver.rc
index a2903d5..b0b6e00 100644
--- a/src/base/ftver.rc
+++ b/src/base/ftver.rc
@@ -28,7 +28,7 @@ FILEFLAGSMASK        VS_FFI_FILEFLAGSMASK
 #ifdef _DEBUG
 FILEFLAGS            VS_FF_DEBUG
 #endif
-#ifdef _DLL
+#ifdef DLL_EXPORT
 FILETYPE             VFT_DLL
 #define FT_FILENAME  "freetype.dll"
 #else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]