Skip to content

Instantly share code, notes, and snippets.

@nodakai
Created August 13, 2015 01:31
Show Gist options
  • Save nodakai/1358c4c3851165e48098 to your computer and use it in GitHub Desktop.
Save nodakai/1358c4c3851165e48098 to your computer and use it in GitHub Desktop.
Minimal Gradle example for withType(CppCompile)
int main() { }
apply plugin: 'cpp'
model {
components {
foo(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs '.'
include 'foo.cpp'
}
}
}
binaries {
all {
lib library: 'rt', linkage: 'shared'
}
}
}
bar(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs '.'
include 'bar.cpp'
}
}
}
binaries {
all {
lib library: 'rt', linkage: 'shared'
}
}
}
}
repositories {
libs(PrebuiltLibraries) {
rt {
headers.srcDir "/hoge/pos"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("/usr/lib64/librt.so")
}
}
}
}
}
tasks.withType(CppCompile) {
compilerArgs = ['-pthread']
includes '/foo/bar'
}
int main() { }
@nodakai
Copy link
Author

nodakai commented Aug 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment