Author: jgardou Date: Thu Aug 7 18:20:46 2014 New Revision: 63837
URL: http://svn.reactos.org/svn/reactos?rev=63837&view=rev Log: [CMAKE] - separate the custom target and the custom command generating reactos.cab, so that it isn't regenerated each time a bootcd is built Note to make user: I tried a hack so that the sequence 'make module/fast reactos_cab/fast bootcd/fast' still works, but this is untested. Please use ninja if you really want fast dependency resolution.
Modified: trunk/reactos/boot/bootdata/CMakeLists.txt trunk/reactos/boot/bootdata/packages/CMakeLists.txt trunk/reactos/cmake/CMakeMacros.cmake
Modified: trunk/reactos/boot/bootdata/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/CMakeLists.tx... ============================================================================== --- trunk/reactos/boot/bootdata/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/CMakeLists.txt [iso-8859-1] Thu Aug 7 18:20:46 2014 @@ -18,10 +18,14 @@ COMMAND native-utf16le ${_hive} ${_converted_hive} DEPENDS native-utf16le ${_hive}) list(APPEND _converted_common_hives ${_converted_hive}) - add_cd_file(FILE ${_converted_hive} DESTINATION reactos NO_CAB FOR bootcd regtest) endforeach()
add_custom_target(converted_hives DEPENDS ${_converted_common_hives}) +add_cd_file(TARGET converted_hives + FILE ${_converted_common_hives} + DESTINATION reactos + NO_CAB + FOR bootcd regtest)
# livecd hives list(APPEND _livecd_hives @@ -84,7 +88,7 @@ add_link(NAME ${name} CMD_LINE_ARGS ${app} ICON ${app} PATH livecd_start.cmd GUID "{450D8FBA-AD25-11D0-98A8-0800361B1103}" MINIMIZE) list(APPEND LIVECD_SHORTCUTS "${CMAKE_CURRENT_BINARY_DIR}/${name}.lnk") add_cd_file(FILE "${CMAKE_CURRENT_BINARY_DIR}/${name}.lnk" - TARGET livecd_links + TARGET livecd_links DESTINATION ${dest} FOR livecd) endmacro(add_livecd_shortcut)
Modified: trunk/reactos/boot/bootdata/packages/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/CMak... ============================================================================== --- trunk/reactos/boot/bootdata/packages/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/packages/CMakeLists.txt [iso-8859-1] Thu Aug 7 18:20:46 2014 @@ -15,12 +15,18 @@
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.dyn "")
+# This finalizes reactos.dff by concat-ing the two files: one generated and one static containing the optional file. +# please keep it this way as it permits to add files to reactos.dff.in without having to run cmake again +# and also avoids rebuilding reactos.cab in case nothing changes after a cmake run add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff COMMAND ${CMAKE_COMMAND} -D SRC1=${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in -D SRC2=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.dyn - -D DST=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff + -D DST=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff -P ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff + ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.dyn ) @@ -34,10 +40,15 @@ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff native-cabman)
# Then we create the actual cab file using a custom target -# Please do not change this into custom command + custom target. This breaks reactos.cab dependencies on modules -# and you can't do something like "make gdi32/fast reactos_cab/fast bootcd/fast" -add_custom_target(reactos_cab +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -L ${CMAKE_CURRENT_BINARY_DIR} -N -P ${REACTOS_SOURCE_DIR} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf native-cabman)
-add_cd_file(TARGET reactos_cab FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf DESTINATION reactos NO_CAB FOR bootcd regtest) +add_custom_target(reactos_cab DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab) + +add_cd_file( + TARGET reactos_cab + FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf + DESTINATION reactos + NO_CAB FOR bootcd regtest)
Modified: trunk/reactos/cmake/CMakeMacros.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeMacros.cmake?rev... ============================================================================== --- trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] Thu Aug 7 18:20:46 2014 @@ -318,6 +318,12 @@ if(_CD_TARGET) #manage dependency add_dependencies(reactos_cab ${_CD_TARGET}) + # add this so that the combination make target/fast reactos_cab/fast bootcd/fast properly detects that reactos.cab must be rebuilt + if (CMAKE_BUILD_TOOL STREQUAL "make") + add_custom_command(TARGET ${_CD_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E touch ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff) + endif() endif() endif() endif() #end bootcd