HOW TO COMPILE FOR WINDOWS

This text shows how to compile Zindiji3 for /MT runtime. Zindaiji3 uses wxWidgets library (necessary) and OpenEXR and HDF5 library (optionaly).

I am sorry that language of most of following images are in Japanese.

1. COMPILE WXWIDGETS

Download source file from here and compile it with /MT option.

From ver 1.5 Zindaiji 3 uses wxWidgets is 3.0.2.

In my environment, wxWidgets are compiled in directory C:/ProgramFiles/WXWIDGETS/wxWidgets-3.0.2. And link path is set to there in Zindaiji3 project file. If you compile (and install) them in other place, set link path according your environment.

Setting Platform



Select Debug/Release solution (not DLL).

Configure solution

There are 20 solutions in the project file. Configure them all from property menu.



Set runtime to /MT or /MTd. Setting "Enable Parallel Code Generation" Yes make compile process faster.

build

In version 2.8, openGL was disabled in defalut setting. It is now enabled in 3.0 and no needs for confuigure.
Lib files would be generated in

/lib/vc_lib
/lib/vc_x64_lib

2. INSTALL LUA

Zindaiji3 ver 0.88 or later use Lua library. Official WWW site of Lua publish libraries for static link. Download and put lua-5.3.x_Win32_vc12_lib or lua-5.3.x_Win64_vc12_lib on proper folder.

In default state, include path is set to be C:/ProgramFiles/LUA/lua-5.2.x_Win32_vc12_lib/ and C:/ProgramFiles/LUA/lua-5.2.x_Win64_vc12_lib/.
Change include and library pathes to the directory you installed lua.

3. COMPILE HDF5 (OPTIONAL)

If you want enable reading HDF5 file, compile HDF5 library. HDF5 have optiona zlib and compression facility. If you want them you must compile zlib and szip.

Following is a way I compiled HDF5 1.8.16 with /MT option using Visual studio 2013. (Somewhat complicated.)

Getting source file

Download sorce file from HDF5. There are Source files of zlib and szip are also redistributred there.
Decompress them in some working directory

Introducing CMake

CMake is a tool for generating Makefile of Visual studio project file according to the environment. CMake-GUI is GUI tool for CMake.

Compile ZLIB

Make build directory BUILD (or some name you like). Set path for source code and build directory in CMake-GUI.
To compile zlib, configure CMake-GUI like follows.



Push Configure button, then, selection dialog for compile environment appears. Select Visual Studio 11 or Visual Studio 11 Win64. (Version number of Visual Studio 2012 is Visual Studio 11)

Then environment chek process begins. (It takes several minutes.)

After configure, various parameters that can be edit are displayed in red.


If required, set parameters here and push Configure button again. Then push Generate button and Solution file ZLIB.sln would be generated.



Open ZLIB.sln and configure. (Select platform and set runtime option /MT). Then build INSTALL. (Open Visual Studio as administrator for installation).
Files are installed in C:\Program Files\ZLIP or C;\Program Files (x86)\ZLIB.

Compile SZIP

Compile and install szip like zlib.

Compile HDF5 CNAKE

Make projectfile for HDF5 using CMake.

To bould HDF5 with /MT option, additional Macro must be enabled.
There are comments about a way to compile with /MT option in HDF5 distributon

\config\cmake\UserMacros\Windows_MT.cmake

# To use this option, copy both the macro and option code
# into the root UserMacros.cmake file. 
# OR add an include to the root UserMacros.cmake file:
# INCLUDE(path_to_file/WINDOWS_MT.cmake)

After doing above settings, start CMake configuration.

Nothe that the macro is for Release only. To compile Debug mode, add /NODEFAULTLIB:MSVCRTD to the macro.


Since many warnings happens, it may be good to disable warning.



Set options after first Configure. Check folloswing options.



/MT Option as added by the above macro.
Disable SHARED_LIBS and Enable STATIC_CTR_LIBS.



Check following options.
HDF5_BUILD_CPP_LIB
HDF5_ENABLE_SZIP_ENCODING (if use szip)
HDF5_ENABLE_SZIP_SUPPORT (if use szip)
HDF5_ENABLE_THREADSAFE
HDF5_ENABLE_Z_LIB_SUPPORT (if use zlib)

Then push Configure button again.
Then, options for path of SLIP and ZLIB appeares. Then, select BUILD folders and Congigure again.



After Configure, push Generate button and Project file would be generated.

Then compile HDF5 with visual studio. Select platforms and set /MT option.
(With above macro. /MT becomes default one)

Compile HDF5 VisualStudio


It is possible that errors happens that says no H5lib_settings.c and H5Tinit.c.

In compiling process, binary files to make these files are compiled, but they may be not executed. (Bug ?)
Execute these binary files from command line.
bin/Release(Debug)/H5detect.exe > H5Tinit.c
bin/Release(Debug)/H5make_libsettings.exe > H5lib_settings.c


If reference errors occur, set libralian setteing.
Add libzlib.lib and libszip.lib to the additional file.



If compiling and installing is successful, library files would be generated in
C:\Program Files (x86)\HDF_Group\HDF5\1.8.16/
C:\Program Files\HDF_Group\HDF5\1.8.16/

4. Settings for .gz deflate

Zindaiji3 uses zlib to deflate .gz compressed file. In default, the switch for usse zlib is set on, and include path and library path must be set manually.

To skip using zlib.

In default, the word ZLIB is set in preprocessor. You can remove this word to compile Zindaiji3 skipping .gz deflation functions.
Also you must rename libzlib.lib to wxzlib.lib in library.
(wxzlib in wxWigdets is not the newest zlib. Thus, we read normal zlib instead to use gz compression. If you do not use .gz compression, take it back to be to wxzlib).

5. Compile OpenEXR

From Official Site download ilmbase-2.2.0.tar.gz and openexr-2.2.0.tar.gz and decompress them.

Zindaiji3 assumes installingdirectory as
C:/ProgramFiles/OpenEXR/
C:/ProgramFiles/OpenEXR/build32bit (Workspaec for build 32bit)
C:/ProgramFiles/OpenEXR/build64bit (Workspaec for build 64bit)
Change include and library path according to your environment.

Compiling ilmbase




Configure and make projectfile using CMake.
Disable BUILD_SHARED_LIBS and NAMESPACE_VERSIONING, and generate project.
(Disabling Versioning is not must. If so, you must rename library-linking settings according to the version).



Then configure VC++ projects. The libraries that must exist for compiling open EXR is marked ones.
Set these project to be /MT (or /MTd) and compile them.

Compiling openEXR

Similary, configure settings with CMake and make project.



OpenEXR uses zlib, so that you must configure pathes about zlib, which is in Advanced setting. (hidden in default state).



The main library for use openEXR is IlmImf, and to compile it you must build b44ExpLogTable and dwaLookups projects.



To compile OpenEXR, libraries in ilmbase is needed. If path is not set, add include pathes to
ilmbase-2.2.x/config.windows
ilmbase-2.2.x/Half
ilmbase-2.2.x/Iex
ilmbase-2.2.x/IexMath
ilmbase-2.2.x/IlmThread
ilmbase-2.2.x/Imath
And library pathes to
ilmbase-2.2.x/buildpath/Half/Release(Debug)
ilmbase-2.2.x/buildpath/Iex/Release(Debug)
ilmbase-2.2.x/buildpath/IexMath/Release(Debug) 
ilmbase-2.2.x/buildpath/IlmThread/Release(Debug)
ilmbase-2.2.x/buildpath/IMath/Release(Debug)
And finally, add librarian setting of IlmImf
Half.lib
Iex.lib
IexMath.lib
IlmThread.lib
IMath.lib
And buld these projects.

(With librarian setting, you need to link IlmImf.lib only. If this is not set, you must link all other .libs)

6. Compile Zindaiji3


With above preparations, open Project file of Zindaiji3. Select platforms as

32bitFWin32 - Release or Win32 - RelHDF5 (with HDF5)
64bitFx64 - RelX64 or x64 - RelHDF5 (with HDF5)

If pathes of libraries are different than my environments, select include path and linker path according to your environment.

If comlipation succeeds, executable file would be generated.

(glut32.dll or glut64.dll is needed. Copy them to system folder or the same folder of executable file.)

return
inserted by FC2 system