$File: //depot/povray/smp/windows/readme.html $ $Revision: #5 $ $Change: 5812 $ $DateTime: 2013/02/17 11:20:13 $ $Author: chrisc $
NOTE: use of our source code in any other project (other than a fully-functional custom version of POV-Ray) is prohibited. In other words you may make your own derivitive version (subject to the license conditions referenced below), but you may not remove functionality or incorporate the source code into another program.
Use of the POV-Ray source code is governed by the conditions laid out in distribution-license.txt and source-license.txt. Be sure you read these files (which are included in this source archive, and also linked from http://www.povray.org/povlegal.html) before doing anything with this source.
Furthermore, as this source code is a release candidate distribution, further conditions are added. These further conditions are documented near the start of most source files. One of these notices is reproduced at the end of this file for your reference.
This document does not attempt to explain how POV-Ray works or how to make modifications to it. Some of the internals of POV-Ray are highly complex; if you wish to gain a better understanding of that topic, please follow the link provided on the source code page mentioned below. This document is intended only to assist you in getting the POV-Ray source code built using an officially- supported compiler on Win32 or Win64. Furthermore, no attempt is made to cover advanced subjects such as profile-guided optimization (though we will point out that the latter is definitely worthwhile, if you have the time and patience).
Please use our support groups at http://news.povray.org/ or
news://news.povray.org/. These groups provide the best means for support with
relation to this subject. We recommend you visit the
there (presuming the beta is still current - if we have gone to a release of
3.7, you should update your source with that version).
This section isn't a substitute for reading the entire document. However, here's a quick list of things to get you going, provided you are using a supported compiler (VS 2008, 2010 or 2012 full versions, not express - read the full instructions if you are), are building a 32-bit target, and do not wish to build the editor DLL's:
povray.has described here.
Currently the only officially-supported means of building the Windows version of POV-Ray is via the provided Visual Studio 2008 or 2010 projects (use the latter with VS 2012) with a full version of Visual Studio and the compilers provided with it or with the platform SDK.
Note that versions of Visual Studio prior to 8.0 (VS 2005) are not supported at all and furthermore will not work. The code in POV-Ray 3.7 requires a reasonably up-to-date C++ compiler and STL, and earlier versions of VC++ are not compatible. VS 2005 may work but as it is not used or tested against by the POV-Ray developers we do not recommend its use.
There are template config files for borland, mingw32, and watcom (aka openwatcom) compilers, but these have not been updated for 3.7 and thus will require considerable work to get going. See the vfe\win\compilers\ directory for more information if you wish to attempt this (plus be sure to read the rest of this document, particularly the remarks about the custom entry point).
The express editions have been reported to work in building 32-bit executables but this is not officially supported, and additionally takes some effort to get set up, especially if you want to build the editor DLL's (these are optional).
At the minimum, you will need to download and install the Platform SDK as this
is not supplied with VS Express. It has also been reported that to obtain the
shlwapi.h header file (which provides functions such as
GetDLLVersion etc), you
will need to allow the SDK setup to install the "Microsoft Web Workshop Build
That said, we will - time permitting - endeavour to assist express edition users in building 32-bit versions of POV-Ray, but make no promises. We do not recommend that express edition users attempt to build a 64-bit executable as the requisite compilers are not supplied with VSE.
Express edition users should not try to build the editor DLL's (cmedit and codemax projects) unless you have read this document in full and installed the ATL libs. These DLL's are not built by default, so you don't need to do anything about this unless you want to include them in the build automatically.
If you do want to compile the editors, you will need a file (atlthunk.lib) that does not ship with the express edition or in the platform SDK. A solution is listed at http://www.codeproject.com/KB/wtl/WTLExpress.aspx..
In either event, you will need to install the Platform SDK. When doing so, make sure you select "Microsoft Web Workshop Build Environment" at it (perhaps non- intuitively) brings in shlwapi.h, which is needed for POVWIN to build.
NOTE: it is not necessary to build the DLL's unless you want to modify
the editor. They are loaded via
LoadLibrary() and thus no import
library is required. You can just use the DLL's included with the official
version 3.7 binary distribution.
Select the Configuration Manager (found in the Build menu) and for each configuration that you wish to build the editors with, tick the cmedit and codemax checkboxes.
Look at http://www.povray.org/beta/source/ for an updated version of these instructions or of the source itself. This is important if you wish to avoid potential frustration! As we get feedback from others we will be improving the build instructions and project files - if you strike a problem in building the code, it could very well have been already solved. [Check the revision number at the head of this document against the version supplied via the above web page if you want to know if it's different].
Make sure you have a working copy of the appropriate release candidate binary as supplied by the POV-Team installed. This ensures that the appropriate registry settings and support files are present. If you don't do this, your compiled code will probably not work on your machine.
windows\vs10\povray.sln in Visual Studio 2010/2012 (or
windows\vs9\povray.sln if using Visual Studio 2008).
Set 'Windows Targets > GUI' as the start-up project if it is not already selected. Then,
select the 'Generic POV-Ray > povbackend' project and expand 'Backend Headers', then open the file
'povray.h' listed within it. Please set
DISTRIBUTION_MESSAGE_2 to your real
name to make unofficial versions distinguishable from each other. Remove the
#error directive afterwards to proceed with the build. Note that if you do not
do this you will get compile errors.
Once you have taken whatever steps are needed as set out above, select your desired build (e.g. Win32 release - anything except SSE2|x64), hit F7, and wait. We recommend that you read the rest of this document while you are waiting.
If all goes well, you should end up with the POV-Ray for Windows executable as
well as (if you selected to build them) the two editor DLL's. All 32-bit
binaries should end up in
windows\vs10\bin32, and the 64-bit ones should be in
Note: if you are building a DEBUG version of POV-Ray, be aware that that the
executable will attempt to load the debug version of the DLL's. This will be an
issue if you did not build them, since POV-Ray will complain (but will still
work - you just won't have the editor). There is however a simple solution to
this that doesn't require you to modify the source or build the DLL's: simply
copy the standard editor DLL's that come with the official 3.7 distribution to
their debug equivalent names (e.g. copy
Note that the copied cmedit32.dll will still attempt to load povcmax32.dll (i.e. the non-debug version), so it's not necessary to copy povcmax32 to its debug equivalent.
NB you should never attempt to build the 'x64 SSE2' configuration: apart from the fact that this is by default excluded from the build in the configuration manager, it simply won't work. The only reason it is there at all is that Visual Studio insists on cloning the Win32 SSE2 project every time it updates the solution file, no matter how hard we try to get rid of it. SSE2 is always enabled for x64 targets (it can't be turned off as it's a standard feature of all x64 CPU's) and thus the x64 release project is all that is needed.
Please read the rest of this document while you're waiting for your compile to finish, particularly the 'other stuff to keep in mind' at the end.
You really don't need to worry about any of the following section unless you want to do editor hacking ; the DLL's provided with the POV-Ray for Windows binaries are sufficient, and therefore you don't need to compile them at all if you don't want to.
The editor used in POV-Ray for Windows is based around a custom control called
CodeMax, supplied courtesy of Barry Allyn. Our implementation consists of two
povcmax32.dll (in this case, as for the rest of the
instructions, we will refer to the 32-bit versions; if building for Win64 then
just replace the '32' with '64'). If you are building debug versions, the DLL's
will be suffixed with a 'd' (for example,
The editor control itself is
povcmax32.dll, and is built by the 'codemax'
project in povray.sln. The other DLL,
cmedit32, consists of support code that
wraps and enhances the custom control, and provides services such as file I/O,
menus, state storage/restore, and many other things. This DLL is built by the
For reference, while most of the POV-Ray-specific customization is done within
cmedit, there are some POV-Ray specific modifications made to codemax itself,
particularly with respect to the code completion support. However, for the most
part, if you are intending to modify some aspect of the POV-Ray interface to
the editor, you will find you will want to modify the contents of the cmedit
project (or, possibly, pvedit.cpp in the windows directory - this implements
the API between the POV-Ray executable and
cmedit32.dll). Note that if you
alter this API at all, you must change the editor version (
By default (as of 3.7 beta 25b), POV-Ray will attempt to load the editor DLL's from the directory in which the EXE resides first. The previous strategy was to look in the current working directory first. POV-Ray no longer checks the CWD by default, though you can force that behaviour if you wish by using the switch mentioned below.
If a DLL with the right name is found with the EXE it will be used; otherwise,
the default binary directory is used. If you are not sure where it's looking,
create the directory
c:\temp if it does not already exist and then
pvengine with the
/debug switch. Once it has loaded
have a look at
c:\temp\povdebug.txt, which will list the search paths attempted.
There is a switch available on the command-line which can alter the search
path. If you specify
/EDITDLLPATH on the command-line and follow it with a
path, that path will be the only one checked. To force POV-Ray to look in the
current directory (i.e. the one the EXE is launched from, which may not be the
one the EXE is stored in), you can pass
"." as the edit DLL path.
NOTE: currently POV-Ray for Windows has no way of differentiating the official
editor DLL's from custom ones. We may at a future point provide a means for
unofficial DLL's to be loaded by the official PVENGINE binary. In the meantime,
if you want to make absolutely sure that your unofficial binary doesn't load
the official DLL's, and vice-versa, you can rename the DLL's. Doing this
requires you to tell the EXE of course - to do this, open
and look for where
EDITDLLNAME is defined. Just change that to suit, re-compile,
and rename the DLL's manually (or change the project to output different names).
If porting POV-Ray for Windows to another compiler, or even if you're just writing a makefile for the Visual Studio version, be aware that there is some special configuration in the project settings. The most critical one to replicate is the entry point - POVWIN uses a custom entry point, and unless you adjust the code, it is essential this is called prior to the C run-time library startup code. It's also highly likely that you will need to change the code that calls the RTL from within POV-Ray as well, unless you are using the Microsoft RTL (or a compatible one).
Currently, the entry point is
POVWINStartup, which is declared in
We use this to set up a private heap prior to any memory allocation occurring
(including even allocations done to construct any global or static classes).
WIN_MEM_TRACKING is defined (which it is by default),
delete operators with its own ones. The
POV-Ray code already uses custom
free functions which also pass
Apart from tracking the amount of memory used and freed, the above tracking
_DEBUG is defined, will also provide a custom wrapper around each
memory block which records where the new or malloc occurred. By default,
EXTRA_VALIDATION to be defined. When this is present, each block
allocated has, in addition to the standard extra fields added to the start,
a single field of length
sizeof(ptrdiff_t) added to the end of the block.
This is then initialized with a simple hash made up from various aspects of
the block, including its address, length, and the source line it was allocated
from. This is able to be checked at any time using the
Validate() method to see
if it has been altered since the block was allocated (e.g. by an overrun).
Additionally, while it has not yet been implemented, the memory hooks give us the opportunity to provide access to a low-fragmentation heap or other useful memory allocation techniques (e.g. handling allocations differently during renders, if we want) for the purpose of improving performance.
The POV-Team would like to thank all those who have assisted in bringing POV-Ray 3.7 and its predecessors to the public - you know who you are, and we salute you.
/********************************************************************************* * NOTICE * * This file is part of a BETA-TEST version of POV-Ray version 3.7. It is not * final code. Use of this source file is governed by both the standard POV-Ray * licences referred to in the copyright header block above this notice, and the * following additional restrictions numbered 1 through 4 below: * * 1. This source file may not be re-distributed without the written permission * of Persistence of Vision Raytracer Pty. Ltd. * * 2. This notice may not be altered or removed. * * 3. Binaries generated from this source file by individuals for their own * personal use may not be re-distributed without the written permission * of Persistence of Vision Raytracer Pty. Ltd. Such personal-use binaries * are not required to have a timeout, and thus permission is granted in * these circumstances only to disable the timeout code contained within * the beta software. * * 4. Binaries generated from this source file for use within an organizational * unit (such as, but not limited to, a company or university) may not be * distributed beyond the local organizational unit in which they were made, * unless written permission is obtained from Persistence of Vision Raytracer * Pty. Ltd. Additionally, the timeout code implemented within the beta may * not be disabled or otherwise bypassed in any manner. * * The following text is not part of the above conditions and is provided for * informational purposes only. * * The purpose of the no-redistribution clause is to attempt to keep the * circulating copies of the beta source fresh. The only authorized distribution * point for the source code is the POV-Ray website and Perforce server, where * the code will be kept up to date with recent fixes. Additionally the beta * timeout code mentioned above has been a standard part of POV-Ray betas since * version 1.0, and is intended to reduce bug reports from old betas as well as * keep any circulating beta binaries relatively fresh. * * All said, however, the POV-Ray developers are open to any reasonable request * for variations to the above conditions and will consider them on a case-by-case * basis. * * Additionally, the developers request your co-operation in fixing bugs and * generally improving the program. If submitting a bug-fix, please ensure that * you quote the revision number of the file shown above in the copyright header * (see the '$Revision:' field). This ensures that it is possible to determine * what specific copy of the file you are working with. The developers also would * like to make it known that until POV-Ray 3.7 is out of beta, they would prefer * to emphasize the provision of bug fixes over the addition of new features. * * Persons wishing to enhance this source are requested to take the above into * account. It is also strongly suggested that such enhancements are started with * a recent copy of the source. * * The source code page (see http://www.povray.org/beta/source/) sets out the * conditions under which the developers are willing to accept contributions back * into the primary source tree. Please refer to those conditions prior to making * any changes to this source, if you wish to submit those changes for inclusion * with POV-Ray. * *********************************************************************************/