summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/CMakeLists.txt28
-rw-r--r--examples/RunExamplesDistCheck.cmake35
2 files changed, 63 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 2a26c59..bdeedac 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,33 @@
+macro(example_distcheck example)
+ add_custom_target(example_${example}_distcheck
+ ${CMAKE_COMMAND}
+ -DCMAKE_BUILD_TOOL=${CMAKE_BUILD_TOOL}
+ -DQT_QMAKE_EXECUTABLE=${QT_QMAKE_EXECUTABLE}
+ -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -DEXAMPLE=${example}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/RunExamplesDistCheck.cmake
+ )
+
+ get_target_property(EXAMPLES_DISTCHECK_TARGET examples_distcheck TYPE)
+ if(NOT EXAMPLES_DISTCHECK_TARGET)
+ add_custom_target(examples_distcheck)
+ endif()
+
+ add_dependencies(examples_distcheck example_${example}_distcheck)
+endmacro()
+
add_subdirectory(player)
+example_distcheck(player)
+
add_subdirectory(appsink-src)
+example_distcheck(appsink-src)
+
add_subdirectory(recorder)
+example_distcheck(recorder)
+
add_subdirectory(voip)
+example_distcheck(voip)
+
add_subdirectory(qmlplayer)
+example_distcheck(qmlplayer)
diff --git a/examples/RunExamplesDistCheck.cmake b/examples/RunExamplesDistCheck.cmake
new file mode 100644
index 0000000..92ab406
--- /dev/null
+++ b/examples/RunExamplesDistCheck.cmake
@@ -0,0 +1,35 @@
+
+macro (run_check tool tool_name)
+
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}/build-${EXAMPLE}-${tool_name})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}/build-${EXAMPLE}-${tool_name})
+
+ execute_process(COMMAND ${tool} ${SOURCE_DIR}/${EXAMPLE}
+ WORKING_DIRECTORY ${BINARY_DIR}/build-${EXAMPLE}-${tool_name}
+ RESULT_VARIABLE ${tool_name}_RESULT
+ )
+
+ if (NOT (${${tool_name}_RESULT} EQUAL 0))
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}/build-${EXAMPLE}-${tool_name})
+ message(FATAL_ERROR "-- ${tool_name} failed --")
+ else()
+ execute_process(COMMAND ${CMAKE_BUILD_TOOL}
+ WORKING_DIRECTORY ${BINARY_DIR}/build-${EXAMPLE}-${tool_name}
+ RESULT_VARIABLE MAKE_RESULT
+ )
+
+ if (NOT (${MAKE_RESULT} EQUAL 0))
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}/build-${EXAMPLE}-${tool_name})
+ message(FATAL_ERROR "-- make (${tool_name}) failed --")
+ endif()
+ endif()
+
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}/build-${EXAMPLE}-${tool_name})
+
+endmacro()
+
+message("##### Running CMAKE on ${EXAMPLE} example #####")
+run_check(${CMAKE_COMMAND} cmake)
+
+message("##### Running QMAKE on ${EXAMPLE} example #####")
+run_check(${QT_QMAKE_EXECUTABLE} qmake)