blob: e28ec9549addd7d603fbc9845ac8e70d2e1e580c [file] [log] [blame]
xNombred07bb0d2020-03-10 20:17:12 +01001Instructions for building libpng using Microsoft Visual Studio
2==============================================================
Chris Craikb50c2172013-07-29 15:28:30 -07003
xNombred07bb0d2020-03-10 20:17:12 +01004Copyright (c) 2018 Cosmin Truta
Matt Sarett11466862016-02-19 13:41:30 -05005Copyright (c) 2010,2013,2015 Glenn Randers-Pehrson
Chris Craikb50c2172013-07-29 15:28:30 -07006
7This code is released under the libpng license.
xNombred07bb0d2020-03-10 20:17:12 +01008For conditions of distribution and use, see the disclaimer and license
9in png.h
Chris Craikb50c2172013-07-29 15:28:30 -070010
xNombred07bb0d2020-03-10 20:17:12 +010011This directory contains a solution for building libpng under Microsoft
12Visual Studio 2010. It may also work under later versions of Visual
13Studio. You should be familiar with Visual Studio before using this
14solution.
Chris Craikb50c2172013-07-29 15:28:30 -070015
16Initial preparations
xNombred07bb0d2020-03-10 20:17:12 +010017--------------------
18You must enter some information in zlib.props before attempting to
19build with this 'solution'. Please read and edit zlib.props first.
20You will probably not be familiar with the contents of zlib.props -
21do not worry, it is mostly harmless.
Chris Craikb50c2172013-07-29 15:28:30 -070022
23This is all you need to do to build the 'release' and 'release library'
24configurations.
25
26Debugging
xNombred07bb0d2020-03-10 20:17:12 +010027---------
Chris Craikb50c2172013-07-29 15:28:30 -070028The release configurations default to /Ox optimization. Full debugging
xNombred07bb0d2020-03-10 20:17:12 +010029information is produced (in the .pdb), but if you encounter a problem
30the optimization may make it difficult to debug. Simply rebuild with a
31lower optimization level (e.g. /Od.)
Chris Craikb50c2172013-07-29 15:28:30 -070032
33Linking your application
xNombred07bb0d2020-03-10 20:17:12 +010034------------------------
35Normally you should link against the 'release' configuration. This
36builds a DLL for libpng with the default runtime options used by Visual
37Studio. In particular the runtime library is the "MultiThreaded DLL"
38version. If you use Visual Studio defaults to build your application,
39you should have no problems.
Chris Craikb50c2172013-07-29 15:28:30 -070040
xNombred07bb0d2020-03-10 20:17:12 +010041If you don't use the Visual Studio defaults your application must still
42be built with the default runtime option (/MD). If, for some reason,
43it is not then your application will crash inside libpng16.dll as soon
44as libpng tries to read from a file handle you pass in.
Chris Craikb50c2172013-07-29 15:28:30 -070045
xNombred07bb0d2020-03-10 20:17:12 +010046If you do not want to use the DLL, and prefer static linking instead,
47you may choose the 'release library' configuration. This is built with
48a non-standard runtime library - the "MultiThreaded" version. When you
49build your application, it must be compiled with this option (/MT),
50otherwise it will not build (if you are lucky) or it will crash (if you
51are not.) See the WARNING file that is distributed with this README.
Chris Craikb50c2172013-07-29 15:28:30 -070052
53Stop reading here
xNombred07bb0d2020-03-10 20:17:12 +010054-----------------
Chris Craikb50c2172013-07-29 15:28:30 -070055You have enough information to build a working application.
56
57Debug versions have limited support
xNombred07bb0d2020-03-10 20:17:12 +010058-----------------------------------
59This solution includes limited support for debug versions of libpng.
60You do not need these unless your own solution itself uses debug builds
61(it is far more effective to debug on the release builds, there is no
62point building a special debug build unless you have heap corruption
63problems that you can't track down.)
Chris Craikb50c2172013-07-29 15:28:30 -070064
xNombred07bb0d2020-03-10 20:17:12 +010065The debug build of libpng is minimally supported. Support for debug
66builds of zlib is also minimal. Please keep this in mind, if you want
67to use it.
Matt Sarett11466862016-02-19 13:41:30 -050068
69WARNING
xNombred07bb0d2020-03-10 20:17:12 +010070-------
71Libpng 1.6.x does not use the default run-time library when building
72static library builds of libpng; instead of the shared DLL runtime, it
73uses a static runtime. If you need to change this, make sure to change
74the setting on all the relevant projects:
Matt Sarett11466862016-02-19 13:41:30 -050075
76 libpng
77 zlib
78 all the test programs
79
80The runtime library settings for each build are as follows:
81
82 Release Debug
83 DLL /MD /MDd
84 Library /MT /MTd
85
xNombred07bb0d2020-03-10 20:17:12 +010086Also, be sure to build libpng, zlib, and your project, all for the same
Alex Naidis7a055fd2016-10-01 12:23:07 +020087platform (e.g., 32-bit or 64-bit).