I wish to compile my single rs file, into bytecode, independently outside ADT (Eclipse) setup. Is there a script available to do that?
Asked
Active
Viewed 301 times
0
-
Have you tried Android's ant build script? http://developer.android.com/tools/building/building-cmdline.html – Morrison Chang Jan 02 '14 at 05:11
-
Yes. Essentially I would like to build a single rs file and not the whole project. Something like javac command that converts .java file to .class file. – Gagan Jan 02 '14 at 06:02
-
1You might want to explain for what purpose you just want a single rs file as ant builds should be handling in project changes and the build process usual creates the Java stubs needed by the rest of Android. If you wanted to know which part of the SDK is building it look at
/build-tools/x.x.y/llvm-rs-cc – Morrison Chang Jan 02 '14 at 06:27 -
llvm-rs-cc is the right start point however can't get the syntax right for using it in order to create .bc from my input .rs file. – Gagan Jan 02 '14 at 08:39
2 Answers
2
here's what works for me on my mac. running from the sdk/build-tools/android-4.4/ directory:
DYLD_LIBRARY_PATH=`pwd` ./llvm-rs-cc -I renderscript/include/ -I renderscript/clang-include/ -emit-bc -o <output dir> <RS input>

Tim Murray
- 2,205
- 13
- 13
-
Exactly what I was looking for. It did the job for me too on Windows. Thanks again! – Gagan Jan 03 '14 at 04:00
-
I couldn't locate the llvm-rs-cc in the built-android(i.e. containing 'out' folder) source directory. – Gagan Jan 03 '14 at 13:22
0
The AOSP uses the transform-renderscripts-to-java-and-bc macro in definitions.mk to compile rs files. The macro uses llvm-rs-cc to build a renderscript bytecode file.
The ADT bundle has it in sdk/build-tools/18.1.X/llvm-rs-cc
The AOSP builds llvm-rs-cc and puts it in $(OUT)/host/linux-x86/bin/llvm-rs-cc
But how are you going to run the functions in the renderscript bytecode file? Best is a java container. See $AOSP/packages/wallpapers/PhaseBeam for an example of java/rs bindings.
I guess you COULD do an NDK interface but I would have no idea which libraries to link.

dturvene
- 2,284
- 1
- 20
- 18
-
Ha! I just saw that Kitkat has a renderscript C++ interface in the NDK. So as they say: "...so if you've been waiting to use RenderScript from your native code, give it a try." I correct myself. – dturvene Jan 09 '14 at 02:06