Tuesday, September 2, 2014

Compiling GEOtop with Eclipse (on Mac)

[The three  operations below are in common with the compilation of GEOtop by using a makefile, and they are better described here in a previous post]

1- Follow the instructions to install meteoIO. Install and compile it. 

This create the dynamic libraries to be linked to GEOtop. Saving the libraries in a “standard place” could be useful. The other information to annotate is the position of the meteo include files (/usr/local/include, at least under Mac OS) since Eclipse needs them to compile the code.

2 - Install the boost libraries

3 - Download GEOtop from the Git:

[The above operations are in common with the compilation of GEOtop by using a makefile, here]

4 - Set up the Eclipse project^1 

Select:

File -> New -> C++ Project 




Then follow instructions from the pop-up window. If you never did it before, you better think, to browse Eclipse on-line help. 

Next you have to indicate the path of the meteoio libraries and includes. These are not the only one includes that are supposed to be made visibile, as you will learn below. 

Right click on the project. From the menu, select ‘Properties’. A pop-up window will appear. Select and open (clicking on the triangle) the C/C++ General Menu. Go and select ‘Path and Symbols’. On the right side of the pop-up window will appear. The window presents several button. The ones important for us are the ‘Include’ button and the ‘Libraries *’ buttons. 
If you click on ‘Includes’, a selection of languages will be shown. Select GNU C++ (that’s my case). Click on the ‘Add’ button at the right side of the window for adding libraries. A further pop-up menu will appear.

Select the ‘File System’ button. This will drive you to the selection of the directory you need.
Repeat the operation all the times it is required. 

Subsequently, always in the same pop-up menu, click on ‘Libraries’. Click on ‘Add’ and add the names of the libraries required: meteoio, meteoio.2.4.3, meteoio.2. These names correspond to the files called lib*.dylib where the ‘*’ stands for the name of the library required. Repeat the operation for each one of the libraries name. [I do not think it is necessary to link all the three libraries, since the real library is one. The others are symbolic links. However, I did not experimented differently]. 

Third, go back on the Path and Symbols window, and select ‘Libraries Paths’. With the same type of procedures as before, please add the path to the libraries. 

Then, you have to import manually the file into Eclipse. GEOtop “core” related files are contained in the root folder of the project, i.e. only the file ‘config.h’, and in the directory: ‘geotop’, ‘gt_utilities’, ‘libraries’, ‘meteoio_plugin’. Directory (folder) ‘libraries’ has two subdirectories (subfolders): ‘ascii’ and ‘fluidturtle’.  Therefore, these directories needed to be created inside the just created GEOtop folder:

File -> New -> Folder, as it appears in the Figure below


Now, what you have to do is to populate the folders with the files:

Right click on the folder in the Project Explorer -> Select Import, and the following window will appear:

Select ‘File System’, and then ‘Next’. Then follow the instructions. Clicking on the ‘Browse’ button a pop-up window will guide you. 

Another operation to consider is that some include files in the code were declared with < > instead than  “ “. This implies that these includes are recognised as “system include” or of this type. Therefore the path to these include has to be added to the project. This addition works the same way as in point #4. The files of which we are talking about  are 'inputKeywords.h' and  'config.h' that has to be added since it has been place directly in the root directory. [ I am not sure that this is necessary but, at the moment, I could not find a better solution. ]

Now you should be almost done. Just


5 - Build and Compile.  [To do it, get the instructions here. When I did it, I got a conflict in linking which was solved by observing that there were some duplicate classes. I just cancelled:part_snow.cc and part_snow.h from the project]

_________________________________________________________________________________
^1 - One would probably get the project directly inside Eclipse using Egit. This is not an option at moment. But I am thinking to create a clone of the git from where it will be possible. In meanwhile, you can get the project from here. 


No comments:

Post a Comment