if(MSVC)
add_definitions(-DNATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/include/c++)
include_directories(${REACTOS_SOURCE_DIR}/include/c++/stlport)
+ else()
+ replace_compile_flags("-nostdinc" " ")
endif()
endif()
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)
endmacro()
function(add_cd_file)
- cmake_parse_arguments(_CD "NO_CAB" "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(NOT (_CD_TARGET OR _CD_FILE))
message(FATAL_ERROR "You must provide a target or a file to install!")
endif()
endif()
#do we add it to all CDs?
- if(_CD_FOR STREQUAL all)
- set(_CD_FOR "bootcd;livecd;regtest")
+ list(FIND _CD_FOR all __cd)
+ if(NOT __cd EQUAL -1)
+ list(REMOVE_AT _CD_FOR __cd)
+ list(INSERT _CD_FOR __cd "bootcd;livecd;regtest")
endif()
#do we add it to bootcd?
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()
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
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)
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)
+ set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "livecd/${_CD_DESTINATION}/${__file}=${item}")
+ endif()
endforeach()
endif() #end livecd
+ #do we need also to add it to hybridcd?
+ list(FIND _CD_FOR hybridcd __cd)
+ if(NOT __cd EQUAL -1)
+ 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
+
#do we add it to regtest?
list(FIND _CD_FOR regtest __cd)
if(NOT __cd EQUAL -1)
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
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.lst "${_filelist}")
file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.lst "${_filelist}")
unset(_filelist)
+ get_property(_filelist GLOBAL PROPERTY HYBRIDCD_FILE_LIST)
+ string(REPLACE ";" "\n" _filelist "${_filelist}")
+ file(APPEND ${REACTOS_BINARY_DIR}/boot/hybridcd.lst "${_filelist}")
+ unset(_filelist)
+
get_property(_filelist GLOBAL PROPERTY BOOTCDREGTEST_FILE_LIST)
string(REPLACE ";" "\n" _filelist "${_filelist}")
file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.lst "${_filelist}")
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
- macro(to_win_path _cmake_path _native_path)
- string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}")
- endmacro()
-
- # yeah the parameter mess sucks, but thats what works...
- function(concatenate_files _file1 _target2 _output)
- get_target_property(_file2 ${_target2} LOCATION)
- to_win_path("${_file1}" _real_file1)
- to_win_path("${_file2}" _real_file2)
- to_win_path("${_output}" _real_output)
+ 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 ${_real_file1} + ${_real_file2} ${_real_output} > nul"
- DEPENDS ${_file1}
- DEPENDS ${_target2})
+ COMMAND cmd.exe /C "copy /Y /B ${_file_list} ${_real_output} > nul"
+ DEPENDS ${_file1} ${ARGN})
endfunction()
else()
- macro(concatenate_files _file1 _target2 _output)
- get_target_property(_file2 ${_target2} LOCATION)
+ macro(concatenate_files _output)
add_custom_command(
OUTPUT ${_output}
- COMMAND cat ${_file1} ${_file2} > ${_output}
- DEPENDS ${_file1}
- DEPENDS ${_target2})
+ COMMAND cat ${ARGN} > ${_output}
+ DEPENDS ${ARGN})
endmacro()
endif()
message(STATUS "set_module_type : unparsed arguments ${__module_UNPARSED_ARGUMENTS}, module : ${MODULE}")
endif()
+ # Add the module to the module group list, if it is defined
+ if(DEFINED CURRENT_MODULE_GROUP)
+ set_property(GLOBAL APPEND PROPERTY ${CURRENT_MODULE_GROUP}_MODULE_LIST "${MODULE}")
+ endif()
+
# Set subsystem. Also take this as an occasion
# to error out if someone gave a non existing type
- if((${TYPE} STREQUAL nativecui) OR (${TYPE} STREQUAL nativedll)
+ if((${TYPE} STREQUAL nativecui) OR (${TYPE} STREQUAL nativedll)
OR (${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver) OR (${TYPE} STREQUAL kerneldll))
set(__subsystem native)
elseif(${TYPE} STREQUAL win32cui)
# 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")
set_module_type_toolchain(${MODULE} ${TYPE})
endfunction()
+function(start_module_group __name)
+ if(DEFINED CURRENT_MODULE_GROUP)
+ message(FATAL_ERROR "CURRENT_MODULE_GROUP is already set ('${CURRENT_MODULE_GROUP}')")
+ endif()
+ set(CURRENT_MODULE_GROUP ${__name} PARENT_SCOPE)
+endfunction()
+
+function(end_module_group)
+ get_property(__modulelist GLOBAL PROPERTY ${CURRENT_MODULE_GROUP}_MODULE_LIST)
+ add_custom_target(${CURRENT_MODULE_GROUP})
+ foreach(__module ${__modulelist})
+ add_dependencies(${CURRENT_MODULE_GROUP} ${__module})
+ endforeach()
+ set(CURRENT_MODULE_GROUP PARENT_SCOPE)
+endfunction()
+
function(preprocess_file __in __out)
set(__arg ${__in})
- foreach(__def in ${ARGN})
+ foreach(__def ${ARGN})
list(APPEND __arg -D${__def})
endforeach()
if(MSVC)
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()