summaryrefslogtreecommitdiffstats
path: root/templates/hybrid-html5/etc
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-05 00:26:35 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-05 00:26:35 +0200
commit9600b8e24fdfa99d44a7c9ebd00ff88b1a34df53 (patch)
treef9a86336fdd0623d292a7497ff63508859dc34b3 /templates/hybrid-html5/etc
parenta04180ccc6885bf2048af4e538051a1ed3d236f9 (diff)
Update template to the reference.
Change-Id: I5140d5c8df51773815074b1f7dd5a9556a3e6428 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'templates/hybrid-html5/etc')
-rw-r--r--templates/hybrid-html5/etc/macros.cmake123
1 files changed, 63 insertions, 60 deletions
diff --git a/templates/hybrid-html5/etc/macros.cmake b/templates/hybrid-html5/etc/macros.cmake
index a002d95..184f8ba 100644
--- a/templates/hybrid-html5/etc/macros.cmake
+++ b/templates/hybrid-html5/etc/macros.cmake
@@ -30,6 +30,14 @@
macro(PROJECT_TARGET_ADD TARGET_NAME)
set(PROJECT_TARGETS ${PROJECT_TARGETS} ${TARGET_NAME} CACHE INTERNAL PROJECT_TARGETS)
set(TARGET_NAME ${TARGET_NAME})
+
+ # Cmake does not maintain targets list before 3.7
+ # -------------------------------------------------
+ if(${CMAKE_VERSION} VERSION_LESS 3.7)
+ set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS})
+ else()
+ get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList)
+ endif()
endmacro(PROJECT_TARGET_ADD)
macro(defstr name value)
@@ -39,52 +47,54 @@ endmacro(defstr)
# WGT packaging
macro(project_targets_populate)
foreach(TARGET ${PROJECT_TARGETS})
- # Declaration of a custom command that will populate widget tree with the target
- set(POPULE_WIDGET_TARGET "project_populate_${TARGET}")
-
get_target_property(T ${TARGET} LABELS)
- get_target_property(P ${TARGET} PREFIX)
- get_target_property(BD ${TARGET} BINARY_DIR)
- get_target_property(OUT ${TARGET} OUTPUT_NAME)
-
- if(${P} STREQUAL "P-NOTFOUND" AND ${T} STREQUAL "BINDING")
- set(P "lib")
- elseif(${P} STREQUAL "P-NOTFOUND")
- set(P "")
- endif(${P} STREQUAL "P-NOTFOUND" AND ${T} STREQUAL "BINDING")
-
- if(${T} STREQUAL "BINDING")
- add_custom_command(OUTPUT ${WIDGET_LIBDIR}/${P}${TARGET}.so
- DEPENDS ${TARGET}
- 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)
- 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})
- elseif(${T} STREQUAL "HTDOCS")
- add_custom_command(OUTPUT ${WIDGET_HTTPDIR}
- DEPENDS ${TARGET}
- COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_HTTPDIR}
+ if(T)
+ # Declaration of a custom command that will populate widget tree with the target
+ set(POPULE_WIDGET_TARGET "project_populate_${TARGET}")
+
+ get_target_property(P ${TARGET} PREFIX)
+ get_target_property(BD ${TARGET} BINARY_DIR)
+ get_target_property(OUT ${TARGET} OUTPUT_NAME)
+
+ if(P MATCHES "NOTFOUND$")
+ if (${T} STREQUAL "BINDING")
+ set(P "lib")
+ else()
+ set(P "")
+ endif()
+ endif()
+
+ if(${T} STREQUAL "BINDING")
+ add_custom_command(OUTPUT ${WIDGET_LIBDIR}/${P}${TARGET}.so
+ DEPENDS ${TARGET}
+ COMMAND mkdir -p ${WIDGET_LIBDIR}
+ COMMAND cp ${BD}/${P}${OUT}.so ${WIDGET_LIBDIR}
)
- add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR})
- 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_LIBDIR}/${P}${TARGET}.so)
+ 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_HTTPDIR})
- else()
- if(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
- MESSAGE(AUTHOR_WARNING "This target, ${TARGET}, will be not be included in the package.")
- endif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
- endif(${T} STREQUAL "BINDING")
- PROJECT_TARGET_ADD(${POPULE_WIDGET_TARGET})
+ add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_BINDIR}/${P}${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})
+ 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})
+ 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.")
+ endif()
endforeach()
endmacro(project_targets_populate)
@@ -131,7 +141,7 @@ set(CMP0048 1)
# Include project configuration
# ------------------------------
-project(${NAME} VERSION ${VERSION})
+project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
set(PROJECT_WGT_DIR "packaging/wgt" CACHE PATH "Subpath to the widget directory")
set(PROJECT_LIBDIR "libs" CACHE PATH "Subpath to libraries")
set(PROJECT_RESOURCES "data" CACHE PATH "Subpath to data")
@@ -221,24 +231,17 @@ endif()
if(EXTRA_DEPENDENCIES_ORDER)
set(DEPENDENCIES_TARGET ${PROJECT_NAME}_extra_dependencies)
add_custom_target(${DEPENDENCIES_TARGET} ALL
- DEPENDS ${EXTRA_DEPENDENCY_ORDER}
+ DEPENDS ${EXTRA_DEPENDENCY_ORDER}
)
endif()
-# Cmake does not maintain targets list before 3.7
-# -------------------------------------------------
-if(${CMAKE_VERSION} VERSION_LESS 3.7)
- set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS})
-else()
- get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList)
-endif()
-
# Print developer helper message when everything is done
# -------------------------------------------------------
-if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST)
- add_custom_target(${PROJECT_NAME}_done ALL
- DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST}
- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
- )
-endif()
-
+macro(project_closing_msg)
+ if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST)
+ add_custom_target(${PROJECT_NAME}_done ALL
+ DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST}
+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
+ )
+ endif()
+endmacro()