aboutsummaryrefslogtreecommitdiffstats
path: root/templates/hybrid-html5
diff options
context:
space:
mode:
Diffstat (limited to 'templates/hybrid-html5')
-rwxr-xr-xtemplates/hybrid-html5/AGLbuild14
-rw-r--r--templates/hybrid-html5/CMakeLists.txt1
-rw-r--r--templates/hybrid-html5/app/CMakeLists.txt4
-rw-r--r--templates/hybrid-html5/etc/config.cmake36
-rw-r--r--templates/hybrid-html5/etc/macros.cmake53
5 files changed, 78 insertions, 30 deletions
diff --git a/templates/hybrid-html5/AGLbuild b/templates/hybrid-html5/AGLbuild
index ccbc28b..4cfd53a 100755
--- a/templates/hybrid-html5/AGLbuild
+++ b/templates/hybrid-html5/AGLbuild
@@ -27,15 +27,19 @@ clean:
@([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean
mrproper:
- rm -rf ${BUILD_DIR}
+ @rm -rf ${BUILD_DIR}
build: ${BUILD_DIR}/Makefile
- cmake --build ${BUILD_DIR} --target all
+ @cmake --build ${BUILD_DIR} --target all
package: config.xml.in icon.png.in build | $(PKG_FILELIST)
- mkdir -p ${BUILD_DIR}/$@/{bin,etc,lib,htdocs,data}
- cmake --build ${BUILD_DIR} --target widget
+ @mkdir -p ${BUILD_DIR}/$@/bin
+ @mkdir -p ${BUILD_DIR}/$@/etc
+ @mkdir -p ${BUILD_DIR}/$@/lib
+ @mkdir -p ${BUILD_DIR}/$@/htdocs
+ @mkdir -p ${BUILD_DIR}/$@/data
+ @cmake --build ${BUILD_DIR} --target widget
${BUILD_DIR}/Makefile:
@[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
- @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CMAKE_OPTS} ..) \ No newline at end of file
+ @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CMAKE_OPTS} ..)
diff --git a/templates/hybrid-html5/CMakeLists.txt b/templates/hybrid-html5/CMakeLists.txt
index 420f6e1..822fd7b 100644
--- a/templates/hybrid-html5/CMakeLists.txt
+++ b/templates/hybrid-html5/CMakeLists.txt
@@ -26,3 +26,4 @@ project_subdirs_add()
project_targets_populate()
project_package_build()
+project_closing_msg() \ No newline at end of file
diff --git a/templates/hybrid-html5/app/CMakeLists.txt b/templates/hybrid-html5/app/CMakeLists.txt
index b4019c7..ec6f6d8 100644
--- a/templates/hybrid-html5/app/CMakeLists.txt
+++ b/templates/hybrid-html5/app/CMakeLists.txt
@@ -23,8 +23,8 @@ PROJECT_TARGET_ADD(hybrid-html5-example)
add_custom_command(OUTPUT dist.prod
DEPENDS ${TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND npm install
- COMMAND gulp widget-config-prod
+ COMMAND [ -d dist.prod ] && npm install
+ COMMAND [ -d dist.prod ] && gulp widget-config-prod
COMMAND cp -r dist.prod ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(${TARGET_NAME} ALL DEPENDS dist.prod)
diff --git a/templates/hybrid-html5/etc/config.cmake b/templates/hybrid-html5/etc/config.cmake
index 31ddb02..f0f64e0 100644
--- a/templates/hybrid-html5/etc/config.cmake
+++ b/templates/hybrid-html5/etc/config.cmake
@@ -31,14 +31,13 @@ set(PROJECT_ICON "icon.png")
# ----------------------------------
set(CMAKE_BUILD_TYPE "DEBUG")
-# Compiler selection if needed. Overload the detected compiler.
+# Compiler selection if needed. Impose a minimal version.
# -----------------------------------------------
-#set(CMAKE_C_COMPILER "gcc")
-#set(CMAKE_CXX_COMPILER "g++")
+set (gcc_minimal_version 4.9)
# PKG_CONFIG required packages
# -----------------------------
-set (PKG_REQUIRED_LIST
+set (PKG_REQUIRED_LIST
json-c
afb-daemon
)
@@ -54,7 +53,7 @@ set(CMAKE_CXX_FLAGS "")
# Print a helper message when every thing is finished
# ----------------------------------------------------
#set(CLOSING_MESSAGE "")
-
+#set(WIDGET_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
# ---------------------------------------------------------------------
@@ -76,12 +75,35 @@ set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
# Optional force binding installation
# ------------------------------------
-set(BINDINGS_INSTALL_PREFIX /opt )
+# set(BINDINGS_INSTALL_PREFIX PrefixPath )
# Optional force widget prefix generation
-# ---------------------------------------
+# ------------------------------------------------
# set(WIDGET_PREFIX DestinationPath)
+# Optional Widget entry point file.
+# ---------------------------------------------------------
+ # This is the file that will be executed, loaded,...
+# at launch time by the application framework
+
+# set(WIDGET_ENTRY_POINT EntryPoint_Path)
+
+# Optional Widget Mimetype specification
+# --------------------------------------------------
+# Choose between :
+# - application/x-executable
+# - application/vnd.agl.url
+# - application/vnd.agl.service
+# - application/vnd.agl.native
+# - text/vnd.qt.qml
+# - text/html
+# - application/vnd.agl.qml
+# - application/vnd.agl.qml.hybrid
+# - application/vnd.agl.html.hybrid
+#
+# set(WIDGET_TYPE MimeType)
+
# Optional force binding Linking flag
# ------------------------------------
# set(BINDINGS_LINK_FLAG LinkOptions )
+
diff --git a/templates/hybrid-html5/etc/macros.cmake b/templates/hybrid-html5/etc/macros.cmake
index 184f8ba..9d34aa7 100644
--- a/templates/hybrid-html5/etc/macros.cmake
+++ b/templates/hybrid-html5/etc/macros.cmake
@@ -34,18 +34,27 @@ macro(PROJECT_TARGET_ADD TARGET_NAME)
# Cmake does not maintain targets list before 3.7
# -------------------------------------------------
if(${CMAKE_VERSION} VERSION_LESS 3.7)
- set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS})
+ set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS} CACHE INTERNAL "Hold project targets")
else()
get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList)
endif()
endmacro(PROJECT_TARGET_ADD)
+# Check GCC minimal version version
+if (gcc_minimal_version)
+ message ("-- Check gcc_minimal_version (found gcc version ${CMAKE_C_COMPILER_VERSION}) (found g++ version ${CMAKE_CXX_COMPILER_VERSION})")
+if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version} OR CMAKE_C_COMPILER_VERSION VERSION_LESS ${gcc_minimal_version})
+ message(FATAL_ERROR "**** FATAL: Require at least gcc-${gcc_minimal_version} please set CMAKE_C[XX]_COMPILER")
+endif()
+endif(gcc_minimal_version)
+
macro(defstr name value)
add_definitions(-D${name}=${value})
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)
@@ -70,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})
@@ -111,14 +126,19 @@ 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_")
+
+ if(WIDGET_MESSAGE)
+ add_custom_command(TARGET widget
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${WIDGET_MESSAGE}")
+ endif()
endmacro(project_package_build)
macro(project_subdirs_add)
@@ -235,13 +255,14 @@ if(EXTRA_DEPENDENCIES_ORDER)
)
endif()
-# Print developer helper message when everything is done
+# Print developer helper message when build is done
# -------------------------------------------------------
macro(project_closing_msg)
if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST)
- add_custom_target(${PROJECT_NAME}_done ALL
- DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST}
+ add_custom_target(${PROJECT_NAME}_build_done ALL
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
)
+ add_dependencies(${PROJECT_NAME}_build_done
+ ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST})
endif()
endmacro()