diff --git a/CMakeLists.txt b/CMakeLists.txt index b885098c..158bcf4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,6 @@ option (BUILDFTI "Build Funtion Table Interface (FTI) in C sensor libraries" OFF option (BUILDSWIGPYTHON "Build swig python modules" ON) option (BUILDSWIGNODE "Build swig node modules" ON) option (BUILDSWIGJAVA "Build swig java modules" OFF) -option (BUILDPYTHON3 "Use python3 for building/installing/testing" OFF) option (BUILDEXAMPLES "Build C/C++ example binaries" OFF) option (BUILDJAVAEXAMPLES "Build java example jars" OFF) option (IPK "Generate IPK using CPack" OFF) @@ -44,12 +43,38 @@ pkg_check_modules (OPENZWAVE libopenzwave) # Find JPEG find_package (JPEG) +# Find nodejs +if (BUILDSWIGNODE) + find_package (Node REQUIRED) +endif (BUILDSWIGNODE) + # Find swig if any wrapper is enabled if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA) find_package (SWIG 3.0.5 REQUIRED) include (${SWIG_USE_FILE}) endif () +# Python is required for swig generated python and for UPM tests +# UPM build can generated modules for both python2 AND python3 +# OpenCV python detect will attempt to find python2/3 +if (BUILDSWIGPYTHON OR BUILDTESTS) + include (cmake/modules/OpenCVDetectPython.cmake) +endif (BUILDSWIGPYTHON OR BUILDTESTS) + +# Which versions of python were found? +if (PYTHON2LIBS_FOUND AND BUILDSWIGPYTHON) + message(STATUS "Building python2 modules with python-${PYTHON2LIBS_VERSION_STRING}") +endif (PYTHON2LIBS_FOUND AND BUILDSWIGPYTHON) +if (PYTHON3LIBS_FOUND AND BUILDSWIGPYTHON) + message(STATUS "Building python3 modules with python-${PYTHON3LIBS_VERSION_STRING}") +endif (PYTHON3LIBS_FOUND AND BUILDSWIGPYTHON) + +# Python2 is currently required for python documentation +if (BUILDSWIGPYTHON AND BUILDDOC AND NOT PYTHON2INTERP_FOUND) + message(FATAL_ERROR "Failed to find python2 interpreter which is required " + "to build python documentation.") +endif (BUILDSWIGPYTHON AND BUILDDOC AND NOT PYTHON2INTERP_FOUND) + # Set CMAKE_INSTALL_LIBDIR if not defined include(GNUInstallDirs) set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries") @@ -111,33 +136,59 @@ else() message(WARNING "Some modules require C++11 support, and may not build without it.") endif() +# The doc target depends on each sensor target +# +# doc +# ├──> libupm_sensor0 +# ├──> libupm_sensor1 +# ├──> libupm_sensor2 +# └──> libupm_sensor_n +# +# The pydoc target builds documentation with sphinx via inspection by loading +# each python module. Those modules must include the CXX documentation via +# a monolithic swig file generated by doxy2swig +# +# pydoc +# └──> _pyupm_sensor0_python2 +# ├──────> libupm_sensor0 +# └──────> doxy2swig +# +# The doxy2swig target is dependent upon the doc target IF BUILDDOC=ON, +# otherwise doxy2swig uses an empty file. Doxy2swig also depends on each +# sensor target +# +# doxy2swig +# ├──> BUILDDOC=ON───> doc +# └──> libupm_sensor0 +# +# The jsdoc target builds js documentation via yuidoc and only requires +# the doc target +# +# jsdoc ─> doc +# if (BUILDDOC) # Add a target to generate API documentation with Doxygen - find_package (Doxygen) - if (DOXYGEN_FOUND) - configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - if (BUILDSWIGJAVA) - configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY) - endif() - file(GLOB PNG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/docs docs/icons/*.png) - foreach(PNG_FILE ${PNG_FILES}) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/${PNG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/html/docs/${PNG_FILE} COPYONLY) - endforeach() - add_custom_target (doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - COMMAND tar -czf html/xml.tar.gz -C xml . - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" VERBATIM - ) - endif (DOXYGEN_FOUND) - # Check if Sphinx is installed and add target to generate API documentation - find_package (Sphinx) - if(SPHINX_FOUND AND BUILDSWIGPYTHON) - # Python required for Sphinx build - find_package (PythonLibs ${PYTHONBUILD_VERSION} REQUIRED) - string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING}) - list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR) - list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR) + find_package (Doxygen REQUIRED) + configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + if (BUILDSWIGJAVA) + configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY) + endif() + file(GLOB PNG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/docs docs/icons/*.png) + foreach(PNG_FILE ${PNG_FILES}) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/${PNG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/html/docs/${PNG_FILE} COPYONLY) + endforeach() + add_custom_target (doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + COMMAND tar -czf html/xml.tar.gz -C xml . + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" VERBATIM + ) + + # Check if Sphinx is installed and add target to generate API documentationa + # Currently, the per-module documentation for python is generated from the + # python2 modules. + if(BUILDSWIGPYTHON) + find_package (Sphinx REQUIRED) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY) add_custom_target (pydoc ALL @@ -153,12 +204,11 @@ if (BUILDDOC) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Sphinx" VERBATIM ) - endif () + endif(BUILDSWIGPYTHON) + # Check if Yuidoc is installed and add target for API documentation - find_package(Yuidoc) - if(YUIDOC_FOUND AND BUILDSWIGNODE) - # Node required for Yuidoc documentation - find_package(Node) + if(BUILDSWIGNODE) + find_package(Yuidoc REQUIRED) file(GLOB_RECURSE JSDOC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/doxy/node doxy/node/*) foreach(JSDOC_FILE ${JSDOC_FILES}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy/node/${JSDOC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${JSDOC_FILE} COPYONLY) @@ -171,11 +221,10 @@ if (BUILDDOC) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Yuidoc" VERBATIM ) - endif() -endif() + endif(BUILDSWIGNODE) +endif (BUILDDOC) if (IPK) - # Get target package arch from Yocto ADT sysroot if set or host OS, mapping to Ubuntu name if necessary if (DEFINED ENV{OECORE_TARGET_SYSROOT}) GET_FILENAME_COMPONENT (DETECTED_SYSROOT $ENV{OECORE_TARGET_SYSROOT} NAME) @@ -238,14 +287,6 @@ if (RPM) include(CPack) endif() -if (BUILDSWIGPYTHON OR BUILDTESTS) - if (BUILDPYTHON3) - set (PYTHONBUILD_VERSION 3) - else () - set (PYTHONBUILD_VERSION 2.7) - endif () -endif () - # UPM common headers set (UPM_COMMON_HEADER_DIRS ${CMAKE_HOME_DIRECTORY}/include @@ -263,8 +304,8 @@ if(BUILDJAVAEXAMPLES) add_subdirectory (examples/java) endif() +# Python interp is previously found if BUILDTESTS=ON if (BUILDTESTS) - find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED) enable_testing () add_subdirectory (tests) endif() diff --git a/cmake/modules/OpenCVDetectPython.cmake b/cmake/modules/OpenCVDetectPython.cmake new file mode 100644 index 00000000..e3fc3a90 --- /dev/null +++ b/cmake/modules/OpenCVDetectPython.cmake @@ -0,0 +1,160 @@ +# Find specified Python version +# Arguments: +# preferred_version (value): Version to check for first +# min_version (value): Minimum supported version +# library_env (value): Name of Python library ENV variable to check +# include_dir_env (value): Name of Python include directory ENV variable to check +# found (variable): Set if interpreter found +# executable (variable): Output of executable found +# version_string (variable): Output of found version +# version_major (variable): Output of found major version +# version_minor (variable): Output of found minor version +# libs_found (variable): Set if libs found +# libs_version_string (variable): Output of found libs version +# libraries (variable): Output of found Python libraries +# library (variable): Output of found Python library +# debug_libraries (variable): Output of found Python debug libraries +# debug_library (variable): Output of found Python debug library +# include_path (variable): Output of found Python include path +# include_dir (variable): Output of found Python include dir +# include_dir2 (variable): Output of found Python include dir2 +# packages_path (variable): Output of found Python packages path +function(find_python preferred_version min_version library_env include_dir_env + found executable version_string version_major version_minor + libs_found libs_version_string libraries library debug_libraries + debug_library include_path include_dir include_dir2 packages_path) +if(NOT ${found}) + if(${executable}) + set(PYTHON_EXECUTABLE "${${executable}}") + endif() + + find_package(PythonInterp "${preferred_version}") + if(NOT PYTHONINTERP_FOUND) + find_package(PythonInterp "${min_version}") + endif() + + if(PYTHONINTERP_FOUND) + # Copy outputs + set(_found ${PYTHONINTERP_FOUND}) + set(_executable ${PYTHON_EXECUTABLE}) + set(_version_string ${PYTHON_VERSION_STRING}) + set(_version_major ${PYTHON_VERSION_MAJOR}) + set(_version_minor ${PYTHON_VERSION_MINOR}) + set(_version_patch ${PYTHON_VERSION_PATCH}) + + # Clear find_host_package side effects + unset(PYTHONINTERP_FOUND) + unset(PYTHON_EXECUTABLE CACHE) + unset(PYTHON_VERSION_STRING) + unset(PYTHON_VERSION_MAJOR) + unset(PYTHON_VERSION_MINOR) + unset(PYTHON_VERSION_PATCH) + endif() + + if(_found) + set(_version_major_minor "${_version_major}.${_version_minor}") + + if(NOT ANDROID AND NOT APPLE_FRAMEWORK) + # not using _version_string here, because it might not conform to the CMake version format + if(CMAKE_CROSSCOMPILING) + # builder version can differ from target, matching base version (e.g. 2.7) + find_package(PythonLibs "${_version_major_minor}") + else() + find_package(PythonLibs "${_version_major_minor}.${_version_patch}" EXACT) + endif() + + if(PYTHONLIBS_FOUND) + # Copy outputs + set(_libs_found ${PYTHONLIBS_FOUND}) + set(_libraries ${PYTHON_LIBRARIES}) + set(_include_path ${PYTHON_INCLUDE_PATH}) + set(_include_dirs ${PYTHON_INCLUDE_DIRS}) + set(_debug_libraries ${PYTHON_DEBUG_LIBRARIES}) + set(_libs_version_string ${PYTHONLIBS_VERSION_STRING}) + set(_debug_library ${PYTHON_DEBUG_LIBRARY}) + set(_library ${PYTHON_LIBRARY}) + set(_library_debug ${PYTHON_LIBRARY_DEBUG}) + set(_library_release ${PYTHON_LIBRARY_RELEASE}) + set(_include_dir ${PYTHON_INCLUDE_DIR}) + set(_include_dir2 ${PYTHON_INCLUDE_DIR2}) + + # Clear find_package side effects + unset(PYTHONLIBS_FOUND) + unset(PYTHON_LIBRARIES) + unset(PYTHON_INCLUDE_PATH) + unset(PYTHON_INCLUDE_DIRS) + unset(PYTHON_DEBUG_LIBRARIES) + unset(PYTHONLIBS_VERSION_STRING) + unset(PYTHON_DEBUG_LIBRARY CACHE) + unset(PYTHON_LIBRARY) + unset(PYTHON_LIBRARY_DEBUG) + unset(PYTHON_LIBRARY_RELEASE) + unset(PYTHON_LIBRARY CACHE) + unset(PYTHON_LIBRARY_DEBUG CACHE) + unset(PYTHON_LIBRARY_RELEASE CACHE) + unset(PYTHON_INCLUDE_DIR CACHE) + unset(PYTHON_INCLUDE_DIR2 CACHE) + endif() + endif() + + execute_process(COMMAND ${_executable} -c "from distutils.sysconfig import *; print(get_python_lib())" + RESULT_VARIABLE _cvpy_process + OUTPUT_VARIABLE _std_packages_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + if("${_std_packages_path}" MATCHES "site-packages") + set(_packages_path "python${_version_major_minor}/site-packages") + else() #debian based assumed, install to the dist-packages. + set(_packages_path "python${_version_major_minor}/dist-packages") + endif() + if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}") + set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}") + else() + set(_packages_path "lib/${_packages_path}") + endif() + endif() + + # Export return values + set(${found} "${_found}" CACHE INTERNAL "") + set(${executable} "${_executable}" CACHE FILEPATH "Path to Python interpretor") + set(${version_string} "${_version_string}" CACHE INTERNAL "") + set(${version_major} "${_version_major}" CACHE INTERNAL "") + set(${version_minor} "${_version_minor}" CACHE INTERNAL "") + set(${libs_found} "${_libs_found}" CACHE INTERNAL "") + set(${libs_version_string} "${_libs_version_string}" CACHE INTERNAL "") + set(${libraries} "${_libraries}" CACHE INTERNAL "Python libraries") + set(${library} "${_library}" CACHE FILEPATH "Path to Python library") + set(${debug_libraries} "${_debug_libraries}" CACHE INTERNAL "") + set(${debug_library} "${_debug_library}" CACHE FILEPATH "Path to Python debug") + set(${include_path} "${_include_path}" CACHE INTERNAL "") + set(${include_dir} "${_include_dir}" CACHE PATH "Python include dir") + set(${include_dir2} "${_include_dir2}" CACHE PATH "Python include dir 2") + set(${packages_path} "${_packages_path}" CACHE PATH "Where to install the python packages.") +endif() +endfunction(find_python) + +set(MIN_VER_PYTHON2 2.7) +set(MIN_VER_PYTHON3 3.2) + +find_python(2.7 "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR + PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING + PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND + PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY + PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH + PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH) + +find_python(3 "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR + PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING + PYTHON3_VERSION_MAJOR PYTHON3_VERSION_MINOR PYTHON3LIBS_FOUND + PYTHON3LIBS_VERSION_STRING PYTHON3_LIBRARIES PYTHON3_LIBRARY + PYTHON3_DEBUG_LIBRARIES PYTHON3_LIBRARY_DEBUG PYTHON3_INCLUDE_PATH + PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR2 PYTHON3_PACKAGES_PATH) + +if(PYTHON_DEFAULT_EXECUTABLE) + set(PYTHON_DEFAULT_AVAILABLE "TRUE") +elseif(PYTHON2INTERP_FOUND) # Use Python 2 as default Python interpreter + set(PYTHON_DEFAULT_AVAILABLE "TRUE") + set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}") +elseif(PYTHON3INTERP_FOUND) # Use Python 2 as fallback Python interpreter (if there is no Python 2) + set(PYTHON_DEFAULT_AVAILABLE "TRUE") + set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON3_EXECUTABLE}") +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d075d1ce..0d92f798 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,28 +26,123 @@ 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) -macro(upm_swig_python) - if (BUILDSWIGPYTHON) +# Provides a means to call target_link_libraries AND the necessary +# swig_link_libaries. This iterates over all additional parameters AFTER +# the target name calling target_link_libraries/swig_link_libraries +# as necessary accordingly +macro (upm_target_link_libraries target_name) + # For each additional argument to upm_target_link_libraries... + foreach(_library ${ARGN}) + # Add the dependency + target_link_libraries(${target_name} ${_library}) - include_directories ( - ${CMAKE_CURRENT_SOURCE_DIR}/.. - ) + # Call the swig link library method for each library + if (BUILDSWIGNODE) + set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) + swig_link_libraries (jsupm_${libname} ${_library}) + endif() + # Build python2 AND/OR python3 modules + if (BUILDSWIGPYTHON) + # python2? + if (PYTHON2LIBS_FOUND) + set (pymod_target_name pyupm_${target_name}-python${PYTHON2_VERSION_MAJOR}) + set_target_properties(${SWIG_MODULE_pyupm_${pymod_target_name}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) + swig_link_libraries (${pymod_target_name} ${_library}) + endif (PYTHON2LIBS_FOUND) + if (PYTHON3LIBS_FOUND) + set (pymod_target_name pyupm_${target_name}-python${PYTHON3_VERSION_MAJOR}) + set_target_properties(${SWIG_MODULE_pyupm_${pymod_target_name}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) + swig_link_libraries (${pymod_target_name} ${_library}) + endif (PYTHON3LIBS_FOUND) + endif() + if (BUILDSWIGJAVA) + set_target_properties(${SWIG_MODULE_javaupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) + swig_link_libraries (javaupm_${libname} ${_library}) + endif() + endforeach(_library ${ARGN}) +endmacro (upm_target_link_libraries target_name) - 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}/..") +# Create a single swig target for python +macro(_upm_swig_python) + # Create a target name which includes python version + set (pymod_target_name pyupm_${libname}-python${PYTHON_VERSION_MAJOR}) - swig_add_module (pyupm_${libname} python pyupm_${libname}.i) - swig_link_libraries (pyupm_${libname} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES} ${libname}) - target_include_directories ( ${SWIG_MODULE_pyupm_${libname}_REAL_NAME} + include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..) + + 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}/..") + + # Set current python binary dir + set (CMAKE_CURRENT_PYTHON_BINARY_DIR + ${CMAKE_CURRENT_BINARY_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) + + # Make sure swig places wrapper/.py collateral under python2/3 directory + # Do do this, save the original outdir, set a new outdir, then restore at the + # end of this macro. + set(CMAKE_SWIG_OUTDIR_SAVED ${CMAKE_SWIG_OUTDIR}) + set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_PYTHON_BINARY_DIR}) + + swig_add_module (${pymod_target_name} python pyupm_${libname}.i) + swig_link_libraries (${pymod_target_name} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES} ${libname}) + target_include_directories (${SWIG_MODULE_${pymod_target_name}_REAL_NAME} PUBLIC "${PYTHON_INCLUDE_PATH}" - "${PYTHON_INCLUDE_DIRS}" - ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_pyupm_${libname}.so - ${CMAKE_CURRENT_BINARY_DIR}/pyupm_${libname}.py - DESTINATION ${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/ - COMPONENT ${libname}) - endif() + "${PYTHON_INCLUDE_DIRS}") + + # Add C++ comments to ALL python modules (requires doc build) + if (BUILDDOC) + # Python module depends on doxy2swig .i file generated from the monolithic doxygen xml file + add_dependencies(${SWIG_MODULE_${pymod_target_name}_REAL_NAME} pyupm_doxy2swig ) + + # The pydoc target depends on EACH python module + add_dependencies(pydoc ${SWIG_MODULE_${pymod_target_name}_REAL_NAME}) + endif (BUILDDOC) + + # Python collateral names with be the same for python2/3 w/different library dirs + set_target_properties (${SWIG_MODULE_${pymod_target_name}_REAL_NAME} PROPERTIES + OUTPUT_NAME _pyupm_${libname} + COMPILE_FLAGS "${CMAKE_C_FLAGS}" + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_PYTHON_BINARY_DIR}) + + # Install py to per-python version site-packages + install (FILES ${CMAKE_SWIG_OUTDIR}/pyupm_${libname}.py + DESTINATION ${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/ + COMPONENT ${libname}) + + # Install python wrapped library with TARGETS to correctly handle RPATH + install (TARGETS ${SWIG_MODULE_${pymod_target_name}_REAL_NAME} + DESTINATION ${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/) + + # Restore OUTDIR + set(CMAKE_SWIG_OUTDIR ${CMAKE_SWIG_OUTDIR_SAVED}) +endmacro(_upm_swig_python) + +# Generate both python2 and python3 modules if possible +macro(upm_swig_python) + # Return if not building python + if (NOT BUILDSWIGPYTHON) + return () + endif (NOT BUILDSWIGPYTHON) + + # Generate python2 module if python2 libs are available + if (PYTHON2LIBS_FOUND) + set(PYTHON_INCLUDE_DIRS ${PYTHON2_INCLUDE_DIRS}) + set(PYTHON_INCLUDE_PATH ${PYTHON2_INCLUDE_PATH}) + set(PYTHON_LIBRARIES ${PYTHON2_LIBRARIES}) + set(PYTHON_VERSION_MAJOR ${PYTHON2_VERSION_MAJOR}) + set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR}) + _upm_swig_python() + endif (PYTHON2LIBS_FOUND) + + # Generate python3 module if python3 libs are available + if (PYTHON3LIBS_FOUND) + set(PYTHON_INCLUDE_DIRS ${PYTHON3_INCLUDE_DIRS}) + set(PYTHON_INCLUDE_PATH ${PYTHON3_INCLUDE_PATH}) + set(PYTHON_LIBRARIES ${PYTHON3_LIBRARIES}) + set(PYTHON_VERSION_MAJOR ${PYTHON3_VERSION_MAJOR}) + set(PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR}) + _upm_swig_python() + endif (PYTHON3LIBS_FOUND) endmacro(upm_swig_python) macro(upm_swig_node) @@ -166,59 +261,37 @@ endmacro(upm_swig_java) macro(upm_doxygen) if (DOXYGEN_FOUND) - if(NOT DEFINED classname) - set (classname ${libname}) - endif() set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND}) - if (BUILDSWIGPYTHON) - add_dependencies (_pyupm_${libname} pyupm_doxy2swig) - add_dependencies (pydoc _pyupm_${libname}) - else () - add_dependencies (${libname} doc) - endif () + add_dependencies (doc ${libname}) endif () endmacro(upm_doxygen) -if (SWIG_FOUND) - if (BUILDSWIGPYTHON) - if(NOT PYTHONLIBS_FOUND) - find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED) - find_package (PythonLibs ${PYTHONBUILD_VERSION} REQUIRED) - string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING}) - list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR) - list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR) - endif() - endif(BUILDSWIGPYTHON) - if (BUILDSWIGNODE) - if(NOT NODE_FOUND) - find_package(Node) - endif() - if(SWIG_VERSION VERSION_LESS 3.0.5 AND NODE_VERSION_STRING VERSION_GREATER 0.12) - message(WARNING "WARNING - SWIG 3.0.5+ required for building with nodejs 0.12. Current version is ${SWIG_VERSION}") - endif() - find_path (NODE_ROOT_DIR "include/node/node.h") - set (NODE_INCLUDE_DIRS - ${NODE_ROOT_DIR}/include/src - ${NODE_ROOT_DIR}/include/node - ${NODE_ROOT_DIR}/include/deps/v8/include - ${NODE_ROOT_DIR}/include/deps/uv/include - ) - macro(createpackagejson) - configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY) - # If a CMAKE_INSTALL_PREFIX has NOT been provided, set NODE_MODULE_INSTALL_PATH - # base on the NODE_ROOT_DIR. - if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set (NODE_MODULE_INSTALL_PATH ${NODE_ROOT_DIR}/lib/node_modules/jsupm_${libname}/) - # If a CMAKE_INSTALL_PREFIX has been provided, set NODE_MODULE_INSTALL_PATH - # relative to the provided install directory. - else () - set (NODE_MODULE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/node_modules/jsupm_${libname}/) - endif () - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/package.json - DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname}) - endmacro(createpackagejson) - endif(BUILDSWIGNODE) -endif() +if (BUILDSWIGNODE) + if(SWIG_VERSION VERSION_LESS 3.0.5 AND NODE_VERSION_STRING VERSION_GREATER 0.12) + message(WARNING "WARNING - SWIG 3.0.5+ required for building with nodejs 0.12. Current version is ${SWIG_VERSION}") + endif() + find_path (NODE_ROOT_DIR "include/node/node.h") + set (NODE_INCLUDE_DIRS + ${NODE_ROOT_DIR}/include/src + ${NODE_ROOT_DIR}/include/node + ${NODE_ROOT_DIR}/include/deps/v8/include + ${NODE_ROOT_DIR}/include/deps/uv/include + ) + macro(createpackagejson) + configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY) + # If a CMAKE_INSTALL_PREFIX has NOT been provided, set NODE_MODULE_INSTALL_PATH + # base on the NODE_ROOT_DIR. + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set (NODE_MODULE_INSTALL_PATH ${NODE_ROOT_DIR}/lib/node_modules/jsupm_${libname}/) + # If a CMAKE_INSTALL_PREFIX has been provided, set NODE_MODULE_INSTALL_PATH + # relative to the provided install directory. + else () + set (NODE_MODULE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/node_modules/jsupm_${libname}/) + endif () + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/package.json + DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname}) + endmacro(createpackagejson) +endif(BUILDSWIGNODE) # Process C/C++ sensor modules # This function pre-processes sensor library input and hands off the @@ -366,22 +439,19 @@ macro(upm_module_init) endmacro(upm_module_init) # Generate python module documentation from doxygen collateral -if (BUILDDOC AND BUILDSWIGPYTHON AND SWIG_FOUND) +if (BUILDDOC AND BUILDSWIGPYTHON) # doxy2swig the doxygen output - add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i + add_custom_target (pyupm_doxy2swig ALL COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py ${CMAKE_BINARY_DIR}/xml/index.xml ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i - DEPENDS ${CMAKE_BINARY_DIR}/xml/index.xml - ) - add_custom_target (pyupm_doxy2swig DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i) - add_dependencies (pyupm_doxy2swig doc) + DEPENDS doc) # BUILDDOC not set but still building python modules, generate an empty # pyupm_doxy2swig.i file (overwriting if necessary) -elseif (BUILDSWIGPYTHON AND SWIG_FOUND) +elseif (BUILDSWIGPYTHON) message (STATUS "Generating empty ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i") file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub") -endif (BUILDDOC AND BUILDSWIGPYTHON AND SWIG_FOUND) +endif (BUILDDOC AND BUILDSWIGPYTHON) if (MODULE_LIST) set(SUBDIRS ${MODULE_LIST}) diff --git a/src/adafruitms1438/CMakeLists.txt b/src/adafruitms1438/CMakeLists.txt index 70c85d9d..e4a37949 100644 --- a/src/adafruitms1438/CMakeLists.txt +++ b/src/adafruitms1438/CMakeLists.txt @@ -6,12 +6,4 @@ set (reqlibname "upm-pca9685") include_directories("../pca9685") upm_module_init() add_dependencies(${libname} pca9685) -target_link_libraries(${libname} pca9685) -if (BUILDSWIGNODE) - set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (jsupm_${libname} pca9685) -endif() -if (BUILDSWIGPYTHON) - set_target_properties(${SWIG_MODULE_pyupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (pyupm_${libname} pca9685) -endif() +upm_target_link_libraries(${libname} pca9685) diff --git a/src/apds9930/pyupm_apds9930.i b/src/apds9930/pyupm_apds9930.i index e54fb2e5..263dd3f2 100755 --- a/src/apds9930/pyupm_apds9930.i +++ b/src/apds9930/pyupm_apds9930.i @@ -1,5 +1,7 @@ %module pyupm_apds9930 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" %feature("autodoc", "3"); diff --git a/src/bacnetmstp/CMakeLists.txt b/src/bacnetmstp/CMakeLists.txt index be2daaa8..5757feef 100644 --- a/src/bacnetmstp/CMakeLists.txt +++ b/src/bacnetmstp/CMakeLists.txt @@ -7,14 +7,5 @@ if (BACNET_FOUND) set (reqlibname "libbacnet") include_directories(${BACNET_INCLUDE_DIRS}) upm_module_init() - target_link_libraries(${libname} ${BACNET_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - if (BUILDSWIGNODE) - swig_link_libraries (jsupm_${libname} ${BACNET_LIBRARIES}) - endif() - if (BUILDSWIGPYTHON) - swig_link_libraries (pyupm_${libname} ${BACNET_LIBRARIES}) - endif() - if (BUILDSWIGJAVA) - swig_link_libraries (javaupm_${libname} ${BACNET_LIBRARIES}) - endif() + upm_target_link_libraries(${libname} ${BACNET_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) endif () diff --git a/src/ds1808lc/pyupm_ds1808lc.i b/src/ds1808lc/pyupm_ds1808lc.i index 4c2b34ac..e479c146 100644 --- a/src/ds1808lc/pyupm_ds1808lc.i +++ b/src/ds1808lc/pyupm_ds1808lc.i @@ -1,5 +1,8 @@ %module pyupm_ds1808lc %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %feature("autodoc", "3"); diff --git a/src/ds18b20/pyupm_ds18b20.i b/src/ds18b20/pyupm_ds18b20.i index 3a4ac70e..b0f019e5 100644 --- a/src/ds18b20/pyupm_ds18b20.i +++ b/src/ds18b20/pyupm_ds18b20.i @@ -1,5 +1,8 @@ %module pyupm_ds18b20 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "carrays.i" %include "std_string.i" diff --git a/src/ds2413/pyupm_ds2413.i b/src/ds2413/pyupm_ds2413.i index 819f71ce..b0d7279c 100644 --- a/src/ds2413/pyupm_ds2413.i +++ b/src/ds2413/pyupm_ds2413.i @@ -1,5 +1,8 @@ %module pyupm_ds2413 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "carrays.i" %include "std_string.i" diff --git a/src/e50hx/CMakeLists.txt b/src/e50hx/CMakeLists.txt index 4a613e3e..fac4f780 100644 --- a/src/e50hx/CMakeLists.txt +++ b/src/e50hx/CMakeLists.txt @@ -9,17 +9,5 @@ if (BACNET_FOUND) include_directories(${BACNET_INCLUDE_DIRS}) include_directories("../bacnetmstp") upm_module_init() - target_link_libraries(${libname} bacnetmstp) - if (BUILDSWIGNODE) - set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (jsupm_${libname} bacnetmstp) - endif() - if (BUILDSWIGPYTHON) - set_target_properties(${SWIG_MODULE_pyupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (pyupm_${libname} bacnetmstp) - endif() - if (BUILDSWIGJAVA) - set_target_properties(${SWIG_MODULE_javaupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (javaupm_${libname} bacnetmstp) - endif() + upm_target_link_libraries(${libname} bacnetmstp) endif () diff --git a/src/h803x/CMakeLists.txt b/src/h803x/CMakeLists.txt index e8901f68..7806a42b 100644 --- a/src/h803x/CMakeLists.txt +++ b/src/h803x/CMakeLists.txt @@ -7,14 +7,5 @@ if (MODBUS_FOUND) set (reqlibname "libmodbus") include_directories(${MODBUS_INCLUDE_DIRS}) upm_module_init() - target_link_libraries(${libname} ${MODBUS_LIBRARIES}) - if (BUILDSWIGNODE) - swig_link_libraries (jsupm_${libname} ${MODBUS_LIBRARIES}) - endif() - if (BUILDSWIGPYTHON) - swig_link_libraries (pyupm_${libname} ${MODBUS_LIBRARIES}) - endif() - if (BUILDSWIGJAVA) - swig_link_libraries (javaupm_${libname} ${MODBUS_LIBRARIES}) - endif() + upm_target_link_libraries(${libname} ${MODBUS_LIBRARIES}) endif () diff --git a/src/hlg150h/pyupm_hlg150h.i b/src/hlg150h/pyupm_hlg150h.i index 29c6697b..c4c65b6b 100644 --- a/src/hlg150h/pyupm_hlg150h.i +++ b/src/hlg150h/pyupm_hlg150h.i @@ -1,5 +1,7 @@ %module pyupm_hlg150h %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" %feature("autodoc", "3"); diff --git a/src/hwxpxx/CMakeLists.txt b/src/hwxpxx/CMakeLists.txt index 7dd1abdc..35abfa57 100644 --- a/src/hwxpxx/CMakeLists.txt +++ b/src/hwxpxx/CMakeLists.txt @@ -7,11 +7,5 @@ if (MODBUS_FOUND) set (reqlibname "libmodbus") include_directories(${MODBUS_INCLUDE_DIRS}) upm_module_init() - target_link_libraries(${libname} ${MODBUS_LIBRARIES}) - if (BUILDSWIGNODE) - swig_link_libraries (jsupm_${libname} ${MODBUS_LIBRARIES}) - endif() - if (BUILDSWIGPYTHON) - swig_link_libraries (pyupm_${libname} ${MODBUS_LIBRARIES}) - endif() + upm_target_link_libraries(${libname} ${MODBUS_LIBRARIES}) endif () diff --git a/src/kxcjk1013/pyupm_kxcjk1013.i b/src/kxcjk1013/pyupm_kxcjk1013.i index 05b03e69..39df471b 100644 --- a/src/kxcjk1013/pyupm_kxcjk1013.i +++ b/src/kxcjk1013/pyupm_kxcjk1013.i @@ -1,5 +1,8 @@ %module pyupm_kxcjk1013 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %feature("autodoc", "3"); diff --git a/src/l3gd20/pyupm_l3gd20.i b/src/l3gd20/pyupm_l3gd20.i index a66a85b9..60b09437 100644 --- a/src/l3gd20/pyupm_l3gd20.i +++ b/src/l3gd20/pyupm_l3gd20.i @@ -1,4 +1,7 @@ %module pyupm_l3gd20 +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "../upm.i" %feature("autodoc", "3"); diff --git a/src/lcd/CMakeLists.txt b/src/lcd/CMakeLists.txt index 26be0cbb..343cd826 100644 --- a/src/lcd/CMakeLists.txt +++ b/src/lcd/CMakeLists.txt @@ -1,5 +1,4 @@ set (libname "i2clcd") -set (classname "lcd") set (libdescription "upm lcd/oled displays") set (module_src lcd.cxx lcm1602.cxx jhd1313m1.cxx ssd1308.cxx eboled.cxx ssd1327.cxx sainsmartks.cxx ssd1306.cxx) set (module_hpp lcd.hpp lcm1602.hpp jhd1313m1.hpp ssd1308.hpp eboled.hpp ssd1327.hpp ssd.hpp sainsmartks.hpp ssd1306.hpp) diff --git a/src/lp8860/pyupm_lp8860.i b/src/lp8860/pyupm_lp8860.i index 04eafe5c..0431cdad 100644 --- a/src/lp8860/pyupm_lp8860.i +++ b/src/lp8860/pyupm_lp8860.i @@ -1,5 +1,7 @@ %module pyupm_lp8860 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" %feature("autodoc", "3"); diff --git a/src/max44009/pyupm_max44009.i b/src/max44009/pyupm_max44009.i index c8e614f9..d6db5ecc 100644 --- a/src/max44009/pyupm_max44009.i +++ b/src/max44009/pyupm_max44009.i @@ -1,5 +1,8 @@ %module pyupm_max44009 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "stdint.i" diff --git a/src/ms5611/pyupm_ms5611.i b/src/ms5611/pyupm_ms5611.i index fcfa1e06..9c7fc846 100644 --- a/src/ms5611/pyupm_ms5611.i +++ b/src/ms5611/pyupm_ms5611.i @@ -1,5 +1,7 @@ %module pyupm_ms5611 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" %feature("autodoc", "3"); diff --git a/src/ozw/CMakeLists.txt b/src/ozw/CMakeLists.txt index 170ba589..805ea201 100644 --- a/src/ozw/CMakeLists.txt +++ b/src/ozw/CMakeLists.txt @@ -7,17 +7,5 @@ if (OPENZWAVE_FOUND) set (reqlibname "libopenzwave") include_directories(${OPENZWAVE_INCLUDE_DIRS}) upm_module_init() - target_link_libraries(${libname} ${OPENZWAVE_LIBRARIES}) - if (BUILDSWIGNODE) - set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (jsupm_${libname} ${OPENZWAVE_LIBRARIES}) - endif() - if (BUILDSWIGPYTHON) - set_target_properties(${SWIG_MODULE_pyupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (pyupm_${libname} ${OPENZWAVE_LIBRARIES}) - endif() - if (BUILDSWIGJAVA) - set_target_properties(${SWIG_MODULE_javaupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (javaupm_${libname} ${OPENZWAVE_LIBRARIES}) - endif() + upm_target_link_libraries(${libname} ${OPENZWAVE_LIBRARIES}) endif () diff --git a/src/si1132/pyupm_si1132.i b/src/si1132/pyupm_si1132.i index 00a4d942..6f427e84 100644 --- a/src/si1132/pyupm_si1132.i +++ b/src/si1132/pyupm_si1132.i @@ -1,5 +1,8 @@ %module pyupm_si1132 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "stdint.i" diff --git a/src/si7005/pyupm_si7005.i b/src/si7005/pyupm_si7005.i index 914d3ffa..123f50f1 100644 --- a/src/si7005/pyupm_si7005.i +++ b/src/si7005/pyupm_si7005.i @@ -1,5 +1,8 @@ %module pyupm_si7005 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "stdint.i" diff --git a/src/smartdrive/pyupm_smartdrive.i b/src/smartdrive/pyupm_smartdrive.i index 3ed4ff20..4ba82a8a 100644 --- a/src/smartdrive/pyupm_smartdrive.i +++ b/src/smartdrive/pyupm_smartdrive.i @@ -1,5 +1,8 @@ %module pyupm_smartdrive %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "stdint.i" diff --git a/src/t3311/CMakeLists.txt b/src/t3311/CMakeLists.txt index 4270403a..f7d7c6c4 100644 --- a/src/t3311/CMakeLists.txt +++ b/src/t3311/CMakeLists.txt @@ -7,14 +7,5 @@ if (MODBUS_FOUND) set (reqlibname "libmodbus") include_directories(${MODBUS_INCLUDE_DIRS}) upm_module_init() - target_link_libraries(${libname} ${MODBUS_LIBRARIES}) - if (BUILDSWIGNODE) - swig_link_libraries (jsupm_${libname} ${MODBUS_LIBRARIES}) - endif() - if (BUILDSWIGPYTHON) - swig_link_libraries (pyupm_${libname} ${MODBUS_LIBRARIES}) - endif() - if (BUILDSWIGJAVA) - swig_link_libraries (javaupm_${libname} ${MODBUS_LIBRARIES}) - endif() + upm_target_link_libraries(${libname} ${MODBUS_LIBRARIES}) endif () diff --git a/src/t6713/pyupm_t6713.i b/src/t6713/pyupm_t6713.i index ab749163..07e6c29f 100644 --- a/src/t6713/pyupm_t6713.i +++ b/src/t6713/pyupm_t6713.i @@ -1,5 +1,8 @@ %module pyupm_t6713 %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" + %include "stdint.i" %feature("autodoc", "3"); diff --git a/src/t8100/CMakeLists.txt b/src/t8100/CMakeLists.txt index 66b0b5cd..76812672 100644 --- a/src/t8100/CMakeLists.txt +++ b/src/t8100/CMakeLists.txt @@ -9,17 +9,5 @@ if (BACNET_FOUND) include_directories(${BACNET_INCLUDE_DIRS}) include_directories("../bacnetmstp") upm_module_init() - target_link_libraries(${libname} bacnetmstp) - if (BUILDSWIGNODE) - set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (jsupm_${libname} bacnetmstp) - endif() - if (BUILDSWIGPYTHON) - set_target_properties(${SWIG_MODULE_pyupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (pyupm_${libname} bacnetmstp) - endif() - if (BUILDSWIGJAVA) - set_target_properties(${SWIG_MODULE_javaupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (javaupm_${libname} bacnetmstp) - endif() + upm_target_link_libraries(${libname} bacnetmstp) endif () diff --git a/src/tb7300/CMakeLists.txt b/src/tb7300/CMakeLists.txt index ba98055a..d2face3f 100644 --- a/src/tb7300/CMakeLists.txt +++ b/src/tb7300/CMakeLists.txt @@ -9,17 +9,5 @@ if (BACNET_FOUND) include_directories(${BACNET_INCLUDE_DIRS}) include_directories("../bacnetmstp") upm_module_init() - target_link_libraries(${libname} bacnetmstp) - if (BUILDSWIGNODE) - set_target_properties(${SWIG_MODULE_jsupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (jsupm_${libname} bacnetmstp) - endif() - if (BUILDSWIGPYTHON) - set_target_properties(${SWIG_MODULE_pyupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (pyupm_${libname} bacnetmstp) - endif() - if (BUILDSWIGJAVA) - set_target_properties(${SWIG_MODULE_javaupm_${libname}_REAL_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE) - swig_link_libraries (javaupm_${libname} bacnetmstp) - endif() + upm_target_link_libraries(${libname} bacnetmstp) endif () diff --git a/src/upm/pyupm_interfaces.i b/src/upm/pyupm_interfaces.i index 2914ee49..b82ad12d 100644 --- a/src/upm/pyupm_interfaces.i +++ b/src/upm/pyupm_interfaces.i @@ -1,5 +1,7 @@ %module pyupm_interfaces %include "../upm.i" +// Include doxygen-generated documentation +%include "pyupm_doxy2swig.i" %feature("autodoc", "3"); diff --git a/src/vcap/CMakeLists.txt b/src/vcap/CMakeLists.txt index ae8d4dd5..103f9c8f 100644 --- a/src/vcap/CMakeLists.txt +++ b/src/vcap/CMakeLists.txt @@ -6,14 +6,5 @@ set (module_hpp ${libname}.hpp) if (JPEG_FOUND) set (reqlibname "jpeg") upm_module_init() - target_link_libraries(${libname} jpeg) - if (BUILDSWIGNODE) - swig_link_libraries (jsupm_${libname} jpeg) - endif() - if (BUILDSWIGPYTHON) - swig_link_libraries (pyupm_${libname} jpeg) - endif() - if (BUILDSWIGJAVA) - swig_link_libraries (javaupm_${libname} jpeg) - endif() + upm_target_link_libraries(${libname} jpeg) endif()