Skip to content

Commit

Permalink
Fix Windows VS build
Browse files Browse the repository at this point in the history
VERSION in config.h is only written by autoconf which isn't invoked
on VS builds. Added a similar logic like on the Mono repo where
we read the version out of configure.ac.
  • Loading branch information
akoeplinger committed Sep 21, 2017
1 parent 43f33e8 commit 44b2521
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pkgconfig_DATA= libgdiplus.pc

DISTCLEANFILES= libgdiplus.pc

EXTRA_DIST = libgdiplus.pc.in LICENSE
EXTRA_DIST = libgdiplus.pc.in LICENSE libgdiplus.sln winconfig.h.in
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,5 @@ libgdiplus_la_SOURCES = \
libgdiplus_la_LIBADD = $(GDIPLUS_LIBS)

INCLUDES = $(GDIPLUS_CFLAGS) -Wall -Wno-unused -Wno-format

EXTRA_DIST = libgdiplus.vcxproj packages.config
3 changes: 2 additions & 1 deletion src/gdiplus-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
#include <pthread.h>
#include <unistd.h>

#include "config.h"
#endif

#include "config.h"

#if HAVE_VISIBILITY_HIDDEN
#define GDIP_INTERNAL __attribute__((visibility ("hidden")))
#else
Expand Down
4 changes: 1 addition & 3 deletions src/gifcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
* Sebastien Pouliot <sebastien@ximian.com>
*/

#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "config.h"
#include "gdiplus-private.h"

GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}};
Expand Down
4 changes: 1 addition & 3 deletions src/jpegcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
*
*/

#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "config.h"
#include "gdiplus-private.h"

GUID gdip_jpg_image_format_guid = {0xb96b3caeU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}};
Expand Down
6 changes: 5 additions & 1 deletion src/libgdiplus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\gtk\$(Platform)\include;$(ProjectDir)\..\gtk\$(Platform)\include\glib-2.0;$(ProjectDir)\..\gtk\$(Platform)\lib\glib-2.0\include;$(ProjectDir)\..\gtk\$(Platform)\include\cairo;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)\..;$(ProjectDir)\..\gtk\$(Platform)\include;$(ProjectDir)\..\gtk\$(Platform)\include\glib-2.0;$(ProjectDir)\..\gtk\$(Platform)\lib\glib-2.0\include;$(ProjectDir)\..\gtk\$(Platform)\include\cairo;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_LIBJPEG;HAVE_LIBTIFF;HAVE_LIBPNG;_WINDLL;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- FIXME: To align with the GDI+ calling convention, this should be StdCall. Only relevant on x86 -->
<CallingConvention>Cdecl</CallingConvention>
Expand All @@ -97,6 +97,9 @@
<AdditionalDependencies>libpng16.lib;freetype.lib;fontconfig.lib;glib-2.0.lib;cairo.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)\..\gtk\$(Platform)\lib</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "(Get-Content $(ProjectDir)\..\winconfig.h.in) -replace '#LIBGDIPLUS_VERSION#', (Select-String -path $(ProjectDir)\..\configure.ac -pattern 'AC_INIT\(libgdiplus, \[(.*)\]').Matches[0].Groups[1].Value | Set-Content $(ProjectDir)\..\config.h" 2&gt;&amp;1</Command>
</PreBuildEvent>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy $(ProjectDir)..\gtk\$(Platform)\bin\cairo.* $(OutDir)
copy $(ProjectDir)..\gtk\$(Platform)\bin\fontconfig.* $(OutDir)
Expand Down Expand Up @@ -139,6 +142,7 @@ copy $(ProjectDir)..\gtk\$(Platform)\bin\zlib1.* $(OutDir)</Command>
</ItemGroup>
<ItemGroup>
<ClInclude Include="*.h" />
<ClInclude Include="..\config.h" />
</ItemGroup>
<ItemGroup>
<None Include="*.inc" />
Expand Down
4 changes: 1 addition & 3 deletions src/pngcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
*
*/

#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "config.h"
#include "win32structs.h"

GUID gdip_png_image_format_guid = {0xb96b3cafU, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}};
Expand Down
4 changes: 1 addition & 3 deletions src/tiffcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
* Copyright (C) Novell, Inc. 2003-2004.
*/

#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "config.h"
#include "gdiplus-private.h"

GUID gdip_tif_image_format_guid = {0xb96b3cb1U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e}};
Expand Down
4 changes: 4 additions & 0 deletions winconfig.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* winconfig.h.in. Template used on Windows/MSVC and processed by libgdiplus.vcxproj PreBuildEvent. */

/* Version number of package */
#define VERSION "#LIBGDIPLUS_VERSION#"

0 comments on commit 44b2521

Please sign in to comment.