You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/05/15 17:33:43 UTC

[5/6] mesos git commit: Windows: Fixed toolset handling.

Windows: Fixed toolset handling.

Mesos must be built with the 64-bit tools. Previously, we added a
dependency which checked if a certain environment variable was set. When
it failed, the message would be a cryptic message:

    error MSB6006: "cmd.exe" exited with code 255.

As the environment variable had to be picked up by every toolchain
(Visual Studio Code, CMake, MSBuild, Visual Studio), it was a frequent
cause of build frustrations.

This patch removes the `ENSURE_TOOL_ARCH` custom command, and instead
asserts at configuration time that the toolset matches `host=x64`. With
this toolset, CMake embeds the preferred tool architecture in the
generated solutions, eliminating the need for an environment variable to
be set, or for `/p:PreferredToolArchitecture=x64` to be passed to the
build tool directly.

Review: https://reviews.apache.org/r/59157/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3fb5f283
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3fb5f283
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3fb5f283

Branch: refs/heads/master
Commit: 3fb5f2839c11f4c2cbea35c1a5022e5f4dd3ffab
Parents: 4ce689c
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed May 10 14:10:05 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon May 15 09:44:08 2017 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake     | 21 ++++++++-------------
 src/CMakeLists.txt                   |  4 ----
 src/slave/cmake/AgentConfigure.cmake |  4 ----
 3 files changed, 8 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3fb5f283/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 9d10781..0567b74 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -60,19 +60,14 @@ if (WIN32)
   # libmesos to occasionally take hours, and one that causes us to be able to
   # fail to open the `mesos-x.lib` file. These have been confirmed as bugs with
   # the MSVC backend team by hausdorff.
-  set(
-    ENSURE_TOOL_ARCH ensure_tool_arch
-    CACHE STRING "Ensures %PreferredToolArchitecture% == x64. See MESOS-6720.")
-
-  # NOTE: The "ERROR:" at the beginning of this message allows Visual Studio to
-  # pick up the error message and print it in the "Error List" pane.
-  ADD_CUSTOM_TARGET(
-    ${ENSURE_TOOL_ARCH} ALL
-    COMMAND
-      IF NOT "%PreferredToolArchitecture%" == "x64" (
-        echo "ERROR: Environment variable 'PreferredToolArchitecture' must be set to 'x64', see MESOS-6720 for details" 1>&2 && EXIT 1
-      )
-    )
+  set(PREFERRED_TOOLSET "host=x64")
+  if (NOT CMAKE_GENERATOR_TOOLSET MATCHES ${PREFERRED_TOOLSET})
+    message(
+      FATAL_ERROR
+      "The x64 toolset MUST be used. See MESOS-6720 for details. "
+      "Please use `cmake -T ${PREFERRED_TOOLSET}`."
+  )
+  endif (NOT CMAKE_GENERATOR_TOOLSET MATCHES ${PREFERRED_TOOLSET})
 endif (WIN32)
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/3fb5f283/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 40d921e..eef718d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -570,10 +570,6 @@ add_dependencies(
   ${AGENT_DEPENDENCIES}
   )
 
-if (WIN32)
-  add_dependencies(${MESOS_TARGET} ${ENSURE_TOOL_ARCH})
-endif (WIN32)
-
 # ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
 ######################################################
 target_link_libraries(${MESOS_LIBS_TARGET} ${MESOS_PROTOBUF_TARGET} ${AGENT_LIBS})

http://git-wip-us.apache.org/repos/asf/mesos/blob/3fb5f283/src/slave/cmake/AgentConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/slave/cmake/AgentConfigure.cmake b/src/slave/cmake/AgentConfigure.cmake
index 2e7ae6e..8d930d3 100644
--- a/src/slave/cmake/AgentConfigure.cmake
+++ b/src/slave/cmake/AgentConfigure.cmake
@@ -45,10 +45,6 @@ set(AGENT_DEPENDENCIES
   make_bin_src_dir
   )
 
-if (WIN32)
-  set(AGENT_DEPENDENCIES ${AGENT_DEPENDENCIES} ${ENSURE_TOOL_ARCH})
-endif (WIN32)
-
 # Define third-party include directories. Tells compiler toolchain where to get
 # headers for our third party libs (e.g., -I/path/to/glog on Linux).
 ###############################################################################