From: Jérôme Gardou Date: Thu, 7 Aug 2014 18:20:46 +0000 (+0000) Subject: [CMAKE] X-Git-Tag: backups/0.3.17@66124~822 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=b51defb8ad21f9d04641aa3268adb984b98a69d6;hp=16623e02faabc747aee3bc678429913266d4abe8 [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. svn path=/trunk/; revision=63837 --- diff --git a/reactos/boot/bootdata/CMakeLists.txt b/reactos/boot/bootdata/CMakeLists.txt index a6842d2802c..97894208dc7 100644 --- a/reactos/boot/bootdata/CMakeLists.txt +++ b/reactos/boot/bootdata/CMakeLists.txt @@ -18,10 +18,14 @@ foreach(_hive ${_common_hives}) 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 @@ macro(add_livecd_shortcut name app dest) 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) diff --git a/reactos/boot/bootdata/packages/CMakeLists.txt b/reactos/boot/bootdata/packages/CMakeLists.txt index 24b6ba2e4f1..3344a23d95f 100644 --- a/reactos/boot/bootdata/packages/CMakeLists.txt +++ b/reactos/boot/bootdata/packages/CMakeLists.txt @@ -15,12 +15,18 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake " 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 @@ add_custom_command( 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) diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index 54e918bdc08..716ac07c75d 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -318,6 +318,12 @@ function(add_cd_file) 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