-include_directories(
+set (mraa_LIB_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/api
+ ${PROJECT_SOURCE_DIR}/api/mraa
${PROJECT_SOURCE_DIR}/include
)
-set (maa_LIB_HEADERS
- ${PROJECT_SOURCE_DIR}/api/maa.h
- ${PROJECT_SOURCE_DIR}/api/gpio.h
- ${PROJECT_SOURCE_DIR}/api/gpio.hpp
- ${PROJECT_SOURCE_DIR}/api/i2c.h
- ${PROJECT_SOURCE_DIR}/api/i2c.hpp
- ${PROJECT_SOURCE_DIR}/api/pwm.h
- ${PROJECT_SOURCE_DIR}/api/pwm.hpp
- ${PROJECT_SOURCE_DIR}/api/spi.h
- ${PROJECT_SOURCE_DIR}/api/spi.hpp
- ${PROJECT_SOURCE_DIR}/api/aio.h
- ${PROJECT_SOURCE_DIR}/api/aio.hpp
- ${PROJECT_SOURCE_DIR}/include/smbus.h
- ${PROJECT_SOURCE_DIR}/include/version.h
- ${PROJECT_SOURCE_DIR}/include/intel_galileo_rev_d.h
- ${PROJECT_SOURCE_DIR}/include/maa_internal.h
-)
-
-set (maa_LIB_KERNEL
- ${PROJECT_SOURCE_DIR}/include/linux/compiler.h
- ${PROJECT_SOURCE_DIR}/include/linux/i2c-dev.h
- ${PROJECT_SOURCE_DIR}/include/linux/posix_types.h
- ${PROJECT_SOURCE_DIR}/include/linux/types.h
+include_directories(
+ ${mraa_LIB_INCLUDE_DIRS}
)
-set (maa_LIB_SRCS
- ${PROJECT_SOURCE_DIR}/src/maa.c
+set (mraa_LIB_SRCS_NOAUTO
+ ${PROJECT_SOURCE_DIR}/src/mraa.c
${PROJECT_SOURCE_DIR}/src/gpio/gpio.c
${PROJECT_SOURCE_DIR}/src/i2c/i2c.c
- ${PROJECT_SOURCE_DIR}/src/i2c/smbus.c
${PROJECT_SOURCE_DIR}/src/pwm/pwm.c
${PROJECT_SOURCE_DIR}/src/spi/spi.c
${PROJECT_SOURCE_DIR}/src/aio/aio.c
+ ${PROJECT_SOURCE_DIR}/src/uart/uart.c
${PROJECT_SOURCE_DIR}/src/intel_galileo_rev_d.c
+ ${PROJECT_SOURCE_DIR}/src/intel_galileo_rev_g.c
+ ${PROJECT_SOURCE_DIR}/src/intel_edison_fab_c.c
+ ${PROJECT_SOURCE_DIR}/src/intel_de3815.c
+ ${PROJECT_SOURCE_DIR}/src/intel_minnow_max.c
+)
+
+set (mraa_LIB_SRCS
+ ${mraa_LIB_SRCS_NOAUTO}
# autogenerated version file
${CMAKE_CURRENT_BINARY_DIR}/version.c
)
-add_library (maa SHARED ${maa_LIB_SRCS})
-target_link_libraries (maa ${CMAKE_THREAD_LIBS_INIT})
+set (mraa_LIB_GLOB_HEADERS
+ ${PROJECT_SOURCE_DIR}/api/mraa.h
+ ${PROJECT_SOURCE_DIR}/api/mraa.hpp
+)
+
+add_library (mraa SHARED ${mraa_LIB_SRCS})
+target_link_libraries (mraa ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(
- maa
+ mraa
PROPERTIES
- SOVERSION ${maa_VERSION_MAJOR}
- VERSION ${maa_VERSION_STRING}
+ SOVERSION ${mraa_VERSION_MAJOR}
+ VERSION ${mraa_VERSION_STRING}
)
-install (FILES ${maa_LIB_HEADERS} DESTINATION include/maa)
-install (FILES ${maa_LIB_KERNEL} DESTINATION include/maa/linux)
+install (FILES ${mraa_LIB_GLOB_HEADERS} DESTINATION include/)
+install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/mraa/ DESTINATION include/mraa)
-macro (maa_CREATE_INSTALL_PKGCONFIG generated_file install_location)
+macro (mraa_CREATE_INSTALL_PKGCONFIG generated_file install_location)
configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
-endmacro (maa_CREATE_INSTALL_PKGCONFIG)
-maa_create_install_pkgconfig (maa.pc lib${LIB_SUFFIX}/pkgconfig)
+endmacro (mraa_CREATE_INSTALL_PKGCONFIG)
+mraa_create_install_pkgconfig (mraa.pc lib${LIB_SUFFIX}/pkgconfig)
-install (TARGETS maa DESTINATION lib)
+install (TARGETS mraa DESTINATION lib)
if (DOXYGEN_FOUND)
set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
- set (DOCFILES maa pwm i2c gpio aio spi)
+ set (DOCCLASSES aio gpio i2c pwm spi uart)
+ # CPP class headers
+ foreach (_file ${DOCCLASSES})
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
+ ${CMAKE_BINARY_DIR}/xml/classmraa_1_1_${_file}.xml
+ ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i
+ DEPENDS ${CMAKE_BINARY_DIR}/xml/classmraa_1_1_${_file}.xml
+ )
+ add_custom_target (${_file}class_doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}_class_doc.i)
+ add_dependencies (${_file}class_doc_i doc)
+ endforeach ()
+ # C header files
+ set (DOCFILES common ${DOCCLASSES})
foreach (_file ${DOCFILES})
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
add_custom_target (${_file}doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i)
add_dependencies (${_file}doc_i doc)
endforeach ()
+ # CPP common header
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/common_hpp_doc.i
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
+ ${CMAKE_BINARY_DIR}/xml/common_8hpp.xml
+ ${CMAKE_CURRENT_BINARY_DIR}//common_hpp_doc.i
+ DEPENDS ${CMAKE_BINARY_DIR}/xml/common_8hpp.xml
+ )
+ add_custom_target (common_hpp_doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/common_hpp_doc.i)
+ add_dependencies (common_hpp_doc_i doc)
endif ()
-find_package (SWIG)
-if (SWIG_FOUND)
- include (${SWIG_USE_FILE})
+if (BUILDSWIG)
+ find_package (SWIG)
+ if (SWIG_FOUND)
+ include (${SWIG_USE_FILE})
+ set_source_files_properties (mraa.i PROPERTIES SWIG_FLAGS "-I${CMAKE_BINARY_DIR}/src")
- add_subdirectory (python)
- add_subdirectory (javascript)
+ if (BUILDSWIGPYTHON)
+ add_subdirectory (python)
+ endif ()
+ if (BUILDSWIGNODE)
+ add_subdirectory (javascript)
+ endif ()
+ endif ()
endif ()