README.txt 3.4 KB
Newer Older
C
Cosmin Truta 已提交
1 2
Instructions for building libpng using Microsoft Visual Studio
==============================================================
3

C
Cosmin Truta 已提交
4
Copyright (c) 2018 Cosmin Truta
5
Copyright (c) 2010,2013,2015 Glenn Randers-Pehrson
6 7

This code is released under the libpng license.
C
Cosmin Truta 已提交
8 9
For conditions of distribution and use, see the disclaimer and license
in png.h
10

C
Cosmin Truta 已提交
11 12 13 14
This directory contains a solution for building libpng under Microsoft
Visual Studio 2010.  It may also work under later versions of Visual
Studio.  You should be familiar with Visual Studio before using this
solution.
15 16

Initial preparations
C
Cosmin Truta 已提交
17 18 19 20 21
--------------------
You must enter some information in zlib.props before attempting to
build with this 'solution'.  Please read and edit zlib.props first.
You will probably not be familiar with the contents of zlib.props -
do not worry, it is mostly harmless.
22 23 24 25 26

This is all you need to do to build the 'release' and 'release library'
configurations.

Debugging
C
Cosmin Truta 已提交
27
---------
28
The release configurations default to /Ox optimization.  Full debugging
C
Cosmin Truta 已提交
29 30 31
information is produced (in the .pdb), but if you encounter a problem
the optimization may make it difficult to debug.  Simply rebuild with a
lower optimization level (e.g. /Od.)
32

33
Linking your application
C
Cosmin Truta 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
------------------------
Normally you should link against the 'release' configuration.  This
builds a DLL for libpng with the default runtime options used by Visual
Studio.  In particular the runtime library is the "MultiThreaded DLL"
version.  If you use Visual Studio defaults to build your application,
you should have no problems.

If you don't use the Visual Studio defaults your application must still
be built with the default runtime option (/MD).  If, for some reason,
it is not then your application will crash inside libpng16.dll as soon
as libpng tries to read from a file handle you pass in.

If you do not want to use the DLL, and prefer static linking instead,
you may choose the 'release library' configuration.  This is built with
a non-standard runtime library - the "MultiThreaded" version.  When you
build your application, it must be compiled with this option (/MT),
otherwise it will not build (if you are lucky) or it will crash (if you
are not.) See the WARNING file that is distributed with this README.
52

53
Stop reading here
C
Cosmin Truta 已提交
54
-----------------
55 56 57
You have enough information to build a working application.

Debug versions have limited support
C
Cosmin Truta 已提交
58 59 60 61 62 63
-----------------------------------
This solution includes limited support for debug versions of libpng.
You do not need these unless your own solution itself uses debug builds
(it is far more effective to debug on the release builds, there is no
point building a special debug build unless you have heap corruption
problems that you can't track down.)
64

C
Cosmin Truta 已提交
65 66 67
The debug build of libpng is minimally supported.  Support for debug
builds of zlib is also minimal.  Please keep this in mind, if you want
to use it.
68 69

WARNING
C
Cosmin Truta 已提交
70 71 72 73 74
-------
Libpng 1.6.x does not use the default run-time library when building
static library builds of libpng; instead of the shared DLL runtime, it
uses a static runtime.  If you need to change this, make sure to change
the setting on all the relevant projects:
75 76 77 78 79 80 81 82 83 84 85

    libpng
    zlib
    all the test programs

The runtime library settings for each build are as follows:

               Release        Debug
    DLL         /MD            /MDd
    Library     /MT            /MTd

C
Cosmin Truta 已提交
86
Also, be sure to build libpng, zlib, and your project, all for the same
87
platform (e.g., 32-bit or 64-bit).