Skip to content

Commit

Permalink
Merge pull request #133 from mbehr1/libmicrohttpd_131
Browse files Browse the repository at this point in the history
use LOCAL_SUPPORT to check whether local.c... should be used
  • Loading branch information
andig committed Mar 1, 2015
2 parents 53fa67a + 0c7ccce commit f6bf8f6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Expand Up @@ -154,15 +154,16 @@ if(SML_FOUND)
else(SML_FOUND)
message(" sml: NOT FOUND")
endif(SML_FOUND)

if(MICROHTTPD_FOUND)
message(" microhttpd: -L${MICROHTTPD_LIBRARY} -I${MICROHTTPD_INCLUDE_DIR}")
endif(MICROHTTPD_FOUND)

if( ENABLE_SML AND NOT SML_FOUND)
message(WARNING "libsml was not found.
Install libsml or call cmake -DSML_HOME=path_to_sml_install")
endif( ENABLE_SML AND NOT SML_FOUND)
if( ENABLE_LOCAL AND NOT MICROHTTPD_FOUND )
message(FATAL_ERROR "microhttpd ist required.
message(WARNING "microhttpd was not found. Ignored ENABLE_LOCAL!
Install microhttpd or call cmake -DMICROHTTPD_HOME=path_to_microhttpd_install")
endif( ENABLE_LOCAL AND NOT MICROHTTPD_FOUND )

Expand Down
11 changes: 7 additions & 4 deletions src/CMakeLists.txt
Expand Up @@ -9,12 +9,12 @@ add_subdirectory(protocols)

## local interface support
#####################################################################
if(ENABLE_LOCAL)
if(LOCAL_SUPPORT)
set(local_srcs local.cpp)
include_directories(${MICROHTTPD_INCLUDE_DIR})
else(ENABLE_LOCAL)
else(LOCAL_SUPPORT)
set(local_srcs "")
endif(ENABLE_LOCAL)
endif(LOCAL_SUPPORT)

configure_file("${CMAKE_SOURCE_DIR}/src/gitSha1.cpp.in" "${CMAKE_BINARY_DIR}/gitSha1.cpp" @ONLY)

Expand All @@ -35,7 +35,7 @@ set(libvz_srcs
Options.cpp
Reading.cpp
exception.cpp
local.cpp
${local_srcs}
MeterMap.cpp
)

Expand All @@ -49,7 +49,10 @@ if(SML_FOUND)
target_link_libraries(vzlogger ${SML_LIBRARY})
endif(SML_FOUND)

if(LOCAL_SUPPORT)
target_link_libraries(vzlogger ${MICROHTTPD_LIBRARY})
endif(LOCAL_SUPPORT)

target_link_libraries(vzlogger ${LIBGCRYPT})
target_link_libraries(vzlogger pthread m ${LIBUUID})
target_link_libraries(vzlogger dl)
Expand Down
6 changes: 4 additions & 2 deletions src/threads.cpp
Expand Up @@ -33,7 +33,9 @@
#include <api/Volkszaehler.hpp>
#include <api/MySmartGrid.hpp>
#include <api/Null.hpp>
#ifdef LOCAL_SUPPORT
#include "local.h"
#endif

extern Config_Options options;

Expand Down Expand Up @@ -126,12 +128,12 @@ void * reading_thread(void *arg) {

/* shrink buffer */
(*ch)->buffer()->clean();

#ifdef LOCAL_SUPPORT
if (options.local()) {
shrink_localbuffer(); // remove old/outdated data in the local buffer
add_ch_to_localbuffer(*(*ch)); // add this ch data to the local buffer
}

#endif
/* notify webserver and logging thread */
(*ch)->notify();

Expand Down
7 changes: 6 additions & 1 deletion tests/mocks/CMakeLists.txt
@@ -1,5 +1,9 @@
include_directories(BEFORE .)

if(LOCAL_SUPPORT)
set(mock_local_srcs ../../src/local.cpp)
endif(LOCAL_SUPPORT)

add_executable(mock_metermap mock_metermap.cpp ../../src/Meter.cpp ../../src/Options.cpp
../../src/protocols/MeterD0.cpp
../../src/protocols/MeterFile.cpp
Expand All @@ -22,8 +26,9 @@ add_executable(mock_metermap mock_metermap.cpp ../../src/Meter.cpp ../../src/Opt
../../src/api/CurlCallback.cpp
../../src/api/CurlResponse.cpp
../../src/CurlSessionProvider.cpp
../../src/local.cpp
${mock_local_srcs}
)

target_link_libraries(mock_metermap ${CURL_STATIC_LIBRARIES} ${CURL_LIBRARIES} ${MICROHTTPD_LIBRARY} ${GNUTLS_LIBRARIES} ${OPENSSL_LIBRARIES})

target_link_libraries(mock_metermap
Expand Down

0 comments on commit f6bf8f6

Please sign in to comment.