| 1 | Building NeXus with Visual Studio |
|---|
| 2 | --------------------------------- |
|---|
| 3 | |
|---|
| 4 | Setup |
|---|
| 5 | ----- |
|---|
| 6 | |
|---|
| 7 | You need to define several Windows environment variables |
|---|
| 8 | HDF4ROOT and HDF5ROOT to point to top of unpacked HDF distributions |
|---|
| 9 | e.g. |
|---|
| 10 | |
|---|
| 11 | HDF4ROOT=c:\program files\hdf42r1 |
|---|
| 12 | HDF5ROOT=C:\program Files\HDF5-164 |
|---|
| 13 | |
|---|
| 14 | Note that you do not need the HDF5 version with F90 support even to build the nexus F90 API |
|---|
| 15 | The above the the latest version of HDF as available from the NCSA site and |
|---|
| 16 | reaquire several external libraries: zlin 1.2.2, jpeg-6b and szip-2.0 (encoder enabled) |
|---|
| 17 | The location of these external libraries is isdicated by the following variables e.g. |
|---|
| 18 | |
|---|
| 19 | JPEGROOT=c:\program files\jpeg-6b |
|---|
| 20 | ZLIBROOT=c:\program fiules\zlib122 |
|---|
| 21 | SZIPROOT=c:\program files\szip20 |
|---|
| 22 | |
|---|
| 23 | the HDF4 includes will be in %HDFROOT%\debug\include and %HDF5ROOT%\release\include and |
|---|
| 24 | similarly HDF5 includes in %HDF5ROOT%\debug\include and %HDF5ROOT%\release\include |
|---|
| 25 | |
|---|
| 26 | All the visual studio project files make use of these variables and so should not |
|---|
| 27 | depend on the location HDF files are installed in. |
|---|
| 28 | |
|---|
| 29 | Currently ZLIB only works as a DLL so your programs will require zlib1.dll |
|---|
| 30 | |
|---|
| 31 | Building |
|---|
| 32 | -------- |
|---|
| 33 | |
|---|
| 34 | Open nexus.dsw, and then select a project to build |
|---|
| 35 | |
|---|
| 36 | nexus4, nexus5 and nexus45 - Static NeXus libraries with HDF4, HDF5, and both HDF4/HDF5 support |
|---|
| 37 | nx45dll - Dynamic Link Library (DLL) version of the NeXus library with HDF4 and HDF5 support |
|---|
| 38 | napi*_test - the various test programs |
|---|
| 39 | nxbrowse - the nexus file browser with static libraru |
|---|
| 40 | nxbrowse_dll - NeXus file browser using nx45dll.dll |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | Building your own projects with static libraries |
|---|
| 44 | ------------------------------------------------ |
|---|
| 45 | |
|---|
| 46 | To make use of the HDF4ROOT and HDF5ROOT variables from within Visual Studio, |
|---|
| 47 | you refer to them as $(HDF4ROOT) and $(HDF5ROOT). When building a |
|---|
| 48 | program using the NeXus library you will need to do the following to the |
|---|
| 49 | project settings: |
|---|
| 50 | |
|---|
| 51 | * Add HDF4 and/or HDF5 to the C "preprocessor definitions" |
|---|
| 52 | * Add either $(HDF4ROOT)\debug\include,$(HDF5ROOT)\debug\include or |
|---|
| 53 | $(HDF4ROOT)\debug\include,$(HDF5ROOT)\release\include to the C "additional include directories" |
|---|
| 54 | depending on whether you are building a debug or release project |
|---|
| 55 | * For a C project add either $(HDF4ROOT)\debug\lib,$(HDF5ROOT)\debug\lib or |
|---|
| 56 | $(HDF4ROOT)\release\lib,$(HDF5ROOT)\release\lib |
|---|
| 57 | to the "additional library path" in the "input" section of the "link" settings |
|---|
| 58 | * For a FORTRAN project add either $(HDF4ROOT)\debug\lib,$(HDF5ROOT)\debug\lib or |
|---|
| 59 | $(HDF4ROOT)\debug\lib,$(HDF5ROOT)\release\lib |
|---|
| 60 | to the "additional library path" in the "input" section of the "link" settings |
|---|
| 61 | * Add "wsock32.lib" (for the _htons@4 symbols etc.) and "hdf5.lib" to the list of |
|---|
| 62 | library modules to load. |
|---|
| 63 | |
|---|
| 64 | For a debug build only, you will have to add "libc.lib" to the list of library modules to ignore |
|---|
| 65 | on the link input tab. |
|---|
| 66 | |
|---|
| 67 | Building your own projects with dynamic link libraries (DLL) |
|---|
| 68 | ------------------------------------------------------------ |
|---|
| 69 | |
|---|
| 70 | For a working example, see the nxbrowse_dll project |
|---|
| 71 | |
|---|
| 72 | When building a program using the DLL version of the NeXus library |
|---|
| 73 | (NX45DLL.DLL) you will need to do the following to the project settings: |
|---|
| 74 | |
|---|
| 75 | * Set your C code generation options to use "debug multithreaded DLL" or "multithreaded DLL" libraries |
|---|
| 76 | * set the FORTRAN libraries option to DLL |
|---|
| 77 | * Add HDF4 and/or HDF5 to the C "preprocessor definitions" |
|---|
| 78 | * Add either $(HDF4ROOT)\include,$(HDF5ROOT)\c\debug\include or |
|---|
| 79 | $(HDF4ROOT)\include,$(HDF5ROOT)\c\release\include to the C "additional include directories" |
|---|
| 80 | depending on whether you are building a debug or release project |
|---|
| 81 | * For a C project add either $(HDF4ROOT)\dlllibdbg,$(HDF5ROOT)\c\debug\dll or |
|---|
| 82 | $(HDF4ROOT)\dlllib,$(HDF5ROOT)\c\release\dll |
|---|
| 83 | to the "additional library path" in the "input" section of the "link" settings |
|---|
| 84 | * For a FORTRAN project add either $(HDF4ROOT)\dllibdbg,$(HDF5ROOT)\f90\debug\dll or |
|---|
| 85 | $(HDF4ROOT)\dlllib,$(HDF5ROOT)\f90\release\dll |
|---|
| 86 | to the "additional library path" in the "input" section of the "link" settings |
|---|
| 87 | * Add "wsock32.lib" (for the _htons@4 symbols etc.) and either "hdf5ddll.lib" or "hdf5dll.lib" |
|---|
| 88 | (depending on debug/release configuration) to the list of library modules to load. |
|---|
| 89 | * Either add "nx45dll.lib" to the list of library modules to load in the link tab |
|---|
| 90 | or make your project "depend" on the "nx45dll" project (in which case it links to nx45dll.lib automatically) |
|---|
| 91 | |
|---|
| 92 | For a debug build only, you will have to add "msvcrt.lib" to the list of library |
|---|
| 93 | modules to ignore on the link input tab. |
|---|
| 94 | |
|---|
| 95 | When you run the program, you either need to have the DLL files in the same directory as the EXE file |
|---|
| 96 | or you need to add the directories containing the DLL files to the PATH environment variable. |
|---|
| 97 | |
|---|
| 98 | Freddie Akeroyd (Freddie.Akeroyd@rl.ac.uk) |
|---|
| 99 | ISIS Facility |
|---|
| 100 | Rutherford Appleton Laboratory |
|---|
| 101 | GB |
|---|
| 102 | |
|---|
| 103 | $Id$ |
|---|