-
Notifications
You must be signed in to change notification settings - Fork 9
Compilation
This document describes how to edit and build the PorousMediaAnalysis project.
Table of Contents:
The codes are supplied with an Eclipse CDT or PDT project and a Visual Studio solution at the root folder. Just open them and start reading or editing. Or simply use notepad++, Sublime Text, emacs or vim. In Visual Studio, you better select Show all files option for the project, because filters are not implemented to mimic the file structure.
No prerequisits are required to compile and link this program. The needed libraries are shipped with the project (see Externals folder).
Makefiles are stored inside folders with the underscore _ prefix; so just go to _Debug or _Release folders and run make. On windows you will need MinSys or cygwin to do this.
WARNING: The project uses an external image processing library, FreeImage. The latter has its own makefile, which is called in a pre-build step. There is a bug in Eclipse CDT/PDT for generating pre-build steps in makefiles: Eclipse does not specify that the main step is actually dependent on a pre-build step. Thus, the two steps may be executed in arbitrary order if you just call "make". You may either edit the makefiles manually (but they will be rewritten if you recompile the project in Eclipse) or you may run the pre-build step manually ("make pre-build") and after that run the main step ("make main-build"). You need to run "make pre-build" just once (and compile the main part many times), as you shall never change the FreeImage code manually.
Just open the Visual Studio solution and run the needed build configuration. Visual Studio projects add a special "define" to the compiler options, "WINDOWS". It is used in the code to make the program work under Windows.
Just add the existing Eclipse project to your workspace and run the needed build configuration.
Eclipse project is set up to generate makefiles into the folders with underscore prefixes, and will use them for building the project, so you won't have to generate makefiles manually or with CMake/qmake/premake/SCons after editing the project. If you are using Windows, you will have to install MinSys or Cygwin to compile and debug with Eclipse.
For some reason building through Eclipse (on my machine) builds the pre-build and the main-build steps in a correct order, so no precautions are needed (as in the point II.1 warning).
I found Eclipse CDT or PDT much better than Visual Studio for editing C++. I found installing cygwin better and easier than installing MinSys (no tricks with Path variables, etc). Also, you may be sure with Cygwin that your program will also compile on a true nix system with GCC.
So,
- install cygwin
- install Eclipse CDT or PDT
- edit PorousMediaAnalysis source, add source code files in Eclipse (if necessary)
- build with Eclipse (makefiles will be added or updated)
- commit updated and added makefiles to source control
- use these makefiles on supercomputers or other nix machines