https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1234223f417c2ea9617af0f7a1d80934861eb7d1

commit 1234223f417c2ea9617af0f7a1d80934861eb7d1
Author:     Jérôme Gardou <jerome.gar...@reactos.org>
AuthorDate: Sun Mar 22 09:54:24 2020 +0000
Commit:     Jérôme Gardou <zefk...@users.noreply.github.com>
CommitDate: Wed Sep 2 11:02:44 2020 +0200

    [CMAKE] Use cutom commands with custom targets for generating cd targets
    
    This avoids rebuilding them over and over while there is nothing to do
---
 boot/CMakeLists.txt | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/boot/CMakeLists.txt b/boot/CMakeLists.txt
index 727f75a7fff..a18810d1e76 100644
--- a/boot/CMakeLists.txt
+++ b/boot/CMakeLists.txt
@@ -15,11 +15,12 @@ else()
     message(FATAL_ERROR "Unknown ARCH '" ${ARCH} "', cannot generate a valid 
UEFI boot filename.")
 endif()
 
-add_custom_target(efisys
+add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin
     COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 
EFIBOOT -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI 
-mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi
     DEPENDS native-fatten fat bootmgfw
     VERBATIM)
-
+add_custom_target(efisys DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin)
 
 # Create an 'empty' directory (guaranteed to be empty) to be able to add
 # arbitrary empty directories to the ISO image using mkisofs.
@@ -97,7 +98,8 @@ endfunction()
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst "")
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst 
"${CMAKE_CURRENT_BINARY_DIR}/empty\n")
 
-add_custom_target(bootcd
+add_custom_command(
+    OUTPUT ${REACTOS_BINARY_DIR}/bootcd.iso
     COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcd.iso 
-iso-level 4
         -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid 
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
         -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 
-eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin 
-no-emul-boot -hide boot.catalog
@@ -106,13 +108,15 @@ add_custom_target(bootcd
     COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 
${REACTOS_BINARY_DIR}/bootcd.iso
     DEPENDS isombr native-isohybrid native-mkisofs
     VERBATIM)
+add_custom_target(bootcd DEPENDS ${REACTOS_BINARY_DIR}/bootcd.iso)
 
 ## BootCDRegTest
 # Create the file list
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst "")
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst 
"${CMAKE_CURRENT_BINARY_DIR}/empty\n")
 
-add_custom_target(bootcdregtest
+add_custom_command(
+    OUTPUT ${REACTOS_BINARY_DIR}/bootcdregtest.iso
     COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcdregtest.iso 
-iso-level 4
         -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid 
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
         -eltorito-boot loader/isobtrt.bin -no-emul-boot -boot-load-size 4 
-eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin 
-no-emul-boot -hide boot.catalog
@@ -121,6 +125,7 @@ add_custom_target(bootcdregtest
     COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 
${REACTOS_BINARY_DIR}/bootcdregtest.iso
     DEPENDS isombr native-isohybrid native-mkisofs
     VERBATIM)
+add_custom_target(bootcdregtest DEPENDS 
${REACTOS_BINARY_DIR}/bootcdregtest.iso)
 
 ## LiveCD
 # Create the file list
@@ -131,7 +136,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst 
"${CMAKE_CURRENT_BINARY_
 add_allusers_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst 
"Profiles")
 add_user_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "Profiles" 
"Default User")
 
-add_custom_target(livecd
+add_custom_command(
+    OUTPUT ${REACTOS_BINARY_DIR}/livecd.iso
     COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/livecd.iso 
-iso-level 4
         -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid 
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
         -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 
-eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin 
-no-emul-boot -hide boot.catalog
@@ -140,6 +146,7 @@ add_custom_target(livecd
     COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 
${REACTOS_BINARY_DIR}/livecd.iso
     DEPENDS isombr native-isohybrid native-mkisofs
     VERBATIM)
+add_custom_target(livecd DEPENDS ${REACTOS_BINARY_DIR}/livecd.iso)
 
 ## HybridCD
 # Create the file list
@@ -150,7 +157,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst 
"${CMAKE_CURRENT_BINAR
 add_allusers_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst 
"livecd/Profiles")
 add_user_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst 
"livecd/Profiles" "Default User")
 
-add_custom_target(hybridcd
+add_custom_command(
+    OUTPUT ${REACTOS_BINARY_DIR}/hybridcd.iso
     COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/hybridcd.iso 
-iso-level 4
         -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid 
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
         -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 
-eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin 
-no-emul-boot -hide boot.catalog
@@ -159,6 +167,7 @@ add_custom_target(hybridcd
     COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 
${REACTOS_BINARY_DIR}/hybridcd.iso
     DEPENDS bootcd livecd
     VERBATIM)
+add_custom_target(hybridcd DEPENDS ${REACTOS_BINARY_DIR}/hybridcd.iso)
 
 add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin 
DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd)
 

Reply via email to