From 184046961dbf354003b81dca77af684cec6a50e9 Mon Sep 17 00:00:00 2001 From: Juraj Michalek Date: Fri, 22 Nov 2013 16:19:17 +0100 Subject: [PATCH] add C++ example of build by Gradle --- .gitignore | 2 ++ README.md | 16 ++++++++++++++++ gradle/hellomuni/build.gradle | 1 + gradle/hellomuni/src/main/cpp/hellomuni.cpp | 9 +++++++++ 4 files changed, 28 insertions(+) create mode 100644 gradle/hellomuni/build.gradle create mode 100644 gradle/hellomuni/src/main/cpp/hellomuni.cpp diff --git a/.gitignore b/.gitignore index e43b0f9..8789cea 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .DS_Store +.gradle +**/build/ diff --git a/README.md b/README.md index 508246c..59b09ba 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,22 @@ How to run: make ./helloworld +Gradle +------ + +Example of building C/C++ project by Gradle. +Gradle is using build.gradle file in main project directory. +Check out project layout. Source code is stored in src/main/cpp. +This is defined by convention and Gradle is able to use it, no further configuration is needed. +Gradle is able to determine compiler chain and use available compiler, e.g. g++ or Visual Studio. + +How to run (Linux): + + cd gradle/hellomuni + gradle mainExecutable + cd build/binaries/mainExecutable + ./hellomuni + Minunit testing --------------- diff --git a/gradle/hellomuni/build.gradle b/gradle/hellomuni/build.gradle new file mode 100644 index 0000000..0590df0 --- /dev/null +++ b/gradle/hellomuni/build.gradle @@ -0,0 +1 @@ +apply plugin: 'cpp-exe' diff --git a/gradle/hellomuni/src/main/cpp/hellomuni.cpp b/gradle/hellomuni/src/main/cpp/hellomuni.cpp new file mode 100644 index 0000000..76274b1 --- /dev/null +++ b/gradle/hellomuni/src/main/cpp/hellomuni.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main() { + cout << "Hello FI MUNI!" << endl; + return 0; +} +