Skip to content

Commit

Permalink
Merge branch 'feature/build-core-plugins' into develop
Browse files Browse the repository at this point in the history
* feature/build-core-plugins: (60 commits)
  [wip][heartbeat] doc: Remove difftext.
  [heartbeat] ping_*: Build message and module.
  [heartbeat] pong_*: Build message and module.
  [heartbeat] Improve message handling.
  [heartbeat] module: Generate UUID, add modules.
  [heartbeat] plugin: Touch ptrs, C+11 support.
  [heartbeat] test: Update units for messages.
  [heartbeat] src: Add skeleton for heartbeat plugin.
  [heartbeat] globals: Add definitions.
  [heartbeat] docs: Update bit of modules and implementation.
  [heartbeat] cmake: Update dependencies and sources.
  [core] test: Add mocks, notes and fixtures.
  [core] event_listener: More logging and checks.
  [core] event_emittable: Remove source.
  [core] event_emitter: More lambda use, logging and checking for listeners.
  [core] event_loop: Add debug msg about primary loop.
  [core] events: Fix typo, inlining and dropped virtual dtors.
  [core] tunnel: Update private data, event emission, and iterator funcs.
  [core] module_pool: Update test, private ctors & dtors.
  [core] module_designation: Stub out 'isLocal'.
  ...
  • Loading branch information
Jacky Alciné committed Mar 31, 2015
2 parents 54193ea + e5fe165 commit 45e9199
Show file tree
Hide file tree
Showing 123 changed files with 4,801 additions and 458 deletions.
55 changes: 55 additions & 0 deletions .clang_format
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# BasedOnStyle: Mozilla
Language: Cpp
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerAlignment: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: false
Standard: Cpp14
IndentWidth: 2
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, for_each ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...

5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/*
CTestConfig.cmake
*.orig
CTestConfig.cmake
src/**/globals.hpp
test/**/test_suite.hpp
**/**/globals.hpp
**/**/test_suite.hpp
.vagrant/*
**/wintermute.log
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
PROJECT(Wintermute)

# Add our CMake files into the mix.
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(defaults)

# Enable testing.
ENABLE_TESTING()
INCLUDE(CTest)

# Include the source code for the project.
ADD_SUBDIRECTORY(src)

# Include the test suite.
ADD_SUBDIRECTORY(test)
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Jacky Alciné <[email protected]>
Copyright (c) 2010, 2011, 2012, 2013, 2014 Jacky Alciné <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ self-driven hyper-connectivity of hardware and software. The whole purpose
of this particular tree is to build a core library, a driver binary
(more on that) and a few plugins to get the show started. Check out
[this weblog post][post] to really understand the mission behind Wintermute.
_Yes, this is yet another Internet of Things project._ But this isn't meant to
be "web scale" or all of that. It's meant to work in a controlled environment
under specific constraints (most devices running Linux, etc).

# Building & Contributing
Building, requirement and installation information all live in
Expand Down
27 changes: 22 additions & 5 deletions TESTING.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Testing Wintermute
# Testing Wintermute {#testing}

All of the tests in Wintermute live under the `test` directory. The testing
framework used for Wintermute is underlying QtTest to handle Qt-specific logic.
Just invoke the `test` to build all of the tests and run the test suite (using
CTest as the driver).
Testing's an important part of Wintermute. It provides a level of insurance of
contract upholding between classes and higher-level interactions and allows for
rapid application development without too much concern for the breaking of
existing software. The test harness used by Wintermute is [CxxTest][] and
[CTest][] is used to drive the whole test suite (via `make test`). Coverage
support is handled by `gcov` and memory checking is handled by `valgrind`.

## Wintermute's Fixture Library {#testing-fixture-lib}

Wintermute has a fixture library `wintermute-fixtures` that
allows test developers to write more introspective actions into Wintermute and
even take advantage of mock classes into Wintermute's operations that are
typically, by design, closed off. In essence, the fixture library is a
recompilation of the core Wintermute library with these additives, thus
preventing the parallel installation of said libraries.

### Available Fixtures {#testing-fixture-lib-fixtures}

### Available Macros {#testing-fixture-lib-macros}

### Available Functions {#testing-fixture-lib-functions}
9 changes: 8 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'chef/ubuntu-13.04'
config.vm.box_check_update = true
config.ssh.forward_agent = true

Expand All @@ -18,4 +17,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
s.path = "./test/bootstrap"
s.args = "--before"
end

config.vm.define "target" do | t |
t.vm.box = 'chef/ubuntu-13.04'
end

config.vm.define "travis" do | t |
t.vm.box = 'chef/ubuntu-12.04'
end
end
9 changes: 9 additions & 0 deletions cmake/FindZeroMQCXX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Find zmq.hpp

INCLUDE(FindPkgConfig)

PKG_SEARCH_MODULE(ZMQ REQUIRED
libzmq)

set(ZEROMQCXX_LIBRARIES ${ZMQ_LIBRARIES})
set(ZEROMQCXX_INCLUDE_DIR /usr/include)
5 changes: 5 additions & 0 deletions cmake/WintermuteDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ INCLUDE(WintermuteVariables)
PKG_SEARCH_MODULE(JsonCpp jsoncpp REQUIRED)
PKG_SEARCH_MODULE(Log4Cxx liblog4cxx REQUIRED)
PKG_SEARCH_MODULE(LibUv libuv REQUIRED)
PKG_SEARCH_MODULE(Uuid uuid REQUIRED)
FIND_PACKAGE(LibConfig REQUIRED)

# == Exported variables
Expand All @@ -43,27 +44,31 @@ set(WINTERMUTE_INCLUDE_DIRS
${Log4Cxx_INCLUDE_DIRS}
${LibUv_INCLUDE_DIRS}
${LIBCONFIG_INCLUDE_DIRS}
${Uuid_INCLUDE_DIRS}
)

set(WINTERMUTE_LIBRARIES
${JsonCpp_LIBRARIES}
${Log4Cxx_LIBRARIES}
${LibUv_LIBRARIES}
${LIBCONFIG_LIBRARIES}
${Uuid_LIBRARIES}
)

list(APPEND WINTERMUTE_COMPILE_FLAGS
${JsonCpp_CFLAGS}
${Log4Cxx_CFLAGS}
${LibUv_CFLAGS}
${LIBCONFIG_CLAGS}
${Uuid_CFLAGS}
)

list(APPEND WINTERMUTE_LINK_FLAGS
${JsonCpp_LDFLAGS}
${Log4Cxx_LDFLAGS}
${LibUv_LDFLAGS}
${LIBCONFIG_LDFLAGS}
${Uuid_LDFLAGS}
)

# == Versioning
Expand Down
2 changes: 1 addition & 1 deletion cmake/WintermuteDocumentation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ MACRO(doxygen_generate_documentation)

SET(_doxy_args "${_doxy_config_path}")

ADD_CUSTOM_TARGET("${_doxy_TARGET}-docs" ALL
ADD_CUSTOM_TARGET("${_doxy_TARGET}-docs"
COMMAND ${DOXYGEN_EXECUTABLE} ${_doxy_args}
DEPENDS ${_doxy_BUILD_AFTER}
WORKING_DIRECTORY ${_doxy_working_dir}
Expand Down
111 changes: 111 additions & 0 deletions cmake/WintermutePlugin.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# vim: set ts=2 sts=2 sw=2 fdm=indent
###############################################################################
# Author: Jacky Alciné <[email protected]>
#
# Wintermute is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Wintermute 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
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with Wintermute; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
###############################################################################

include(WintermuteSourceBuild
OPTIONAL
RESULT_VARIABLE WINTERMUTE_IS_SOURCE_BUILD
)

include(WintermuteTest)
include(WintermuteVariables)

MACRO(wintermute_plugin_declare)
SET(options
)
SET(oneValueArgs
NAME
TARGET
)
SET(multiValueArgs
)

CMAKE_PARSE_ARGUMENTS(_wpd "${options}"
"${oneValueArgs}" "${multiValueArgs}" ${ARGN})

wintermute_add_target_properties(${_wpd_TARGET})
target_link_libraries(${_wpd_TARGET}
wintermute)

set(_include_dirs )
set(_libs )

if (EXISTS ${WINTERMUTE_IS_SOURCE_BUILD})
set(_include_dirs
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src/wintermutecore
)
else()
set(_include_dirs ${WINTERMUTE_INCLUDE_DIR})
endif()

target_include_directories(${_wpd_TARGET} BEFORE
PUBLIC ${_include_dirs})
ENDMACRO(wintermute_plugin_declare)

# TODO: Configure the test driver source file to work for the provided Plugin.
MACRO(wintermute_plugin_validate)
SET(options
)
SET(oneValueArgs
TARGET
)
SET(multiValueArgs
)

CMAKE_PARSE_ARGUMENTS(_wpv "${options}"
"${oneValueArgs}" "${multiValueArgs}" ${ARGN})

SET(_plugin_driver_file
"${CMAKE_CURRENT_BINARY_DIR}/${_wpv_TARGET}-validator.hh")
SET(_test_driver_file )

IF (EXISTS ${WINTERMUTE_IS_SOURCE_BUILD})
SET(_test_driver_file "${CMAKE_SOURCE_DIR}/cmake/plugin_driver.hh.in")
ELSE()
ENDIF()

GET_TARGET_PROPERTY(_wpv_file ${_wpv_TARGET} LOCATION)

CONFIGURE_FILE(${_test_driver_file}
${_plugin_driver_file}
@ONLY)

WINTERMUTE_ADD_TEST(plugin-verify ${_wpv_TARGET} ${_plugin_driver_file})
ENDMACRO(wintermute_plugin_validate)

MACRO(wintermute_plugin_add_test)
SET(options
)
SET(oneValueArgs
PREFIX
HEADER
NAME
TARGET
)
SET(multiValueArgs
)

CMAKE_PARSE_ARGUMENTS(_wpat "${options}"
"${oneValueArgs}" "${multiValueArgs}" ${ARGN})

WINTERMUTE_ADD_TEST("plugin-${_wpat_PREFIX}" ${_wpat_NAME} ${_wpat_HEADER})
TARGET_LINK_LIBRARIES("plugin-${_wpat_PREFIX}-${_wpat_NAME}"
${_wpat_TARGET})
ENDMACRO(wintermute_plugin_add_test)
1 change: 1 addition & 0 deletions cmake/WintermuteTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ SET(_wntr_test_tpl

SET(CXXTEST_TESTGEN_ARGS
--template ${_wntr_test_tpl}
--runner=ErrorPrinter
)

SET(WINTERMUTE_TEST_INCLUDE_DIRS
Expand Down
2 changes: 1 addition & 1 deletion cmake/WintermuteTestMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ else()
endif()

MACRO(wintermute_add_test _prefix _name _hdr)
SET(_target ${_prefix}_${_name})
SET(_target ${_prefix}-${_name})
CXXTEST_ADD_TEST(${_target} ${_target}_test.cc ${_hdr})
WINTERMUTE_LINK_LIBRARIES(${_target})
WINTERMUTE_ADD_TARGET_PROPERTIES(${_target})
Expand Down
11 changes: 6 additions & 5 deletions cmake/WintermuteVariables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ SET(WINTERMUTE_COMPILE_FLAGS
-Wunused
-Wctor-dtor-privacy
-Wenum-compare
-fmessage-length=0
)

SET(WINTERMUTE_COMPILE_FLAGS_DEBUG
-O0
-g3
-fexceptions
-Wextra
-Wno-conversion-null
-Wno-deprecated
Expand All @@ -47,7 +47,7 @@ SET(WINTERMUTE_COMPILE_FLAGS_DEBUG
-Wunused-parameter
-Wunused-variable
-Wwrite-strings
-ftemplate-backtrace-limit=0
-ggdb3
)

SET(WINTERMUTE_COMPILE_FLAGS_RELEASE
Expand All @@ -73,21 +73,22 @@ if (CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND WINTERMUTE_COMPILE_FLAGS_DEBUG
-fprofile-arcs
-ftest-coverage
-fabi-version=4
-gstabs+
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
list(APPEND WINTERMUTE_COMPILE_FLAGS_DEBUG
)
endif()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^4.6")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION MATCHES "^4.6")
list(APPEND WINTERMUTE_COMPILE_FLAGS
--std=c++0x
)
else()
list(APPEND WINTERMUTE_COMPILE_FLAGS
--std=c++11
--std=c++14
)
endif()

Expand Down
Loading

0 comments on commit 45e9199

Please sign in to comment.