1#reactos.dff
2
3# reactos.dff is the concatenation of two files:
4# - reactos.dff.in, which is a static one and can be altered to
5#   add custom modules/files to reactos.cab
6# - reactos.dff.dyn (dyn as in dynamic) which is generated at generation
7#   time by our cmake scripts (from reactos.dff.cmake, which contains
8#   generator expressions)
9# If you want to slip-stream anything into the bootcd, then you want to alter reactos.dff.in
10
11# Idea taken from there : http://www.cmake.org/pipermail/cmake/2010-July/038028.html
12file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake "
13    file(READ \${SRC1} S1)
14    file(READ \${SRC2} S2)
15    file(WRITE \${DST} \"\${S1}\${S2}\")
16")
17
18file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.cmake "")
19
20# This generates reactos.dff.dyn by processing the generator expressions
21file(GENERATE
22     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn
23     INPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.cmake)
24
25# This finalizes reactos.dff by concat-ing the two files: one generated and one static containing the optional file.
26# please keep it this way as it permits to add files to reactos.dff.in without having to run cmake again
27# and also avoids rebuilding reactos.cab in case nothing changes after a cmake run
28add_custom_command(
29    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff
30    COMMAND ${CMAKE_COMMAND} -D SRC1=${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in
31                             -D SRC2=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn
32                             -D DST=${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff
33                             -P ${CMAKE_CURRENT_BINARY_DIR}/concat.cmake
34    COMMAND ${CMAKE_COMMAND} -E copy_if_different
35                             ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.maydiff
36                             ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff
37    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/reactos.dff.in
38    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff.$<CONFIG>.dyn)
39
40add_custom_target(
41    reactos_cab_inf
42    COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -L ${CMAKE_CURRENT_BINARY_DIR} -I -P ${REACTOS_SOURCE_DIR}
43    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff native-cabman)
44
45add_cd_file(
46    TARGET reactos_cab_inf
47    FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf
48    DESTINATION reactos
49    NO_CAB FOR bootcd regtest)
50