diff options
-rw-r--r-- | sources/cmake_helpers/helpers.cmake | 15 | ||||
-rw-r--r-- | sources/pyside2/cmake/Macros/PySideModules.cmake | 4 | ||||
-rw-r--r-- | sources/pyside2/tests/pysidetest/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/shiboken2/shibokenmodule/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/shiboken2/tests/minimalbinding/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/shiboken2/tests/otherbinding/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/shiboken2/tests/samplebinding/CMakeLists.txt | 5 | ||||
-rw-r--r-- | sources/shiboken2/tests/smartbinding/CMakeLists.txt | 5 |
8 files changed, 42 insertions, 7 deletions
diff --git a/sources/cmake_helpers/helpers.cmake b/sources/cmake_helpers/helpers.cmake index dd2e98a3a..e64b8d9d3 100644 --- a/sources/cmake_helpers/helpers.cmake +++ b/sources/cmake_helpers/helpers.cmake @@ -61,3 +61,18 @@ macro(compute_config_py_values endif() endmacro() + +# Creates a new target called "${library_name}_generator" which +# depends on the mjb_rejected_classes.log file generated by shiboken. +# This target is added as a dependency to ${library_name} target. +# This file's timestamp informs cmake when the last generation was +# done, without force-updating the timestamps of the generated class +# cpp files. +# In practical terms this means that changing some injection code in +# an xml file that modifies only one specific class cpp file, will +# not force rebuilding all the cpp files, and thus allow for better +# incremental builds. +macro(create_generator_target library_name) + add_custom_target(${library_name}_generator DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log") + add_dependencies(${library_name} ${library_name}_generator) +endmacro() diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake index 816190612..0f8b500ac 100644 --- a/sources/pyside2/cmake/Macros/PySideModules.cmake +++ b/sources/pyside2/cmake/Macros/PySideModules.cmake @@ -80,7 +80,8 @@ macro(create_pyside_module get_filename_component(pyside_binary_dir ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY) - add_custom_command(OUTPUT ${${module_sources}} + add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" + BYPRODUCTS ${${module_sources}} COMMAND "${SHIBOKEN_BINARY}" ${GENERATOR_EXTRA_FLAGS} "${pyside2_BINARY_DIR}/${module_name}_global.h" --include-paths=${shiboken_include_dirs} @@ -112,6 +113,7 @@ macro(create_pyside_module if(${module_deps}) add_dependencies(${module_name} ${${module_deps}}) endif() + create_generator_target(${module_name}) # install install(TARGETS ${module_name} LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}/PySide2) diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt index 5b7f0fde1..119553fad 100644 --- a/sources/pyside2/tests/pysidetest/CMakeLists.txt +++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt @@ -66,7 +66,9 @@ make_path(testbinding_include_dirs ${pyside2_BINARY_DIR} make_path(testbinding_typesystem_path ${pyside2_SOURCE_DIR} ${pyside2_BINARY_DIR}) -add_custom_command(OUTPUT ${testbinding_SRC} +add_custom_command( +OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" +BYPRODUCTS ${testbinding_SRC} COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/pysidetest_global.h --include-paths=${testbinding_include_dirs} @@ -116,6 +118,7 @@ target_link_libraries(testbinding ${SBK_PYTHON_LIBRARIES}) add_dependencies(testbinding pyside2 QtCore QtGui QtWidgets pysidetest) +create_generator_target(testbinding) PYSIDE_TEST(decoratedslot_test.py) # Will always crash when built against Qt 5.6, no point in running it. diff --git a/sources/shiboken2/shibokenmodule/CMakeLists.txt b/sources/shiboken2/shibokenmodule/CMakeLists.txt index 517aecba8..20baf9f7e 100644 --- a/sources/shiboken2/shibokenmodule/CMakeLists.txt +++ b/sources/shiboken2/shibokenmodule/CMakeLists.txt @@ -12,7 +12,9 @@ set(shibokenmodule_TYPESYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_shiboken.xml ) -add_custom_command(OUTPUT ${sample_SRC} +add_custom_command( +OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" +BYPRODUCTS ${sample_SRC} # Note: shiboken2 is an executable target. By not specifying its explicit # path, CMAKE figures it out, itself! # This fixes an issue with Visual Studio, see https://github.com/PySide/shiboken2/pull/11 @@ -39,6 +41,7 @@ target_link_libraries(shibokenmodule libshiboken) add_dependencies(shibokenmodule shiboken2) +create_generator_target(shibokenmodule) install(TARGETS shibokenmodule DESTINATION ${PYTHON_SITE_PACKAGES}/shiboken2) diff --git a/sources/shiboken2/tests/minimalbinding/CMakeLists.txt b/sources/shiboken2/tests/minimalbinding/CMakeLists.txt index b8b6417d1..ec674b56b 100644 --- a/sources/shiboken2/tests/minimalbinding/CMakeLists.txt +++ b/sources/shiboken2/tests/minimalbinding/CMakeLists.txt @@ -15,7 +15,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/minimal/minbooluser_wrapper.cpp configure_file("${CMAKE_CURRENT_SOURCE_DIR}/minimal-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt" @ONLY) -add_custom_command(OUTPUT ${minimal_SRC} +add_custom_command( +OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" +BYPRODUCTS ${minimal_SRC} COMMAND shiboken2 --project-file=${CMAKE_CURRENT_BINARY_DIR}/minimal-binding.txt ${GENERATOR_EXTRA_FLAGS} DEPENDS ${minimal_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -38,3 +40,4 @@ target_link_libraries(minimal libminimal ${SBK_PYTHON_LIBRARIES} libshiboken) +create_generator_target(minimal) diff --git a/sources/shiboken2/tests/otherbinding/CMakeLists.txt b/sources/shiboken2/tests/otherbinding/CMakeLists.txt index 186766b41..0be66f797 100644 --- a/sources/shiboken2/tests/otherbinding/CMakeLists.txt +++ b/sources/shiboken2/tests/otherbinding/CMakeLists.txt @@ -17,7 +17,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/other/other_module_wrapper.cpp configure_file("${CMAKE_CURRENT_SOURCE_DIR}/other-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/other-binding.txt" @ONLY) -add_custom_command(OUTPUT ${other_SRC} +add_custom_command( +OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" +BYPRODUCTS ${other_SRC} COMMAND shiboken2 --project-file=${CMAKE_CURRENT_BINARY_DIR}/other-binding.txt ${GENERATOR_EXTRA_FLAGS} DEPENDS ${other_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -48,4 +50,5 @@ target_link_libraries(other libshiboken) add_dependencies(other sample) +create_generator_target(other) diff --git a/sources/shiboken2/tests/samplebinding/CMakeLists.txt b/sources/shiboken2/tests/samplebinding/CMakeLists.txt index ca737ca08..7f4bec5f4 100644 --- a/sources/shiboken2/tests/samplebinding/CMakeLists.txt +++ b/sources/shiboken2/tests/samplebinding/CMakeLists.txt @@ -128,7 +128,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/union_wrapper.cpp configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sample-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/sample-binding.txt" @ONLY) -add_custom_command(OUTPUT ${sample_SRC} +add_custom_command( +OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" +BYPRODUCTS ${sample_SRC} COMMAND shiboken2 --project-file=${CMAKE_CURRENT_BINARY_DIR}/sample-binding.txt ${GENERATOR_EXTRA_FLAGS} DEPENDS ${sample_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -152,3 +154,4 @@ target_link_libraries(sample libsample ${SBK_PYTHON_LIBRARIES} libshiboken) +create_generator_target(sample) diff --git a/sources/shiboken2/tests/smartbinding/CMakeLists.txt b/sources/shiboken2/tests/smartbinding/CMakeLists.txt index faaa797b6..43888fae2 100644 --- a/sources/shiboken2/tests/smartbinding/CMakeLists.txt +++ b/sources/shiboken2/tests/smartbinding/CMakeLists.txt @@ -16,7 +16,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/smart/registry_wrapper.cpp configure_file("${CMAKE_CURRENT_SOURCE_DIR}/smart-binding.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/smart-binding.txt" @ONLY) -add_custom_command(OUTPUT ${smart_SRC} +add_custom_command( +OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log" +BYPRODUCTS ${smart_SRC} COMMAND shiboken2 --project-file=${CMAKE_CURRENT_BINARY_DIR}/smart-binding.txt ${GENERATOR_EXTRA_FLAGS} DEPENDS ${smart_TYPESYSTEM} ${CMAKE_CURRENT_SOURCE_DIR}/global.h shiboken2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -40,3 +42,4 @@ target_link_libraries(smart libsmart ${SBK_PYTHON_LIBRARIES} libshiboken) +create_generator_target(smart) |