diff --git a/com.ibm.wala.cast.test/build.gradle b/com.ibm.wala.cast.test/build.gradle index 19e7c09fc..33469953a 100644 --- a/com.ibm.wala.cast.test/build.gradle +++ b/com.ibm.wala.cast.test/build.gradle @@ -36,15 +36,6 @@ def addCastRpath(currentJvm, targetPlatform, linker) { } } -static final def addCastEnvironment(task, xlatorLibrary) { - final def castLibrary = xlatorLibrary.libs[2] - if (castLibrary == null) return - final def castLibraryFile = castLibrary.linkFiles.singleFile - final def castLibraryDirectory = castLibraryFile.parent - assert castLibraryDirectory.endsWith('/com.ibm.wala.cast/build/libs/cast/shared') - task.environment 'DYLD_LIBRARY_PATH', castLibraryDirectory -} - model { components { xlator_test(JniNativeLibrarySpec) { @@ -92,8 +83,6 @@ model { def lib = linkXlator_testSharedLibrary dependsOn lib systemProperty 'java.library.path', lib.destinationDirectory.get().asFile - - addCastEnvironment(it, $.binaries.xlator_testSharedLibrary) } checkSmoke_main(Exec) { @@ -122,8 +111,6 @@ model { // all combined as a colon-delimited path list args pathElements.join(':') - - addCastEnvironment(it, $.binaries.xlator_testSharedLibrary) } check.dependsOn checkSmoke_main diff --git a/com.ibm.wala.cast/build.gradle b/com.ibm.wala.cast/build.gradle index 9b4b52108..8b78f1a33 100644 --- a/com.ibm.wala.cast/build.gradle +++ b/com.ibm.wala.cast/build.gradle @@ -82,6 +82,9 @@ model { .find { it.targetPlatform.name == targetPlatform.name } .sharedLibraryLinkFile.parent linker.args "-Wl,-rpath,$libDir" + if (targetPlatform.operatingSystem.name == 'osx') { + linker.args "-Wl,-install_name,@rpath/$sharedLibraryFile.name" + } } } }