aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-09 13:19:29 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-09 13:19:29 +0200
commit7e358c8d5f94ac7658321cba5b6918ec6d33a3ea (patch)
tree8d856daac828689e34b64e6823031f909b277101
parent741d3a45300756c98efce668fa3a5ef9e6b95ec9 (diff)
Change packaging dependency logic
Make a main target on which populate target will depend then build widget will just depend on a this target. Change-Id: Idada3b7ce97b9b7412550a1fbc36e8fb19857afc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--reference/etc/macros.cmake30
1 files changed, 18 insertions, 12 deletions
diff --git a/reference/etc/macros.cmake b/reference/etc/macros.cmake
index 210ed91..45c1a1f 100644
--- a/reference/etc/macros.cmake
+++ b/reference/etc/macros.cmake
@@ -54,6 +54,7 @@ endmacro(defstr)
# WGT packaging
macro(project_targets_populate)
+ add_custom_target(MAIN_POPULATE)
foreach(TARGET ${PROJECT_TARGETS})
get_target_property(T ${TARGET} LABELS)
if(T)
@@ -78,36 +79,42 @@ macro(project_targets_populate)
COMMAND mkdir -p ${WIDGET_LIBDIR}
COMMAND cp ${BD}/${P}${OUT}.so ${WIDGET_LIBDIR}
)
- add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_LIBDIR}/${P}${TARGET}.so)
+ add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_LIBDIR}/${P}${TARGET}.so)
+ add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
elseif(${T} STREQUAL "EXECUTABLE")
add_custom_command(OUTPUT ${WIDGET_BINDIR}/${P}${TARGET}
DEPENDS ${TARGET}
COMMAND mkdir -p ${WIDGET_BINDIR}
COMMAND cp ${BD}/${P}${OUT} ${WIDGET_BINDIR}
)
- add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_BINDIR}/${P}${TARGET})
+ add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_BINDIR}/${P}${TARGET})
+ add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
elseif(${T} STREQUAL "HTDOCS")
add_custom_command(OUTPUT ${WIDGET_HTTPDIR}
DEPENDS ${TARGET}
COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_HTTPDIR}
)
- add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR})
+ add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_HTTPDIR})
+ add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
elseif(${T} STREQUAL "DATA")
add_custom_command(OUTPUT ${WIDGET_DATADIR}
DEPENDS ${TARGET}
COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_DATADIR}
)
- add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR})
+ add_custom_target(${POPULE_WIDGET_TARGET} DEPENDS ${WIDGET_HTTPDIR})
+ add_dependencies(MAIN_POPULATE ${POPULE_WIDGET_TARGET})
endif(${T} STREQUAL "BINDING")
- PROJECT_TARGET_ADD(${POPULE_WIDGET_TARGET})
# elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
-# MESSAGE(AUTHOR_WARNING "This target, ${TARGET}, will be not be included in the package.")
+# MESSAGE(WARNING "This target, ${TARGET}, will be not be included in the package.")
endif()
endforeach()
endmacro(project_targets_populate)
macro(project_package_build)
- if("${PROJECT_TARGETS}" MATCHES "project_populate_")
+ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/config.xml.in OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/${PROJECT_ICON}.in)
+ MESSAGE(FATAL_ERROR "Missing mandatory files: you need config.xml.in and ${PROJECT_ICON}.in files in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR} folder.")
+ endif()
+
if(NOT EXISTS ${WIDGET_DIR}/config.xml.in OR NOT EXISTS ${WIDGET_DIR}/${PROJECT_ICON}.in)
configure_file(${PROJECT_WGT_DIR}/config.xml.in ${WIDGET_DIR}/config.xml)
file(COPY ${PROJECT_WGT_DIR}/${PROJECT_ICON}.in DESTINATION ${WIDGET_DIR}/${PROJECT_ICON})
@@ -119,14 +126,13 @@ macro(project_package_build)
endif(${PROJECT_CONF_FILES})
add_custom_command(OUTPUT ${PROJECT_NAME}.wgt
- DEPENDS ${PROJECT_TARGETS}
- COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt ${WIDGET_DIR}
+ DEPENDS ${PROJECT_TARGETS}
+ COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt ${WIDGET_DIR}
)
+
add_custom_target(widget DEPENDS ${PROJECT_NAME}.wgt)
+ add_dependencies(widget MAIN_POPULATE)
set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.wgt")
- else()
- MESSAGE(FATAL_ERROR "Widget tree empty, please populate it by calling populate_widget() macro with target you want to include into it.")
- endif("${PROJECT_TARGETS}" MATCHES "project_populate_")
endmacro(project_package_build)
macro(project_subdirs_add)