1*a67afe4dSAndroid Build Coastguard WorkerInstructions for building libpng using Microsoft Visual Studio 2*a67afe4dSAndroid Build Coastguard Worker============================================================== 3*a67afe4dSAndroid Build Coastguard Worker 4*a67afe4dSAndroid Build Coastguard WorkerCopyright (c) 2018,2022 Cosmin Truta 5*a67afe4dSAndroid Build Coastguard WorkerCopyright (c) 2010,2013,2015 Glenn Randers-Pehrson 6*a67afe4dSAndroid Build Coastguard Worker 7*a67afe4dSAndroid Build Coastguard WorkerThis code is released under the libpng license. 8*a67afe4dSAndroid Build Coastguard WorkerFor conditions of distribution and use, see the disclaimer and license 9*a67afe4dSAndroid Build Coastguard Workerin png.h 10*a67afe4dSAndroid Build Coastguard Worker 11*a67afe4dSAndroid Build Coastguard WorkerThis directory contains a solution for building libpng under Microsoft 12*a67afe4dSAndroid Build Coastguard WorkerVisual Studio 2019. It may also work under earlier or later versions 13*a67afe4dSAndroid Build Coastguard Workerof Visual Studio. You should be familiar with Visual Studio before 14*a67afe4dSAndroid Build Coastguard Workerusing this solution. 15*a67afe4dSAndroid Build Coastguard Worker 16*a67afe4dSAndroid Build Coastguard WorkerInitial preparations 17*a67afe4dSAndroid Build Coastguard Worker-------------------- 18*a67afe4dSAndroid Build Coastguard WorkerYou must enter some information in zlib.props before attempting to 19*a67afe4dSAndroid Build Coastguard Workerbuild with this 'solution'. Please read and edit zlib.props first. 20*a67afe4dSAndroid Build Coastguard WorkerYou will probably not be familiar with the contents of zlib.props - 21*a67afe4dSAndroid Build Coastguard Workerdo not worry, it is mostly harmless. 22*a67afe4dSAndroid Build Coastguard Worker 23*a67afe4dSAndroid Build Coastguard WorkerThis is all you need to do to build the 'release' and 'release library' 24*a67afe4dSAndroid Build Coastguard Workerconfigurations. 25*a67afe4dSAndroid Build Coastguard Worker 26*a67afe4dSAndroid Build Coastguard WorkerDebugging 27*a67afe4dSAndroid Build Coastguard Worker--------- 28*a67afe4dSAndroid Build Coastguard WorkerThe release configurations default to /Ox optimization. Full debugging 29*a67afe4dSAndroid Build Coastguard Workerinformation is produced (in the .pdb), but if you encounter a problem 30*a67afe4dSAndroid Build Coastguard Workerthe optimization may make it difficult to debug. Simply rebuild with a 31*a67afe4dSAndroid Build Coastguard Workerlower optimization level (e.g. /Od.) 32*a67afe4dSAndroid Build Coastguard Worker 33*a67afe4dSAndroid Build Coastguard WorkerLinking your application 34*a67afe4dSAndroid Build Coastguard Worker------------------------ 35*a67afe4dSAndroid Build Coastguard WorkerNormally you should link against the 'release' configuration. This 36*a67afe4dSAndroid Build Coastguard Workerbuilds a DLL for libpng with the default runtime options used by Visual 37*a67afe4dSAndroid Build Coastguard WorkerStudio. In particular the runtime library is the "MultiThreaded DLL" 38*a67afe4dSAndroid Build Coastguard Workerversion. If you use Visual Studio defaults to build your application, 39*a67afe4dSAndroid Build Coastguard Workeryou should have no problems. 40*a67afe4dSAndroid Build Coastguard Worker 41*a67afe4dSAndroid Build Coastguard WorkerIf you don't use the Visual Studio defaults your application must still 42*a67afe4dSAndroid Build Coastguard Workerbe built with the default runtime option (/MD). If, for some reason, 43*a67afe4dSAndroid Build Coastguard Workerit is not then your application will crash inside libpng16.dll as soon 44*a67afe4dSAndroid Build Coastguard Workeras libpng tries to read from a file handle you pass in. 45*a67afe4dSAndroid Build Coastguard Worker 46*a67afe4dSAndroid Build Coastguard WorkerIf you do not want to use the DLL, and prefer static linking instead, 47*a67afe4dSAndroid Build Coastguard Workeryou may choose the 'release library' configuration. This is built with 48*a67afe4dSAndroid Build Coastguard Workera non-standard runtime library - the "MultiThreaded" version. When you 49*a67afe4dSAndroid Build Coastguard Workerbuild your application, it must be compiled with this option (/MT), 50*a67afe4dSAndroid Build Coastguard Workerotherwise it will not build (if you are lucky) or it will crash (if you 51*a67afe4dSAndroid Build Coastguard Workerare not.) See the WARNING file that is distributed with this README. 52*a67afe4dSAndroid Build Coastguard Worker 53*a67afe4dSAndroid Build Coastguard WorkerStop reading here 54*a67afe4dSAndroid Build Coastguard Worker----------------- 55*a67afe4dSAndroid Build Coastguard WorkerYou have enough information to build a working application. 56*a67afe4dSAndroid Build Coastguard Worker 57*a67afe4dSAndroid Build Coastguard WorkerDebug versions have limited support 58*a67afe4dSAndroid Build Coastguard Worker----------------------------------- 59*a67afe4dSAndroid Build Coastguard WorkerThis solution includes limited support for debug versions of libpng. 60*a67afe4dSAndroid Build Coastguard WorkerYou do not need these unless your own solution itself uses debug builds 61*a67afe4dSAndroid Build Coastguard Worker(it is far more effective to debug on the release builds, there is no 62*a67afe4dSAndroid Build Coastguard Workerpoint building a special debug build unless you have heap corruption 63*a67afe4dSAndroid Build Coastguard Workerproblems that you can't track down.) 64*a67afe4dSAndroid Build Coastguard Worker 65*a67afe4dSAndroid Build Coastguard WorkerThe debug build of libpng is minimally supported. Support for debug 66*a67afe4dSAndroid Build Coastguard Workerbuilds of zlib is also minimal. Please keep this in mind, if you want 67*a67afe4dSAndroid Build Coastguard Workerto use it. 68*a67afe4dSAndroid Build Coastguard Worker 69*a67afe4dSAndroid Build Coastguard WorkerWARNING 70*a67afe4dSAndroid Build Coastguard Worker------- 71*a67afe4dSAndroid Build Coastguard WorkerLibpng 1.6.x does not use the default run-time library when building 72*a67afe4dSAndroid Build Coastguard Workerstatic library builds of libpng; instead of the shared DLL runtime, it 73*a67afe4dSAndroid Build Coastguard Workeruses a static runtime. If you need to change this, make sure to change 74*a67afe4dSAndroid Build Coastguard Workerthe setting on all the relevant projects: 75*a67afe4dSAndroid Build Coastguard Worker 76*a67afe4dSAndroid Build Coastguard Worker libpng 77*a67afe4dSAndroid Build Coastguard Worker zlib 78*a67afe4dSAndroid Build Coastguard Worker all the test programs 79*a67afe4dSAndroid Build Coastguard Worker 80*a67afe4dSAndroid Build Coastguard WorkerThe runtime library settings for each build are as follows: 81*a67afe4dSAndroid Build Coastguard Worker 82*a67afe4dSAndroid Build Coastguard Worker Release Debug 83*a67afe4dSAndroid Build Coastguard Worker DLL /MD /MDd 84*a67afe4dSAndroid Build Coastguard Worker Library /MT /MTd 85*a67afe4dSAndroid Build Coastguard Worker 86*a67afe4dSAndroid Build Coastguard WorkerAlso, be sure to build libpng, zlib, and your project, all for the same 87*a67afe4dSAndroid Build Coastguard Workerplatform (e.g., 32-bit or 64-bit). 88