From 3648e16e17a908e7f08bde789fefe3abc6981544 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 18 Aug 2017 10:45:11 +0200 Subject: Latest app-templates features integration - CMake >= 3.6 mandatory - Change DATA and HTDOCS targets methods to use macro add_input_files() - header generated from OpenAPI file using BINDINGV2 label and set_openapi_filename() macro. - Adjusted README to reflect new cmake requirement Change-Id: I8da515b98c1877d5be5e51f2bf94d691ac3cefb7 Signed-off-by: Romain Forlot --- CMakeLists.txt | 2 +- Controller-afb/CMakeLists.txt | 19 ++----------------- README.md | 5 ++++- conf.d/app-templates | 2 +- conf.d/project/config.d/CMakeLists.txt | 16 ++++------------ conf.d/project/lua.d/CMakeLists.txt | 16 ++++------------ data/CMakeLists.txt | 15 +-------------- htdocs/CMakeLists.txt | 12 +----------- 8 files changed, 18 insertions(+), 69 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faef509..b8bb607 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ########################################################################### -CMAKE_MINIMUM_REQUIRED(VERSION 3.3) +CMAKE_MINIMUM_REQUIRED(VERSION 3.6) # Do not change this file, config is located into conf.d include(${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/config.cmake) diff --git a/Controller-afb/CMakeLists.txt b/Controller-afb/CMakeLists.txt index 7ac0842..d1b430b 100644 --- a/Controller-afb/CMakeLists.txt +++ b/Controller-afb/CMakeLists.txt @@ -16,18 +16,6 @@ # limitations under the License. ########################################################################### - -# Generate API-v2 hat from OpenAPI json definition -macro(SET_TARGET_GENSKEL TARGET_NAME API_DEF_NAME) - add_custom_command(OUTPUT ${API_DEF_NAME}.h - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${API_DEF_NAME}.json - COMMAND afb-genskel ${API_DEF_NAME}.json >${API_DEF_NAME}.h - ) - add_custom_target(${API_DEF_NAME}_OPENAPI DEPENDS ${API_DEF_NAME}.h) - add_dependencies(${TARGET_NAME} ${API_DEF_NAME}_OPENAPI) -endmacro(SET_TARGET_GENSKEL) - # Include LUA only when requested if(CONTROL_SUPPORT_LUA) message(STATUS "Notice: LUA Controler Support Selected") @@ -40,14 +28,11 @@ PROJECT_TARGET_ADD(control-afb) # Define project Targets ADD_LIBRARY(${TARGET_NAME} MODULE ctl-binding.c ctl-timer.c ctl-dispatch.c ${CTL_LUA_SOURCE}) - # Generate API-v2 hat from OpenAPI json definition - SET_TARGET_GENSKEL(${TARGET_NAME} ctl-apidef) - - SET_OPENAPI_FILENAME("afb-control-afb") + SET_OPENAPI_FILENAME("ctl-apidef") # Binder exposes a unique public entry point SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "afb-" - LABELS "BINDING" + LABELS "BINDINGV2" LINK_FLAGS ${BINDINGS_LINK_FLAG} OUTPUT_NAME ${TARGET_NAME} ) diff --git a/README.md b/README.md index 5d03694..54bf154 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,20 @@ git pull --recurse-submodules https://github.com/iotbzh/audio-bindings # Specific Dependencies + * cmake >= 3.6 * alsa-devel >= 1.1.2 Warning some distro like Fedora-25 still ship version 1.1.1 as default * lua >= 5.3 Most distribution only ship version 5.2 but binary package should be easy to find ``` OpenSuse + - cmake 3.6 Take the Tumbleweed version https://software.opensuse.org/ymp/openSUSE:Factory/standard/cmake.ymp?base=openSUSE%3AFactory&query=cmake - LUA-5.3-devel https://software.opensuse.org//download.html?project=devel%3Alanguages%3Alua&package=lua53 - Alsa-devel zypper --install alsa-devel # 42.3 is shipped default with 1.1.4 Fedora 26 (out of the box) - - Lua 5.3 + - cmake 3.6 + - Lua 5.3 - Alsa-devel 1.1.4 ``` diff --git a/conf.d/app-templates b/conf.d/app-templates index 8967162..421f628 160000 --- a/conf.d/app-templates +++ b/conf.d/app-templates @@ -1 +1 @@ -Subproject commit 8967162dd12bce89f9ae27f5c9bce7b78624e3fd +Subproject commit 421f62833dc53ab95648951e75827deb2d9d20b2 diff --git a/conf.d/project/config.d/CMakeLists.txt b/conf.d/project/config.d/CMakeLists.txt index 229cf2d..8070997 100644 --- a/conf.d/project/config.d/CMakeLists.txt +++ b/conf.d/project/config.d/CMakeLists.txt @@ -24,17 +24,9 @@ PROJECT_TARGET_ADD(ctl-config.d) file(GLOB XML_FILES "*.json") - add_custom_target(${TARGET_NAME} - DEPENDS ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - ) + add_input_files("${XML_FILES}") - # check XML schema before pushing config - add_custom_command( - DEPENDS ${XML_FILES} - OUTPUT ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - # COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout (Fulup we miss this for JSON) - COMMAND mkdir -p ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND touch ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND cp -r ${XML_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS "DATA" + OUTPUT_NAME ${TARGET_NAME} ) - diff --git a/conf.d/project/lua.d/CMakeLists.txt b/conf.d/project/lua.d/CMakeLists.txt index ecf1e6d..5cd61f2 100644 --- a/conf.d/project/lua.d/CMakeLists.txt +++ b/conf.d/project/lua.d/CMakeLists.txt @@ -24,17 +24,9 @@ PROJECT_TARGET_ADD(ctl-lua.d) file(GLOB LUA_FILES "*.lua") - add_custom_target(${TARGET_NAME} - DEPENDS ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - ) + add_input_files("${LUA_FILES}") - # check XML schema before pushing config - add_custom_command( - DEPENDS ${LUA_FILES} - OUTPUT ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND ${LUA_COMPILER} ${LUA_FILES} - COMMAND mkdir -p ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND touch ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND cp -r ${LUA_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS "DATA" + OUTPUT_NAME ${TARGET_NAME} ) - diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 55ee664..3b052c9 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -25,20 +25,7 @@ PROJECT_TARGET_ADD(Control_config) file(GLOB XML_FILES "*.json") - add_custom_target(${TARGET_NAME} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - ) - - # check XML schema before pushing config - add_custom_command( - DEPENDS ${XML_FILES} - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - # COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout (Fulup we miss this for JSON) - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND cp -r ${XML_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - ) + add_input_files("${XML_FILES}") SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES LABELS "DATA" diff --git a/htdocs/CMakeLists.txt b/htdocs/CMakeLists.txt index e85ca3c..322033d 100644 --- a/htdocs/CMakeLists.txt +++ b/htdocs/CMakeLists.txt @@ -25,17 +25,7 @@ PROJECT_TARGET_ADD(htdocs) file(GLOB SOURCE_FILES "*.html" "*.js" "*.jpg" "*.css") - add_custom_target(${TARGET_NAME} - DEPENDS ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - ) - - add_custom_command( - DEPENDS ${SOURCE_FILES} - OUTPUT ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND mkdir -p ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND touch ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND cp -r ${SOURCE_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - ) + add_input_files("${SOURCE_FILES}") SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES LABELS "HTDOCS" -- cgit 1.2.3-korg