From 3675ee066feecaba1b8efdca9e8668c979e44dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Mon, 4 Jul 2016 12:43:19 +0200 Subject: [PATCH] Adding the C code. I'm keeping the Java file for now as reference. --- CMakeLists.txt | 13 +++++++++++++ README.md | 16 ++++++++-------- src/Main.c | 14 ++++++++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 src/Main.c diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a5e2488 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.6) +project(MMMCalc) + +set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic-errors") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -O0") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O3") +set(CMAKE_C_FLAGS_MIN_SIZEREL "${CMAKE_C_FLAGS} -Os") + +set(SRCS + src/Main.c) + +add_executable(mmmcalc ${SRCS}) diff --git a/README.md b/README.md index 92fe11b..339b70a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ MMMCalc ======= -This is a very simple project, it was made for educational purposes (hence why it is open-source), and I encourage everyone to contribute if they have something to add. - -###Compiling -To compile make sure you have JDK and Apache Ant installed. Then run the following command in the root directory of the project: +### Compiling +MMMCalc uses [CMake](http://cmake.org/) to compile. Please install the C development tools and CMake (along with whichever build script you plan on having CMake generate) in order to run this command. ```bash -$ ant +$ cd build/ +$ cmake .. +$ make ``` -###Contributing -To contribute, simply open a pull request. +### Contributing +To contribute, simply open a pull request, however, be aware that this code is licensed under a GNU GPLv3 and so will yours. -###License +### License All code in this repository is under the [GNU GPLv3](/LICENSE). diff --git a/src/Main.c b/src/Main.c new file mode 100644 index 0000000..c1fe429 --- /dev/null +++ b/src/Main.c @@ -0,0 +1,14 @@ +#include + +// 0 = false; +// 1 = true; +char version[16] = "v0.5"; +int verbose = 0; + +int main(int argc, char **argv) { + printf("MMMCalc %s, Copyright (c) 2016 Nicolás A. Ortega.\n", version); + printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); + printf("This program is free software and you are welcome to redistribute\n"); + printf("under the terms and conditions of the GNU GPLv3 or higher.\n\n"); + return 0; +}