fplutil
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
Examples

Android

The android module contains functions that make it easy to build, deploy and run Android applications.

For reference the complete source is in examples/buildutil/android.py.

The following code parses arguments to the script and creates an android.BuildEnvironment instance which is used to perform Android specific build operations...

1 parser = argparse.ArgumentParser()
2 buildutil.android.BuildEnvironment.add_arguments(parser)
3 args = parser.parse_args()
4 
5 env = buildutil.android.BuildEnvironment(args)

The following code then copies the NDK native-plasma sample to the example directory...

1 samplename = 'native-plasma'
2 samplepath = os.path.join(env.ndk_home, 'samples', samplename)
3 shutil.rmtree(samplename, True)
4 shutil.copytree(samplepath, samplename)

The native-plasma application is built using ndk-build to build the native (C/C++) component and ant to build the Java component and APK...

1 (rc, errmsg) = env.build_all()

Finally, the resultant APK is archived in a zip file...

1 env.make_archive(['apks'], 'output.zip', exclude=['objs', 'objs-debug'])

Linux

The linux module contains functions that make it easy to build applications that use cmake in conjunction with the make generator for Unix-like operating systems (e.g Linux and OSX).

For reference the complete source is in examples/buildutil/linux.py.

The following code, parses arguments to the script and creates an linux.BuildEnvironment instance which is used to perform Linux specific build operations...

1 parser = argparse.ArgumentParser()
2 buildutil.linux.BuildEnvironment.add_arguments(parser)
3 args = parser.parse_args()
4 
5 env = buildutil.linux.BuildEnvironment(args)

The example application prints the preprocessor MESSAGE to the standard output stream. So this is passed as a flag to CMake...

1 env.cmake_flags = '-DMESSAGE="Hello, World!"'

The application is built by running CMake followed by make...

1 env.run_cmake()
2 env.run_make()

Finally, the build artifacts are archived in a zip file called output.zip...

1 env.make_archive(['Hello'], 'output.zip')