mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
Added modifications to cmake to create a separate lib for the new interfaces using SWIG.
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
This commit is contained in:
parent
360306db8d
commit
71a7491702
@ -253,7 +253,11 @@ function (_get_current_dot_i_file filePrefix varDotIFile)
|
|||||||
set(SWIG_HASH_INCLUDES "#include \"${SWIG_HASH_INCLUDES}\"")
|
set(SWIG_HASH_INCLUDES "#include \"${SWIG_HASH_INCLUDES}\"")
|
||||||
# And the SWIG import string
|
# And the SWIG import string
|
||||||
string(REPLACE "#" "%" SWIG_PERCENT_INCLUDES "${SWIG_HASH_INCLUDES}")
|
string(REPLACE "#" "%" SWIG_PERCENT_INCLUDES "${SWIG_HASH_INCLUDES}")
|
||||||
|
if(module_iface)
|
||||||
|
foreach(_iface ${module_iface})
|
||||||
|
set(SWIG_PERCENT_INCLUDES "%import \"interfaces/${_iface}\"")
|
||||||
|
endforeach(_iface ${module_iface})
|
||||||
|
endif()
|
||||||
# Write the interface file
|
# Write the interface file
|
||||||
configure_file (${PROJECT_SOURCE_DIR}/src/swigme.i.in "${${varDotIFile}}" @ONLY)
|
configure_file (${PROJECT_SOURCE_DIR}/src/swigme.i.in "${${varDotIFile}}" @ONLY)
|
||||||
endif()
|
endif()
|
||||||
@ -271,7 +275,8 @@ macro(_upm_swig_python)
|
|||||||
|
|
||||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||||
${DEPEND_DIRS})
|
${DEPEND_DIRS}
|
||||||
|
${UPM_COMMON_HEADER_DIRS})
|
||||||
|
|
||||||
# Decide between ${libname}.i or a language-specific .i
|
# Decide between ${libname}.i or a language-specific .i
|
||||||
_get_current_dot_i_file(pyupm SWIG_CURRENT_DOT_I_FILE)
|
_get_current_dot_i_file(pyupm SWIG_CURRENT_DOT_I_FILE)
|
||||||
@ -305,6 +310,11 @@ macro(_upm_swig_python)
|
|||||||
endif ()
|
endif ()
|
||||||
# Get target library name (example _pyupm_a110x-python2)
|
# Get target library name (example _pyupm_a110x-python2)
|
||||||
set (python_wrapper_target ${SWIG_MODULE_${python_wrapper_name}_REAL_NAME})
|
set (python_wrapper_target ${SWIG_MODULE_${python_wrapper_name}_REAL_NAME})
|
||||||
|
|
||||||
|
if(module_iface)
|
||||||
|
add_dependencies(${python_wrapper_target} _pyupm_new_interfaces-python${PYTHON_VERSION_MAJOR})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_dependencies(${python_wrapper_target} ${libname})
|
add_dependencies(${python_wrapper_target} ${libname})
|
||||||
|
|
||||||
swig_link_libraries (${python_wrapper_name} ${PYTHON_LIBRARIES} ${libname} -Wl,--unresolved-symbols=report-all)
|
swig_link_libraries (${python_wrapper_name} ${PYTHON_LIBRARIES} ${libname} -Wl,--unresolved-symbols=report-all)
|
||||||
@ -390,7 +400,7 @@ endfunction(upm_swig_python)
|
|||||||
function(upm_swig_node)
|
function(upm_swig_node)
|
||||||
# Skip if the libname is in the blacklist
|
# Skip if the libname is in the blacklist
|
||||||
if (NOT ";${NODESWIG_BLACKLIST};" MATCHES ";${libname};")
|
if (NOT ";${NODESWIG_BLACKLIST};" MATCHES ";${libname};")
|
||||||
# SWIG treats SWIG_FLAGS as a list and not a string so semicolon seperation is
|
# SWIG treats SWIG_FLAGS as a list and not a string so semicolon seperation is
|
||||||
# required. This hardcodes V8_VERSION to be <10 but I assume that's not going
|
# required. This hardcodes V8_VERSION to be <10 but I assume that's not going
|
||||||
# to be a problem for a little while! SWIG uses a padded SWIG_V8 version which
|
# to be a problem for a little while! SWIG uses a padded SWIG_V8 version which
|
||||||
# we hack together from our findnode module.
|
# we hack together from our findnode module.
|
||||||
@ -866,7 +876,11 @@ function(upm_module_init)
|
|||||||
# Install interface file if it exists
|
# Install interface file if it exists
|
||||||
if(DEFINED module_iface)
|
if(DEFINED module_iface)
|
||||||
set(iface_path ${PROJECT_SOURCE_DIR}/include/interfaces)
|
set(iface_path ${PROJECT_SOURCE_DIR}/include/interfaces)
|
||||||
install (FILES ${iface_path}/${module_iface}
|
set(iface_files "")
|
||||||
|
foreach(iface ${module_iface})
|
||||||
|
LIST(APPEND iface_files "${iface_path}/${iface}")
|
||||||
|
endforeach(iface ${module_iface})
|
||||||
|
install (FILES ${iface_files}
|
||||||
DESTINATION include/upm/interfaces
|
DESTINATION include/upm/interfaces
|
||||||
COMPONENT ${CMAKE_PROJECT_NAME}-dev)
|
COMPONENT ${CMAKE_PROJECT_NAME}-dev)
|
||||||
endif(DEFINED module_iface)
|
endif(DEFINED module_iface)
|
||||||
@ -941,6 +955,7 @@ foreach(subdir ${MODULE_LIST})
|
|||||||
add_subdirectory(${subdir})
|
add_subdirectory(${subdir})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
add_subdirectory(${PROJECT_SOURCE_DIR}/include/interfaces ${CMAKE_BINARY_DIR}/interfaces)
|
||||||
|
|
||||||
# Print stats for all targets
|
# Print stats for all targets
|
||||||
_print_target_summary()
|
_print_target_summary()
|
||||||
|
@ -10,5 +10,6 @@ JAVA_JNI_LOADLIBRARY(javaupm_abp)
|
|||||||
%{
|
%{
|
||||||
#include "abp.hpp"
|
#include "abp.hpp"
|
||||||
%}
|
%}
|
||||||
|
%include "interfaces/iTemperature.hpp"
|
||||||
%include "abp.hpp"
|
%include "abp.hpp"
|
||||||
/* END Common SWIG syntax */
|
/* END Common SWIG syntax */
|
||||||
|
@ -2,4 +2,5 @@ set (libname "am2315")
|
|||||||
set (libdescription "Digital Temperature and Humidity Sensor")
|
set (libdescription "Digital Temperature and Humidity Sensor")
|
||||||
set (module_src ${libname}.cpp)
|
set (module_src ${libname}.cpp)
|
||||||
set (module_hpp ${libname}.hpp)
|
set (module_hpp ${libname}.hpp)
|
||||||
|
set (module_iface iTemperature.hpp iHumidity.hpp)
|
||||||
upm_module_init(mraa)
|
upm_module_init(mraa)
|
||||||
|
@ -5,5 +5,6 @@ upm_mixed_module_init (NAME sht1x
|
|||||||
CPP_HDR sht1x.hpp
|
CPP_HDR sht1x.hpp
|
||||||
CPP_SRC sht1x.cxx
|
CPP_SRC sht1x.cxx
|
||||||
FTI_SRC sht1x_fti.c
|
FTI_SRC sht1x_fti.c
|
||||||
|
IFACE_HDR iTemperature.hpp iHumidity.hpp
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa utilities-c)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
%module (package="pyupm_new_interfaces") sht1x
|
||||||
|
%import "interfaces/new_interfaces.i"
|
||||||
|
|
||||||
%include "../common_top.i"
|
%include "../common_top.i"
|
||||||
|
|
||||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user