python: Build both python2 and python3 modules

Updated UPM cmake to build both python2/3 modules if the necessary
python libs are available.

    * Removed BUILDPYTHON3 cmake option in favor of building both
      versions
    * Added cmake module to find both python2 and python3
    * Added macro which can be called from per-sensor cmake files
      to add dependency libraries via target_link_libraries as well
      as swig_link_libraries (for java, nodejs, and python)
    * Python2 is required for python documentation builds
    * Cleanup of python usage throughout UPM cmakelists.
    * Make find_package for Node required.  Removed check for NODE_FOUND
      (which should have been NODEJS_FOUND) in favor of REQUIRED.
    * The cxx and .py wrapper files get generated in python2/3 (instead
      of the same directory).  It appears these files are identical,
      however since the targets can be built in parallel it's safer to split
      them out.
    * Updated all cmake dependencies related to building documentation.
    * Removed unused classname from cmake files

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck 2016-09-29 13:46:20 -07:00
parent f0fa6f7b68
commit 62718daf0b
29 changed files with 438 additions and 226 deletions

View File

@ -8,7 +8,6 @@ option (BUILDFTI "Build Funtion Table Interface (FTI) in C sensor libraries" OFF
option (BUILDSWIGPYTHON "Build swig python modules" ON) option (BUILDSWIGPYTHON "Build swig python modules" ON)
option (BUILDSWIGNODE "Build swig node modules" ON) option (BUILDSWIGNODE "Build swig node modules" ON)
option (BUILDSWIGJAVA "Build swig java modules" OFF) 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 (BUILDEXAMPLES "Build C/C++ example binaries" OFF)
option (BUILDJAVAEXAMPLES "Build java example jars" OFF) option (BUILDJAVAEXAMPLES "Build java example jars" OFF)
option (IPK "Generate IPK using CPack" OFF) option (IPK "Generate IPK using CPack" OFF)
@ -44,12 +43,38 @@ pkg_check_modules (OPENZWAVE libopenzwave)
# Find JPEG # Find JPEG
find_package (JPEG) find_package (JPEG)
# Find nodejs
if (BUILDSWIGNODE)
find_package (Node REQUIRED)
endif (BUILDSWIGNODE)
# Find swig if any wrapper is enabled # Find swig if any wrapper is enabled
if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA) if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA)
find_package (SWIG 3.0.5 REQUIRED) find_package (SWIG 3.0.5 REQUIRED)
include (${SWIG_USE_FILE}) include (${SWIG_USE_FILE})
endif () 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 # Set CMAKE_INSTALL_LIBDIR if not defined
include(GNUInstallDirs) include(GNUInstallDirs)
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries") set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries")
@ -111,10 +136,39 @@ else()
message(WARNING "Some modules require C++11 support, and may not build without it.") message(WARNING "Some modules require C++11 support, and may not build without it.")
endif() 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) if (BUILDDOC)
# Add a target to generate API documentation with Doxygen # Add a target to generate API documentation with Doxygen
find_package (Doxygen) find_package (Doxygen REQUIRED)
if (DOXYGEN_FOUND)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
if (BUILDSWIGJAVA) if (BUILDSWIGJAVA)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.java.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-java @ONLY)
@ -129,15 +183,12 @@ if (BUILDDOC)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM COMMENT "Generating API documentation with Doxygen" VERBATIM
) )
endif (DOXYGEN_FOUND)
# Check if Sphinx is installed and add target to generate API documentation # Check if Sphinx is installed and add target to generate API documentationa
find_package (Sphinx) # Currently, the per-module documentation for python is generated from the
if(SPHINX_FOUND AND BUILDSWIGPYTHON) # python2 modules.
# Python required for Sphinx build if(BUILDSWIGPYTHON)
find_package (PythonLibs ${PYTHONBUILD_VERSION} REQUIRED) find_package (Sphinx 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)
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/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) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
add_custom_target (pydoc ALL add_custom_target (pydoc ALL
@ -153,12 +204,11 @@ if (BUILDDOC)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Sphinx" VERBATIM COMMENT "Generating API documentation with Sphinx" VERBATIM
) )
endif () endif(BUILDSWIGPYTHON)
# Check if Yuidoc is installed and add target for API documentation # Check if Yuidoc is installed and add target for API documentation
find_package(Yuidoc) if(BUILDSWIGNODE)
if(YUIDOC_FOUND AND BUILDSWIGNODE) find_package(Yuidoc REQUIRED)
# Node required for Yuidoc documentation
find_package(Node)
file(GLOB_RECURSE JSDOC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/doxy/node doxy/node/*) file(GLOB_RECURSE JSDOC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/doxy/node doxy/node/*)
foreach(JSDOC_FILE ${JSDOC_FILES}) foreach(JSDOC_FILE ${JSDOC_FILES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy/node/${JSDOC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${JSDOC_FILE} COPYONLY) 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} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Yuidoc" VERBATIM COMMENT "Generating API documentation with Yuidoc" VERBATIM
) )
endif() endif(BUILDSWIGNODE)
endif() endif (BUILDDOC)
if (IPK) if (IPK)
# Get target package arch from Yocto ADT sysroot if set or host OS, mapping to Ubuntu name if necessary # 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}) if (DEFINED ENV{OECORE_TARGET_SYSROOT})
GET_FILENAME_COMPONENT (DETECTED_SYSROOT $ENV{OECORE_TARGET_SYSROOT} NAME) GET_FILENAME_COMPONENT (DETECTED_SYSROOT $ENV{OECORE_TARGET_SYSROOT} NAME)
@ -238,14 +287,6 @@ if (RPM)
include(CPack) include(CPack)
endif() endif()
if (BUILDSWIGPYTHON OR BUILDTESTS)
if (BUILDPYTHON3)
set (PYTHONBUILD_VERSION 3)
else ()
set (PYTHONBUILD_VERSION 2.7)
endif ()
endif ()
# UPM common headers # UPM common headers
set (UPM_COMMON_HEADER_DIRS set (UPM_COMMON_HEADER_DIRS
${CMAKE_HOME_DIRECTORY}/include ${CMAKE_HOME_DIRECTORY}/include
@ -263,8 +304,8 @@ if(BUILDJAVAEXAMPLES)
add_subdirectory (examples/java) add_subdirectory (examples/java)
endif() endif()
# Python interp is previously found if BUILDTESTS=ON
if (BUILDTESTS) if (BUILDTESTS)
find_package (PythonInterp ${PYTHONBUILD_VERSION} REQUIRED)
enable_testing () enable_testing ()
add_subdirectory (tests) add_subdirectory (tests)
endif() endif()

View File

@ -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()

View File

@ -26,28 +26,123 @@ macro (upm_create_install_pkgconfig generated_file install_location)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location}) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
endmacro(upm_create_install_pkgconfig) endmacro(upm_create_install_pkgconfig)
macro(upm_swig_python) # Provides a means to call target_link_libraries AND the necessary
if (BUILDSWIGPYTHON) # 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 ( # Call the swig link library method for each library
${CMAKE_CURRENT_SOURCE_DIR}/.. 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)
# 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})
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..)
set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON) 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_source_files_properties (pyupm_${libname}.i PROPERTIES SWIG_FLAGS "-I${CMAKE_CURRENT_BINARY_DIR}/..")
swig_add_module (pyupm_${libname} python pyupm_${libname}.i) # Set current python binary dir
swig_link_libraries (pyupm_${libname} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES} ${libname}) set (CMAKE_CURRENT_PYTHON_BINARY_DIR
target_include_directories ( ${SWIG_MODULE_pyupm_${libname}_REAL_NAME} ${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 PUBLIC
"${PYTHON_INCLUDE_PATH}" "${PYTHON_INCLUDE_PATH}"
"${PYTHON_INCLUDE_DIRS}" "${PYTHON_INCLUDE_DIRS}")
)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_pyupm_${libname}.so # Add C++ comments to ALL python modules (requires doc build)
${CMAKE_CURRENT_BINARY_DIR}/pyupm_${libname}.py 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/ DESTINATION ${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/
COMPONENT ${libname}) COMPONENT ${libname})
endif()
# 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) endmacro(upm_swig_python)
macro(upm_swig_node) macro(upm_swig_node)
@ -166,33 +261,12 @@ endmacro(upm_swig_java)
macro(upm_doxygen) macro(upm_doxygen)
if (DOXYGEN_FOUND) if (DOXYGEN_FOUND)
if(NOT DEFINED classname)
set (classname ${libname})
endif()
set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND}) set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
if (BUILDSWIGPYTHON) add_dependencies (doc ${libname})
add_dependencies (_pyupm_${libname} pyupm_doxy2swig)
add_dependencies (pydoc _pyupm_${libname})
else ()
add_dependencies (${libname} doc)
endif ()
endif () endif ()
endmacro(upm_doxygen) 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 (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) 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}") message(WARNING "WARNING - SWIG 3.0.5+ required for building with nodejs 0.12. Current version is ${SWIG_VERSION}")
endif() endif()
@ -218,7 +292,6 @@ if (SWIG_FOUND)
DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname}) DESTINATION ${NODE_MODULE_INSTALL_PATH} COMPONENT ${libname})
endmacro(createpackagejson) endmacro(createpackagejson)
endif(BUILDSWIGNODE) endif(BUILDSWIGNODE)
endif()
# Process C/C++ sensor modules # Process C/C++ sensor modules
# This function pre-processes sensor library input and hands off the # This function pre-processes sensor library input and hands off the
@ -366,22 +439,19 @@ macro(upm_module_init)
endmacro(upm_module_init) endmacro(upm_module_init)
# Generate python module documentation from doxygen collateral # Generate python module documentation from doxygen collateral
if (BUILDDOC AND BUILDSWIGPYTHON AND SWIG_FOUND) if (BUILDDOC AND BUILDSWIGPYTHON)
# doxy2swig the doxygen output # 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 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py
${CMAKE_BINARY_DIR}/xml/index.xml ${CMAKE_BINARY_DIR}/xml/index.xml
${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i
DEPENDS ${CMAKE_BINARY_DIR}/xml/index.xml DEPENDS doc)
)
add_custom_target (pyupm_doxy2swig DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i)
add_dependencies (pyupm_doxy2swig doc)
# BUILDDOC not set but still building python modules, generate an empty # BUILDDOC not set but still building python modules, generate an empty
# pyupm_doxy2swig.i file (overwriting if necessary) # 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") message (STATUS "Generating empty ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i")
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyupm_doxy2swig.i "// Empty doxy2swig stub") 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) if (MODULE_LIST)
set(SUBDIRS ${MODULE_LIST}) set(SUBDIRS ${MODULE_LIST})

View File

@ -6,12 +6,4 @@ set (reqlibname "upm-pca9685")
include_directories("../pca9685") include_directories("../pca9685")
upm_module_init() upm_module_init()
add_dependencies(${libname} pca9685) add_dependencies(${libname} pca9685)
target_link_libraries(${libname} pca9685) upm_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()

View File

@ -1,5 +1,7 @@
%module pyupm_apds9930 %module pyupm_apds9930
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -7,14 +7,5 @@ if (BACNET_FOUND)
set (reqlibname "libbacnet") set (reqlibname "libbacnet")
include_directories(${BACNET_INCLUDE_DIRS}) include_directories(${BACNET_INCLUDE_DIRS})
upm_module_init() upm_module_init()
target_link_libraries(${libname} ${BACNET_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) upm_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()
endif () endif ()

View File

@ -1,5 +1,8 @@
%module pyupm_ds1808lc %module pyupm_ds1808lc
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -1,5 +1,8 @@
%module pyupm_ds18b20 %module pyupm_ds18b20
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "carrays.i" %include "carrays.i"
%include "std_string.i" %include "std_string.i"

View File

@ -1,5 +1,8 @@
%module pyupm_ds2413 %module pyupm_ds2413
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "carrays.i" %include "carrays.i"
%include "std_string.i" %include "std_string.i"

View File

@ -9,17 +9,5 @@ if (BACNET_FOUND)
include_directories(${BACNET_INCLUDE_DIRS}) include_directories(${BACNET_INCLUDE_DIRS})
include_directories("../bacnetmstp") include_directories("../bacnetmstp")
upm_module_init() upm_module_init()
target_link_libraries(${libname} bacnetmstp) upm_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()
endif () endif ()

View File

@ -7,14 +7,5 @@ if (MODBUS_FOUND)
set (reqlibname "libmodbus") set (reqlibname "libmodbus")
include_directories(${MODBUS_INCLUDE_DIRS}) include_directories(${MODBUS_INCLUDE_DIRS})
upm_module_init() upm_module_init()
target_link_libraries(${libname} ${MODBUS_LIBRARIES}) upm_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()
endif () endif ()

View File

@ -1,5 +1,7 @@
%module pyupm_hlg150h %module pyupm_hlg150h
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -7,11 +7,5 @@ if (MODBUS_FOUND)
set (reqlibname "libmodbus") set (reqlibname "libmodbus")
include_directories(${MODBUS_INCLUDE_DIRS}) include_directories(${MODBUS_INCLUDE_DIRS})
upm_module_init() upm_module_init()
target_link_libraries(${libname} ${MODBUS_LIBRARIES}) upm_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()
endif () endif ()

View File

@ -1,5 +1,8 @@
%module pyupm_kxcjk1013 %module pyupm_kxcjk1013
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -1,4 +1,7 @@
%module pyupm_l3gd20 %module pyupm_l3gd20
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "../upm.i" %include "../upm.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -1,5 +1,4 @@
set (libname "i2clcd") set (libname "i2clcd")
set (classname "lcd")
set (libdescription "upm lcd/oled displays") 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_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) set (module_hpp lcd.hpp lcm1602.hpp jhd1313m1.hpp ssd1308.hpp eboled.hpp ssd1327.hpp ssd.hpp sainsmartks.hpp ssd1306.hpp)

View File

@ -1,5 +1,7 @@
%module pyupm_lp8860 %module pyupm_lp8860
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -1,5 +1,8 @@
%module pyupm_max44009 %module pyupm_max44009
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "stdint.i" %include "stdint.i"

View File

@ -1,5 +1,7 @@
%module pyupm_ms5611 %module pyupm_ms5611
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -7,17 +7,5 @@ if (OPENZWAVE_FOUND)
set (reqlibname "libopenzwave") set (reqlibname "libopenzwave")
include_directories(${OPENZWAVE_INCLUDE_DIRS}) include_directories(${OPENZWAVE_INCLUDE_DIRS})
upm_module_init() upm_module_init()
target_link_libraries(${libname} ${OPENZWAVE_LIBRARIES}) upm_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()
endif () endif ()

View File

@ -1,5 +1,8 @@
%module pyupm_si1132 %module pyupm_si1132
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "stdint.i" %include "stdint.i"

View File

@ -1,5 +1,8 @@
%module pyupm_si7005 %module pyupm_si7005
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "stdint.i" %include "stdint.i"

View File

@ -1,5 +1,8 @@
%module pyupm_smartdrive %module pyupm_smartdrive
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "stdint.i" %include "stdint.i"

View File

@ -7,14 +7,5 @@ if (MODBUS_FOUND)
set (reqlibname "libmodbus") set (reqlibname "libmodbus")
include_directories(${MODBUS_INCLUDE_DIRS}) include_directories(${MODBUS_INCLUDE_DIRS})
upm_module_init() upm_module_init()
target_link_libraries(${libname} ${MODBUS_LIBRARIES}) upm_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()
endif () endif ()

View File

@ -1,5 +1,8 @@
%module pyupm_t6713 %module pyupm_t6713
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%include "stdint.i" %include "stdint.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -9,17 +9,5 @@ if (BACNET_FOUND)
include_directories(${BACNET_INCLUDE_DIRS}) include_directories(${BACNET_INCLUDE_DIRS})
include_directories("../bacnetmstp") include_directories("../bacnetmstp")
upm_module_init() upm_module_init()
target_link_libraries(${libname} bacnetmstp) upm_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()
endif () endif ()

View File

@ -9,17 +9,5 @@ if (BACNET_FOUND)
include_directories(${BACNET_INCLUDE_DIRS}) include_directories(${BACNET_INCLUDE_DIRS})
include_directories("../bacnetmstp") include_directories("../bacnetmstp")
upm_module_init() upm_module_init()
target_link_libraries(${libname} bacnetmstp) upm_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()
endif () endif ()

View File

@ -1,5 +1,7 @@
%module pyupm_interfaces %module pyupm_interfaces
%include "../upm.i" %include "../upm.i"
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%feature("autodoc", "3"); %feature("autodoc", "3");

View File

@ -6,14 +6,5 @@ set (module_hpp ${libname}.hpp)
if (JPEG_FOUND) if (JPEG_FOUND)
set (reqlibname "jpeg") set (reqlibname "jpeg")
upm_module_init() upm_module_init()
target_link_libraries(${libname} jpeg) upm_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()
endif() endif()