├── .gitmodules
├── CONTRIBUTING
├── LICENSE
├── __init__.py
├── autobuild
├── build_android
├── build_android.cmd
└── build_android.py
├── bin
├── android_ndk_perf
├── android_ndk_perf.cmd
├── android_ndk_perf.py
├── build_all_android
├── build_all_android.cmd
├── build_all_android.py
└── setup_all_prereqs.py
├── buildutil
├── __init__.py
├── android.py
├── android_common.mk
├── android_test.py
├── cmake_common.txt
├── common.py
├── common_test.py
├── linux.py
└── linux_test.py
├── disttools
├── __init__.py
├── config.json
└── push_package.py
├── docs
├── __init__.py
├── generate_docs
├── generate_docs.cmd
├── generate_docs.py
├── py_filter
├── py_filter.bat
├── src
│ ├── buildutil
│ │ ├── api_reference.md
│ │ ├── examples.md
│ │ ├── examples_android.md
│ │ ├── examples_linux.md
│ │ └── overview.md
│ ├── contributing.md
│ ├── doxyfile
│ ├── doxygen_layout.xml
│ ├── footer.html
│ ├── header.html
│ ├── html_overlay
│ │ ├── fpl_logo_small.png
│ │ ├── ftv2mnode.png
│ │ └── ftv2pnode.png
│ ├── index.md
│ ├── iossdkversions.js
│ ├── libfplutil
│ │ ├── examples.md
│ │ ├── linking.md
│ │ ├── main.md
│ │ ├── overview.md
│ │ └── print.md
│ ├── prereqisites.md
│ ├── readme.md
│ ├── style.css
│ ├── tested_ios_sdk_versions.json
│ └── tools
│ │ ├── android_ndk_perf.md
│ │ ├── android_ndk_perf_visualize.png
│ │ ├── android_ndk_perf_visualize_chart.png
│ │ ├── android_ndk_perf_visualize_details.png
│ │ ├── android_ndk_perf_visualize_legend.png
│ │ ├── android_ndk_perf_visualize_summary.png
│ │ ├── build_all_android.md
│ │ └── report.html
└── update_code_snippets.py
├── examples
├── buildutil_example
│ ├── android
│ │ └── build.py
│ └── linux
│ │ ├── CMakeLists.txt
│ │ ├── build.py
│ │ └── main.c
└── libfplutil_example
│ ├── AndroidManifest.xml
│ ├── jni
│ ├── Android.mk
│ └── Application.mk
│ └── main.c
├── fbx_common
├── CMakeLists.txt
├── cmake_fbx.txt
├── include
│ └── fbx_common
│ │ ├── fbx_common.h
│ │ └── fbx_sdk_no_warnings.h
└── src
│ └── fbx_common.cpp
├── libfplutil
├── CMakeLists.txt
├── include
│ └── fplutil
│ │ ├── android_utils.h
│ │ ├── file_utils.h
│ │ ├── index_allocator.h
│ │ ├── intrusive_list.h
│ │ ├── main.h
│ │ ├── mutex.h
│ │ ├── print.h
│ │ ├── string_utils.h
│ │ ├── variable_size.h
│ │ └── version.h
├── jni
│ ├── Android.mk
│ ├── Application.mk
│ └── libs
│ │ └── googletest
│ │ ├── Android.mk
│ │ └── Application.mk
├── src
│ ├── android_utils.cpp
│ ├── file_utils.cpp
│ ├── main.c
│ ├── print.c
│ ├── print_cxx.cc
│ └── string_utils.cpp
└── unit_tests
│ ├── CMakeLists.txt
│ ├── test_index_allocator
│ ├── AndroidManifest.xml
│ ├── jni
│ │ ├── Android.mk
│ │ └── Application.mk
│ └── test_index_allocator.cc
│ ├── test_intrusive_list
│ ├── AndroidManifest.xml
│ ├── jni
│ │ ├── Android.mk
│ │ └── Application.mk
│ └── test_intrusive_list.cc
│ ├── test_main
│ ├── AndroidManifest.xml
│ ├── jni
│ │ ├── Android.mk
│ │ └── Application.mk
│ └── test_main.cc
│ ├── test_perrormsg
│ ├── AndroidManifest.xml
│ ├── jni
│ │ ├── Android.mk
│ │ └── Application.mk
│ └── test_perrormsg.cc
│ ├── test_stdio
│ ├── AndroidManifest.xml
│ ├── jni
│ │ ├── Android.mk
│ │ └── Application.mk
│ └── test_stdio.cc
│ ├── test_string
│ ├── AndroidManifest.xml
│ ├── jni
│ │ ├── Android.mk
│ │ └── Application.mk
│ └── test_string.cc
│ └── test_variable_size
│ ├── AndroidManifest.xml
│ ├── jni
│ ├── Android.mk
│ └── Application.mk
│ └── test_variable_size.cc
├── libs
├── cardboard.jar
└── libprotobuf-java-2.6-nano.jar
├── perf
├── bin
│ ├── COPYING
│ ├── LICENSE
│ ├── android-16
│ │ ├── arch-arm
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── arch-x86
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── darwin-x86
│ │ │ ├── build_info
│ │ │ └── perfhost
│ │ └── linux-x86
│ │ │ ├── build_info
│ │ │ └── perfhost
│ ├── android-17
│ │ ├── arch-arm
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── arch-mips
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── arch-x86
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── darwin-x86
│ │ │ ├── build_info
│ │ │ └── perfhost
│ │ └── linux-x86
│ │ │ ├── build_info
│ │ │ └── perfhost
│ ├── android-18
│ │ ├── arch-arm
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── arch-mips
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── arch-x86
│ │ │ ├── build_info
│ │ │ └── perf
│ │ ├── darwin-x86
│ │ │ ├── build_info
│ │ │ └── perfhost
│ │ └── linux-x86
│ │ │ ├── build_info
│ │ │ └── perfhost
│ └── android-19
│ │ ├── arch-arm
│ │ ├── build_info
│ │ └── perf
│ │ ├── arch-mips
│ │ ├── build_info
│ │ └── perf
│ │ ├── arch-x86
│ │ ├── build_info
│ │ └── perf
│ │ ├── darwin-x86
│ │ ├── build_info
│ │ └── perfhost
│ │ └── linux-x86
│ │ ├── build_info
│ │ └── perfhost
├── build
│ ├── build@
│ │ ├── b225d8b17ee61f0cfe4fb14e7153826183872b00.patch
│ │ ├── b34d556982095a8fe84273ffceadd80f41325acf.patch
│ │ └── ed7d36d0b422b3cb6f15e62c3c88d4f0ad96a613.patch
│ ├── build_perf.py
│ ├── external@elfutils
│ │ └── 101941576c52a1270c9c2d63ea95d48729d6cf96.patch
│ ├── external@linux-tools-perf
│ │ ├── 2db19c77b59c71eef27e9876d4c09ceb6966608d.patch
│ │ ├── 48630d72aea6bab5223eb2538c34d87c1500d7f6.patch
│ │ └── 8a1715044713722b9fa01419a2148a4a2a67aae5.patch
│ └── frameworks@native
│ │ ├── 9c7db08049e1d36c2f60dd703f27c432bc8cfbc5.patch
│ │ └── ac9a96da65f6eae4513654adaad8a457d1c1575c.patch
└── tools
│ ├── LICENSE
│ └── telemetry
│ └── telemetry
│ └── core
│ └── platform
│ └── profiler
│ └── perf_vis
│ ├── LICENSE-d3.v3.min.js.txt
│ ├── LICENSE-jquery.txt
│ ├── LICENSE-sammy.js.txt
│ ├── d3.v3.min.js
│ ├── jquery-1.11.0.min.js
│ ├── perf-vis
│ ├── perf-vis-template.html
│ ├── perf-vis.cmd
│ ├── perf-vis.py
│ ├── perf_to_tracing_json
│ ├── perf_to_tracing_json.cmd
│ ├── perf_to_tracing_json.py
│ ├── sammy-latest.min.js
│ └── sequences.js
├── readme.md
└── setuputil
├── __init__.py
├── android.py
├── common.py
├── linux.py
├── mac.py
├── util.py
└── windows.py
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dependencies/googletest"]
2 | path = dependencies/googletest
3 | url = http://github.com/google/googletest.git
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING:
--------------------------------------------------------------------------------
1 | Contributing {#contributing}
2 | ============
3 |
4 | Want to contribute? Great! First, read this page (including the small print at
5 | the end).
6 |
7 | # Before you contribute
8 | Before we can use your code, you must sign the
9 | [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
10 | (CLA), which you can do online. The CLA is necessary mainly because you own the
11 | copyright to your changes, even after your contribution becomes part of our
12 | codebase, so we need your permission to use and distribute your code. We also
13 | need to be sure of various other things—for instance that you'll tell us if you
14 | know that your code infringes on other people's patents. You don't have to sign
15 | the CLA until after you've submitted your code for review and a member has
16 | approved it, but you must do it before we can put your code into our codebase.
17 | Before you start working on a larger contribution, you should get in touch with
18 | us first through the issue tracker with your idea so that we can help out and
19 | possibly guide you. Coordinating up front makes it much easier to avoid
20 | frustration later on.
21 |
22 | # Code reviews
23 | All submissions, including submissions by project members, require review. We
24 | use Github pull requests for this purpose.
25 |
26 | # The small print
27 | Contributions made by corporations are covered by a different agreement than
28 | the one above, the Software Grant and Corporate Contributor License Agreement.
29 |
--------------------------------------------------------------------------------
/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google/fplutil/ac0118ad7fedf054c2645efdb13f52788c183d12/__init__.py
--------------------------------------------------------------------------------
/autobuild/build_android:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2014 Google Inc. All Rights Reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | $0.py "$@"
16 |
17 |
--------------------------------------------------------------------------------
/autobuild/build_android.cmd:
--------------------------------------------------------------------------------
1 | @rem Copyright 2014 Google Inc. All Rights Reserved.
2 | @rem
3 | @rem Licensed under the Apache License, Version 2.0 (the "License");
4 | @rem you may not use this file except in compliance with the License.
5 | @rem You may obtain a copy of the License at
6 | @rem
7 | @rem http://www.apache.org/licenses/LICENSE-2.0
8 | @rem
9 | @rem Unless required by applicable law or agreed to in writing, software
10 | @rem distributed under the License is distributed on an "AS IS" BASIS,
11 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | @rem See the License for the specific language governing permissions and
13 | @rem limitations under the License.
14 | python %~dp0\build_android.py %*
15 |
--------------------------------------------------------------------------------
/autobuild/build_android.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # Copyright 2014 Google Inc. All rights reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | """Android automated build script.
17 |
18 | This script may be used for turnkey android builds of fplutil.
19 |
20 | Optional environment variables:
21 |
22 | ANDROID_SDK_HOME = Path to the Android SDK. Required if it is not passed on the
23 | command line.
24 | NDK_HOME = Path to the Android NDK. Required if it is not in passed on the
25 | command line.
26 | MAKE_FLAGS = String to override the default make flags with for ndk-build.
27 | ANT_PATH = Path to ant executable. Required if it is not in $PATH or passed on
28 | the command line.
29 | """
30 |
31 | import argparse
32 | import os
33 | import sys
34 | sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
35 | import buildutil.android
36 | import buildutil.common
37 |
38 | PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
39 | os.pardir))
40 |
41 | GOOGLETEST_MAKEFILE = os.path.join('googletest', 'Android.mk')
42 |
43 | # Set of paths to search for googletest.
44 | GOOGLETEST_DEFAULT_PATHS = [
45 | os.path.abspath(os.path.join(PROJECT_ROOT, 'dependencies')),
46 | os.path.abspath(os.path.join(PROJECT_ROOT, os.pardir))]
47 |
48 |
49 | def main():
50 | parser = argparse.ArgumentParser()
51 | buildutil.android.BuildEnvironment.add_arguments(parser)
52 |
53 | googletest_default_path = GOOGLETEST_DEFAULT_PATHS[0]
54 | for path in GOOGLETEST_DEFAULT_PATHS:
55 | if os.path.exists(os.path.join(path, GOOGLETEST_MAKEFILE)):
56 | googletest_default_path = path
57 | break
58 |
59 | parser.add_argument('-G', '--gtest_path',
60 | help='Path to Google Test', dest='gtest_path',
61 | default=googletest_default_path)
62 |
63 | args = parser.parse_args()
64 |
65 | env = buildutil.android.BuildEnvironment(args)
66 |
67 | gtest_arg = 'GOOGLETEST_PATH="%s"' % args.gtest_path
68 | if env.make_flags:
69 | env.make_flags = '%s %s' % (env.make_flags, gtest_arg)
70 | else:
71 | env.make_flags = gtest_arg
72 |
73 | env.git_clean()
74 | (rc, errmsg) = env.build_all(exclude_dirs=['dependencies'])
75 | if (rc == 0):
76 | env.make_archive(['libs', 'apks', os.path.join('libfplutil', 'include'),
77 | os.path.join('libfplutil', 'jni')], 'output.zip',
78 | exclude=['objs', 'objs-debug'])
79 | else:
80 | print >> sys.stderr, errmsg
81 |
82 | return rc
83 |
84 | if __name__ == '__main__':
85 | sys.exit(main())
86 |
--------------------------------------------------------------------------------
/bin/android_ndk_perf:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2014 Google Inc. All Rights Reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | $0.py "$@"
16 |
--------------------------------------------------------------------------------
/bin/android_ndk_perf.cmd:
--------------------------------------------------------------------------------
1 | @rem Copyright 2014 Google Inc. All Rights Reserved.
2 | @rem
3 | @rem Licensed under the Apache License, Version 2.0 (the "License");
4 | @rem you may not use this file except in compliance with the License.
5 | @rem You may obtain a copy of the License at
6 | @rem
7 | @rem http://www.apache.org/licenses/LICENSE-2.0
8 | @rem
9 | @rem Unless required by applicable law or agreed to in writing, software
10 | @rem distributed under the License is distributed on an "AS IS" BASIS,
11 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | @rem See the License for the specific language governing permissions and
13 | @rem limitations under the License.
14 | python %~dp0\android_ndk_perf.py %*
15 |
--------------------------------------------------------------------------------
/bin/build_all_android:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2014 Google Inc. All Rights Reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | $0.py "$@"
16 |
--------------------------------------------------------------------------------
/bin/build_all_android.cmd:
--------------------------------------------------------------------------------
1 | @rem Copyright 2014 Google Inc. All Rights Reserved.
2 | @rem
3 | @rem Licensed under the Apache License, Version 2.0 (the "License");
4 | @rem you may not use this file except in compliance with the License.
5 | @rem You may obtain a copy of the License at
6 | @rem
7 | @rem http://www.apache.org/licenses/LICENSE-2.0
8 | @rem
9 | @rem Unless required by applicable law or agreed to in writing, software
10 | @rem distributed under the License is distributed on an "AS IS" BASIS,
11 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | @rem See the License for the specific language governing permissions and
13 | @rem limitations under the License.
14 | python %~dp0\build_all_android.py %*
15 |
--------------------------------------------------------------------------------
/buildutil/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Google Inc. All rights reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | """Build utilities for use in automated build scripts and tools.
17 |
18 | This module is a set of functions that can be used to help implement tools
19 | to perform typical build tasks. The main focus is to enable turnkey building
20 | both for users and also for continuous integration builds and tests.
21 |
22 | Simple usage example:
23 |
24 | import buildutil.linux
25 |
26 | def main():
27 | env = buildutil.linux.BuildEnvironment(buildutil.linux.build_defaults())
28 |
29 | env.run_make()
30 | env.make_archive(['bin', 'lib', 'include'], 'output.zip')
31 |
32 |
33 | Please see examples/buildutil/* for more comprehensive uses.
34 | """
35 |
--------------------------------------------------------------------------------
/buildutil/linux.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Google Inc. All rights reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | """@file buildutil/linux.py Linux-specific BuildEnvironment sub-module.
17 |
18 | Optional environment variables:
19 |
20 | @li CMAKE_PATH = Path to CMake binary. Required if cmake is not in $PATH,
21 | or not passed on command line.
22 | @li CMAKE_FLAGS = String to override the default CMake flags with.
23 |
24 | @package fplutil.buildutil.linux Linux-specific BuildEnvironment sub-module.
25 | """
26 |
27 | import distutils.spawn
28 | import os
29 | import shlex
30 | import sys
31 | sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
32 | import buildutil.common as common
33 |
34 | _CMAKE_PATH_ENV_VAR = 'CMAKE_PATH'
35 | _CMAKE_FLAGS_ENV_VAR = 'CMAKE_FLAGS'
36 | _CMAKE_PATH = 'cmake_path'
37 | _CMAKE_FLAGS = 'cmake_flags'
38 |
39 |
40 | class BuildEnvironment(common.BuildEnvironment):
41 |
42 | """Class representing a Linux build environment.
43 |
44 | This class adds Linux-specific functionality to the common
45 | BuildEnvironment.
46 |
47 | Attributes:
48 | cmake_path: Path to the cmake binary, for cmake-based projects.
49 | cmake_flags: Flags to pass to cmake, for cmake-based projects.
50 | """
51 |
52 | CMAKE = 'cmake'
53 |
54 | def __init__(self, arguments):
55 | """Constructs the BuildEnvironment with basic information needed to build.
56 |
57 | The build properties as set by argument parsing are also available
58 | to be modified by code using this object after construction.
59 |
60 | It is required to call this function with a valid arguments object,
61 | obtained either by calling argparse.ArgumentParser.parse_args() after
62 | adding this modules arguments via buildutils.add_arguments(), or by passing
63 | in an object returned from buildutils.build_defaults().
64 |
65 | Args:
66 | arguments: The argument object returned from ArgumentParser.parse_args().
67 | """
68 |
69 | super(BuildEnvironment, self).__init__(arguments)
70 |
71 | if type(arguments) is dict:
72 | args = arguments
73 | else:
74 | args = vars(arguments)
75 |
76 | self.cmake_path = args[_CMAKE_PATH]
77 | self.cmake_flags = args[_CMAKE_FLAGS]
78 |
79 | @staticmethod
80 | def build_defaults():
81 | """Helper function to set build defaults.
82 |
83 | Returns:
84 | A dict containing appropriate defaults for a build.
85 | """
86 | args = common.BuildEnvironment.build_defaults()
87 |
88 | args[_CMAKE_PATH] = (os.getenv(_CMAKE_PATH_ENV_VAR) or
89 | distutils.spawn.find_executable('cmake'))
90 | args[_CMAKE_FLAGS] = os.getenv(_CMAKE_FLAGS_ENV_VAR)
91 |
92 | return args
93 |
94 | @staticmethod
95 | def add_arguments(parser):
96 | """Add module-specific command line arguments to an argparse parser.
97 |
98 | This will take an argument parser and add arguments appropriate for this
99 | module. It will also set appropriate default values.
100 |
101 | Args:
102 | parser: The argparse.ArgumentParser instance to use.
103 | """
104 | defaults = BuildEnvironment.build_defaults()
105 |
106 | common.BuildEnvironment.add_arguments(parser)
107 |
108 | parser.add_argument('-b', '--' + _CMAKE_PATH,
109 | help='Path to CMake binary', dest=_CMAKE_PATH,
110 | default=defaults[_CMAKE_PATH])
111 | parser.add_argument(
112 | '-F', '--' + _CMAKE_FLAGS, help='Flags to use to override CMake flags',
113 | dest=_CMAKE_FLAGS, default=defaults[_CMAKE_FLAGS])
114 |
115 | def _find_binary(self, binary, additional_paths=None):
116 | """Find a binary from the set of binaries managed by this class.
117 |
118 | This method enables the lookup of a binary path using the name of the
119 | binary to avoid replication of code which searches for binaries.
120 |
121 | This class allows the lookup of...
122 | * BuildEnvironment.CMAKE
123 |
124 | The _find_binary() method in derived classes may add more binaries.
125 |
126 | Args:
127 | binary: Name of the binary.
128 | additional_paths: Additional dictionary to search for binary paths.
129 |
130 | Returns:
131 | String containing the path of binary.
132 |
133 | Raises:
134 | ToolPathError: Binary is not at the specified path.
135 | """
136 | search_dict = {BuildEnvironment.CMAKE: [self.cmake_path]}
137 | if additional_paths:
138 | search_dict.update(additional_paths)
139 | return BuildEnvironment._check_binary(binary, search_dict[binary])
140 |
141 | def run_cmake(self, gen='Unix Makefiles'):
142 | """Run cmake based on the specified build environment.
143 |
144 | This will execute cmake using the configured environment, passing it the
145 | flags specified in the cmake_flags property.
146 |
147 | Args:
148 | gen: Optional argument to specify CMake project generator (defaults to
149 | Unix Makefiles)
150 |
151 | Raises:
152 | SubCommandError: CMake invocation failed or returned an error.
153 | ToolPathError: CMake not found in configured build environment or $PATH.
154 | """
155 |
156 | cmake_path = self._find_binary(BuildEnvironment.CMAKE)
157 |
158 | args = [cmake_path, '-G', gen]
159 | if self.cmake_flags:
160 | args += shlex.split(self.cmake_flags, posix=self._posix)
161 | args.append(self.project_directory)
162 |
163 | self.run_subprocess(args, cwd=self.project_directory)
164 |
--------------------------------------------------------------------------------
/buildutil/linux_test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # Copyright 2014 Google Inc. All rights reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | import argparse
18 | import distutils.spawn
19 | import os
20 | import sys
21 | import unittest
22 | sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
23 | import buildutil.android as android
24 | import buildutil.common as common
25 | import buildutil.common_test as common_test
26 | import buildutil.linux as linux
27 |
28 |
29 | class CMakeMock(common_test.RunCommandMock):
30 | """Verifies cmake command lines."""
31 |
32 | def __init__(self, test_case, expected, cwd):
33 | """Callable object which verifies cmake command lines.
34 |
35 | Args:
36 | test_case: unitetst.TestCase used to verify arguments.
37 | expected: Expected arguments for cmake.
38 | cwd: Expected working directory.
39 | """
40 | common_test.RunCommandMock.__init__(self, test_case)
41 | build_environment_defaults = linux.BuildEnvironment.build_defaults()
42 | self.expect([build_environment_defaults[linux._CMAKE_PATH]] + expected,
43 | cwd)
44 |
45 |
46 | class LinuxBuildUtilTest(unittest.TestCase):
47 | """Linux-specific unit tests."""
48 |
49 | def setUp(self):
50 | self.find_executable = common._find_executable
51 | # Mock out find_executable so all binaries are found.
52 | common._find_executable = (
53 | lambda name, path=None: path if path else os.path.join('a', 'b', name))
54 |
55 | def tearDown(self):
56 | common._find_executable = self.find_executable
57 |
58 | def test_build_defaults(self):
59 | d = linux.BuildEnvironment.build_defaults()
60 | # Verify that the linux ones are set.
61 | self.assertIn(linux._CMAKE_FLAGS, d)
62 | self.assertIn(linux._CMAKE_PATH, d)
63 | # Verify that a mandatory superclass one gets set.
64 | self.assertIn(common._PROJECT_DIR, d)
65 | # Verify that a required Android one does not get set.
66 | self.assertNotIn(android._NDK_HOME, d)
67 |
68 | def test_init(self):
69 | d = linux.BuildEnvironment.build_defaults()
70 | b = linux.BuildEnvironment(d)
71 | # Verify that the linux ones are set.
72 | self.assertEqual(b.cmake_flags, d[linux._CMAKE_FLAGS])
73 | self.assertEqual(b.cmake_path, d[linux._CMAKE_PATH])
74 | # Verify that a mandatory superclass one gets set.
75 | self.assertEqual(b.project_directory, d[common._PROJECT_DIR])
76 | # Verify that a required Android one does not get set.
77 | self.assertNotIn(android._NDK_HOME, vars(b))
78 |
79 | def test_add_arguments(self):
80 | p = argparse.ArgumentParser()
81 | linux.BuildEnvironment.add_arguments(p)
82 | args = ['--' + linux._CMAKE_FLAGS, 'a', '--' + linux._CMAKE_PATH, 'b']
83 | argobj = p.parse_args(args)
84 | d = vars(argobj)
85 | self.assertEqual('a', d[linux._CMAKE_FLAGS])
86 | self.assertEqual('b', d[linux._CMAKE_PATH])
87 | self.assertEqual(os.getcwd(), d[common._PROJECT_DIR])
88 | self.assertNotIn(android._NDK_HOME, d)
89 |
90 | def test_run_cmake(self):
91 | d = linux.BuildEnvironment.build_defaults()
92 | b = linux.BuildEnvironment(d)
93 | # Mock the call to run_subprocess.
94 | b.run_subprocess = CMakeMock(self, ['-G', 'b', 'c', 'd', 'e'], 'e')
95 | b.cmake_flags = 'c d'
96 | b.project_directory = 'e'
97 | b.run_cmake(gen='b')
98 |
99 | if __name__ == '__main__':
100 | unittest.main()
101 |
--------------------------------------------------------------------------------
/disttools/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Google Inc. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Source distribution scripts."""
16 |
17 | import push_package
18 |
--------------------------------------------------------------------------------
/disttools/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "package": {
3 | "name": "fplutil",
4 | "url": "http://github.com/google/fplutil.git",
5 | "branch": "develop",
6 | "is_library": 1,
7 | "third_party": 0,
8 | "push": 1
9 | },
10 |
11 | "dependencies": [
12 | {
13 | "name": "googletest",
14 | "url": "http://github.com/google/googletest.git",
15 | "branch": "master",
16 | "revision": "13206d6f53aaff844f2d3595a01ac83a29e383db",
17 | "is_library": 1,
18 | "third_party": 1,
19 | "push": 0
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/docs/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Google Inc. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Documentation generation scripts."""
16 |
17 | import generate_docs
18 |
--------------------------------------------------------------------------------
/docs/generate_docs:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2014 Google Inc. All Rights Reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | $0.py "$@"
16 |
--------------------------------------------------------------------------------
/docs/generate_docs.cmd:
--------------------------------------------------------------------------------
1 | @rem Copyright 2014 Google Inc. All Rights Reserved.
2 | @rem
3 | @rem Licensed under the Apache License, Version 2.0 (the "License");
4 | @rem you may not use this file except in compliance with the License.
5 | @rem You may obtain a copy of the License at
6 | @rem
7 | @rem http://www.apache.org/licenses/LICENSE-2.0
8 | @rem
9 | @rem Unless required by applicable law or agreed to in writing, software
10 | @rem distributed under the License is distributed on an "AS IS" BASIS,
11 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | @rem See the License for the specific language governing permissions and
13 | @rem limitations under the License.
14 | python %~dp0\generate_docs.py %*
15 |
--------------------------------------------------------------------------------
/docs/py_filter:
--------------------------------------------------------------------------------
1 | #!/bin/bash -eu
2 | # Copyright 2014 Google Inc. All rights reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | # NOTE: This requires https://github.com/Feneric/doxypypy which filters
17 | # python doc strings so they're understood by doxygen.
18 | #
19 | # git clone https://github.com/Feneric/doxypypy
20 | # cd doxypypy
21 | # sudo python -m setup install
22 | #
23 | python -m doxypypy.doxypypy -a -c $1
24 |
--------------------------------------------------------------------------------
/docs/py_filter.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | @rem Copyright 2014 Google Inc. All rights reserved.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem http://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 |
16 | @rem NOTE: This requires https://github.com/Feneric/doxypypy which filters
17 | @rem python doc strings so they're understood by doxygen.
18 | @rem
19 | @rem git clone https://github.com/Feneric/doxypypy
20 | @rem cd doxypypy
21 | @rem python -m setup install
22 | @rem
23 | python -m doxypypy.doxypypy -a -c %1
24 |
--------------------------------------------------------------------------------
/docs/src/buildutil/api_reference.md:
--------------------------------------------------------------------------------
1 | buildutil API Reference {#buildutil_api_reference}
2 | =======================
3 |
4 | `buildutil` consists of the following modules:
5 |
6 | * [common.py][]
7 | * [android.py][]
8 | * [linux.py][]
9 |
10 | The [common.py][] module implements functionality shared across multiple build
11 | environments.
12 |
13 | [android.py][] implements functions to build [Android][] projects, sign APKs,
14 | deploy APKs to [Android][] devices and launch the built applications.
15 |
16 | [linux.py][] implements functions to build applications using [CMake][] and
17 | [make][] on Unix-like operating systems (e.g [Linux][] and [OSX][]).
18 |
19 | Each module implements a [BuildEnvironment][] class which contains functions
20 | to build for a specific build environment.
21 |
22 | Each [BuildEnvironment][] class implements an [add_arguments][] which adds
23 | a set of arguments to an [ArgumentParser][] instance. The arguments parsed by
24 | [ArgumentParser][] can be passed to a [BuildEnvironment][] on construction to
25 | configure the instance.
26 |
27 | After constructing a [BuildEnvironment][] instance, it's possible to build
28 | projects for the selected build environment using methods like the following:
29 |
30 | * [run_make](@ref fplutil.buildutil.common.BuildEnvironment.run_make)
31 | * [run_cmake](@ref fplutil.buildutil.linux.BuildEnvironment.run_cmake)
32 | * [build_all](@ref fplutil.buildutil.android.BuildEnvironment.build_all)
33 |
34 | [ArgumentParser]: @ref argparse.ArgumentParser
35 | [BuildEnvironment]: @ref fplutil.buildutil.common.BuildEnvironment
36 | [add_arguments]: @ref fplutil.buildutil.common.BuildEnvironment.add_arguments
37 | [android.py]: @ref buildutil/android.py
38 | [common.py]: @ref buildutil/common.py
39 | [linux.py]: @ref buildutil/linux.py
40 | [Android]: http://www.android.com
41 | [make]: http://www.gnu.org/software/make
42 | [CMake]: http://www.cmake.org
43 | [Linux]: http://en.m.wikipedia.org/wiki/Linux
44 | [OSX]: http;//www.apple.com/osx
45 |
--------------------------------------------------------------------------------
/docs/src/buildutil/examples.md:
--------------------------------------------------------------------------------
1 | Examples {#buildutil_examples}
2 | ========
3 |
4 | # Android {#buildutil_examples_android}
5 |
6 | The [android](@ref buildutil/android.py) module contains functions that make
7 | it easy to build, deploy and run Android applications.
8 |
9 | For reference the complete source is in
10 | [examples/buildutil/android.py](@ref buildutil_examples_android_code).
11 |
12 | The following code parses arguments to the script and creates an
13 | [android.BuildEnvironment](@ref fplutil.buildutil.android.BuildEnvironment)
14 | instance which is used to perform Android specific build operations...
15 |
16 | ~~~{.py}
17 | parser = argparse.ArgumentParser()
18 | buildutil.android.BuildEnvironment.add_arguments(parser)
19 | args = parser.parse_args()
20 |
21 | env = buildutil.android.BuildEnvironment(args)
22 | ~~~
23 |
24 | The following code then copies the NDK `native-plasma` sample to the example
25 | directory...
26 |
27 | ~~~{.py}
28 | samplename = 'native-plasma'
29 | samplepath = os.path.join(env.ndk_home, 'samples', samplename)
30 | shutil.rmtree(samplename, True)
31 | shutil.copytree(samplepath, samplename)
32 | ~~~
33 |
34 | The `native-plasma` application is built using `ndk-build` to build the native
35 | (C/C++) component and `ant` to build the Java component and APK...
36 |
37 | ~~~{.py}
38 | (rc, errmsg) = env.build_all()
39 | ~~~
40 |
41 | Finally, the resultant APK is archived in a zip file...
42 |
43 | ~~~{.py}
44 | env.make_archive(['apks'], 'output.zip', exclude=['objs', 'objs-debug'])
45 | ~~~
46 |
47 | # Linux {#buildutil_examples_linux}
48 |
49 | The [linux](@ref buildutil/linux.py) module contains functions that make it
50 | easy to build applications that use [cmake][] in conjunction with the [make][]
51 | generator for Unix-like operating systems (e.g [Linux][] and [OSX][]).
52 |
53 | For reference the complete source is in
54 | [examples/buildutil/linux.py](@ref buildutil_examples_linux_code).
55 |
56 | The following code, parses arguments to the script and creates an
57 | [linux.BuildEnvironment](@ref fplutil.buildutil.linux.BuildEnvironment)
58 | instance which is used to perform Linux specific build operations...
59 |
60 | ~~~{.py}
61 | parser = argparse.ArgumentParser()
62 | buildutil.linux.BuildEnvironment.add_arguments(parser)
63 | args = parser.parse_args()
64 |
65 | env = buildutil.linux.BuildEnvironment(args)
66 | ~~~
67 |
68 | The example application prints the preprocessor `MESSAGE` to the standard
69 | output stream. So this is passed as a flag to [CMake][]...
70 |
71 | ~~~{.py}
72 | env.cmake_flags = '-DMESSAGE="Hello, World!"'
73 | ~~~
74 |
75 | The application is built by running [CMake][] followed by [make][]...
76 |
77 | ~~~{.py}
78 | env.run_cmake()
79 | env.run_make()
80 | ~~~
81 |
82 | Finally, the build artifacts are archived in a zip file called `output.zip`...
83 |
84 | ~~~{.py}
85 | env.make_archive(['Hello'], 'output.zip')
86 | ~~~
87 |
88 |
89 |
90 | [make]: http://www.gnu.org/software/make
91 | [CMake]: http://www.cmake.org
92 | [Linux]: http://en.m.wikipedia.org/wiki/Linux
93 | [OSX]: http://www.apple.com/osx
94 |
--------------------------------------------------------------------------------
/docs/src/buildutil/examples_android.md:
--------------------------------------------------------------------------------
1 | Android Buildutil Example {#buildutil_examples_android_code}
2 | =========================
3 |
4 | @include android/build.py
5 |
--------------------------------------------------------------------------------
/docs/src/buildutil/examples_linux.md:
--------------------------------------------------------------------------------
1 | Linux Buildutil Example {#buildutil_examples_linux_code}
2 | =======================
3 |
4 | @include linux/build.py
5 |
--------------------------------------------------------------------------------
/docs/src/buildutil/overview.md:
--------------------------------------------------------------------------------
1 | buildutil {#buildutil_overview}
2 | =========
3 |
4 | `buildutil` contains a set of [Python][] modules which can simplify the process
5 | of automating builds of C/C++ applications for [Android][] and [Linux][].
6 |
7 | Many builds require the following steps to be performed:
8 | * Configuration
9 | * Build
10 | * Archive of artifacts
11 |
12 | Some build environments - like [autoconf][], [automake][] and [make][] -
13 | require each of these steps to be executed manually, others - like [CMake][] -
14 | perform the configuration step and generate scripts that are executed as part
15 | of another build environment. Artifact collection can be part of the build
16 | scripts (e.g make install) or part of the continuous automation system
17 | depending upon the build environment.
18 |
19 | `buildutil` provides a set of modules that simplify the process of writing
20 | continuous automation scripts that use [CMake][] to support [Linux][],
21 | [OSX][] and [Windows][] in addition to [Ant][] and [NDK Build][] for
22 | [Android][]. This allows developers to write cross-platform turnkey scripts
23 | that are trivial to execute from a continuous automation system like
24 | [Jenkins][], [Buildbot][], [Travis-CI][] etc.
25 |
26 | In order to use this module, all [prerequisites](@ref fplutil_prerequisites)
27 | should be installed.
28 |
29 | For more information about this module see the following:
30 |
31 | * [Example](@ref buildutil_examples_android) of building an Android
32 | application using `buildutil`.
33 | * [Example](@ref buildutil_examples_linux) of building a Linux
34 | application using `buildutil`.
35 | * [Common](@ref buildutil/common.py), [Android](@ref buildutil/android.py)
36 | and [Linux](@ref buildutil/linux.py) API reference.
37 |
38 | [Android]: http://www.android.com
39 | [Ant]: http://ant.apache.org
40 | [Buildbot]: http://www.buildbot.net
41 | [CMake]: http://www.cmake.org
42 | [Jenkins]: htttp://www.jenkins-ci.org
43 | [Linux]: http://en.m.wikipedia.org/wiki/Linux
44 | [NDK Build]: http://developer.android.com/tools/sdk/ndk/index.html
45 | [OSX]: http://www.apple.com/osx
46 | [Travis-CI]: http://www.travis-ci.org
47 | [Windows]: http://windows.microsoft.com
48 | [autoconf]: http://www.gnu.org/software/autoconf
49 | [automake]: http://www.gnu.org/software/automake
50 | [make]: http://www.gnu.org/software/make
51 | [Python]: http://www.python.org
52 |
--------------------------------------------------------------------------------
/docs/src/contributing.md:
--------------------------------------------------------------------------------
1 | ../../CONTRIBUTING
--------------------------------------------------------------------------------
/docs/src/footer.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |