Skip to content
Jory Schossau edited this page Jan 25, 2018 · 5 revisions

MBuild: pythonTools/mbuild.py

Description

MBuild automates the process of compiling MABE by using your compiler or creating a project file for your editor such as Visual Studio or X Code. It relies on the file buildOptions.txt to know what parts of MABE to include in the compilation. See the buildOptions wiki page for more about buildOptions.txt. MBuild also generates the necessary modules.h header file required for compiling MABE and which must be created from MBuild.

Examples

  • See all the command options
    python pythonTools/mbuild.py -h
  • Generating a visual studio project file
    python pythonTools/mbuild.py -g vs
  • Compile directly with mbuild (linux and mac only) using 4 processor cores
    python pythonTools/mbuild.py -p 4

Usage

usage: mbuild.py [-h] [-b FILE] [-c] [-nc] [-g GENERATE] [-pg] [-p PARALLEL]  
                                                                          
optional arguments:                                                           
  -h, --help            show this help message and exit                       
  -b FILE, --buildOptions FILE                                                
                        name of file with build options - default :           
                        buildOptions.txt                                      
  -c, --cleanup         add this flag if you want build files (including make)
                        removed after building                                
  -nc, --noCompile      create modules.h and makefile, but do not compile     
  -g GENERATE, --generate GENERATE                                            
                        does not compile but generates a project files of     
                        type: make,vs,xcode,devcpp,cb (Make, Visual Studio,   
                        XCode, [orwell] Dev-C++, CodeBlocks)                  
  -pg, --gprof          compile with -pg option (for gprof)                   
  -p PARALLEL, --parallel PARALLEL                                            
                        how many threads do you want to use when you compile? 
                        i.e. make -j6                                         

Generating Project Files

Users of Visual Studio, X Code, Code Blocks, or Dev-c++ can have project files generated for them and then use their respective IDE (integrated development environment) to compile MABE using that project file. MBuild project generation options and the IDEs to which they match:

IDE option
Visual Studio -g vs
X Code -g xcode
Code::Blocks -g cb
Dev-c++ -g devcpp
Makefile -g make

modules.h will also be created as a result of generating a project file.

Compiling Directly with MBuild

Optionally, you may use the MBuild tool to directly compile MABE on linux or Mac. When doing so, you have the option to compile quickly with the -p NUMCORES parallel build option, or also to use gprof when compiling -pg. For example: python pythonTools/mbuild.py -p 4 would compile using the gcc compiler and 4 processor cores.

Clone this wiki locally