Skip to content

Commit

Permalink
Improved support for native library deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jcuda committed Aug 29, 2016
1 parent 1858668 commit d69c891
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 133 deletions.
7 changes: 6 additions & 1 deletion .gitignore
@@ -1 +1,6 @@
JCurandJava/target/
/JCurandJava/target/
/JCurandJava/.settings
/JCurandJava/.classpath
/JCurandJava/.project
/target
/nativeLibraries
2 changes: 1 addition & 1 deletion JCurandJNI/CMakeLists.txt
Expand Up @@ -36,4 +36,4 @@ target_link_libraries(${PROJECT_NAME}


set_target_properties(${PROJECT_NAME}
PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-${CMAKE_HOST}-${CMAKE_ARCH})
PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-${JCUDA_VERSION}-${JCUDA_OS}-${JCUDA_ARCH})
49 changes: 0 additions & 49 deletions JCurandJNI/pom.xml

This file was deleted.

89 changes: 8 additions & 81 deletions JCurandJava/pom.xml
Expand Up @@ -5,20 +5,14 @@
<parent>
<groupId>org.jcuda</groupId>
<artifactId>jcuda-parent</artifactId>
<version>0.7.5b</version>
<version>0.7.5c</version>
<relativePath>../../jcuda-common/JCudaParentPOM/pom.xml</relativePath>
</parent>

<artifactId>jcurand</artifactId>

<dependencies>

<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcuda</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -28,85 +22,18 @@

<dependency>
<groupId>org.jcuda</groupId>
<artifactId>JCurand-native</artifactId>
<artifactId>jcuda</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcurand-natives</artifactId>
<version>${project.version}</version>
<classifier>${jcuda.os}-${jcuda.arch}</classifier>
<type>${jcuda.ext}</type>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>

<execution>
<phase>process-test-resources</phase>
<id>copy-natives</id>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jcuda</groupId>
<artifactId>JCurand-native</artifactId>
<classifier>${jcuda.os}-${jcuda.arch}</classifier>
<type>${jcuda.ext}</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<destFileName>${jcuda.prefix}JCurand-${jcuda.os}-${jcuda.arch}.${jcuda.ext}</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>

</executions>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.10,)
</versionRange>
<goals>
<goal>
copy-dependencies
</goal>
<goal>copy</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
6 changes: 5 additions & 1 deletion JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
Expand Up @@ -29,6 +29,7 @@
package jcuda.jcurand;

import jcuda.*;
import jcuda.runtime.JCuda;
import jcuda.runtime.cudaStream_t;

/**
Expand Down Expand Up @@ -72,7 +73,10 @@ public static void initialize()
{
if (!initialized)
{
LibUtils.loadLibrary("JCurand");
String libraryBaseName = "JCurand-" + JCuda.getJCudaVersion();
String libraryName =
LibUtils.createPlatformLibraryName(libraryBaseName);
LibUtils.loadLibrary(libraryName);
initialized = true;
}
}
Expand Down

0 comments on commit d69c891

Please sign in to comment.