From 657ce4f051e162595b28ddfeef3c46f7603e20a0 Mon Sep 17 00:00:00 2001 From: NADAL Jean-Baptiste Date: Fri, 8 Nov 2019 13:54:47 +0100 Subject: [PATCH] Add skeleton of program. --- .gitignore | 1 + CMakeLists.txt | 13 +++++++++++++ build.local.sh | 9 +++++++++ build/.gitkeep | 0 src/CMakeLists.txt | 25 +++++++++++++++++++++++++ src/domo-iot.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 93 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100755 build.local.sh create mode 100644 build/.gitkeep create mode 100644 src/CMakeLists.txt create mode 100644 src/domo-iot.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a007fea --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4e06bf1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +# CMakeLists files in this project can +# refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and +# to the root binary directory of the project as ${HELLO_BINARY_DIR}. +cmake_minimum_required (VERSION 3.0) + +project (domo-iot) + +set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/bin") +set(LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/lib") +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules/") + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../nats.c ${CMAKE_CURRENT_BINARY_DIR}/nats.c) +add_subdirectory (src) diff --git a/build.local.sh b/build.local.sh new file mode 100755 index 0000000..66539c7 --- /dev/null +++ b/build.local.sh @@ -0,0 +1,9 @@ +#!/bin/sh +if [ -e build ]; then +echo "Clean" +rm -rf build/* +fi + +cd build +cmake .. -DNATS_BUILD_WITH_TLS=OFF -DNATS_BUILD_TLS_USE_OPENSSL_1_1_API=ON -DNATS_BUILD_STREAMING=OFF .. +make diff --git a/build/.gitkeep b/build/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..fba3511 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.0) + +project(domo-iot) + +set (CMAKE_MODULE_PATH "${MODULE_PATH}") +set (CMAKE_CXX_STANDARD 11) + +include_directories(${CMAKE_SOURCE_DIR}/../nats.c/src) + +#set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Werror=strict-aliasing") + +file( + GLOB_RECURSE + source_files + domo-iot.c +) + +add_executable (domo-iot ${source_files}) + +target_link_libraries (domo-iot + LINK_PUBLIC + rt +) + +install (TARGETS domo-iot DESTINATION local/bin) diff --git a/src/domo-iot.c b/src/domo-iot.c new file mode 100644 index 0000000..4e9e5a2 --- /dev/null +++ b/src/domo-iot.c @@ -0,0 +1,45 @@ +/*! + * domi-iot.cpp + * + * Copyright (c) 2015-2019, NADAL Jean-Baptiste. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * @Author: NADAL Jean-Baptiste + * @Date: 08/11/2019 + * + */ + +/*-------------------------------- INCLUDES ---------------------------------*/ + +#include + +/*! ---------------------------------------------------------------------------- + * @fn main + * + * @brief Main function of domo-iot daemon. + */ +int main(int argc, char *argv[]) +{ + natsConnection *conn = NULL; + natsSubscription *sub = NULL; + natsStatus s; + volatile bool done = false; + + printf("Listening on subject 'foo'\n"); + + return 0; +}