diff --git a/examples/c++/ads1015.cxx b/examples/c++/ads1015.cxx index 8c87dc7e..bc5e3e1b 100644 --- a/examples/c++/ads1015.cxx +++ b/examples/c++/ads1015.cxx @@ -30,6 +30,8 @@ #include #include #include +#include + #include "ads1015.hpp" using namespace std; diff --git a/examples/c++/ads1x15.cxx b/examples/c++/ads1x15.cxx index d4196cde..c2100fb8 100644 --- a/examples/c++/ads1x15.cxx +++ b/examples/c++/ads1x15.cxx @@ -316,5 +316,5 @@ int main() delete ads; - return MRAA_SUCCESS; + return 0; } diff --git a/examples/c++/mcp9808.cxx b/examples/c++/mcp9808.cxx index 590ba3fe..c61bdd1e 100644 --- a/examples/c++/mcp9808.cxx +++ b/examples/c++/mcp9808.cxx @@ -159,5 +159,5 @@ int main() }while (command != -1 ); //! [Interesting] - return MRAA_SUCCESS; + return 0; } diff --git a/examples/c++/micsv89.cxx b/examples/c++/micsv89.cxx index b2e42749..f8b2adee 100644 --- a/examples/c++/micsv89.cxx +++ b/examples/c++/micsv89.cxx @@ -74,5 +74,5 @@ int main() delete sensor; //! [Interesting] - return MRAA_SUCCESS; + return 0; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7e973371..10568f16 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,18 +37,88 @@ macro (upm_create_install_pkgconfig generated_file install_location) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location}) endmacro(upm_create_install_pkgconfig) -# Provide a wrapper to call target_link_libraries AND add any additional -# functionality necessary for upm modules. This was being used to add -# link dependencies for the swig wrappers (swig_link_libraries). This has -# been removed. Leaving the wrapper call to minimize changes. -macro (upm_target_link_libraries target_name) - # Add the dependencies - target_link_libraries(${target_name} ${ARGN}) -endmacro (upm_target_link_libraries target_name) +# This function iterates over all target names stored in CACHE variable +# UPM_LIBRARY_TARGETS and writes a .pc file to each build directory +function (_gen_pkg_config_per_target) + list(LENGTH UPM_LIBRARY_TARGETS n_targets) + message(STATUS "Generating pkg-config files for ${n_targets} libraries...") + set (n_ctargets 0) + set (n_cxxtargets 0) + # Iterate over the targets an build package config (.pc) files + foreach (target ${UPM_LIBRARY_TARGETS}) + if (TARGET ${target}) + get_target_property(libname ${target} PKG_CONFIG_NAME) + get_target_property(libdescription ${target} PKG_CONFIG_DESCRIPTION) + get_target_property(reqlibname ${target} PKG_EXT_REQ_LIBS) + get_target_property(BINARY_DIR ${target} BINARY_DIR) + get_target_property(DEPLIBS ${target} LINK_LIBRARIES) + # Remove this libname from the DEPLIBS (if it's there) + list(REMOVE_ITEM DEPLIBS ${libname}) + # Check if any of the LINK_LIBRARIES are targets in this project, + # if so, add them to reqlibname + foreach (deplib ${DEPLIBS}) + # If this target exists, get the actual library name (which equates + # to it's .pc filename, example: target dfrph = .pc + if (TARGET ${deplib}) + get_target_property(deplibname ${deplib} PKG_CONFIG_NAME) + list(APPEND reqlibname ${deplibname}) + # If the deplib is mraa, add that verbatim (mraa's .pc file is mraa.pc) + elseif (${deplib} MATCHES mraa) + list(APPEND reqlibname mraa) + endif (TARGET ${deplib}) + endforeach (deplib ${DEPLIBS}) + # Make sure no dups exist + separate_arguments(reqlibname) + list(REMOVE_DUPLICATES reqlibname) + # Switch to comma separated Requires: field (per pkg-config docs) + string(REPLACE ";" "," reqlibname "${reqlibname}") + + # Keep some stats + string(REGEX MATCH "-c$" _isC ${target}) + if (_isC) + MATH(EXPR n_ctargets "${n_ctargets}+1") + else () + MATH(EXPR n_cxxtargets "${n_cxxtargets}+1") + endif() + upm_create_install_pkgconfig (${libname}.pc ${LIB_INSTALL_DIR}/pkgconfig) + endif (TARGET ${target}) + endforeach (target ${UPM_LIBRARY_TARGETS}) + message(STATUS "\tFound C libraries: ${n_ctargets}") + message(STATUS "\tFound CXX libraries: ${n_cxxtargets}") + message(STATUS "Generating pkg-config files for ${n_targets} libraries... Complete") +endfunction (_gen_pkg_config_per_target) + +function (_get_target_dependency_interface_include_dirs target varIncludeDirs) + set (${varIncludeDirs} "") + + # For each LINK_LIBRARIES of target + get_property(_targets TARGET ${target} PROPERTY LINK_LIBRARIES) + foreach (_target ${_targets}) + # If the target currently exists, use its include directories + if (TARGET ${_target}) + get_property(_tmp_prop_val TARGET ${_target} PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + list(APPEND ${varIncludeDirs} ${_tmp_prop_val}) + # It's possible that the target does NOT exist yet, attempt to build an include directory + else () + # Guess at a src dir name + file (TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/src/${_target}" _dirname) + if (EXISTS ${_dirname}) + list(APPEND ${varIncludeDirs} ${_dirname}) + else () + endif (EXISTS ${_dirname}) + endif (TARGET ${_target}) + endforeach (_target ${_targets}) + set(${varIncludeDirs} "${${varIncludeDirs}}" PARENT_SCOPE) +endfunction (_get_target_dependency_interface_include_dirs target varIncludeDirs) # Create a single swig target for python macro(_upm_swig_python) - include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..) + # Transitive headers don't appear to get picked up by swig_add_module call for + # wrapper generation. Get them manually and add them here. + _get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS) + + include_directories (${CMAKE_CURRENT_SOURCE_DIR}/.. + ${DEPEND_DIRS}) set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON) set_source_files_properties (pyupm_${libname}.i PROPERTIES SWIG_FLAGS "-I${CMAKE_CURRENT_BINARY_DIR}/..") @@ -74,7 +144,8 @@ macro(_upm_swig_python) target_include_directories (${python_wrapper_target} PUBLIC "${PYTHON_INCLUDE_PATH}" - "${PYTHON_INCLUDE_DIRS}") + "${PYTHON_INCLUDE_DIRS}" + ${DEPEND_DIRS}) # Turn off flags for wrapper foreach(flag ${SWIG_CXX_DISABLE_WARNINGS}) @@ -154,8 +225,13 @@ macro(upm_swig_node) string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length) endwhile () + # Transitive headers don't appear to get picked up by swig_add_module call for + # wrapper generation. Get them manually and add them here. + _get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS) + include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${DEPEND_DIRS} ) set_property (SOURCE jsupm_${libname}.i PROPERTY SWIG_FLAGS "-node" "-DV8_VERSION=${V8_VERSION_HEX}") @@ -165,6 +241,7 @@ macro(upm_swig_node) target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PUBLIC "${NODE_INCLUDE_DIRS}" + ${DEPEND_DIRS} ) # Turn off flags for wrapper @@ -205,10 +282,15 @@ endmacro(upm_swig_node) macro(upm_swig_java) # Skip if the libname is in the blacklist if (NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};") + # Transitive headers don't appear to get picked up by swig_add_module call for + # wrapper generation. Get them manually and add them here. + _get_target_dependency_interface_include_dirs(${libname} DEPEND_DIRS) + include_directories ( ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${DEPEND_DIRS} ) set_source_files_properties (javaupm_${libname}.i PROPERTIES CPLUSPLUS ON) @@ -220,11 +302,12 @@ macro(upm_swig_java) # See issue #518 # TODO: Fix this somehow swig_add_module (javaupm_${libname} java javaupm_${libname}.i ${module_src}) - swig_link_libraries (javaupm_${libname} ${MRAAJAVA_LIBRARIES} ${MRAA_LIBRARIES} ${JAVA_LIBRARIES} ${libname}) + swig_link_libraries (javaupm_${libname} ${MRAAJAVA_LIBRARIES} ${MRAA_LIBRARIES} ${JAVA_LIBRARIES} ${libname} interfaces) target_include_directories ( ${SWIG_MODULE_javaupm_${libname}_REAL_NAME} PUBLIC "${JAVA_INCLUDE_DIRS}" "${JAVA_INCLUDE_PATH}" + ${DEPEND_DIRS} ) set_target_properties (javaupm_${libname} PROPERTIES COMPILE_FLAGS "-fpermissive -DJAVACALLBACK" @@ -332,10 +415,10 @@ if (BUILDSWIGNODE) # Utilities and interfaces file (COPY ${CMAKE_SOURCE_DIR}/src/utilities DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}) - file (COPY ${CMAKE_SOURCE_DIR}/src/upm DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}) + file (COPY ${CMAKE_SOURCE_DIR}/src/interfaces DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}) set (upm_LIB_SRCS_GYP "'utilities/upm_utilities.c',\n${upm_LIB_SRCS_GYP}") set (upm_LIB_INCLUDE_DIRS_GYP "'utilities',\n${upm_LIB_INCLUDE_DIRS_GYP}") - set (upm_LIB_INCLUDE_DIRS_GYP "'upm',\n${upm_LIB_INCLUDE_DIRS_GYP}") + set (upm_LIB_INCLUDE_DIRS_GYP "'interfaces',\n${upm_LIB_INCLUDE_DIRS_GYP}") # Add readme, package.json for NPM and node-gyp config file configure_file (${PROJECT_SOURCE_DIR}/src/binding.gyp.in ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}/binding.gyp @ONLY) @@ -390,6 +473,9 @@ function (UPM_MIXED_MODULE_INIT) # Set the description set (libdescription ${UPM_MIXED_MODULE_INIT_DESCRIPTION}) + # Make sure REQUIRES is a list + separate_arguments(UPM_MIXED_MODULE_INIT_REQUIRES) + # Always build C libs first if (UPM_MIXED_MODULE_INIT_C_SRC) set (libname ${UPM_MIXED_MODULE_INIT_NAME}) @@ -397,11 +483,9 @@ function (UPM_MIXED_MODULE_INIT) set (module_src ${UPM_MIXED_MODULE_INIT_C_SRC}) set (module_hpp ${UPM_MIXED_MODULE_INIT_C_HDR}) - # Create the reqlibname list - string(REPLACE ";" " " reqlibname "${UPM_MIXED_MODULE_INIT_REQUIRES}") - # Append upmc-utilities to the reqlibs (but not on upm-utilities itself) + # Append the utilities-c target to each c target if (NOT ${libname} MATCHES "utilities") - set (reqlibname "${reqlibname} upmc-utilities") + list (APPEND UPM_MIXED_MODULE_INIT_REQUIRES utilities-c) endif() # If building FTI, and FTI src exists, add it in @@ -416,7 +500,7 @@ function (UPM_MIXED_MODULE_INIT) # Set a flag to tell upm_module_init that it's building a C library set (IS_C_LIBRARY TRUE) - upm_module_init() + upm_module_init(${UPM_MIXED_MODULE_INIT_REQUIRES}) # add upmc-utilities as a dependancy to all C libs (but NOT to the # utilities lib itself) @@ -436,13 +520,10 @@ function (UPM_MIXED_MODULE_INIT) set (module_src ${UPM_MIXED_MODULE_INIT_CPP_SRC}) set (module_hpp ${UPM_MIXED_MODULE_INIT_CPP_HDR}) - # Create the reqlibname list - string(REPLACE ";" " " reqlibname "${UPM_MIXED_MODULE_INIT_REQUIRES}") - # Reset the libname (upm_module_init can change it) set (libname ${UPM_MIXED_MODULE_INIT_NAME}) unset (IS_C_LIBRARY) - upm_module_init() + upm_module_init(${UPM_MIXED_MODULE_INIT_REQUIRES}) # If the C++ wraps the C target, add the C target as a dependency if (UPM_MIXED_MODULE_INIT_CPP_WRAPS_C) @@ -466,19 +547,30 @@ function(upm_module_init) # If this is a C library, export C library target name to parent's libname set (libname ${libname} PARENT_SCOPE) set (libprefix upmc-) - set (pcname upmc-${basename}.pc) else () set (libprefix upm-) - set (pcname upm-${basename}.pc) endif (IS_C_LIBRARY) - link_directories (${MRAA_LIBDIR}) + # Create the target library from src/hdrs add_library (${libname} SHARED ${module_src} ${module_hpp}) + + # Specify the current source directory as an INTERFACE include dir. + # This allows for transitive header dependencies via target_link_libraries + target_include_directories(${libname} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + + # Iterate over all arguments passed to upm_module_init. + # 1. Add them via target_link_libraries + # 2. If the argument is a target, foreach (linkflag ${ARGN}) target_link_libraries (${libname} ${linkflag}) endforeach () - include_directories (${MRAA_INCLUDE_DIRS} . ..) - target_link_libraries (${libname} ${MRAA_LIBRARIES}) + + # Always add a dependency to MRAA libs + target_link_libraries (${libname} ${MRAA_LDFLAGS}) + + # Always add a dependency to MRAA include dirs + target_include_directories (${libname} PUBLIC ${MRAA_INCLUDE_DIRS}) + set_target_properties( ${libname} PROPERTIES PREFIX lib${libprefix} @@ -486,7 +578,6 @@ function(upm_module_init) SOVERSION ${upm_VERSION_MAJOR} VERSION ${upm_VERSION_STRING} ) - upm_create_install_pkgconfig (${pcname} ${LIB_INSTALL_DIR}/pkgconfig) # Don't SWIG C if (NOT IS_C_LIBRARY) @@ -501,12 +592,21 @@ function(upm_module_init) endif (BUILDSWIGJAVA) endif (NOT IS_C_LIBRARY) + # Add this target to the list of library target names + set(UPM_LIBRARY_TARGETS ${UPM_LIBRARY_TARGETS} ${libname} CACHE INTERNAL "List of ALL target names") + set_target_properties(${libname} PROPERTIES PKG_CONFIG_NAME "${libprefix}${basename}") + set_target_properties(${libname} PROPERTIES PKG_CONFIG_DESCRIPTION "${libdescription}") + set_target_properties(${libname} PROPERTIES PKG_EXT_REQ_LIBS "${reqlibname}") + # Skip doxygen run on C (for now) if (BUILDDOC AND NOT IS_C_LIBRARY) upm_doxygen() endif() + # Install target library to lib dir install (TARGETS ${libname} DESTINATION ${LIB_INSTALL_DIR}) + + # Install header files to include/upm/ install (FILES ${module_hpp} DESTINATION include/upm COMPONENT ${libname}) if (IPK) @@ -545,11 +645,15 @@ elseif (BUILDSWIGPYTHON) file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub") endif (BUILDDOC AND BUILDSWIGPYTHON) +# Provide a cached variable to save a list of library target names +set(UPM_LIBRARY_TARGETS "" CACHE INTERNAL "List of ALL target names") + # Add subdirectories from MODULE_LIST if defined # Example -DMODULE_LIST="dfrph;rotaryencoder" if (MODULE_LIST) set(SUBDIRS ${MODULE_LIST}) - set(SUBDIRS ${SUBDIRS} upm) + # Add interfaces directory + set(SUBDIRS ${SUBDIRS} interfaces) else() # Otherwise, add all subdirectories subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) @@ -567,3 +671,6 @@ foreach(subdir ${SUBDIRS}) add_subdirectory(${subdir}) endif() endforeach() + +# Generate a pkg-config file (.pc) per target +_gen_pkg_config_per_target() diff --git a/src/adafruitms1438/CMakeLists.txt b/src/adafruitms1438/CMakeLists.txt index 0f968847..9393fde5 100644 --- a/src/adafruitms1438/CMakeLists.txt +++ b/src/adafruitms1438/CMakeLists.txt @@ -2,8 +2,4 @@ set (libname "adafruitms1438") set (libdescription "Module for the Adafruit Motor Shield 1438") set (module_src ${libname}.cxx) set (module_hpp ${libname}.hpp) -set (reqlibname "upm-pca9685") -include_directories("../pca9685") -upm_module_init() -add_dependencies(${libname} pca9685) -upm_target_link_libraries(${libname} pca9685) +upm_module_init(pca9685) diff --git a/src/ads1x15/CMakeLists.txt b/src/ads1x15/CMakeLists.txt index f684c8dd..53bfa912 100644 --- a/src/ads1x15/CMakeLists.txt +++ b/src/ads1x15/CMakeLists.txt @@ -2,7 +2,7 @@ set (libname "ads1x15") set (libdescription "Analog to digital converter") set (module_src ${libname}.cxx ads1115.cxx ads1015.cxx) set (module_hpp ${libname}.hpp ads1115.hpp ads1015.hpp) -upm_module_init() +upm_module_init(interfaces) compiler_flag_supported(CXX is_supported -Wno-overloaded-virtual) if (is_supported) target_compile_options(${libname} PUBLIC -Wno-overloaded-virtual) diff --git a/src/ads1x15/ads1015.cxx b/src/ads1x15/ads1015.cxx index 99fdc03a..40fefdae 100644 --- a/src/ads1x15/ads1015.cxx +++ b/src/ads1x15/ads1015.cxx @@ -21,7 +21,11 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + #include "ads1015.hpp" +#include "mraa/i2c.hpp" using namespace upm; diff --git a/src/ads1x15/ads1015.hpp b/src/ads1x15/ads1015.hpp index 476b3d5b..8cfcb93b 100644 --- a/src/ads1x15/ads1015.hpp +++ b/src/ads1x15/ads1015.hpp @@ -26,7 +26,7 @@ #pragma once #include "ads1x15.hpp" -#include "upm/iADC.hpp" +#include "interfaces/iADC.hpp" #define ADS1015_VREF 2.048 diff --git a/src/ads1x15/ads1x15.cxx b/src/ads1x15/ads1x15.cxx index 2f370ef2..35782709 100644 --- a/src/ads1x15/ads1x15.cxx +++ b/src/ads1x15/ads1x15.cxx @@ -24,6 +24,7 @@ #include "ads1x15.hpp" +#include "mraa/i2c.hpp" #include #include diff --git a/src/ads1x15/ads1x15.hpp b/src/ads1x15/ads1x15.hpp index 8ff4fa34..2507142d 100644 --- a/src/ads1x15/ads1x15.hpp +++ b/src/ads1x15/ads1x15.hpp @@ -26,8 +26,8 @@ #include #include -#include "mraa.hpp" -#include "mraa/i2c.hpp" + +namespace mraa {class I2c;} /*========================================================================= I2C ADDRESS/BITS @@ -419,6 +419,6 @@ namespace upm { void updateConfigRegister(uint16_t update, bool read = false); uint16_t swapWord(uint16_t value); - mraa::I2c* i2c; + mraa::I2c* i2c; };} diff --git a/src/ads1x15/javaupm_ads1x15.i b/src/ads1x15/javaupm_ads1x15.i index e16dc4e8..d24c87b0 100644 --- a/src/ads1x15/javaupm_ads1x15.i +++ b/src/ads1x15/javaupm_ads1x15.i @@ -8,6 +8,8 @@ #include "ads1115.hpp" %} +%include "iModuleStatus.hpp" +%include "iADC.hpp" %include "ads1x15.hpp" %include "ads1015.hpp" %include "ads1115.hpp" @@ -23,4 +25,4 @@ System.exit(1); } } -%} \ No newline at end of file +%} diff --git a/src/ads1x15/jsupm_ads1x15.i b/src/ads1x15/jsupm_ads1x15.i index 8a10beb7..9bdc2e0f 100644 --- a/src/ads1x15/jsupm_ads1x15.i +++ b/src/ads1x15/jsupm_ads1x15.i @@ -1,6 +1,9 @@ %module jsupm_ads1x15 %include "../upm.i" +%include "iModuleStatus.hpp" +%include "iADC.hpp" + %include "ads1x15.hpp" %{ #include "ads1x15.hpp" @@ -14,4 +17,4 @@ %include "ads1115.hpp" %{ #include "ads1115.hpp" -%} \ No newline at end of file +%} diff --git a/src/ads1x15/pyupm_ads1x15.i b/src/ads1x15/pyupm_ads1x15.i index e2573139..fb7a89ff 100644 --- a/src/ads1x15/pyupm_ads1x15.i +++ b/src/ads1x15/pyupm_ads1x15.i @@ -5,6 +5,9 @@ %feature("autodoc", "3"); +%include "iModuleStatus.hpp" +%include "iADC.hpp" + %include "ads1x15.hpp" %{ #include "ads1x15.hpp" @@ -18,4 +21,4 @@ %include "ads1115.hpp" %{ #include "ads1115.hpp" -%} \ No newline at end of file +%} diff --git a/src/apa102/CMakeLists.txt b/src/apa102/CMakeLists.txt index 881f063e..ec1a1c49 100644 --- a/src/apa102/CMakeLists.txt +++ b/src/apa102/CMakeLists.txt @@ -5,4 +5,4 @@ upm_mixed_module_init (NAME apa102 CPP_HDR apa102.hpp CPP_SRC apa102.cxx FTI_SRC apa102_fti.c - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/bacnetmstp/CMakeLists.txt b/src/bacnetmstp/CMakeLists.txt index 825174d5..6e70a014 100644 --- a/src/bacnetmstp/CMakeLists.txt +++ b/src/bacnetmstp/CMakeLists.txt @@ -1,11 +1,11 @@ -set (libname "bacnetmstp") -set (libdescription "Driver module for BACnet MS/TP devices") -set (module_src ${libname}.cxx device-client.c bacnetutil.cxx) -set (module_hpp ${libname}.hpp bacnetutil.hpp) - if (BACNET_FOUND) + set (libname "bacnetmstp") + set (libdescription "Driver module for BACnet MS/TP devices") + set (module_src ${libname}.cxx device-client.c bacnetutil.cxx) + set (module_hpp ${libname}.hpp bacnetutil.hpp device.h) + set (reqlibname "libbacnet") - include_directories(${BACNET_INCLUDE_DIRS}) - upm_module_init() - upm_target_link_libraries(${libname} ${BACNET_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + upm_module_init(${BACNET_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + # Add the bacnet include dirs to this target + target_include_directories(${libname} PUBLIC ${BACNET_INCLUDE_DIRS}) endif () diff --git a/src/bh1750/CMakeLists.txt b/src/bh1750/CMakeLists.txt index a87434b6..dd985eb6 100644 --- a/src/bh1750/CMakeLists.txt +++ b/src/bh1750/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME bh1750 CPP_SRC bh1750.cxx FTI_SRC bh1750_fti.c CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/bmp280/CMakeLists.txt b/src/bmp280/CMakeLists.txt index c7227820..6b5ac7e6 100644 --- a/src/bmp280/CMakeLists.txt +++ b/src/bmp280/CMakeLists.txt @@ -2,4 +2,4 @@ set (libname "bmp280") set (libdescription "Bosch bmp280 Pressure sensor and bme280 humidity sensor") set (module_src ${libname}.cxx bme280.cxx) set (module_hpp ${libname}.hpp bme280.hpp) -upm_module_init() +upm_module_init(interfaces) diff --git a/src/bmp280/bme280.hpp b/src/bmp280/bme280.hpp index da4a43c1..5865d826 100644 --- a/src/bmp280/bme280.hpp +++ b/src/bmp280/bme280.hpp @@ -28,7 +28,7 @@ #include #include -#include "upm/iHumiditySensor.hpp" +#include "interfaces/iHumiditySensor.hpp" #include "bmp280.hpp" diff --git a/src/bmp280/bmp280.hpp b/src/bmp280/bmp280.hpp index 97c6835f..2d159632 100644 --- a/src/bmp280/bmp280.hpp +++ b/src/bmp280/bmp280.hpp @@ -28,8 +28,8 @@ #include #include -#include "upm/iPressureSensor.hpp" -#include "upm/iTemperatureSensor.hpp" +#include "interfaces/iPressureSensor.hpp" +#include "interfaces/iTemperatureSensor.hpp" #define BMP280_DEFAULT_I2C_BUS 0 #define BMP280_DEFAULT_SPI_BUS 0 diff --git a/src/bmp280/javaupm_bmp280.i b/src/bmp280/javaupm_bmp280.i index f91403f2..63395546 100644 --- a/src/bmp280/javaupm_bmp280.i +++ b/src/bmp280/javaupm_bmp280.i @@ -5,6 +5,10 @@ %include "arrays_java.i"; %include "../java_buffer.i" +%include "iModuleStatus.hpp" +%include "iHumiditySensor.hpp" +%include "iPressureSensor.hpp" +%include "iTemperatureSensor.hpp" %include "bmp280.hpp" %{ #include "bmp280.hpp" diff --git a/src/bmp280/jsupm_bmp280.i b/src/bmp280/jsupm_bmp280.i index 1d7d75fb..9720894d 100644 --- a/src/bmp280/jsupm_bmp280.i +++ b/src/bmp280/jsupm_bmp280.i @@ -2,6 +2,10 @@ %include "../upm.i" %include "cpointer.i" +%include "iModuleStatus.hpp" +%include "iHumiditySensor.hpp" +%include "iPressureSensor.hpp" +%include "iTemperatureSensor.hpp" %include "bmp280.hpp" %{ #include "bmp280.hpp" diff --git a/src/bmp280/pyupm_bmp280.i b/src/bmp280/pyupm_bmp280.i index d6d1f7b2..6d73f1d7 100644 --- a/src/bmp280/pyupm_bmp280.i +++ b/src/bmp280/pyupm_bmp280.i @@ -12,6 +12,10 @@ %include "bmp280_doc.i" #endif +%include "iModuleStatus.hpp" +%include "iHumiditySensor.hpp" +%include "iPressureSensor.hpp" +%include "iTemperatureSensor.hpp" %include "bmp280.hpp" %{ #include "bmp280.hpp" diff --git a/src/bmpx8x/bmpx8x.hpp b/src/bmpx8x/bmpx8x.hpp index 1a1dee4c..6b9b7034 100644 --- a/src/bmpx8x/bmpx8x.hpp +++ b/src/bmpx8x/bmpx8x.hpp @@ -30,8 +30,8 @@ #include #include #include -#include "upm/iPressureSensor.hpp" -#include "upm/iTemperatureSensor.hpp" +#include "interfaces/iPressureSensor.hpp" +#include "interfaces/iTemperatureSensor.hpp" #define ADDR 0x77 // device address diff --git a/src/buzzer/buzzer.h b/src/buzzer/buzzer.h index a4788200..712dc1e1 100644 --- a/src/buzzer/buzzer.h +++ b/src/buzzer/buzzer.h @@ -32,7 +32,7 @@ #include #include -#include +#include "buzzer_tones.h" #ifdef __cplusplus extern "C" { diff --git a/src/cjq4435/CMakeLists.txt b/src/cjq4435/CMakeLists.txt index 394317eb..9ebcda4a 100644 --- a/src/cjq4435/CMakeLists.txt +++ b/src/cjq4435/CMakeLists.txt @@ -5,4 +5,4 @@ upm_mixed_module_init (NAME cjq4435 CPP_HDR cjq4435.hpp CPP_SRC cjq4435.cxx CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/dfrec/CMakeLists.txt b/src/dfrec/CMakeLists.txt index 38ea12f6..06c4bee4 100644 --- a/src/dfrec/CMakeLists.txt +++ b/src/dfrec/CMakeLists.txt @@ -1,6 +1,3 @@ -# we need includes from ds18b20 -include_directories("../ds18b20") - upm_mixed_module_init (NAME dfrec DESCRIPTION "DFRobot analog electrical conductivity (EC) sensor" C_HDR dfrec.h @@ -9,9 +6,8 @@ upm_mixed_module_init (NAME dfrec CPP_SRC dfrec.cxx FTI_SRC dfrec_fti.c CPP_WRAPS_C - REQUIRES upmc-ds18b20 mraa) + REQUIRES ds18b20 mraa) # make sure the C library has the appropriate dependency on the UPM # DS18B20 C library -add_dependencies(${libnamec} ds18b20-c) target_link_libraries(${libnamec} ds18b20-c) diff --git a/src/dfrorp/CMakeLists.txt b/src/dfrorp/CMakeLists.txt index 4f49c43b..91de3dc1 100644 --- a/src/dfrorp/CMakeLists.txt +++ b/src/dfrorp/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME dfrorp CPP_SRC dfrorp.cxx FTI_SRC dfrorp_fti.c CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/ds1808lc/CMakeLists.txt b/src/ds1808lc/CMakeLists.txt index 6d3ab2c4..48a532af 100644 --- a/src/ds1808lc/CMakeLists.txt +++ b/src/ds1808lc/CMakeLists.txt @@ -1,6 +1,5 @@ -include_directories(..) set (libname "ds1808lc") set (libdescription "DS1808 lighting controller") set (module_src ${libname}.cxx mraa-utils.cxx) set (module_hpp ${libname}.hpp) -upm_module_init() +upm_module_init(interfaces) diff --git a/src/ds1808lc/ds1808lc.hpp b/src/ds1808lc/ds1808lc.hpp index 9b871921..1d855654 100644 --- a/src/ds1808lc/ds1808lc.hpp +++ b/src/ds1808lc/ds1808lc.hpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "upm/iLightController.hpp" +#include "iLightController.hpp" #include "mraa/i2c.hpp" namespace upm diff --git a/src/ds1808lc/javaupm_ds1808lc.i b/src/ds1808lc/javaupm_ds1808lc.i index 988bb1dd..69f63b62 100644 --- a/src/ds1808lc/javaupm_ds1808lc.i +++ b/src/ds1808lc/javaupm_ds1808lc.i @@ -9,6 +9,8 @@ #include "ds1808lc.hpp" %} +%include "iModuleStatus.hpp" +%include "iLightController.hpp" %include "ds1808lc.hpp" %pragma(java) jniclasscode=%{ diff --git a/src/ds1808lc/jsupm_ds1808lc.i b/src/ds1808lc/jsupm_ds1808lc.i index 5f8fa160..970c2e29 100644 --- a/src/ds1808lc/jsupm_ds1808lc.i +++ b/src/ds1808lc/jsupm_ds1808lc.i @@ -5,4 +5,6 @@ #include "ds1808lc.hpp" %} +%include "iModuleStatus.hpp" +%include "iLightController.hpp" %include "ds1808lc.hpp" diff --git a/src/ds1808lc/pyupm_ds1808lc.i b/src/ds1808lc/pyupm_ds1808lc.i index e479c146..60ddccfa 100644 --- a/src/ds1808lc/pyupm_ds1808lc.i +++ b/src/ds1808lc/pyupm_ds1808lc.i @@ -6,6 +6,8 @@ %feature("autodoc", "3"); +%include "iModuleStatus.hpp" +%include "iLightController.hpp" %include "ds1808lc.hpp" %{ #include "ds1808lc.hpp" diff --git a/src/ds18b20/CMakeLists.txt b/src/ds18b20/CMakeLists.txt index 20f901f0..916ac0a3 100644 --- a/src/ds18b20/CMakeLists.txt +++ b/src/ds18b20/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ds18b20 CPP_SRC ds18b20.cxx FTI_SRC ds18b20_fti.c CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/e50hx/CMakeLists.txt b/src/e50hx/CMakeLists.txt index ae904889..f6afd26d 100644 --- a/src/e50hx/CMakeLists.txt +++ b/src/e50hx/CMakeLists.txt @@ -1,13 +1,8 @@ -set (libname "e50hx") -set (libdescription "Module for the Veris E50HX (E50H2/E50H5)Energy Meters") -set (module_src ${libname}.cxx) -set (module_hpp ${libname}.hpp) - if (BACNET_FOUND) - # upm-libbacnetmstp will bring in libbacnet, I hope - set (reqlibname "upm-bacnetmstp") - include_directories(${BACNET_INCLUDE_DIRS}) - include_directories("../bacnetmstp") - upm_module_init() - upm_target_link_libraries(${libname} bacnetmstp) + set (libname "e50hx") + set (libdescription "Module for the Veris E50HX (E50H2/E50H5)Energy Meters") + set (module_src ${libname}.cxx) + set (module_hpp ${libname}.hpp) + + upm_module_init(bacnetmstp) endif () diff --git a/src/e50hx/javaupm_e50hx.i b/src/e50hx/javaupm_e50hx.i index 26244a7c..0a42d017 100644 --- a/src/e50hx/javaupm_e50hx.i +++ b/src/e50hx/javaupm_e50hx.i @@ -6,7 +6,7 @@ // We need to use this method for enum wrapping since the enum typedefs used // by the derived classes (like ANALOG_VALUES_T) are passed to methods // in the base class which expect a uint32_t. This is fine, and -// works everywhere except Java. It's type safety is a little too +// works everywhere except Java. Its type safety is a little too // stringent in these cases. %javaconst(1) is generally recommended // as it avoids JNI calls to determine the enumerant values at // runtime. diff --git a/src/h803x/CMakeLists.txt b/src/h803x/CMakeLists.txt index 344c7cb3..dce473f8 100644 --- a/src/h803x/CMakeLists.txt +++ b/src/h803x/CMakeLists.txt @@ -1,11 +1,10 @@ -set (libname "h803x") -set (libdescription "Module for the Veris H803X (H8035/H8036)") -set (module_src ${libname}.cxx) -set (module_hpp ${libname}.hpp) - if (MODBUS_FOUND) + set (libname "h803x") + set (libdescription "Module for the Veris H803X (H8035/H8036)") + set (module_src ${libname}.cxx) + set (module_hpp ${libname}.hpp) + set (reqlibname "libmodbus") - include_directories(${MODBUS_INCLUDE_DIRS}) - upm_module_init() - upm_target_link_libraries(${libname} ${MODBUS_LIBRARIES}) + upm_module_init(${MODBUS_LIBRARIES}) + target_include_directories(${libname} PUBLIC ${MODBUS_INCLUDE_DIRS}) endif () diff --git a/src/hlg150h/CMakeLists.txt b/src/hlg150h/CMakeLists.txt index 2b38a466..1eec48bd 100644 --- a/src/hlg150h/CMakeLists.txt +++ b/src/hlg150h/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) set (libname "hlg150h") set (libdescription "Lighting power supply") set (module_src ${libname}.cxx mraa-utils.cxx) diff --git a/src/hlg150h/hlg150h.hpp b/src/hlg150h/hlg150h.hpp index a92a8be8..1b33b4bf 100644 --- a/src/hlg150h/hlg150h.hpp +++ b/src/hlg150h/hlg150h.hpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "upm/iLightController.hpp" +#include "interfaces/iLightController.hpp" // #include "mraa/gpio.hpp" #include "mraa/pwm.hpp" diff --git a/src/hwxpxx/CMakeLists.txt b/src/hwxpxx/CMakeLists.txt index cb06fb3c..d6b3dc16 100644 --- a/src/hwxpxx/CMakeLists.txt +++ b/src/hwxpxx/CMakeLists.txt @@ -1,11 +1,10 @@ -set (libname "hwxpxx") -set (libdescription "Module for the Veris HWXPXX (HWXPHTX)") -set (module_src ${libname}.cxx) -set (module_hpp ${libname}.hpp) - if (MODBUS_FOUND) + set (libname "hwxpxx") + set (libdescription "Module for the Veris HWXPXX (HWXPHTX)") + set (module_src ${libname}.cxx) + set (module_hpp ${libname}.hpp) + set (reqlibname "libmodbus") - include_directories(${MODBUS_INCLUDE_DIRS}) - upm_module_init() - upm_target_link_libraries(${libname} ${MODBUS_LIBRARIES}) + upm_module_init(${MODBUS_LIBRARIES}) + target_include_directories(${libname} PUBLIC ${MODBUS_INCLUDE_DIRS}) endif () diff --git a/src/ili9341/ili9341_gfx.cxx b/src/ili9341/ili9341_gfx.cxx index 98882655..ada25e9d 100644 --- a/src/ili9341/ili9341_gfx.cxx +++ b/src/ili9341/ili9341_gfx.cxx @@ -25,6 +25,7 @@ */ #include "ili9341_gfx.hpp" +#include "mraa.hpp" using namespace upm; @@ -746,4 +747,4 @@ const unsigned char GFX::font[] = { 0x00, 0x19, 0x1D, 0x17, 0x12, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP -}; \ No newline at end of file +}; diff --git a/src/ili9341/ili9341_gfx.hpp b/src/ili9341/ili9341_gfx.hpp index a02583c1..1b5069ce 100644 --- a/src/ili9341/ili9341_gfx.hpp +++ b/src/ili9341/ili9341_gfx.hpp @@ -26,7 +26,8 @@ #pragma once -#include +#include +#include #define adagfxswap(a, b) { int16_t t = a; a = b; b = t; } diff --git a/src/interfaces/CMakeLists.txt b/src/interfaces/CMakeLists.txt new file mode 100644 index 00000000..273e2695 --- /dev/null +++ b/src/interfaces/CMakeLists.txt @@ -0,0 +1,18 @@ +set (libname "interfaces") +set (libdescription "CXX interface library") +set (module_src ${libname}.cxx) + +upm_module_init() + +# Don't add the hpp files with upm_module_init, this allows +# them to be installed separately +set (module_hpp iADC.hpp + iCO2Sensor.hpp + iHumiditySensor.hpp + iLightController.hpp + iLightSensor.hpp + iModuleStatus.hpp + iPressureSensor.hpp + iTemperatureSensor.hpp) +# Install interfaces headers a bit differently +install (FILES ${module_hpp} DESTINATION include/upm/${libname} COMPONENT ${libname}) diff --git a/src/upm/iADC.hpp b/src/interfaces/iADC.hpp similarity index 100% rename from src/upm/iADC.hpp rename to src/interfaces/iADC.hpp diff --git a/src/upm/iCO2Sensor.hpp b/src/interfaces/iCO2Sensor.hpp similarity index 100% rename from src/upm/iCO2Sensor.hpp rename to src/interfaces/iCO2Sensor.hpp diff --git a/src/upm/iHumiditySensor.hpp b/src/interfaces/iHumiditySensor.hpp similarity index 100% rename from src/upm/iHumiditySensor.hpp rename to src/interfaces/iHumiditySensor.hpp diff --git a/src/upm/iLightController.hpp b/src/interfaces/iLightController.hpp similarity index 100% rename from src/upm/iLightController.hpp rename to src/interfaces/iLightController.hpp diff --git a/src/upm/iLightSensor.hpp b/src/interfaces/iLightSensor.hpp similarity index 100% rename from src/upm/iLightSensor.hpp rename to src/interfaces/iLightSensor.hpp diff --git a/src/upm/iModuleStatus.hpp b/src/interfaces/iModuleStatus.hpp similarity index 100% rename from src/upm/iModuleStatus.hpp rename to src/interfaces/iModuleStatus.hpp diff --git a/src/upm/iPressureSensor.hpp b/src/interfaces/iPressureSensor.hpp similarity index 100% rename from src/upm/iPressureSensor.hpp rename to src/interfaces/iPressureSensor.hpp diff --git a/src/upm/iTemperatureSensor.hpp b/src/interfaces/iTemperatureSensor.hpp similarity index 100% rename from src/upm/iTemperatureSensor.hpp rename to src/interfaces/iTemperatureSensor.hpp diff --git a/src/interfaces/interfaces.cxx b/src/interfaces/interfaces.cxx new file mode 100644 index 00000000..5b0912d5 --- /dev/null +++ b/src/interfaces/interfaces.cxx @@ -0,0 +1 @@ +#include "iLightSensor.hpp" diff --git a/src/upm/javaupm_interfaces.i b/src/interfaces/javaupm_interfaces.i similarity index 84% rename from src/upm/javaupm_interfaces.i rename to src/interfaces/javaupm_interfaces.i index 962750ad..5d1b6c11 100644 --- a/src/upm/javaupm_interfaces.i +++ b/src/interfaces/javaupm_interfaces.i @@ -6,8 +6,9 @@ %{ - #include "../upm/iLightSensor.hpp" - #include "../upm/iLightController.hpp" + #include "iModuleStatus.hpp" + #include "iLightSensor.hpp" + #include "iLightController.hpp" %} %include "iModuleStatus.hpp" diff --git a/src/upm/javaupm_light_sensor.i b/src/interfaces/javaupm_light_sensor.i similarity index 93% rename from src/upm/javaupm_light_sensor.i rename to src/interfaces/javaupm_light_sensor.i index 2c153f44..285bad76 100644 --- a/src/upm/javaupm_light_sensor.i +++ b/src/interfaces/javaupm_light_sensor.i @@ -5,7 +5,7 @@ %} /* -%include "../upm/iModuleStatus.hpp" +%include "../iModuleStatus.hpp" */ %include "iLightSensor.hpp" diff --git a/src/upm/jsupm_interfaces.i b/src/interfaces/jsupm_interfaces.i similarity index 63% rename from src/upm/jsupm_interfaces.i rename to src/interfaces/jsupm_interfaces.i index 4cdfda6f..7a2cd0f6 100644 --- a/src/upm/jsupm_interfaces.i +++ b/src/interfaces/jsupm_interfaces.i @@ -2,8 +2,8 @@ %include "../upm.i" %{ - #include "../upm/iLightSensor.hpp" - #include "../upm/iLightController.hpp" + #include "iLightSensor.hpp" + #include "iLightController.hpp" %} %include "iModuleStatus.hpp" diff --git a/src/upm/pyupm_interfaces.i b/src/interfaces/pyupm_interfaces.i similarity index 74% rename from src/upm/pyupm_interfaces.i rename to src/interfaces/pyupm_interfaces.i index b82ad12d..85c85764 100644 --- a/src/upm/pyupm_interfaces.i +++ b/src/interfaces/pyupm_interfaces.i @@ -6,8 +6,8 @@ %feature("autodoc", "3"); %{ - #include "../upm/iLightSensor.hpp" - #include "../upm/iLightController.hpp" + #include "iLightSensor.hpp" + #include "iLightController.hpp" %} %include "iModuleStatus.hpp" diff --git a/src/jhd1313m1/CMakeLists.txt b/src/jhd1313m1/CMakeLists.txt index 5a0ea256..e3012b5b 100644 --- a/src/jhd1313m1/CMakeLists.txt +++ b/src/jhd1313m1/CMakeLists.txt @@ -6,6 +6,4 @@ upm_mixed_module_init (NAME jhd1313m1 CPP_SRC jhd1313m1.cxx # FTI_SRC jhd1313m1_fti.c CPP_WRAPS_C - REQUIRES mraa) -# We need hd44780_bits.h from lcm1602 -include_directories("../lcm1602") + REQUIRES mraa lcm1602) diff --git a/src/loudness/CMakeLists.txt b/src/loudness/CMakeLists.txt index 401d4093..ea87cec2 100644 --- a/src/loudness/CMakeLists.txt +++ b/src/loudness/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME loudness CPP_HDR loudness.hpp FTI_SRC loudness_fti.c CPP_WRAPS_C - REQUIRES libmraa) + REQUIRES mraa) diff --git a/src/lp8860/CMakeLists.txt b/src/lp8860/CMakeLists.txt index 92370ecd..92428ab2 100644 --- a/src/lp8860/CMakeLists.txt +++ b/src/lp8860/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) set (libname "lp8860") set (libdescription "LED lighting controller") set (module_src ${libname}.cxx mraa-utils.cxx) diff --git a/src/lp8860/lp8860.hpp b/src/lp8860/lp8860.hpp index 4b96dffe..f563a38b 100644 --- a/src/lp8860/lp8860.hpp +++ b/src/lp8860/lp8860.hpp @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "upm/iLightController.hpp" +#include "interfaces/iLightController.hpp" #include "mraa/i2c.hpp" namespace upm diff --git a/src/max44009/CMakeLists.txt b/src/max44009/CMakeLists.txt index b4fa462e..ca607af9 100644 --- a/src/max44009/CMakeLists.txt +++ b/src/max44009/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) set (libname "max44009") set (libdescription "MAX44009") set (module_src ${libname}.cxx) diff --git a/src/max44009/max44009.hpp b/src/max44009/max44009.hpp index 70bf50b6..c0aaddb9 100644 --- a/src/max44009/max44009.hpp +++ b/src/max44009/max44009.hpp @@ -26,7 +26,7 @@ #include #include -#include "upm/iLightSensor.hpp" +#include "interfaces/iLightSensor.hpp" /* ADDRESS AND NOT_FOUND VALUE */ #define MAX44009_ADDRESS ( 0x4A ) diff --git a/src/mcp2515/mcp2515.h b/src/mcp2515/mcp2515.h index 889c78fb..491f346b 100644 --- a/src/mcp2515/mcp2515.h +++ b/src/mcp2515/mcp2515.h @@ -32,7 +32,7 @@ #include #include -#include +#include "mcp2515_regs.h" #ifdef __cplusplus extern "C" { diff --git a/src/mcp9808/mcp9808.cxx b/src/mcp9808/mcp9808.cxx index bddac210..91e410fe 100644 --- a/src/mcp9808/mcp9808.cxx +++ b/src/mcp9808/mcp9808.cxx @@ -26,6 +26,9 @@ #include #include +#include "mraa.hpp" +#include "mraa/i2c.hpp" + using namespace upm; MCP9808::MCP9808 (int bus, uint8_t address){ diff --git a/src/mcp9808/mcp9808.hpp b/src/mcp9808/mcp9808.hpp index dc8ec14d..fba10262 100644 --- a/src/mcp9808/mcp9808.hpp +++ b/src/mcp9808/mcp9808.hpp @@ -28,8 +28,6 @@ #include #include -#include "mraa.hpp" -#include "mraa/i2c.hpp" #define MCP9808_REG_CONFIG 0x01 #define MCP9808_REG_AMBIENT_TEMP 0x05 @@ -41,6 +39,8 @@ #define MCP9808_CONFIG_WINLOCKED 0x4000 #define MCP9808_CONFIG_INTCLR 0x2000 +namespace mraa { class I2c;} + namespace upm { /** * @brief MCP9808 precision temperature sensor library diff --git a/src/micsv89/micsv89.cxx b/src/micsv89/micsv89.cxx index 9637c221..602101a8 100644 --- a/src/micsv89/micsv89.cxx +++ b/src/micsv89/micsv89.cxx @@ -22,8 +22,12 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include + #include "micsv89.hpp" +#include "mraa/i2c.hpp" + using namespace upm; MICSV89::MICSV89 (int bus, uint8_t address) { diff --git a/src/micsv89/micsv89.hpp b/src/micsv89/micsv89.hpp index 0fc369c2..1b115178 100644 --- a/src/micsv89/micsv89.hpp +++ b/src/micsv89/micsv89.hpp @@ -26,8 +26,8 @@ #include #include -#include "mraa.hpp" -#include "mraa/i2c.hpp" + +namespace mraa { class I2c;} namespace upm { /** diff --git a/src/mma7361/CMakeLists.txt b/src/mma7361/CMakeLists.txt index 8e2bd535..a260afc0 100644 --- a/src/mma7361/CMakeLists.txt +++ b/src/mma7361/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME mma7361 CPP_SRC mma7361.cxx FTI_SRC mma7361_fti.c CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/mma7660/mma7660.h b/src/mma7660/mma7660.h index 61094553..16436860 100644 --- a/src/mma7660/mma7660.h +++ b/src/mma7660/mma7660.h @@ -30,7 +30,7 @@ #include #include -#include +#include "mma7660_regs.h" #ifdef __cplusplus extern "C" { diff --git a/src/moisture/CMakeLists.txt b/src/moisture/CMakeLists.txt index a31dd8af..ea719470 100644 --- a/src/moisture/CMakeLists.txt +++ b/src/moisture/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME moisture CPP_SRC moisture.cxx FTI_SRC moisture_fti.c CPP_WRAPS_C - REQUIRES libmraa) + REQUIRES mraa) diff --git a/src/ms5611/CMakeLists.txt b/src/ms5611/CMakeLists.txt index a24238ca..3aaf4592 100644 --- a/src/ms5611/CMakeLists.txt +++ b/src/ms5611/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) set (libname "ms5611") set (libdescription "Pressure and temperature sensor") set (module_src ${libname}.cxx) diff --git a/src/ms5611/ms5611.hpp b/src/ms5611/ms5611.hpp index 19d09d43..094e811d 100644 --- a/src/ms5611/ms5611.hpp +++ b/src/ms5611/ms5611.hpp @@ -22,8 +22,8 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "upm/iPressureSensor.hpp" -#include "upm/iTemperatureSensor.hpp" +#include "interfaces/iPressureSensor.hpp" +#include "interfaces/iTemperatureSensor.hpp" #include "mraa/i2c.hpp" namespace upm diff --git a/src/ms5803/ms5803.h b/src/ms5803/ms5803.h index dd68e5da..c7df5990 100644 --- a/src/ms5803/ms5803.h +++ b/src/ms5803/ms5803.h @@ -32,7 +32,7 @@ #include #include -#include +#include "ms5803_defs.h" #ifdef __cplusplus extern "C" { diff --git a/src/nrf8001/aci_setup.cpp b/src/nrf8001/aci_setup.cpp index 810c70f0..1546e8ff 100644 --- a/src/nrf8001/aci_setup.cpp +++ b/src/nrf8001/aci_setup.cpp @@ -22,7 +22,7 @@ #include "aci.h" #include "hal_aci_tl.h" -#include +#include "lib_aci.h" #include "aci_setup.h" diff --git a/src/nrf8001/nrf8001.hpp b/src/nrf8001/nrf8001.hpp index a34fcee8..5681e5c0 100644 --- a/src/nrf8001/nrf8001.hpp +++ b/src/nrf8001/nrf8001.hpp @@ -55,8 +55,8 @@ #include #include -#include -#include +#include "lib_aci.h" +#include "aci_setup.h" void init_local_interfaces (aci_state_t* aci, uint8_t reqn, uint8_t rdyn, uint8_t rst); void close_local_interfaces (aci_state_t* aci); diff --git a/src/otp538u/otp538u.c b/src/otp538u/otp538u.c index acc83415..65767665 100644 --- a/src/otp538u/otp538u.c +++ b/src/otp538u/otp538u.c @@ -28,7 +28,7 @@ #include #include -#include +#include "otp538u.h" #include "thermopile_vt_table.h" #include "thermister_rt_table.h" diff --git a/src/ozw/CMakeLists.txt b/src/ozw/CMakeLists.txt index 3e53e013..b177e88a 100644 --- a/src/ozw/CMakeLists.txt +++ b/src/ozw/CMakeLists.txt @@ -1,13 +1,12 @@ -set (libname "ozw") -set (libdescription "Module for the OpenZWave library interface") -set (module_src ${libname}.cxx zwNode.cxx ozwinterface.cxx ozwdump.cxx aeotecss6.cxx aeotecsdg2.cxx aeotecdw2e.cxx aeotecdsb09104.cxx tzemt400.cxx) -set (module_hpp ${libname}.hpp ozwinterface.hpp ozwdump.hpp aeotecss6.hpp aeotecsdg2.hpp aeotecdw2e.hpp aeotecdsb09104.hpp tzemt400.hpp) - if (OPENZWAVE_FOUND) + set (libname "ozw") + set (libdescription "Module for the OpenZWave library interface") + set (module_src ${libname}.cxx zwNode.cxx ozwinterface.cxx ozwdump.cxx aeotecss6.cxx aeotecsdg2.cxx aeotecdw2e.cxx aeotecdsb09104.cxx tzemt400.cxx) + set (module_hpp ${libname}.hpp ozwinterface.hpp ozwdump.hpp aeotecss6.hpp aeotecsdg2.hpp aeotecdw2e.hpp aeotecdsb09104.hpp tzemt400.hpp) + set (reqlibname "libopenzwave") - include_directories(${OPENZWAVE_INCLUDE_DIRS}) - upm_module_init() - upm_target_link_libraries(${libname} ${OPENZWAVE_LIBRARIES}) + upm_module_init(${OPENZWAVE_LIBRARIES}) + target_include_directories(${libname} PUBLIC ${OPENZWAVE_INCLUDE_DIRS}) # openzwave/aes/aes.h has unknown pragmas, disable warning -Wunknown-pragmas compiler_flag_supported(CXX is_supported -Wno-unknown-pragmas) diff --git a/src/pkgconfig.in b/src/pkgconfig.in index 81b79611..84a90e22 100644 --- a/src/pkgconfig.in +++ b/src/pkgconfig.in @@ -3,11 +3,11 @@ exec_prefix=${prefix} libdir=${exec_prefix}/lib@LIB_SUFFIX@ includedir=${prefix}/include -Name: @libprefix@@basename@ +Name: @libname@ Description: @libdescription@ Version: @upm_VERSION_STRING@ -Libs: -L${libdir} -l@libprefix@@basename@ +Libs: -L${libdir} -l@libname@ Cflags: -I${includedir}/upm Requires: @reqlibname@ diff --git a/src/ppd42ns/ppd42ns.h b/src/ppd42ns/ppd42ns.h index 96d8d5eb..09bc5971 100644 --- a/src/ppd42ns/ppd42ns.h +++ b/src/ppd42ns/ppd42ns.h @@ -32,7 +32,7 @@ #include #include -#include +#include "ppd42ns_data.h" #ifdef __cplusplus extern "C" { diff --git a/src/rf22/rf22.cxx b/src/rf22/rf22.cxx index 3b33e05c..55b69e65 100644 --- a/src/rf22/rf22.cxx +++ b/src/rf22/rf22.cxx @@ -28,7 +28,7 @@ #include #include #include -#include +#include "rf22.hpp" using namespace upm; diff --git a/src/si1132/CMakeLists.txt b/src/si1132/CMakeLists.txt index 5201720c..3412a729 100644 --- a/src/si1132/CMakeLists.txt +++ b/src/si1132/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) set (libname "si1132") set (libdescription "UV and ambient light sensor") set (module_src ${libname}.cxx) diff --git a/src/si1132/javaupm_si1132.i b/src/si1132/javaupm_si1132.i index e35c2dae..bdbfe317 100644 --- a/src/si1132/javaupm_si1132.i +++ b/src/si1132/javaupm_si1132.i @@ -1,6 +1,6 @@ %module(directors="1") javaupm_si1132 %include "../upm.i" -%include "../upm/javaupm_interfaces.i" +%include "../interfaces/javaupm_interfaces.i" %pragma(java) jniclasscode=%{ static { @@ -18,8 +18,8 @@ %} /* -%include "../upm/iModuleStatus.hpp" -%include "../upm/iLightSensor.hpp" +%include "../iModuleStatus.hpp" +%include "../iLightSensor.hpp" %feature("director") IModuleStatus; %feature("director") ILightSensor; diff --git a/src/si1132/si1132.hpp b/src/si1132/si1132.hpp index 55260013..c5f41704 100644 --- a/src/si1132/si1132.hpp +++ b/src/si1132/si1132.hpp @@ -25,7 +25,7 @@ #include #include "mraa/i2c.hpp" -#include "upm/iLightSensor.hpp" +#include "interfaces/iLightSensor.hpp" namespace upm { diff --git a/src/si7005/CMakeLists.txt b/src/si7005/CMakeLists.txt index 8e8ad9cd..ce35e210 100644 --- a/src/si7005/CMakeLists.txt +++ b/src/si7005/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) set (libname "si7005") set (libdescription "Digital I2C humidity and temperature sensor") set (module_src ${libname}.cxx mraa-utils.cxx) diff --git a/src/si7005/si7005.hpp b/src/si7005/si7005.hpp index 2e4c4a4c..64ecaf10 100644 --- a/src/si7005/si7005.hpp +++ b/src/si7005/si7005.hpp @@ -25,8 +25,8 @@ #include -#include "upm/iTemperatureSensor.hpp" -#include "upm/iHumiditySensor.hpp" +#include "interfaces/iTemperatureSensor.hpp" +#include "interfaces/iHumiditySensor.hpp" /* ADDRESS AND NOT_FOUND VALUE */ #define SI7005_ADDRESS ( 0x40 ) diff --git a/src/speaker/CMakeLists.txt b/src/speaker/CMakeLists.txt index 7f52c96e..10e60a10 100644 --- a/src/speaker/CMakeLists.txt +++ b/src/speaker/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME speaker CPP_SRC speaker.cxx # FTI_SRC speaker_fti.c CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/t3311/CMakeLists.txt b/src/t3311/CMakeLists.txt index 354293f4..74985f7f 100644 --- a/src/t3311/CMakeLists.txt +++ b/src/t3311/CMakeLists.txt @@ -1,11 +1,10 @@ -set (libname "t3311") -set (libdescription "Module for the Comet System T3311") -set (module_src ${libname}.cxx) -set (module_hpp ${libname}.hpp) - if (MODBUS_FOUND) + set (libname "t3311") + set (libdescription "Module for the Comet System T3311") + set (module_src ${libname}.cxx) + set (module_hpp ${libname}.hpp) + set (reqlibname "libmodbus") - include_directories(${MODBUS_INCLUDE_DIRS}) - upm_module_init() - upm_target_link_libraries(${libname} ${MODBUS_LIBRARIES}) + upm_module_init(${MODBUS_LIBRARIES}) + target_include_directories(${libname} PUBLIC ${MODBUS_INCLUDE_DIRS}) endif () diff --git a/src/t6713/t6713.cxx b/src/t6713/t6713.cxx index 65c850e6..07cc500b 100644 --- a/src/t6713/t6713.cxx +++ b/src/t6713/t6713.cxx @@ -29,7 +29,7 @@ #include #include -#include +#include "t6713.hpp" #define T6713_ADDR 0x15 diff --git a/src/t6713/t6713.hpp b/src/t6713/t6713.hpp index 603a3dac..7d069edb 100644 --- a/src/t6713/t6713.hpp +++ b/src/t6713/t6713.hpp @@ -24,7 +24,7 @@ #include "mraa/i2c.hpp" -#include "upm/iCO2Sensor.hpp" +#include "interfaces/iCO2Sensor.hpp" namespace upm { diff --git a/src/t8100/CMakeLists.txt b/src/t8100/CMakeLists.txt index ee09e2b1..29f2279f 100644 --- a/src/t8100/CMakeLists.txt +++ b/src/t8100/CMakeLists.txt @@ -1,13 +1,8 @@ -set (libname "t8100") -set (libdescription "Module for the Telaire T8100 Ventostat") -set (module_src ${libname}.cxx) -set (module_hpp ${libname}.hpp) - if (BACNET_FOUND) - # upm-libbacnetmstp will bring in libbacnet, I hope - set (reqlibname "upm-bacnetmstp") - include_directories(${BACNET_INCLUDE_DIRS}) - include_directories("../bacnetmstp") - upm_module_init() - upm_target_link_libraries(${libname} bacnetmstp) + set (libname "t8100") + set (libdescription "Module for the Telaire T8100 Ventostat") + set (module_src ${libname}.cxx) + set (module_hpp ${libname}.hpp) + + upm_module_init(bacnetmstp) endif () diff --git a/src/tb7300/CMakeLists.txt b/src/tb7300/CMakeLists.txt index 3f931be3..73c2c83a 100644 --- a/src/tb7300/CMakeLists.txt +++ b/src/tb7300/CMakeLists.txt @@ -1,13 +1,8 @@ -set (libname "tb7300") -set (libdescription "Module for the TB7300 Fan Coil Thermostat") -set (module_src ${libname}.cxx) -set (module_hpp ${libname}.hpp) - if (BACNET_FOUND) - # upm-libbacnetmstp will bring in libbacnet, I hope - set (reqlibname "upm-bacnetmstp") - include_directories(${BACNET_INCLUDE_DIRS}) - include_directories("../bacnetmstp") - upm_module_init() - upm_target_link_libraries(${libname} bacnetmstp) + set (libname "tb7300") + set (libdescription "Module for the TB7300 Fan Coil Thermostat") + set (module_src ${libname}.cxx) + set (module_hpp ${libname}.hpp) + + upm_module_init(bacnetmstp) endif () diff --git a/src/tsl2561/CMakeLists.txt b/src/tsl2561/CMakeLists.txt index cefe5672..dbb8cee2 100644 --- a/src/tsl2561/CMakeLists.txt +++ b/src/tsl2561/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME tsl2561 CPP_SRC tsl2561.cxx FTI_SRC tsl2561_fti.c CPP_WRAPS_C - REQUIRES libmraa) + REQUIRES mraa) diff --git a/src/ttp223/CMakeLists.txt b/src/ttp223/CMakeLists.txt index eb63d03f..619aa9e0 100644 --- a/src/ttp223/CMakeLists.txt +++ b/src/ttp223/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME ttp223 CPP_SRC ttp223.cxx FTI_SRC ttp223_fti.c CPP_WRAPS_C - REQUIRES libmraa) + REQUIRES mraa) diff --git a/src/upm/CMakeLists.txt b/src/upm/CMakeLists.txt deleted file mode 100644 index 3e15c6f3..00000000 --- a/src/upm/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -install (DIRECTORY . DESTINATION include/upm FILES_MATCHING PATTERN "*.hpp") -if (BUILDSWIGJAVA) - set (libname "interfaces") - set (libdescription "CXX interface library") - set (module_src ${libname}.cxx) -# set (module_hpp ${libname}.hpp) - upm_module_init() -endif() diff --git a/src/upm/interfaces.cxx b/src/upm/interfaces.cxx deleted file mode 100644 index e76f7062..00000000 --- a/src/upm/interfaces.cxx +++ /dev/null @@ -1 +0,0 @@ -#include "upm/iLightSensor.hpp" diff --git a/src/urm37/CMakeLists.txt b/src/urm37/CMakeLists.txt index 52907967..8c529033 100644 --- a/src/urm37/CMakeLists.txt +++ b/src/urm37/CMakeLists.txt @@ -6,4 +6,4 @@ upm_mixed_module_init (NAME urm37 CPP_SRC urm37.cxx FTI_SRC urm37_fti.c CPP_WRAPS_C - REQUIRES upmc-utilities mraa) + REQUIRES mraa) diff --git a/src/vcap/CMakeLists.txt b/src/vcap/CMakeLists.txt index 310539aa..25795be3 100644 --- a/src/vcap/CMakeLists.txt +++ b/src/vcap/CMakeLists.txt @@ -6,5 +6,5 @@ set (module_hpp ${libname}.hpp) if (JPEG_FOUND) set (reqlibname "jpeg") upm_module_init() - upm_target_link_libraries(${libname} jpeg) + target_link_libraries(${libname} jpeg) endif()