| 1 |
To build and install CCfits from source code on a UNIX-like (e.g. UNIX, |
| 2 |
Linux, or Cygwin) platform, take the following steps. For building on |
| 3 |
a Microsoft Windows platform with Visual Developer Studio, see below. |
| 4 |
|
| 5 |
=============================================================================== |
| 6 |
Instructions for Building CCfits on UNIX-like platforms: |
| 7 |
=============================================================================== |
| 8 |
|
| 9 |
1. Configure |
| 10 |
|
| 11 |
The configure script will create the Makefile with the path to the |
| 12 |
compiler you choose (or GCC by default), and the path to the CFITSIO |
| 13 |
package. To see all options available with configure, type |
| 14 |
|
| 15 |
> ./configure --help |
| 16 |
|
| 17 |
1.a. Compiler Choice |
| 18 |
|
| 19 |
By default, the GCC compiler and linker will be used. If you want to |
| 20 |
compile and link with a different compiler and linker, you can set |
| 21 |
some environment variables before running the configure script. For |
| 22 |
example, to use a specific Macports C++ compiler, do the following: |
| 23 |
|
| 24 |
> setenv CXX /opt/local/bin/g++-mp-10 (csh syntax) |
| 25 |
|
| 26 |
or |
| 27 |
|
| 28 |
> export CXX=/opt/local/bin/g++-mp-10 (bash syntax) |
| 29 |
|
| 30 |
See also the compiler tips for installing HEASoft: |
| 31 |
|
| 32 |
https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/ |
| 33 |
|
| 34 |
1.b. CFITSIO Location |
| 35 |
|
| 36 |
CCfits requires that the CFITSIO package is available on your system. See |
| 37 |
|
| 38 |
http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html |
| 39 |
|
| 40 |
for more information. The configure script that you will run takes an |
| 41 |
option to specify the location of the CFITSIO package. |
| 42 |
|
| 43 |
If the CFITSIO package is installed in a directory consisting of a |
| 44 |
'lib' subdirectory containing "libcfitsio.a" or "libcfitsio.so" and |
| 45 |
an 'include' subdirectory containing "fitsio.h", then you can run the |
| 46 |
configure script with a single option. For example, if the cfitsio |
| 47 |
package is installed in this fashion in /usr/local/cfitsio/, then the |
| 48 |
configure script option will be |
| 49 |
|
| 50 |
--with-cfitsio=/usr/local/cfitsio |
| 51 |
|
| 52 |
If the CFITSIO package is not installed in the above manner, then you |
| 53 |
need to run the configure script with two options: one to specify the |
| 54 |
include directory and the other to specify the library directory. For |
| 55 |
example, if the cfitsio package was built in /home/user/cfitsio/ then |
| 56 |
the two options will be |
| 57 |
|
| 58 |
--with-cfitsio-include=/home/user/cfitsio |
| 59 |
--with-cfitsio-libdir=/home/user/cfitsio |
| 60 |
|
| 61 |
For users of HEASoft (instead of stand-alone CFITSIO): |
| 62 |
You can configure CCfits, after initializing HEASoft, using |
| 63 |
|
| 64 |
--with-cfitsio=$HEADAS |
| 65 |
|
| 66 |
1.c. Build Location |
| 67 |
|
| 68 |
You have the option of carrying out the build in a separate directory |
| 69 |
from the source directory or in the same directory as the source. In |
| 70 |
either case, you need to run the configure script in the directory |
| 71 |
where the build will occur. For example, if building in the source |
| 72 |
directory, with the cfitsio directory in /usr/local/cfitsio/, then the |
| 73 |
configure command should be issued like this: |
| 74 |
|
| 75 |
> ./configure --with-cfitsio=/usr/local/cfitsio |
| 76 |
|
| 77 |
If you do the build in a separate directory from the source, you may |
| 78 |
need to issue the configure command something like this: |
| 79 |
|
| 80 |
> ../CCfits/configure --with-cfitsio=/usr/local/cfitsio |
| 81 |
|
| 82 |
1.d. Install Location |
| 83 |
|
| 84 |
If you would like to install the CCfits files in a separate location, you |
| 85 |
can do that during the "make install" command (DESTDIR, described below), |
| 86 |
or you can specify the location during configure. For example, if you |
| 87 |
would like the CCfits files installed in /usr/local/CCfits, you would run |
| 88 |
the configure command like this: |
| 89 |
|
| 90 |
> ./configure --prefix=/usr/local/CCfits |
| 91 |
|
| 92 |
|
| 93 |
2. Build |
| 94 |
|
| 95 |
Building the C++ shared library will be done automatically by running make |
| 96 |
(or gmake if you prefer the GNU make) without arguments like this: |
| 97 |
|
| 98 |
> gmake |
| 99 |
|
| 100 |
|
| 101 |
3. Install |
| 102 |
|
| 103 |
To install, type: |
| 104 |
|
| 105 |
> make install |
| 106 |
|
| 107 |
The default install location will be /usr/local/lib for the library |
| 108 |
and /usr/local/include for the header files. If you do not have permission to |
| 109 |
write to these locations, you will need to specify another install location. |
| 110 |
You can change this with the --prefix option when you configure, |
| 111 |
or with the DESTDIR variable when installing. The DESTDIR option |
| 112 |
will create a /usr/local/ path in that specified location. |
| 113 |
|
| 114 |
Note that you will also need to update your LD_LIBRARY_PATH: |
| 115 |
|
| 116 |
> export LD_LIBRARY_PATH="/usr/local/CCfits/usr/local/lib/:$LD_LIBRARY_PATH" |
| 117 |
|
| 118 |
> make DESTDIR=/usr/local/CCfits install |
| 119 |
|
| 120 |
|
| 121 |
=============================================================================== |
| 122 |
Instructions for Microsft Windows build: |
| 123 |
=============================================================================== |
| 124 |
|
| 125 |
These instructions follow similar steps to the building of the CFITSIO |
| 126 |
library on Windows, described at |
| 127 |
|
| 128 |
http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/README.win |
| 129 |
|
| 130 |
and rely having the following already installed on your system: |
| 131 |
|
| 132 |
a) Microsoft Visual Studio |
| 133 |
b) The CMake build system available from http://www.cmake.org |
| 134 |
c) The CFITSIO library available from |
| 135 |
|
| 136 |
http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html |
| 137 |
|
| 138 |
1. After unzipping and untarring the CCfits source code tarball, the source |
| 139 |
code will appear in a new \CCfits subdirectory. |
| 140 |
|
| 141 |
2. Open the Visual Studio Developer Command Prompt window and create a |
| 142 |
directory named "CCfits.build" parallel to this CCfits source code directory. |
| 143 |
|
| 144 |
mkdir CCfits.build |
| 145 |
cd CCfits.build |
| 146 |
|
| 147 |
This will be the directory from which CMake generate its files and performs |
| 148 |
the build. |
| 149 |
|
| 150 |
3. Decide which CMake generator you will want to use. The full list is |
| 151 |
shown by doing |
| 152 |
|
| 153 |
cmake.exe /? |
| 154 |
|
| 155 |
We've done successful builds using Visual Studio's 'nmake' utility, and so |
| 156 |
recommend choosing "NMake Makefiles" as the generator option. However if |
| 157 |
you wish to perform the build inside a Visual Studio IDE, you should choose |
| 158 |
the appropriate "Visual Studio <version>" generator. |
| 159 |
|
| 160 |
4. Now run cmake.exe to generate the necessary Makefiles. With this |
| 161 |
command you must specify the path to your CFITSIO library and header |
| 162 |
files by setting the '-DCMAKE_PREFIX_PATH' option. This path should |
| 163 |
be set to the root directory of your CFITSIO installation, from which |
| 164 |
it will look in \lib and \include subdirectories for the library and |
| 165 |
header files respectively. Your full cmake command may then look like: |
| 166 |
|
| 167 |
CCfits.build>cmake.exe -G"NMake Makefiles" -DCMAKE_PREFIX_PATH=C:\path\to\your\CFITSIO ..\CCfits |
| 168 |
|
| 169 |
If you wish to eventually install CCfits at any place other than the |
| 170 |
default location ("C:\Program Files"), you should pass an additional |
| 171 |
flag to the cmake command above: |
| 172 |
|
| 173 |
-DCMAKE_INSTALL_PREFIX=C:\path\to\your\CCfits\installation |
| 174 |
|
| 175 |
5. Build and install CCfits: |
| 176 |
|
| 177 |
CCfits.build> nmake |
| 178 |
|
| 179 |
If all goes well you should now have a CCfits.lib library and |
| 180 |
cookbook.exe executable in your CCfits.build directory. To test |
| 181 |
the build you can run cookbook.exe, which should generate 3 output |
| 182 |
FITS files: atestfil, btestfil, and ctestfil.fit. |
| 183 |
|
| 184 |
Now install CCfits.lib and its header files into the default |
| 185 |
installation location, or the directory you specified in step 4: |
| 186 |
|
| 187 |
CCfits.build> nmake install |
| 188 |
|
| 189 |
|
| 190 |
=============================================================================== |
| 191 |
|
| 192 |
Author: Paul Kunz |
| 193 |
Revised 1 Nov 2006 by Bryan Irby |
| 194 |
Revised Jan 2016 by Craig Gordon |
| 195 |
Revised May 2021 by Kristin Rutkowski |
| 196 |
|