Created
August 13, 2015 01:31
-
-
Save nodakai/1358c4c3851165e48098 to your computer and use it in GitHub Desktop.
Minimal Gradle example for withType(CppCompile)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() { } |
Author
nodakai
commented
Aug 13, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment