-# add a target to generate API documentation with Doxygen
-find_package (Doxygen)
-if (DOXYGEN_FOUND)
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
- add_custom_target (doc
- ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Generating API documentation with Doxygen" VERBATIM
- )
-endif (DOXYGEN_FOUND)
+if (BUILDDOC)
+ # add a target to generate API documentation with Doxygen
+ find_package (Doxygen)
+ if (DOXYGEN_FOUND)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+ add_custom_target (doc
+ ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating API documentation with Doxygen" VERBATIM
+ )
+ endif (DOXYGEN_FOUND)
+endif ()
+
+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)
+ string (REGEX REPLACE "-poky-linux" "" TARGET_ARCH "${DETECTED_SYSROOT}")
+ else ()
+ # debian uses amd64 to denote x86_64
+ if (DETECTED_ARCH STREQUAL "x86_64")
+ set (TARGET_ARCH "amd64")
+ else ()
+ set (TARGET_ARCH ${DETECTED_ARCH})
+ endif ()
+ endif ()
+ message (INFO " - Package arch is ${TARGET_ARCH}")
+
+ set(CPACK_GENERATOR "DEB" "TGZ")
+ set(OPKG_ARCH ${TARGET_ARCH})
+ set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR})
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Intel IoT-Devkit") #required
+ set(mraa_PACKAGE_ON_TAG ".")
+ if ("${VERSION_COMMIT}" STREQUAL "")
+ set(mraa_PACKAGE_ON_TAG "")
+ endif()
+ set(CPACK_PACKAGE_VERSION
+ "${mraa_VERSION_MAJOR}.${mraa_VERSION_MINOR}.${mraa_VERSION_PATCH}${mraa_PACKAGE_ON_TAG}${VERSION_COMMIT}")
+ set(CPACK_PACKAGE_NAME "libmraa${mraa_VERSION_MAJOR}")
+ set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${TARGET_ARCH})
+ set(CPACK_SYSTEM_NAME ${TARGET_ARCH})
+ set(CPACK_DEBIAN_PACKAGE_PROVIDES "libmraa-dev, libmraa-dbg, libmraa-doc")
+ set(CPACK_DEBIAN_PACKAGE_REPLACES ${CPACK_DEBIAN_PACKAGE_PROVIDES})
+ set(CPACK_DEBIAN_PACKAGE_CONFLICTS ${CPACK_DEBIAN_PACKAGE_PROVIDES})
+ set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
+ include (CPack)
+endif()