{"action":"opened","issue":{"url":"https://api.github.com/repos/broadinstitute/gatk/issues/1492","repository_url":"https://api.github.com/repos/broadinstitute/gatk","labels_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1492/labels{/name}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1492/comments","events_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1492/events","html_url":"https://github.com/broadinstitute/gatk/issues/1492","id":134112726,"number":1492,"title":"Gradle build for AVX PairHMM shared library","user":{"login":"gspowley","id":10476709,"avatar_url":"https://avatars.githubusercontent.com/u/10476709?v=3","gravatar_id":"","url":"https://api.github.com/users/gspowley","html_url":"https://github.com/gspowley","followers_url":"https://api.github.com/users/gspowley/followers","following_url":"https://api.github.com/users/gspowley/following{/other_user}","gists_url":"https://api.github.com/users/gspowley/gists{/gist_id}","starred_url":"https://api.github.com/users/gspowley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gspowley/subscriptions","organizations_url":"https://api.github.com/users/gspowley/orgs","repos_url":"https://api.github.com/users/gspowley/repos","events_url":"https://api.github.com/users/gspowley/events{/privacy}","received_events_url":"https://api.github.com/users/gspowley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-16T22:19:45Z","updated_at":"2016-02-16T22:19:45Z","closed_at":null,"body":"The build.gradle code below builds the native shared library for AVX PairHMM using gcc and copies the .so file to the desired location. The jar task will archive the .so file in the GATK jar file.\r\n\r\n```gradle\r\napply plugin: 'cpp'\r\nmodel {\r\n  components {\r\n    VectorLoglessPairHMM(NativeLibrarySpec) {\r\n      binaries.withType(SharedLibraryBinarySpec) { binary ->\r\n        cppCompiler.args \"-I\", \"${System.properties['java.home']}/../include\"\r\n        cppCompiler.args \"-I\", \"${System.properties['java.home']}/../include/linux\"\r\n        cppCompiler.args \"-mavx\"\r\n        linker.args \"-static-libgcc\"\r\n\r\n        task copySharedLib(type: Copy) {\r\n          from binary.tasks\r\n          into \"build/classes/main/org/broadinstitute/hellbender/utils/pairhmm\"\r\n        }\r\n        jar.dependsOn copySharedLib\r\n      }\r\n      // skip static library build\r\n      binaries.withType(StaticLibraryBinarySpec) { binary ->\r\n        buildable = false\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThe gradle gcc plugin expects to find the C++ source code in the default location shown below. We can use a different directory structure, if desired.\r\n```\r\nsrc/\r\n|-- main\r\n|-- test\r\n`-- VectorLoglessPairHMM\r\n    |-- cpp\r\n    `-- headers\r\n```\r\n"}}