From ae2a80453b95775364e93ed1a4647429b2fd7bad Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 26 Jul 2013 12:11:21 -0400 Subject: Improve dependencies for tests Add the global header and typesystem XML, and shiboken itself, as dependencies to running Shiboken for generating the wrapped code used in the unit tests. This gives a better example in case of users looking at this code for how to do things in their own projects, and also makes test writing easier by removing the need to do a clean build or touch files to force the wrapping code to be recreated when modifying the test code or the generator. Change command invocation to use shiboken as a target name (CMake will recognize it as a target and use the correct path automatically), and remove the now redundant dependency of the wrapping libraries on the same. (This is superfluous both because using shiboken as a target will cause CMake to add an implicit dependency on it for users of the generated files, but also because it isn't really needed; the generate command having it as a dependency covers needing it built first, and is what we really care about as far as rebuilding anything if it changes.) Change-Id: If5cdf2e98602e500b49ba7b000e4e30e77e1a136 Reviewed-by: John Ehresman --- tests/minimalbinding/CMakeLists.txt | 7 ++----- tests/otherbinding/CMakeLists.txt | 5 +++-- tests/samplebinding/CMakeLists.txt | 5 ++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/minimalbinding/CMakeLists.txt b/tests/minimalbinding/CMakeLists.txt index 15eaafc77..a293eb97a 100644 --- a/tests/minimalbinding/CMakeLists.txt +++ b/tests/minimalbinding/CMakeLists.txt @@ -16,10 +16,10 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/minimal-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt" @ONLY) add_custom_command(OUTPUT ${minimal_SRC} -COMMAND ${shibokengenerator_BINARY_DIR}/shiboken --project-file=${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt ${GENERATOR_EXTRA_FLAGS} +COMMAND shiboken --project-file=${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt ${GENERATOR_EXTRA_FLAGS} +DEPENDS ${minimal_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'minimal' test binding..." -DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_minimal.xml libminimal ) include_directories(${CMAKE_CURRENT_SOURCE_DIR} @@ -36,6 +36,3 @@ target_link_libraries(minimal libminimal ${SBK_PYTHON_LIBRARIES} libshiboken) - -add_dependencies(minimal shiboken) - diff --git a/tests/otherbinding/CMakeLists.txt b/tests/otherbinding/CMakeLists.txt index 632391209..e2682fa17 100644 --- a/tests/otherbinding/CMakeLists.txt +++ b/tests/otherbinding/CMakeLists.txt @@ -18,7 +18,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/other-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/other-binding.txt" @ONLY) add_custom_command(OUTPUT ${other_SRC} -COMMAND ${shibokengenerator_BINARY_DIR}/shiboken --project-file=${CMAKE_CURRENT_BINARY_DIR}/other-binding.txt ${GENERATOR_EXTRA_FLAGS} +COMMAND shiboken --project-file=${CMAKE_CURRENT_BINARY_DIR}/other-binding.txt ${GENERATOR_EXTRA_FLAGS} +DEPENDS ${other_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'other' test binding..." ) @@ -43,5 +44,5 @@ target_link_libraries(other ${SBK_PYTHON_LIBRARIES} libshiboken) -add_dependencies(other sample shiboken) +add_dependencies(other sample) diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt index f0d973088..78bba9da4 100644 --- a/tests/samplebinding/CMakeLists.txt +++ b/tests/samplebinding/CMakeLists.txt @@ -118,7 +118,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sample-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/sample-binding.txt" @ONLY) add_custom_command(OUTPUT ${sample_SRC} -COMMAND ${shibokengenerator_BINARY_DIR}/shiboken --project-file=${CMAKE_CURRENT_BINARY_DIR}/sample-binding.txt ${GENERATOR_EXTRA_FLAGS} +COMMAND shiboken --project-file=${CMAKE_CURRENT_BINARY_DIR}/sample-binding.txt ${GENERATOR_EXTRA_FLAGS} +DEPENDS ${sample_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for 'sample' test binding..." ) @@ -137,5 +138,3 @@ target_link_libraries(sample libsample ${SBK_PYTHON_LIBRARIES} libshiboken) - -add_dependencies(sample shiboken) -- cgit v1.2.3