New Script: MakefileGenerator

Juan Conejero

PixInsight Staff
Staff member
Hi all,

I am glad to introduce a new script specifically designed for PixInsight/PCL developers: MakefileGenerator.

As its name suggests, this is a script for automatic generation of makefiles and project files for PCL-based PixInsight development projects. It covers all platforms and architectures currently supported by PixInsight: Linux/X11, Mac OS X and Windows, x86 and x86_64. Standard GNU make makefiles are generated for GCC on Linux and Mac OS X, and .vcproj XML project files for Visual C++ 2008 on Windows.

MakefileGenerator is being released under GPL v3 license. This is the script source code:

http://pteam.pixinsight.com/MakefileGenerator.js.zip

and here is a screenshot of the script's interface:

MakefileGenerator-1.0.jpg


MakefileGenerator has been written primarily as an internal tool. In fact, the entire PixInsight platform is being re-built with makefiles and projects generated by this script. This is from now on an essential element of PixInsight's multiplatform development chain.

I have decided to release this script because I think it can be extremely useful for developers on the PixInsight/PCL framework. Now you don't have to worry about the correct symbols defined, or the appropriate settings and compiler optimizations for each platform: just run the script, select the directory where you have your module source code, and click OK with default script settings. This will generate all necessary makefiles and projects for all platforms.

MakefileGenerator makes just one assumption: all the source code of your module (including .cpp, .h and resource files) lies under a single directory. There can be any number of subdirectories, but one root only. As long as this is your case, MakefileGenerator will work for you.

The script has been written for the new PCL version, which still has not been published. The new PCL introduces some breaking changes that require making a few manual changes to your current PCL installation in order to use generated makefiles and .vcproj files:

* All PCL libraries (both static and dynamic) carry the -pxi filename suffix on all platforms. Consequently, denoting as <PCL> your current PCL installation directory, you have to rename:
- Linux and Mac OS X: <PCL>/lib/PCL.a as <PCL>/lib/PCL-pxi.a
- Windows: <PCL>\lib\PCL-vc9.lib as <PCL>\lib\PCL-pxi.lib

* All PCL libraries are from now on located on architecture-specific directories. You must move your PCL-pxi.a or PCL-pxi.lib to a newly created <PCL>/lib/x86 or <PCL>/lib/x86_64 directory, depending on your platform/architecture. See the new PCLLIBDIR32 and PCLLIBDIR64 environmental variables below.

* The following environmental variables must be defined on all platforms:
PCLDIR - PCL root installation directory. Usually ~/PCL or C:\PCL
PCLINCDIR - PCL include root directory, usually equal to $PCLDIR/include
PCLSRCDIR - PCL source root directory, usually equal to $PCLDIR/src
PCLLIBDIR32 - PCL 32-bit libraries directory, usually equal to $PCLDIR/lib/x86
PCLLIBDIR64 - PCL 64-bit libraries directory, usually equal to $PCLDIR/lib/x86_64
PCLBINDIR32 - PCL 32-bit binaries directory, usually equal to $PCLDIR/bin (on x86 platforms)
PCLBINDIR64 - PCL 64-bit binaries directory, usually equal to $PCLDIR/bin (on x86_64 platforms)

Let me know if you need more information, or if you find some error in generated makefiles or .vcproj files.

Enjoy!
 
Hi Juan,

I'm confused. Can we already use this with the current PCL or do we wait for the next release?

Also: will it be possible to install both PCL and PCL64 on the same windows box and compile both flavors provided the host is 64 bit? I notice you have one PCLDIR rather than PCLDIR32 and PCLDIR64. I could move directories around but that's rather messy.
 
Sander, this script works well with the current PCL. Just have to do "exactly" what Juan said in his post.

I think that in the new PCL all it matters is there the PCL-pxi.lib is (and wich flavor of PCL you downloaded). If you have both versions, just keep one of them, but copy the W32 .lib file to the _x86 folder before deleting. Other than that, just define all the variables with this change: set the bin foder, for the w32 version elsewhere, or you'll end with a mix of dlls for both versions in the same folder (outputted by the compiler).

(DISCLAIMER: Correct me if I'm wrong :D )
 
OK, I was able to recompile Carlos' sharpen module in PCL64. I'll have to install PCL32 on this system and see if I can make both 32 and 64 bit compiles work.
 
Carlos and Sander,

Yes, I know all of this is confusing - I probably shouldn't have published this script yet, since it really belongs to the new PCL and build system.

With the new PI 1.5.8 everything works extremely well for development of PCL-based modules on all supported platforms. Automatic generation of makefiles and projects is a big step forward because it simplifies cross-platform development and ensures that everything compiles and links consistently.

For your information, I am working on a new script that you'll love for sure. It generates all the initial source code of a process or file format module automatically, including parameter definitions (which I know are the hardest part to code manually). I really need this script ASAP, given the large amount of modules that Carlos has been writing during the last weeks  :eek:  ;D
 
That sounds really great Juan! Using VS 2008 there was a warning that the SSE2 option was not recognized or something like that. Minor issue. Oh and I'm pretty sure the debug settings didn't include -DPCL_DIAGNOSTICS=2. I wonder why :)
 
Thanks! That's a good point - I'll add an option to include -DPCL_DIAGNOSTICS=<n> (<n> selectable) (you know, I actually don't use diagnostics code and that's why I forgot to include it :)). I'll fix that SSE2 issue too, I have it controlled :)
 
Back
Top