[CMAKE] Overhaul creation from CD

Get rid of global properties and use a target-level properties instead
Limit temporary files by using cmake-generator expressions instead
Avoid function calls at the end configuration, use file(GENERATE) idiom instead
This commit is contained in:
Jérôme Gardou 2020-03-27 16:04:27 +00:00 committed by Jérôme Gardou
parent 1234223f41
commit 7ffb6a09c3
4 changed files with 145 additions and 196 deletions

View file

@ -265,9 +265,6 @@ else()
# Create the registry hives # Create the registry hives
create_registry_hives() create_registry_hives()
# Create {bootcd, livecd, bootcdregtest}.lst
create_iso_lists()
file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/sdk/include/reactos) file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/sdk/include/reactos)
add_dependency_footer() add_dependency_footer()

View file

@ -60,44 +60,45 @@ set(ISO_VOLNAME "ReactOS") # For both the Volume ID and the Vol
# Create user profile directories in the LiveImage # Create user profile directories in the LiveImage
function(add_allusers_profile_dirs _image_filelist _rootdir) function(add_allusers_profile_dirs _target _rootdir)
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Documents/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Documents/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Documents/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Documents/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Documents/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Documents/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/My Documents=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/My Documents=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/All Users/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/All Users/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty")
endfunction() endfunction()
function(add_user_profile_dirs _image_filelist _rootdir _username) function(add_user_profile_dirs _target _rootdir _username)
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Application Data/Microsoft/Internet Explorer/Quick Launch=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Application Data/Microsoft/Internet Explorer/Quick Launch=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Cookies=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Cookies=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Desktop=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Desktop=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Local Settings/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Local Settings/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Local Settings/History=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Local Settings/History=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Local Settings/Temporary Internet Files=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Local Settings/Temporary Internet Files=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/NetHood=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/NetHood=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/PrintHood=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/PrintHood=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Recent=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Recent=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/SendTo=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/SendTo=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Start Menu/Programs=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") set_property(TARGET ${_target} APPEND PROPERTY FILE_LIST "${_rootdir}/${_username}/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty")
endfunction() endfunction()
## BootCD ## BootCD
# Create the file list # create file list on generation phase
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst "") file(GENERATE
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootcd.$<CONFIG>.lst
CONTENT $<GENEX_EVAL:$<JOIN:$<TARGET_PROPERTY:bootcd,FILE_LIST>,\n>>)
# create target
add_custom_command( add_custom_command(
OUTPUT ${REACTOS_BINARY_DIR}/bootcd.iso OUTPUT ${REACTOS_BINARY_DIR}/bootcd.iso
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcd.iso -iso-level 4 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcd.iso -iso-level 4
@ -106,15 +107,16 @@ add_custom_command(
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcd.$<CONFIG>.lst -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcd.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/bootcd.iso COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/bootcd.iso
DEPENDS isombr native-isohybrid native-mkisofs DEPENDS isombr native-isohybrid native-mkisofs $<TARGET_PROPERTY:bootcd,ISO_DEPENDENCIES>
VERBATIM) VERBATIM)
add_custom_target(bootcd DEPENDS ${REACTOS_BINARY_DIR}/bootcd.iso) add_custom_target(bootcd DEPENDS ${REACTOS_BINARY_DIR}/bootcd.iso)
## BootCDRegTest ## BootCDRegTest
# Create the file list # create file list on generation phase
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst "") file(GENERATE
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.$<CONFIG>.lst
CONTENT $<GENEX_EVAL:$<JOIN:$<TARGET_PROPERTY:bootcdregtest,FILE_LIST>,\n>>)
# create target
add_custom_command( add_custom_command(
OUTPUT ${REACTOS_BINARY_DIR}/bootcdregtest.iso OUTPUT ${REACTOS_BINARY_DIR}/bootcdregtest.iso
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcdregtest.iso -iso-level 4 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcdregtest.iso -iso-level 4
@ -123,19 +125,16 @@ add_custom_command(
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.$<CONFIG>.lst -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/bootcdregtest.iso COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/bootcdregtest.iso
DEPENDS isombr native-isohybrid native-mkisofs DEPENDS isombr native-isohybrid native-mkisofs $<TARGET_PROPERTY:bootcdregtest,ISO_DEPENDENCIES>
VERBATIM) VERBATIM)
add_custom_target(bootcdregtest DEPENDS ${REACTOS_BINARY_DIR}/bootcdregtest.iso) add_custom_target(bootcdregtest DEPENDS ${REACTOS_BINARY_DIR}/bootcdregtest.iso)
## LiveCD ## LiveCD
# Create the file list # create file list on generation phase
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "") file(GENERATE
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/livecd.$<CONFIG>.lst
CONTENT $<GENEX_EVAL:$<JOIN:$<TARGET_PROPERTY:livecd,FILE_LIST>,\n>>)
# Create user profile directories # create target
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_command( add_custom_command(
OUTPUT ${REACTOS_BINARY_DIR}/livecd.iso OUTPUT ${REACTOS_BINARY_DIR}/livecd.iso
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/livecd.iso -iso-level 4 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/livecd.iso -iso-level 4
@ -144,19 +143,19 @@ add_custom_command(
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/livecd.$<CONFIG>.lst -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/livecd.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/livecd.iso COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/livecd.iso
DEPENDS isombr native-isohybrid native-mkisofs DEPENDS isombr native-isohybrid native-mkisofs ${CMAKE_CURRENT_BINARY_DIR}/livecd.$<CONFIG>.lst $<TARGET_PROPERTY:livecd,ISO_DEPENDENCIES>
VERBATIM) VERBATIM)
add_custom_target(livecd DEPENDS ${REACTOS_BINARY_DIR}/livecd.iso) add_custom_target(livecd DEPENDS ${REACTOS_BINARY_DIR}/livecd.iso)
# Create user profile directories
add_allusers_profile_dirs(livecd "Profiles")
add_user_profile_dirs(livecd "Profiles" "Default User")
## HybridCD ## HybridCD
# Create the file list # create file list on generation phase
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst "") file(GENERATE
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.$<CONFIG>.lst
CONTENT $<GENEX_EVAL:$<JOIN:$<TARGET_PROPERTY:hybridcd,FILE_LIST>,\n>>)
# Create user profile directories # create target
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_command( add_custom_command(
OUTPUT ${REACTOS_BINARY_DIR}/hybridcd.iso OUTPUT ${REACTOS_BINARY_DIR}/hybridcd.iso
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/hybridcd.iso -iso-level 4 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/hybridcd.iso -iso-level 4
@ -165,11 +164,15 @@ add_custom_command(
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.$<CONFIG>.lst -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/hybridcd.iso COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/hybridcd.iso
DEPENDS bootcd livecd DEPENDS isombr native-isohybrid native-mkisofs ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.$<CONFIG>.lst $<TARGET_PROPERTY:hybridcd,ISO_DEPENDENCIES>
VERBATIM) VERBATIM)
add_custom_target(hybridcd DEPENDS ${REACTOS_BINARY_DIR}/hybridcd.iso) add_custom_target(hybridcd DEPENDS ${REACTOS_BINARY_DIR}/hybridcd.iso)
# Create user profile directories
add_allusers_profile_dirs(hybridcd "livecd/Profiles")
add_user_profile_dirs(livecd "livecd/Profiles" "Default User")
add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd) add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd)
add_cd_file(TARGET livecd FILE ${REACTOS_BINARY_DIR}/livecd.iso DESTINATION livecd FOR hybridcd)
add_subdirectory(freeldr) add_subdirectory(freeldr)
add_subdirectory(bootdata) add_subdirectory(bootdata)

View file

@ -31,20 +31,37 @@ add_custom_command(
-D SRC2=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn -D SRC2=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn
-D DST=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff -D DST=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff
-P ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake -P ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff
${CMAKE_CURRENT_BINARY_DIR}/reactos.dff ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn)
add_custom_target( # reactos.inf. We want this command to be always executed, in case someone added an optional file between two builds.
reactos_cab_inf # So we pretend it generates another file although it will never do.
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos_real.inf ${CMAKE_CURRENT_BINARY_DIR}/__some_non_existent_file
COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -L ${CMAKE_CURRENT_BINARY_DIR} -I -P ${REACTOS_SOURCE_DIR} COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -L ${CMAKE_CURRENT_BINARY_DIR} -I -P ${REACTOS_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/reactos_real.inf
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff native-cabman DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff native-cabman
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf) BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf)
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 -N -P ${REACTOS_SOURCE_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos_real.inf native-cabman $<TARGET_PROPERTY:reactos_cab,CAB_DEPENDENCIES>)
add_custom_target(reactos_cab DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab)
add_cd_file( add_cd_file(
TARGET reactos_cab_inf TARGET reactos_cab
FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab
DESTINATION reactos
NO_CAB FOR bootcd regtest)
add_cd_file(
TARGET reactos_cab
FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos_real.inf
NAME_ON_CD reactos.inf
DESTINATION reactos DESTINATION reactos
NO_CAB FOR bootcd regtest) NO_CAB FOR bootcd regtest)

View file

@ -309,7 +309,12 @@ macro(dir_to_num dir var)
endmacro() endmacro()
function(add_cd_file) function(add_cd_file)
cmake_parse_arguments(_CD "NO_CAB;NOT_IN_HYBRIDCD" "DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN}) cmake_parse_arguments(_CD "NO_CAB;NOT_IN_HYBRIDCD" "DESTINATION;NAME_ON_CD;TARGET;FILE" "FOR" ${ARGN})
if (_CD_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unexpected arguments to add_cd_file : ${_CD_UNPARSED_ARGUMENTS}")
endif()
if(NOT (_CD_TARGET OR _CD_FILE)) if(NOT (_CD_TARGET OR _CD_FILE))
message(FATAL_ERROR "You must provide a target or a file to install!") message(FATAL_ERROR "You must provide a target or a file to install!")
endif() endif()
@ -332,6 +337,10 @@ function(add_cd_file)
endif() endif()
endif() endif()
if (NOT _CD_NAME_ON_CD)
get_filename_component(_CD_NAME_ON_CD ${_CD_FILE} NAME)
endif()
# do we add it to all CDs? # do we add it to all CDs?
list(FIND _CD_FOR all __cd) list(FIND _CD_FOR all __cd)
if(NOT __cd EQUAL -1) if(NOT __cd EQUAL -1)
@ -339,42 +348,38 @@ function(add_cd_file)
list(INSERT _CD_FOR __cd "bootcd;livecd;regtest") list(INSERT _CD_FOR __cd "bootcd;livecd;regtest")
endif() endif()
# do we add it to bootcd? # do we add it to bootcd?
list(FIND _CD_FOR bootcd __cd) list(FIND _CD_FOR bootcd __cd)
if(NOT __cd EQUAL -1) if(NOT __cd EQUAL -1)
# whether or not we should put it in reactos.cab or directly on cd # whether or not we should put it in reactos.cab or directly on cd
if(_CD_NO_CAB) if(_CD_NO_CAB)
# directly on cd # directly on cd
foreach(item ${_CD_FILE}) set_property(TARGET bootcd APPEND PROPERTY FILE_LIST "${_CD_DESTINATION}/${_CD_NAME_ON_CD}=${_CD_FILE}")
if(_CD_NAME_ON_CD) # add it also into the hybridcd if not specified otherwise
# rename it in the cd tree if(NOT _CD_NOT_IN_HYBRIDCD)
set(__file ${_CD_NAME_ON_CD}) set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "bootcd/${_CD_DESTINATION}/${_CD_NAME_ON_CD}=${_CD_FILE}")
else() endif()
get_filename_component(__file ${item} NAME)
endif()
set_property(GLOBAL APPEND PROPERTY BOOTCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
# add it also into the hybridcd if not specified otherwise
if(NOT _CD_NOT_IN_HYBRIDCD)
set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "bootcd/${_CD_DESTINATION}/${__file}=${item}")
endif()
endforeach()
# manage dependency # manage dependency
if(_CD_TARGET) if(_CD_TARGET)
add_dependencies(bootcd ${_CD_TARGET} registry_inf) set_property(TARGET bootcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_TARGET})
if(NOT _CD_NOT_IN_HYBRIDCD)
set_property(TARGET hybridcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_TARGET})
endif()
else()
set_property(TARGET bootcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_FILE})
if(NOT _CD_NOT_IN_HYBRIDCD)
set_property(TARGET hybridcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_FILE})
endif()
endif() endif()
else() else()
dir_to_num(${_CD_DESTINATION} _num) dir_to_num(${_CD_DESTINATION} _num)
foreach(item ${_CD_FILE}) file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.cmake "\"${_CD_FILE}\" ${_num}\n")
# add it in reactos.cab # manage dependencies
file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.cmake "\"${item}\" ${_num}\n")
# manage dependency - file level
set_property(GLOBAL APPEND PROPERTY REACTOS_CAB_DEPENDS ${item})
endforeach()
# manage dependency - target level
if(_CD_TARGET) if(_CD_TARGET)
add_dependencies(reactos_cab_inf ${_CD_TARGET}) set_property(TARGET reactos_cab APPEND PROPERTY CAB_DEPENDENCIES ${_CD_TARGET})
else()
set_property(TARGET reactos_cab APPEND PROPERTY CAB_DEPENDENCIES ${_CD_FILE})
endif() endif()
endif() endif()
endif() #end bootcd endif() #end bootcd
@ -384,39 +389,36 @@ function(add_cd_file)
if(NOT __cd EQUAL -1) if(NOT __cd EQUAL -1)
# manage dependency # manage dependency
if(_CD_TARGET) if(_CD_TARGET)
add_dependencies(livecd ${_CD_TARGET} registry_inf) set_property(TARGET livecd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_TARGET})
endif()
foreach(item ${_CD_FILE})
if(_CD_NAME_ON_CD)
# rename it in the cd tree
set(__file ${_CD_NAME_ON_CD})
else()
get_filename_component(__file ${item} NAME)
endif()
set_property(GLOBAL APPEND PROPERTY LIVECD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
# add it also into the hybridcd if not specified otherwise
if(NOT _CD_NOT_IN_HYBRIDCD) if(NOT _CD_NOT_IN_HYBRIDCD)
set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "livecd/${_CD_DESTINATION}/${__file}=${item}") set_property(TARGET hybridcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_TARGET})
endif() endif()
endforeach() endif()
set_property(TARGET livecd APPEND PROPERTY FILE_LIST "${_CD_DESTINATION}/${_CD_NAME_ON_CD}=${_CD_FILE}")
# manage dependency
if (NOT _CD_TARGET)
set_property(TARGET livecd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_FILE})
endif()
# add it also into the hybridcd if not specified otherwise
if(NOT _CD_NOT_IN_HYBRIDCD)
set_property(TARGET hybridcd APPEND PROPERTY FILE_LIST "livecd/${_CD_DESTINATION}/${_CD_NAME_ON_CD}=${_CD_FILE}")
if (NOT _CD_TARGET)
set_property(TARGET hybridcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_FILE})
endif()
endif()
endif() #end livecd endif() #end livecd
# do we need also to add it to hybridcd? # do we need also to add it to hybridcd?
list(FIND _CD_FOR hybridcd __cd) list(FIND _CD_FOR hybridcd __cd)
if(NOT __cd EQUAL -1) if(NOT __cd EQUAL -1)
set_property(TARGET hybridcd APPEND PROPERTY FILE_LIST "${_CD_DESTINATION}/${_CD_NAME_ON_CD}=${_CD_FILE}")
# manage dependency # manage dependency
if(_CD_TARGET) if(_CD_TARGET)
add_dependencies(hybridcd ${_CD_TARGET}) set_property(TARGET hybridcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_TARGET})
else()
set_property(TARGET hybridcd APPEND PROPERTY ISO_DEPENDENCIES ${_CD_FILE})
endif() endif()
foreach(item ${_CD_FILE})
if(_CD_NAME_ON_CD)
# rename it in the cd tree
set(__file ${_CD_NAME_ON_CD})
else()
get_filename_component(__file ${item} NAME)
endif()
set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
endforeach()
endif() #end hybridcd endif() #end hybridcd
# do we add it to regtest? # do we add it to regtest?
@ -424,19 +426,12 @@ function(add_cd_file)
if(NOT __cd EQUAL -1) if(NOT __cd EQUAL -1)
# whether or not we should put it in reactos.cab or directly on cd # whether or not we should put it in reactos.cab or directly on cd
if(_CD_NO_CAB) if(_CD_NO_CAB)
# directly on cd set_property(TARGET bootcdregtest APPEND PROPERTY FILE_LIST "${_CD_DESTINATION}/${_CD_NAME_ON_CD}=${_CD_FILE}")
foreach(item ${_CD_FILE})
if(_CD_NAME_ON_CD)
# rename it in the cd tree
set(__file ${_CD_NAME_ON_CD})
else()
get_filename_component(__file ${item} NAME)
endif()
set_property(GLOBAL APPEND PROPERTY BOOTCDREGTEST_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}")
endforeach()
# manage dependency # manage dependency
if(_CD_TARGET) if(_CD_TARGET)
add_dependencies(bootcdregtest ${_CD_TARGET} registry_inf) set_property(TARGET bootcdregtest APPEND PROPERTY ISO_DEPENDENCIES ${_CD_TARGET})
else()
set_property(TARGET bootcdregtest APPEND PROPERTY ISO_DEPENDENCIES ${_CD_FILE})
endif() endif()
else() else()
#add it in reactos.cab #add it in reactos.cab
@ -450,68 +445,6 @@ function(add_cd_file)
endif() #end bootcd endif() #end bootcd
endfunction() endfunction()
function(create_iso_lists)
# generate reactos.cab before anything else
get_property(_filelist GLOBAL PROPERTY REACTOS_CAB_DEPENDS)
# begin with reactos.inf. We want this command to be always executed, so we pretend it generates another file although it will never do.
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/__some_non_existent_file
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf
DEPENDS ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.inf reactos_cab_inf)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab
COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -N -P ${REACTOS_SOURCE_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf native-cabman ${_filelist})
add_custom_target(reactos_cab DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab)
add_dependencies(reactos_cab reactos_cab_inf)
add_cd_file(
TARGET reactos_cab
FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab
DESTINATION reactos
NO_CAB FOR bootcd regtest)
add_cd_file(
FILE ${CMAKE_CURRENT_BINARY_DIR}/livecd.iso
DESTINATION livecd
FOR hybridcd)
get_property(_filelist GLOBAL PROPERTY BOOTCD_FILE_LIST)
string(REPLACE ";" "\n" _filelist "${_filelist}")
file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.cmake.lst "${_filelist}")
unset(_filelist)
file(GENERATE
OUTPUT ${REACTOS_BINARY_DIR}/boot/bootcd.$<CONFIG>.lst
INPUT ${REACTOS_BINARY_DIR}/boot/bootcd.cmake.lst)
get_property(_filelist GLOBAL PROPERTY LIVECD_FILE_LIST)
string(REPLACE ";" "\n" _filelist "${_filelist}")
file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake.lst "${_filelist}")
unset(_filelist)
file(GENERATE
OUTPUT ${REACTOS_BINARY_DIR}/boot/livecd.$<CONFIG>.lst
INPUT ${REACTOS_BINARY_DIR}/boot/livecd.cmake.lst)
get_property(_filelist GLOBAL PROPERTY HYBRIDCD_FILE_LIST)
string(REPLACE ";" "\n" _filelist "${_filelist}")
file(APPEND ${REACTOS_BINARY_DIR}/boot/hybridcd.cmake.lst "${_filelist}")
unset(_filelist)
file(GENERATE
OUTPUT ${REACTOS_BINARY_DIR}/boot/hybridcd.$<CONFIG>.lst
INPUT ${REACTOS_BINARY_DIR}/boot/hybridcd.cmake.lst)
get_property(_filelist GLOBAL PROPERTY BOOTCDREGTEST_FILE_LIST)
string(REPLACE ";" "\n" _filelist "${_filelist}")
file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake.lst "${_filelist}")
unset(_filelist)
file(GENERATE
OUTPUT ${REACTOS_BINARY_DIR}/boot/bootcdregtest.$<CONFIG>.lst
INPUT ${REACTOS_BINARY_DIR}/boot/bootcdregtest.cmake.lst)
endfunction()
# Create module_clean targets # Create module_clean targets
function(add_clean_target _target) function(add_clean_target _target)
set(_clean_working_directory ${CMAKE_CURRENT_BINARY_DIR}) set(_clean_working_directory ${CMAKE_CURRENT_BINARY_DIR})
@ -887,15 +820,11 @@ function(create_registry_hives)
${CMAKE_BINARY_DIR}/boot/bootdata/sam ${CMAKE_BINARY_DIR}/boot/bootdata/sam
${CMAKE_BINARY_DIR}/boot/bootdata/security) ${CMAKE_BINARY_DIR}/boot/bootdata/security)
add_cd_file( add_cd_file(FILE ${CMAKE_BINARY_DIR}/boot/bootdata/system TARGET livecd_hives DESTINATION reactos/system32/config FOR livecd)
FILE ${CMAKE_BINARY_DIR}/boot/bootdata/system add_cd_file(FILE ${CMAKE_BINARY_DIR}/boot/bootdata/software TARGET livecd_hives DESTINATION reactos/system32/config FOR livecd)
${CMAKE_BINARY_DIR}/boot/bootdata/software add_cd_file(FILE ${CMAKE_BINARY_DIR}/boot/bootdata/default TARGET livecd_hives DESTINATION reactos/system32/config FOR livecd)
${CMAKE_BINARY_DIR}/boot/bootdata/default add_cd_file(FILE ${CMAKE_BINARY_DIR}/boot/bootdata/sam TARGET livecd_hives DESTINATION reactos/system32/config FOR livecd)
${CMAKE_BINARY_DIR}/boot/bootdata/sam add_cd_file(FILE ${CMAKE_BINARY_DIR}/boot/bootdata/security TARGET livecd_hives DESTINATION reactos/system32/config FOR livecd)
${CMAKE_BINARY_DIR}/boot/bootdata/security
TARGET livecd_hives
DESTINATION reactos/system32/config
FOR livecd)
# BCD Hive # BCD Hive
add_custom_command( add_custom_command(
@ -924,10 +853,13 @@ function(add_driver_inf _module)
COMMAND native-utf16le "${_source_item}" "${_converted_item}" COMMAND native-utf16le "${_source_item}" "${_converted_item}"
DEPENDS native-utf16le "${_source_item}") DEPENDS native-utf16le "${_source_item}")
list(APPEND _converted_inf_files ${_converted_item}) list(APPEND _converted_inf_files ${_converted_item})
endforeach() endforeach()
add_custom_target(${_module}_inf_files DEPENDS ${_converted_inf_files}) add_custom_target(${_module}_inf_files DEPENDS ${_converted_inf_files})
add_cd_file(FILE ${_converted_inf_files} TARGET ${_module}_inf_files DESTINATION reactos/inf FOR all) foreach(item ${_converted_inf_files})
add_cd_file(FILE ${item} TARGET ${_module}_inf_files DESTINATION reactos/inf FOR all)
endforeach()
endfunction() endfunction()
if(KDBG) if(KDBG)