From 9272a92519001b26a9e4802bcc813cdc1429de67 Mon Sep 17 00:00:00 2001 From: Thomas Pedersen Date: Thu, 17 Dec 2015 13:52:57 +0100 Subject: [PATCH] Renamed struct and made hpdREST install alongside homeport with 'make install' --- Examples/CMakeLists.txt | 2 +- Examples/hpd_example_easy.c | 2 +- REST/hpdREST/CMakeLists.txt | 1 + REST/hpdREST/include/CMakeLists.txt | 31 +++++++++++++++++++++++++++++ REST/hpdREST/include/hpd_rest.h | 6 +++--- REST/hpdREST/src/CMakeLists.txt | 6 ++++-- REST/hpdREST/src/hpd_rest.c | 4 ++-- 7 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 REST/hpdREST/include/CMakeLists.txt diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 17864510..b0ff4389 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -35,5 +35,5 @@ include_directories(${PROJECT_SOURCE_DIR}/REST/hpdREST/include) add_executable(hpd_example_easy EXCLUDE_FROM_ALL hpd_example_easy.c ) -target_link_libraries(hpd_example_easy hpd ev hpdREST) +target_link_libraries(hpd_example_easy hpd ev hpd_rest) add_dependencies(example hpd_example_easy) diff --git a/Examples/hpd_example_easy.c b/Examples/hpd_example_easy.c index 1a31dbf5..6b974a15 100644 --- a/Examples/hpd_example_easy.c +++ b/Examples/hpd_example_easy.c @@ -158,7 +158,7 @@ static int init(HomePort *homeport, void *data) int main() { - struct hpd_lr data; + struct hpd_rest data; /** Starts the hpdaemon. If using avahi-core pass a host name for the server, otherwise pass NULL */ return homePortEasy(init, deinit, &data); diff --git a/REST/hpdREST/CMakeLists.txt b/REST/hpdREST/CMakeLists.txt index c08b55ed..cb08c492 100644 --- a/REST/hpdREST/CMakeLists.txt +++ b/REST/hpdREST/CMakeLists.txt @@ -36,4 +36,5 @@ include_directories(${PROJECT_SOURCE_DIR}/REST/http-webserver/include) include_directories(${PROJECT_SOURCE_DIR}/REST/libREST/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +add_subdirectory(include) add_subdirectory(src) diff --git a/REST/hpdREST/include/CMakeLists.txt b/REST/hpdREST/include/CMakeLists.txt new file mode 100644 index 00000000..7dd7d084 --- /dev/null +++ b/REST/hpdREST/include/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright 2013 Aalborg University. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY Aalborg University ''AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Aalborg University OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# The views and conclusions contained in the software and +# documentation are those of the authors and should not be interpreted +# as representing official policies, either expressed. + +install (FILES hpd_rest.h DESTINATION include/hpdaemon) diff --git a/REST/hpdREST/include/hpd_rest.h b/REST/hpdREST/include/hpd_rest.h index 53253370..d278514a 100644 --- a/REST/hpdREST/include/hpd_rest.h +++ b/REST/hpdREST/include/hpd_rest.h @@ -28,12 +28,12 @@ #include "homeport.h" -struct hpd_lr { +struct hpd_rest { struct lr *lr; Listener *dev_listener; }; -int hpd_rest_init(struct hpd_lr *data, HomePort *hp, int port); -int hpd_rest_deinit(struct hpd_lr *data, HomePort *hp); +int hpd_rest_init(struct hpd_rest *data, HomePort *hp, int port); +int hpd_rest_deinit(struct hpd_rest *data, HomePort *hp); #endif //HOMEPORT_HPD_REST_H diff --git a/REST/hpdREST/src/CMakeLists.txt b/REST/hpdREST/src/CMakeLists.txt index 214b5eb6..0d10baa2 100644 --- a/REST/hpdREST/src/CMakeLists.txt +++ b/REST/hpdREST/src/CMakeLists.txt @@ -29,10 +29,12 @@ # as representing official policies, either expressed. # Main library -add_library(hpdREST +add_library(hpd_rest SHARED lr_interface.c hpd_rest.c json.c xml.c ) -target_link_libraries(hpdREST libREST) +target_link_libraries(hpd_rest libREST) +install (TARGETS hpd_rest DESTINATION lib) +set_target_properties(hpd_rest PROPERTIES VERSION 0.0.0 SOVERSION 0) \ No newline at end of file diff --git a/REST/hpdREST/src/hpd_rest.c b/REST/hpdREST/src/hpd_rest.c index bd6d93ad..4cab832e 100644 --- a/REST/hpdREST/src/hpd_rest.c +++ b/REST/hpdREST/src/hpd_rest.c @@ -46,7 +46,7 @@ static void on_dev_detach(void *data, Device *device) { } } -int hpd_rest_init(struct hpd_lr *data, HomePort *hp, int port) +int hpd_rest_init(struct hpd_rest *data, HomePort *hp, int port) { // Create settings struct lr_settings settings = LR_SETTINGS_DEFAULT; @@ -76,7 +76,7 @@ int hpd_rest_init(struct hpd_lr *data, HomePort *hp, int port) return 0; } -int hpd_rest_deinit(struct hpd_lr *data, HomePort *hp) +int hpd_rest_deinit(struct hpd_rest *data, HomePort *hp) { lr_stop(data->lr);