X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fcmake%2FCMakeMacros.cmake;h=68ab5a685acdf66c141747138186ac58e4e00932;hp=8a0bb4bc35244d057fb6f14c2b19d0e5f2912797;hb=4f3a4a5c0406922185de818c4b168a3c57cf4a2a;hpb=02997eb8f4daf96683824e1026fcf7d178f58a36 diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index 8a0bb4bc352..68ab5a685ac 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -171,7 +171,7 @@ macro(dir_to_num dir var) set(${var} 6) elseif(${dir} STREQUAL reactos/bin) set(${var} 7) - elseif(${dir} STREQUAL reactos/bin/data) + elseif(${dir} STREQUAL reactos/bin/testdata) set(${var} 8) elseif(${dir} STREQUAL reactos/media) set(${var} 9) @@ -315,7 +315,7 @@ function(add_cd_file) endforeach() if(_CD_TARGET) #manage dependency - add_dependencies(bootcd ${_CD_TARGET} converted_hives) + add_dependencies(bootcd ${_CD_TARGET} registry_inf) endif() else() #add it in reactos.cab @@ -337,7 +337,7 @@ function(add_cd_file) if(NOT __cd EQUAL -1) #manage dependency if(_CD_TARGET) - add_dependencies(livecd ${_CD_TARGET} converted_hives) + add_dependencies(livecd ${_CD_TARGET} registry_inf) endif() foreach(item ${_CD_FILE}) if(_CD_NAME_ON_CD) @@ -385,7 +385,7 @@ function(add_cd_file) endforeach() if(_CD_TARGET) #manage dependency - add_dependencies(bootcdregtest ${_CD_TARGET} converted_hives) + add_dependencies(bootcdregtest ${_CD_TARGET} registry_inf) endif() else() #add it in reactos.cab @@ -504,12 +504,27 @@ elseif(USE_FOLDER_STRUCTURE) endfunction() endif() -macro(concatenate_files _output) - add_custom_command( - OUTPUT ${_output} - COMMAND native-cat ${ARGN} > ${_output} - DEPENDS ${ARGN} native-cat) -endmacro() +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + function(concatenate_files _output _file1) + file(TO_NATIVE_PATH "${_output}" _real_output) + file(TO_NATIVE_PATH "${_file1}" _file_list) + foreach(_file ${ARGN}) + file(TO_NATIVE_PATH "${_file}" _real_file) + set(_file_list "${_file_list} + ${_real_file}") + endforeach() + add_custom_command( + OUTPUT ${_output} + COMMAND cmd.exe /C "copy /Y /B ${_file_list} ${_real_output} > nul" + DEPENDS ${_file1} ${ARGN}) + endfunction() +else() + macro(concatenate_files _output) + add_custom_command( + OUTPUT ${_output} + COMMAND cat ${ARGN} > ${_output} + DEPENDS ${ARGN}) + endmacro() +endif() function(add_importlibs _module) add_dependency_node(${_module}) @@ -562,8 +577,8 @@ function(set_module_type MODULE TYPE) # Handle hotpatchable images. # GCC has this as a function attribute so we're handling it using DECLSPEC_HOTPATCH if(__module_HOTPATCHABLE AND MSVC AND (NOT ARCH STREQUAL "arm")) - set_property(TARGET ${MODULE} APPEND_STRING PROPERTY COMPILE_FLAGS " /hotpatch") if(ARCH STREQUAL "i386") + set_property(TARGET ${MODULE} APPEND_STRING PROPERTY COMPILE_FLAGS " /hotpatch") set_property(TARGET ${MODULE} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:5") elseif(ARCH STREQUAL "amd64") set_property(TARGET ${MODULE} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:6") @@ -632,7 +647,7 @@ function(set_module_type MODULE TYPE) # Now do some stuff which is specific to each type if((${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver) OR (${TYPE} STREQUAL kerneldll)) - add_dependencies(${MODULE} bugcodes) + add_dependencies(${MODULE} bugcodes xdk) if((${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver)) set_target_properties(${MODULE} PROPERTIES SUFFIX ".sys") endif() @@ -668,7 +683,7 @@ endfunction() function(preprocess_file __in __out) set(__arg ${__in}) - foreach(__def in ${ARGN}) + foreach(__def ${ARGN}) list(APPEND __arg -D${__def}) endforeach() if(MSVC) @@ -708,8 +723,84 @@ else() endfunction() endif() +function(add_registry_inf) + # Add to the inf files list + foreach(_file ${ARGN}) + set(_source_file "${CMAKE_CURRENT_SOURCE_DIR}/${_file}") + set_property(GLOBAL APPEND PROPERTY REGISTRY_INF_LIST ${_source_file}) + endforeach() +endfunction() + +function(create_registry_hives) + + # Shortcut to the registry.inf file + set(_registry_inf "${CMAKE_BINARY_DIR}/boot/bootdata/registry.inf") + + # Get the list of inf files + get_property(_inf_files GLOBAL PROPERTY REGISTRY_INF_LIST) + + # Convert files to utf16le + foreach(_file ${_inf_files}) + get_filename_component(_file_name ${_file} NAME_WE) + string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file "${_file}") + string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file ${_converted_file}) + add_custom_command(OUTPUT ${_converted_file} + COMMAND native-utf16le ${_file} ${_converted_file} + DEPENDS native-utf16le ${_file}) + list(APPEND _converted_files ${_converted_file}) + endforeach() + + # Concatenate all registry files to registry.inf + concatenate_files(${_registry_inf} ${_converted_files}) + + # Add registry.inf to bootcd + add_custom_target(registry_inf DEPENDS ${_registry_inf}) + add_cd_file(TARGET registry_inf + FILE ${_registry_inf} + DESTINATION reactos + NO_CAB + FOR bootcd regtest) + + # livecd hives + list(APPEND _livecd_inf_files + ${_registry_inf} + ${CMAKE_SOURCE_DIR}/boot/bootdata/livecd.inf + ${CMAKE_SOURCE_DIR}/boot/bootdata/hiveinst.inf) + + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/sam + ${CMAKE_BINARY_DIR}/boot/bootdata/default + ${CMAKE_BINARY_DIR}/boot/bootdata/security + ${CMAKE_BINARY_DIR}/boot/bootdata/software + ${CMAKE_BINARY_DIR}/boot/bootdata/system + COMMAND native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/ ${_livecd_inf_files} + DEPENDS native-mkhive ${_livecd_inf_files}) + + add_custom_target(livecd_hives + DEPENDS ${CMAKE_BINARY_DIR}/boot/bootdata/sam + ${CMAKE_BINARY_DIR}/boot/bootdata/default + ${CMAKE_BINARY_DIR}/boot/bootdata/security + ${CMAKE_BINARY_DIR}/boot/bootdata/software + ${CMAKE_BINARY_DIR}/boot/bootdata/system) + + add_cd_file( + FILE ${CMAKE_BINARY_DIR}/boot/bootdata/sam + ${CMAKE_BINARY_DIR}/boot/bootdata/default + ${CMAKE_BINARY_DIR}/boot/bootdata/security + ${CMAKE_BINARY_DIR}/boot/bootdata/software + ${CMAKE_BINARY_DIR}/boot/bootdata/system + TARGET livecd_hives + DESTINATION reactos/system32/config + FOR livecd) + +endfunction() + if(KDBG) set(ROSSYM_LIB "rossym") else() set(ROSSYM_LIB "") endif() + +function(add_rc_deps _target_rc) + set_source_files_properties(${_target_rc} PROPERTIES OBJECT_DEPENDS "${ARGN}") +endfunction()