[CMAKE]
[reactos.git] / ros_cd.cmake
1 #reactos.dff
2 add_custom_command(
3 OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.dff
4 COMMAND ${CMAKE_COMMAND} -E copy ${REACTOS_SOURCE_DIR}/boot/bootdata/packages/reactos.dff.in ${REACTOS_BINARY_DIR}/boot/reactos.dff
5 DEPENDS ${REACTOS_SOURCE_DIR}/boot/bootdata/packages/reactos.dff.in
6 )
7
8 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt CAB_TARGET_ENTRIES)
9 foreach(ENTRY ${CAB_TARGET_ENTRIES})
10 string(REGEX REPLACE "^(.*)\t.*" "\\1" _targetname ${ENTRY})
11 string(REGEX REPLACE "^.*\t(.)" "\\1" _dir_num ${ENTRY})
12 get_target_property(_FILENAME ${_targetname} LOCATION)
13 add_custom_command(
14 OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.dff
15 COMMAND ${CMAKE_COMMAND} -E echo ${_FILENAME} ${_dir_num} >> ${REACTOS_BINARY_DIR}/boot/reactos.dff
16 DEPENDS ${_targetname}
17 APPEND
18 )
19 endforeach()
20
21 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_cab.txt CAB_TARGET_ENTRIES)
22 foreach(ENTRY ${CAB_TARGET_ENTRIES})
23 string(REGEX REPLACE "^(.*)\t.*" "\\1" _FILENAME ${ENTRY})
24 string(REGEX REPLACE "^.*\t(.)" "\\1" _dir_num ${ENTRY})
25 add_custom_command(
26 OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.dff
27 COMMAND ${CMAKE_COMMAND} -E echo ${_FILENAME} ${_dir_num} >> ${REACTOS_BINARY_DIR}/boot/reactos.dff
28 DEPENDS ${_FILENAME}
29 APPEND
30 )
31 endforeach()
32
33 #reactos.cab
34 add_custom_command(
35 OUTPUT ${REACTOS_BINARY_DIR}/bootcd/reactos/reactos.inf
36 COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/reactos.dff -L ${REACTOS_BINARY_DIR}/boot/bootcd/reactos -I
37 DEPENDS ${REACTOS_BINARY_DIR}/boot/reactos.dff
38 )
39 add_custom_command(
40 OUTPUT ${REACTOS_BINARY_DIR}/bootcd/reactos/reactos.cab
41 COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/reactos.dff -RC ${REACTOS_BINARY_DIR}/boot/bootcd/reactos/reactos.inf -L ${REACTOS_BINARY_DIR}/boot/bootcd/reactos -N
42 DEPENDS ${REACTOS_BINARY_DIR}/bootcd/reactos/reactos.inf
43 )
44 list( APPEND BOOTCD_FILES ${REACTOS_BINARY_DIR}/bootcd/reactos/reactos.cab)
45
46 #bootcd target
47 set(BOOTCD_DIR "${REACTOS_BINARY_DIR}/boot/bootcd")
48
49 file(MAKE_DIRECTORY "${BOOTCD_DIR}")
50 file(MAKE_DIRECTORY "${BOOTCD_DIR}/loader")
51 file(MAKE_DIRECTORY "${BOOTCD_DIR}/reactos")
52 file(MAKE_DIRECTORY "${BOOTCD_DIR}/reactos/system32")
53
54 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt MINICD_TARGET_ENTRIES)
55 foreach(ENTRY ${MINICD_TARGET_ENTRIES})
56 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _targetname ${ENTRY})
57 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
58 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
59 get_target_property(_FILENAME ${_targetname} LOCATION)
60 set(filename ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD})
61 list( APPEND BOOTCD_FILES ${filename})
62 add_custom_command(
63 OUTPUT ${filename}
64 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD}
65 DEPENDS ${_targetname}
66 )
67 endforeach()
68
69 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt MINICD_ENTRIES)
70 foreach(ENTRY ${MINICD_ENTRIES})
71 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _FILENAME ${ENTRY})
72 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
73 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
74 set(filename ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD})
75 list( APPEND BOOTCD_FILES ${filename})
76 add_custom_command(
77 OUTPUT ${filename}
78 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD}
79 DEPENDS ${_FILENAME}
80 )
81 endforeach()
82
83 add_custom_target(bootcd
84 COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${BOOTCD_DIR} REACTOS ${REACTOS_BINARY_DIR}/minicd.iso
85 DEPENDS ${BOOTCD_FILES})
86
87 add_dependencies(bootcd dosmbr ext2 fat32 fat isoboot isobtrt vgafonts)
88
89 set_directory_properties(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${REACTOS_BINARY_DIR}/minicd.iso)
90
91 #livecd target
92 file(MAKE_DIRECTORY "${LIVECD_DIR}")
93 file(MAKE_DIRECTORY "${LIVECD_DIR}/loader")
94 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles")
95 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/All Users")
96 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/All Users/Desktop")
97 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/Default User")
98 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/Default User/Desktop")
99 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/Default User/My Documents")
100 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos")
101 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/inf")
102 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/fonts")
103 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/system32")
104 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/system32/config")
105
106 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt LIVECD_TARGET_ENTRIES)
107 foreach(ENTRY ${LIVECD_TARGET_ENTRIES})
108 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _targetname ${ENTRY})
109 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
110 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
111 get_target_property(_FILENAME ${_targetname} LOCATION)
112 set(filename ${LIVECD_DIR}/${_DIR}/${_NAMEONCD})
113 list( APPEND LIVECD_FILES ${filename})
114 add_custom_command(
115 OUTPUT ${filename}
116 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${LIVECD_DIR}/${_DIR}/${_NAMEONCD}
117 DEPENDS ${_targetname}
118 )
119 endforeach()
120 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt LIVECD_ENTRIES)
121
122 foreach(ENTRY ${LIVECD_ENTRIES})
123 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _FILENAME ${ENTRY})
124 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
125 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
126 set(filename ${LIVECD_DIR}/${_DIR}/${_NAMEONCD})
127 list( APPEND LIVECD_FILES ${filename})
128 add_custom_command(
129 OUTPUT ${filename}
130 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${LIVECD_DIR}/${_DIR}/${_NAMEONCD}
131 DEPENDS ${_FILENAME}
132 )
133 endforeach()
134
135 add_custom_target(livecd
136 COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${LIVECD_DIR} REACTOS ${REACTOS_BINARY_DIR}/livecd.iso
137 DEPENDS ${LIVECD_FILES})
138 add_dependencies(livecd isoboot livecd_hives)
139
140 set_directory_properties(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${REACTOS_BINARY_DIR}/livecd.iso)