1 2include(ExternalProject) 3 4function(setup_host_tools) 5 list(APPEND HOST_TOOLS bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink utf16le xml2sdb) 6 if(NOT MSVC) 7 list(APPEND HOST_TOOLS rsym pefixup) 8 endif() 9 list(TRANSFORM HOST_TOOLS PREPEND "${REACTOS_BINARY_DIR}/host-tools/bin/" OUTPUT_VARIABLE HOST_TOOLS_OUTPUT) 10 if (CMAKE_HOST_WIN32) 11 list(TRANSFORM HOST_TOOLS_OUTPUT APPEND ".exe") 12 if(MSVC_IDE) 13 set(HOST_EXTRA_DIR "$(ConfigurationName)/") 14 endif() 15 set(HOST_EXE_SUFFIX ".exe") 16 endif() 17 18 ExternalProject_Add(host-tools 19 SOURCE_DIR ${REACTOS_SOURCE_DIR} 20 PREFIX ${REACTOS_BINARY_DIR}/host-tools 21 BINARY_DIR ${REACTOS_BINARY_DIR}/host-tools/bin 22 CMAKE_ARGS -UCMAKE_TOOLCHAIN_FILE -DARCH:STRING=${ARCH} -DCMAKE_INSTALL_PREFIX=${REACTOS_BINARY_DIR}/host-tools -DTOOLS_FOLDER=${REACTOS_BINARY_DIR}/host-tools/bin 23 BUILD_ALWAYS TRUE 24 INSTALL_COMMAND ${CMAKE_COMMAND} -E true 25 BUILD_BYPRODUCTS ${HOST_TOOLS_OUTPUT} 26 ) 27 28 ExternalProject_Get_Property(host-tools INSTALL_DIR) 29 30 foreach(_tool ${HOST_TOOLS}) 31 add_executable(native-${_tool} IMPORTED) 32 set_target_properties(native-${_tool} PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/bin/${HOST_EXTRA_DIR}${_tool}${HOST_EXE_SUFFIX}) 33 add_dependencies(native-${_tool} host-tools ${INSTALL_DIR}/bin/${HOST_EXTRA_DIR}${_tool}${HOST_EXE_SUFFIX}) 34 endforeach() 35endfunction() 36