<property name="gcc" value="gcc"/> \r
<property name="gcc-opts" value="${g++-opts}"/>\r
<fileset id="gcc-files" dir="./"> \r
- <include name="**/*.c"/> \r
+ <include name="**/*.c"/>\r
</fileset>\r
\r
<!-- define linker and options -->\r
package com.badlogic.gdx.jnigen;\r
\r
import java.io.BufferedReader;\r
+import java.io.File;\r
import java.io.IOException;\r
import java.io.InputStreamReader;\r
\r
-\r
-public class AntScriptExecutor {\r
- public static void execute(String buildFile, String params) {\r
- try {\r
+public class BuildExecutor {\r
+ public static void executeAnt(String buildFile, String params) {\r
FileDescriptor build = new FileDescriptor(buildFile);\r
String ant = System.getProperty("os.name").contains("Windows")?"ant.bat":"ant";\r
String command = ant + " -f " + build.name() + " " + params;\r
System.out.println("Executing '" + command + "'");\r
- final Process process = Runtime.getRuntime().exec(command, null, build.parent().file());\r
+ startProcess(command, build.parent().file());\r
+ }\r
+ \r
+ public static void executeNdk(String directory) {\r
+ FileDescriptor build = new FileDescriptor(directory);\r
+ String command = "ndk-build";\r
+ startProcess(command, build.file());\r
+ }\r
+ \r
+ private static void startProcess(String command, File directory) {\r
+ try {\r
+ final Process process = Runtime.getRuntime().exec(command, null, directory);\r
Thread t = new Thread(new Runnable() {\r
@Override\r
public void run() {\r
t.setDaemon(true);\r
t.start();\r
process.waitFor();\r
- } catch (Exception e) {\r
+ } catch(Exception e) {\r
e.printStackTrace();\r
}\r
}\r
package com.badlogic.gdx.jnigen.test;\r
\r
-import com.badlogic.gdx.jnigen.AntScriptExecutor;\r
+import com.badlogic.gdx.jnigen.BuildExecutor;\r
import com.badlogic.gdx.jnigen.AntScriptGenerator;\r
import com.badlogic.gdx.jnigen.BuildConfig;\r
import com.badlogic.gdx.jnigen.BuildTarget;\r
new AntScriptGenerator().generate(new BuildConfig("test"), win32, win64, lin32, lin64);\r
\r
// build natives\r
- AntScriptExecutor.execute("jni/build.xml", "-v");\r
+ BuildExecutor.executeAnt("jni/build.xml", "-v");\r
}\r
}\r
package com.badlogic.gdx.graphics.g2d.stbtt;\r
\r
-import com.badlogic.gdx.jnigen.AntScriptExecutor;\r
+import com.badlogic.gdx.jnigen.BuildExecutor;\r
import com.badlogic.gdx.jnigen.AntScriptGenerator;\r
import com.badlogic.gdx.jnigen.BuildConfig;\r
import com.badlogic.gdx.jnigen.BuildTarget;\r
new AntScriptGenerator().generate(new BuildConfig("stbtruetype"), win32home, win32, win64, lin32, lin64, mac);\r
\r
// build natives\r
- AntScriptExecutor.execute("jni/build-windows32home.xml", "-v");\r
+ BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");\r
}\r
}\r