blob: 03c069212211449cbefcbe73f0b04c272da0f8f6 [file] [log] [blame]
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace ndk_library}
/***/
{template .soyweb}
{call buck.page}
{param title: 'ndk_library()' /}
{param navid: 'rule_ndk_library' /}
{param prettify: true /}
{param description}
A rule that is used to define a set of C/C++ files, an Android.mk and an
Application.mk file that are used by the Android NDK's ndk-build tool to
generate one or more shared objects.
{/param}
{param content}
{call buck.rule}
{param status: 'FROZEN' /}
{param overview}
An <code>ndk_library()</code> is used to define a set of C/C++ files,
an <code>Android.mk</code> and an <code>Application.mk</code> file that
are used by the NDK's <code>ndk-build</code> tool to generate one or more shared
objects.
{/param}
{param args}
{call buck.name_arg /}
{call buck.arg}
{param name: 'srcs' /}
{{param default : '[**/*.{cpp,c,cc,cxx,h,hpp,mk}]' /}}
{param desc}
The set of files to compile for this rule.
If not provided, <code>buck</code> assumes
that all files with the following extensions are part of the build:
{sp}<code>c, cpp, cc, cxx, h, hpp, mk</code>.
{/param}
{/call}
{call buck.arg}
{param name: 'deps' /}
{param default : '[]' /}
{param desc}
List of build targets to build before this rule.
{/param}
{/call}
{call buck.arg}
{param name: 'flags' /}
{param default : '[]' /}
{param desc}
Array of strings passed verbatim to <code>ndk-build</code>. Normally
this is not needed, but in some cases you may want to put something
here. For example, this can be used to build the libraries in debug
mode (<code>NDK_DEBUG=1</code>) or set the number of jobs spawned by
{sp}<code>ndk-build</code> (by default, the same as the number of
cores).
{/param}
{/call}
{call buck.arg}
{param name: 'is_asset' /}
{param default: 'False' /}
{param desc}
Normally native shared objects end up in a directory in the root of the APK
named <code>lib/</code>. If this parameter is set to <code>True</code>, then
these objects are placed in <code>assets/lib/</code>. Placing shared objects in
a non-standard location prevents Android from extracting them to the device's
internal storage.
{/param}
{/call}
{/param} // close args
{param furtherexp}
<p>
An <code>android_binary()</code> that includes this library will
aggregate all of the native shared objects into a directory in the
root of the APK named <code>lib/</code> or <code>assets/lib/</code>.
<p>
Unlike the default invocation of <code>ndk-build</code>,
{sp}<code>buck</code> will put all intermediate files and build output
into a subdirectory under <code>buck-out/gen</code>.
{/param}
{/call} // close buck.rule
{/param}
{/call}
{/template}