Add skeleton of program.

This commit is contained in:
NADAL Jean-Baptiste
2019-11-08 13:54:47 +01:00
parent 9468c083e0
commit 657ce4f051
6 changed files with 93 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build/*

13
CMakeLists.txt Normal file
View File

@@ -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)

9
build.local.sh Executable file
View File

@@ -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

0
build/.gitkeep Normal file
View File

25
src/CMakeLists.txt Normal file
View File

@@ -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)

45
src/domo-iot.c Normal file
View File

@@ -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 <nats.h>
/*! ----------------------------------------------------------------------------
* @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;
}