https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f67345320fdc400e2f354…
commit f67345320fdc400e2f354c4eed915fee96eb01b4
Author: Andrew Cook <ariscop(a)gmail.com>
AuthorDate: Wed Feb 13 21:06:49 2019 +1100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sat Aug 17 17:39:43 2019 +0200
Add WITH_HOST_TOOLS option
Required for cross-compiling with msvc as only one target
architecture is available at a time in the dev prompt
---
sdk/cmake/host-tools.cmake | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/sdk/cmake/host-tools.cmake b/sdk/cmake/host-tools.cmake
index 25559192ee2..41b82d29fac 100644
--- a/sdk/cmake/host-tools.cmake
+++ b/sdk/cmake/host-tools.cmake
@@ -1,6 +1,6 @@
-function(setup_host_tools)
- file(MAKE_DIRECTORY ${REACTOS_BINARY_DIR}/host-tools)
+function(configure_host_tools HOST_TOOLS_DIR)
+ file(MAKE_DIRECTORY ${HOST_TOOLS_DIR})
message(STATUS "Configuring host tools...")
# cmake sets CC and CXX when those languages are enabled
@@ -13,7 +13,7 @@ function(setup_host_tools)
-DARCH:STRING=${ARCH}
${USE_CLANG_CL_ARG}
${REACTOS_SOURCE_DIR}
- WORKING_DIRECTORY ${REACTOS_BINARY_DIR}/host-tools
+ WORKING_DIRECTORY ${HOST_TOOLS_DIR}
RESULT_VARIABLE _host_config_result
OUTPUT_VARIABLE _host_config_log
ERROR_VARIABLE _host_config_log)
@@ -31,15 +31,30 @@ function(setup_host_tools)
# custom target + symbolic output prevents cmake from running
# the command multiple times per build
add_custom_command(
- COMMAND ${CMAKE_COMMAND} --build ${REACTOS_BINARY_DIR}/host-tools
+ COMMAND ${CMAKE_COMMAND} --build ${HOST_TOOLS_DIR}
OUTPUT host_tools)
add_custom_target(build-host-tools ALL DEPENDS host_tools)
- include(${REACTOS_BINARY_DIR}/host-tools/ImportExecutables.cmake)
- include(${REACTOS_BINARY_DIR}/host-tools/TargetList.cmake)
+ include(${HOST_TOOLS_DIR}/ImportExecutables.cmake)
+ include(${HOST_TOOLS_DIR}/TargetList.cmake)
foreach(_target ${NATIVE_TARGETS})
add_dependencies(native-${_target} build-host-tools)
endforeach()
endfunction()
+
+function(setup_host_tools)
+ if(WITH_HOST_TOOLS)
+ # Use pre-built tools, required for cross compiling with msvc
+ # as only one target architecture is available at a time
+ set(HOST_TOOLS_DIR ${WITH_HOST_TOOLS})
+ include(${HOST_TOOLS_DIR}/ImportExecutables.cmake)
+ else()
+ # Build host-tools. Changes to tool sources will rebuild targets
+ # using that tool
+ set(HOST_TOOLS_DIR ${REACTOS_BINARY_DIR}/host-tools)
+ configure_host_tools(${HOST_TOOLS_DIR})
+ endif()
+
+endfunction()