Skip to content

Commit

Permalink
* Set the internal DT_SONAME field in libraries created for Android …
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Apr 2, 2016
1 parent 0bdcabc commit 8182d7d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Set the internal DT_SONAME field in libraries created for Android ([issue bytedeco/javacpp-presets#188](https://github.com/bytedeco/javacpp-presets/issues/188))
* Add "org.bytedeco.javacpp.maxbytes" system property, forcing a call to `System.gc()` when this amount of memory tracked with deallocators is reached
* Let `Parser` pick up `Info.annotations` in the case of function pointers as well
* Add `@Convention(extern=...)` value to have `Generator` produce `FunctionPointer` with other language linkage than "C"
Expand Down
28 changes: 15 additions & 13 deletions src/main/java/org/bytedeco/javacpp/tools/Builder.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,17 @@ int compile(String sourceFilename, String outputFilename, ClassProperties proper
command.addAll(compilerOptions);

String output = properties.getProperty("platform.compiler.output");
if (output != null && output.length() > 0) {
command.addAll(Arrays.asList(output.split(" ")));
}
for (int i = 1; i < 2 || output != null; i++,
output = properties.getProperty("platform.compiler.output" + i)) {
if (output != null && output.length() > 0) {
command.addAll(Arrays.asList(output.split(" ")));
}

if (output == null || output.length() == 0 || output.endsWith(" ")) {
command.add(outputFilename);
} else {
command.add(command.remove(command.size() - 1) + outputFilename);
if (output == null || output.length() == 0 || output.endsWith(" ")) {
command.add(outputFilename);
} else {
command.add(command.remove(command.size() - 1) + outputFilename);
}
}

{
Expand Down Expand Up @@ -314,8 +317,8 @@ int compile(String sourceFilename, String outputFilename, ClassProperties proper
logger.info(text);

ProcessBuilder pb = new ProcessBuilder(command);
// Use the library output path as the working directory so that
// intermediate build files from MSVC are dumped there
// Use the library output path as the working directory so that all
// build files, including intermediate ones from MSVC, are dumped there
pb.directory(workingDirectory);
if (environmentVariables != null) {
pb.environment().putAll(environmentVariables);
Expand Down Expand Up @@ -372,17 +375,16 @@ File generateAndCompile(Class[] classes, String outputName) throws IOException,
if (generator.generate(sourceFilename, headerFilename, classPath, classes)) {
generator.close();
if (compile) {
String libraryFilename = outputPath.getPath() + File.separator + libraryName;
logger.info("Compiling " + libraryFilename);
int exitValue = compile(sourceFilename, libraryFilename, p, outputPath);
logger.info("Compiling " + outputPath.getPath() + File.separator + libraryName);
int exitValue = compile(sourceFilename, libraryName, p, outputPath);
if (exitValue == 0) {
if (deleteJniFiles) {
logger.info("Deleting " + sourceFilename);
new File(sourceFilename).delete();
} else {
logger.info("Keeping " + sourceFilename);
}
outputFile = new File(libraryFilename);
outputFile = new File(outputPath, libraryName);
} else {
System.exit(exitValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ platform.compiler.default=-march=armv5te -mtune=xscale -msoft-float
platform.compiler.fastfpu=-march=armv7-a -mfloat-abi=softfp -mfpu=neon -ffast-math -Wl,--fix-cortex-a8
platform.compiler.nodeprecated=-Wno-deprecated-declarations
platform.compiler.output=-Wl,-rpath,lib/ -DANDROID -ffunction-sections -funwind-tables -fstack-protector -funswitch-loops -finline-limit=300 -Wall -O3 -nodefaultlibs -fPIC -shared -Wl,--no-undefined -z text -s -o\u0020
platform.compiler.output2=-Wl,-soname,
platform.linkpath.prefix=-L
platform.linkpath=sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/
platform.link.prefix=-l
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ platform.compiler.default=
platform.compiler.fastfpu=-ffast-math
platform.compiler.nodeprecated=-Wno-deprecated-declarations
platform.compiler.output=-Wl,-rpath,lib/ -DANDROID -ffunction-sections -funwind-tables -fstack-protector -funswitch-loops -finline-limit=300 -Wall -O3 -nodefaultlibs -fPIC -shared -Wl,--no-undefined -z text -s -o\u0020
platform.compiler.output2=-Wl,-soname,
platform.linkpath.prefix=-L
platform.linkpath=sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/
platform.link.prefix=-l
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ platform.compiler.default=
platform.compiler.fastfpu=-msse3 -ffast-math -mfpmath=sse
platform.compiler.nodeprecated=-Wno-deprecated-declarations
platform.compiler.output=-Wl,-rpath,lib/ -DANDROID -ffunction-sections -funwind-tables -fstack-protector -funswitch-loops -finline-limit=300 -Wall -O3 -nodefaultlibs -fPIC -shared -Wl,--no-undefined -z text -s -o\u0020
platform.compiler.output2=-Wl,-soname,
platform.linkpath.prefix=-L
platform.linkpath=sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/
platform.link.prefix=-l
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ platform.compiler.default=
platform.compiler.fastfpu=-msse3 -ffast-math
platform.compiler.nodeprecated=-Wno-deprecated-declarations
platform.compiler.output=-Wl,-rpath,lib/ -DANDROID -ffunction-sections -funwind-tables -fstack-protector -funswitch-loops -finline-limit=300 -Wall -O3 -nodefaultlibs -fPIC -shared -Wl,--no-undefined -z text -s -o\u0020
platform.compiler.output2=-Wl,-soname,
platform.linkpath.prefix=-L
platform.linkpath=sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/
platform.link.prefix=-l
Expand Down

0 comments on commit 8182d7d

Please sign in to comment.