summaryrefslogtreecommitdiffstats
path: root/cmake/cmake.d/03-macros.cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-06-15 10:40:01 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-06-15 10:40:20 +0200
commit92646f63ffc32e2c6ede8fb10da2299fc5a54563 (patch)
tree279209137d40bc11b1b698feefbb544728ca3dcf /cmake/cmake.d/03-macros.cmake
parentf65761cff834757e97165fb2de5cffa332c9a1e5 (diff)
Fallback using zip format if no wgtpkg-pack found
wgtpkg-pack tool is part of "application-framework-main" project and not mandatory when developing natively. As a wgt package is a zip file then use the zip format to simulate a real wgt package. Change-Id: If2d5a86e93b9c9dc707658b2367f59a7824eddf6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/cmake.d/03-macros.cmake')
-rw-r--r--cmake/cmake.d/03-macros.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake
index 9df9a10..71f2964 100644
--- a/cmake/cmake.d/03-macros.cmake
+++ b/cmake/cmake.d/03-macros.cmake
@@ -453,9 +453,19 @@ macro(wgt_package_build)
file(COPY "${TEMPLATE_DIR}/etc/*" DESTINATION ${PROJECT_PKG_BUILD_DIR}/etc/)
endif(${PROJECT_CONF_FILES})
+ find_program(wgtpkgCMD "wgtpkg-pack")
+ if(wgtpkgCMD)
+ message(STATUS "------ Create widget using WGTPKG")
+ set(packCMD ${wgtpkgCMD} "-f" "-o" "${PROJECT_NAME}.wgt" ${PROJECT_PKG_BUILD_DIR})
+ else()
+ message(STATUS "----- Create widget using ZIP")
+
+ set(packCMD cd ${PROJECT_PKG_BUILD_DIR} && ${CMAKE_COMMAND} "-E" "tar" "cf" "../${PROJECT_NAME}.wgt" "--format=zip" "*")
+ endif()
+
add_custom_command(OUTPUT ${PROJECT_NAME}.wgt
DEPENDS ${PROJECT_TARGETS}
- COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt ${PROJECT_PKG_BUILD_DIR}
+ COMMAND ${packCMD}
)
add_custom_target(widget DEPENDS ${PROJECT_NAME}.wgt)