summaryrefslogtreecommitdiffstats
path: root/cmake/cmake.d
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-08-16 18:33:46 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-15 18:22:47 +0200
commit25057ef19f2aa613192b384b41345be13b7c3fd2 (patch)
tree20c83e478038b70440124a6db46664fb7c84912d /cmake/cmake.d
parent306b77890d3ecf17a5a6c9bd109c2815eafaabed (diff)
Personal files inclusion now by projects.
Depending on file name you can include some files from your home or system by project or globally Change-Id: I1fef678073977633576a21893065e681b286646c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/cmake.d')
-rw-r--r--cmake/cmake.d/03-macros.cmake48
1 files changed, 37 insertions, 11 deletions
diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake
index 62e5790..7abbf08 100644
--- a/cmake/cmake.d/03-macros.cmake
+++ b/cmake/cmake.d/03-macros.cmake
@@ -50,21 +50,41 @@ endmacro(configure_files_in_dir)
# Create custom target dedicated for HTML5 and DATA AGL target type
macro(add_input_files INPUT_FILES)
+ set(XML_LIST ${INPUT_FILES})
+ set(LUA_LIST ${INPUT_FILES})
+ set(JSON_LIST ${INPUT_FILES})
+ list(FILTER XML_LIST INCLUDE REGEX "xml$")
+ list(FILTER LUA_LIST INCLUDE REGEX "lua$")
+ list(FILTER JSON_LIST INCLUDE REGEX "json$")
+
add_custom_target(${TARGET_NAME}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
)
+ foreach(file ${XML_LIST})
+ add_custom_command(TARGET ${TARGET_NAME}
+ PRE_BUILD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND ${XML_CHECKER} ${file}
+ )
+ endforeach()
+ foreach(file ${LUA_LIST})
add_custom_command(TARGET ${TARGET_NAME}
- PRE_BUILD
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND [ -f *xml ] && ${XML_CHECKER} ${INPUT_FILES}
- COMMAND [ -f *lua ] && ${LUA_CHECKER} ${INPUT_FILES}
- COMMAND [ -f *json ] && for f in ${INPUT_FILES}; do cat ${INPUT_FILES} | ${JSON_CHECKER}; done
+ PRE_BUILD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND ${LUA_CHECKER} ${file}
)
+ endforeach()
+ foreach(file ${JSON_LIST})
+ add_custom_command(TARGET ${TARGET_NAME}
+ PRE_BUILD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND cat ${file} | ${JSON_CHECKER}
+ )
+ endforeach()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
- DEPENDS ${INPUT_FILES}
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
+ DEPENDS ${INPUT_FILES}
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
COMMAND cp -r ${INPUT_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}
@@ -163,13 +183,19 @@ macro(project_targets_populate)
add_dependencies(populate ${POPULE_PACKAGE_TARGET})
add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
elseif(${T} STREQUAL "DATA")
- add_custom_command(OUTPUT ${PACKAGE_DATADIR}-xx
- DEPENDS ${BD}/${P}${OUT}
+ # Generate list of output files instead of just one output directory
+ get_target_property(SF ${TARGET} SOURCES)
+ foreach(file ${SF})
+ get_filename_component(JUST_FILENAME ${file} NAME)
+ list(APPEND OUTPUT_FILES ${PACKAGE_DATADIR}/${JUST_FILENAME})
+ endforeach()
+ add_custom_target(${POPULE_PACKAGE_TARGET})
+ add_custom_command(TARGET ${POPULE_PACKAGE_TARGET}
+ POST_BUILD
COMMAND mkdir -p ${PACKAGE_DATADIR}
COMMAND touch ${PACKAGE_DATADIR}
- COMMAND cp -r ${BD}/${P}${OUT}/* ${PACKAGE_DATADIR}
+ COMMAND cp -r ${BD}/${TARGET} ${PACKAGE_DATADIR}
)
- add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_DATADIR}-xx)
add_dependencies(populate ${POPULE_PACKAGE_TARGET})
add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
endif(${T} STREQUAL "BINDING")