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:39 UTC

[1/6] mesos git commit: Windows: Removed deprecated flag parsing behavior.

Repository: mesos
Updated Branches:
  refs/heads/master 8ca6e6f04 -> 4e0a30f66


Windows: Removed deprecated flag parsing behavior.

On Posix, you can load a file into a flag by specifying prefixing
the flag value with a forward slash.  This behavior has been
deprecated since 0.22.

Therefore, on Windows, we choose to omit the deprecated code
instead of porting it.

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


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

Branch: refs/heads/master
Commit: 877f24bbeb06f8ce25b7e2e7279e542f492fdb76
Parents: 7b74227
Author: Jeff Coffler <je...@taltos.com>
Authored: Mon May 8 18:21:43 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon May 15 09:44:07 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/flags/parse.hpp | 8 ++++++++
 3rdparty/stout/tests/flags_tests.cpp         | 8 +++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/877f24bb/3rdparty/stout/include/stout/flags/parse.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/parse.hpp b/3rdparty/stout/include/stout/flags/parse.hpp
index 65edd86..3448c57 100644
--- a/3rdparty/stout/include/stout/flags/parse.hpp
+++ b/3rdparty/stout/include/stout/flags/parse.hpp
@@ -87,12 +87,15 @@ inline Try<net::IP> parse(const std::string& value)
 template <>
 inline Try<JSON::Object> parse(const std::string& value)
 {
+#ifndef __WINDOWS__
   // A value that already starts with 'file://' will properly be
   // loaded from the file and put into 'value' but if it starts with
   // '/' we need to explicitly handle it for backwards compatibility
   // reasons (because we used to handle it before we introduced the
   // 'fetch' mechanism for flags that first fetches the data from URIs
   // such as 'file://').
+  //
+  // NOTE: Because this code is deprecated, it is not supported on Windows.
   if (strings::startsWith(value, "/")) {
     LOG(WARNING) << "Specifying an absolute filename to read a command line "
                     "option out of without using 'file:// is deprecated and "
@@ -106,6 +109,7 @@ inline Try<JSON::Object> parse(const std::string& value)
     }
     return JSON::parse<JSON::Object>(read.get());
   }
+#endif // __WINDOWS__
   return JSON::parse<JSON::Object>(value);
 }
 
@@ -113,12 +117,15 @@ inline Try<JSON::Object> parse(const std::string& value)
 template <>
 inline Try<JSON::Array> parse(const std::string& value)
 {
+#ifndef __WINDOWS__
   // A value that already starts with 'file://' will properly be
   // loaded from the file and put into 'value' but if it starts with
   // '/' we need to explicitly handle it for backwards compatibility
   // reasons (because we used to handle it before we introduced the
   // 'fetch' mechanism for flags that first fetches the data from URIs
   // such as 'file://').
+  //
+  // NOTE: Because this code is deprecated, it is not supported on Windows.
   if (strings::startsWith(value, "/")) {
     LOG(WARNING) << "Specifying an absolute filename to read a command line "
                     "option out of without using 'file:// is deprecated and "
@@ -132,6 +139,7 @@ inline Try<JSON::Array> parse(const std::string& value)
     }
     return JSON::parse<JSON::Array>(read.get());
   }
+#endif // __WINDOWS__
   return JSON::parse<JSON::Array>(value);
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/877f24bb/3rdparty/stout/tests/flags_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/flags_tests.cpp b/3rdparty/stout/tests/flags_tests.cpp
index e2681f8..d78ab55 100644
--- a/3rdparty/stout/tests/flags_tests.cpp
+++ b/3rdparty/stout/tests/flags_tests.cpp
@@ -978,9 +978,10 @@ TEST(FlagsTest, JSON)
 class FlagsFileTest : public TemporaryDirectoryTest {};
 
 
-// TODO(hausdorff): Enable this test on Windows. Currently `flags::parse`
-// assumes filesystems are rooted at '/'. See MESOS-5937.
-TEST_F_TEMP_DISABLED_ON_WINDOWS(FlagsFileTest, JSONFile)
+#ifndef __WINDOWS__
+// This tests deprecated code that pre-dates Windows support for Mesos.
+// Hence, we should not build or enable this test on Windows.
+TEST_F(FlagsFileTest, JSONFile)
 {
   class TestFlags : public virtual FlagsBase
   {
@@ -1015,6 +1016,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FlagsFileTest, JSONFile)
 
   ASSERT_SOME_EQ(object, flags.json);
 }
+#endif // __WINDOWS__
 
 
 TEST_F(FlagsFileTest, FilePrefix)


[6/6] mesos git commit: Windows: Updated `support/windows-build.bat`.

Posted by jo...@apache.org.
Windows: Updated `support/windows-build.bat`.

This helper script now understands the environment variable
`CMAKE_GENERATOR` so that users can change the generator;
the default is still Visual Studio 14.

Direct usage of `msbuild` was replaced with `cmake --build`.

We now build `mesos-tests` in the same pattern as `stout-tests` and
`libprocess-tests`. If admin privileges are missing, we skip running the
tests, but still proceed to build the general target.

We set the CMake toolset instead of an environment variable for
`PreferredToolArchitecture`.

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


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

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

----------------------------------------------------------------------
 support/windows-build.bat | 38 ++++++++++++++------------------------
 1 file changed, 14 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4e0a30f6/support/windows-build.bat
----------------------------------------------------------------------
diff --git a/support/windows-build.bat b/support/windows-build.bat
index 88e177c..100013e 100644
--- a/support/windows-build.bat
+++ b/support/windows-build.bat
@@ -17,8 +17,10 @@ REM limitations under the License.
 @echo on
 
 REM NOTE: Before you run this script, you must have the Visual Studio
-REM environment variables set up. Visual Studio provides a script to do
-REM this at `/path/to/Visual Studio 14/VC/vcvarsall.bat`.
+REM environment variables set up. Visual Studio provides a script to do this,
+REM depending on the version of Visual Studio installed:
+REM /path/to/Visual Studio 14/VC/vcvarsall.bat
+REM /path/to/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat
 
 REM NOTE: Batch doesn't have any way of exiting upon failing a command.
 REM The best we can do is add this line after every command that matters:
@@ -49,37 +51,26 @@ REM Generate the Visual Studio solution.
 REM You can pass in other flags by setting `OTHER_CMAKE_OPTIONS` before
 REM calling the script. For example, the ASF CI will add `-DPATCHEXE_PATH=...`
 REM because the path to GNU Patch is not the default.
-cmake .. -G "Visual Studio 14 2015 Win64" -DENABLE_LIBEVENT=1 -DHAS_AUTHENTICATION=0 %OTHER_CMAKE_OPTIONS%
+if not defined CMAKE_GENERATOR (set CMAKE_GENERATOR=Visual Studio 15 2017 Win64)
+cmake .. -G "%CMAKE_GENERATOR%" -T "host=x64" -DENABLE_LIBEVENT=1 -DHAS_AUTHENTICATION=0 %OTHER_CMAKE_OPTIONS%
 if %errorlevel% neq 0 exit /b %errorlevel%
 
-REM NOTE: We set the environment variable `PreferredToolArchitecture`
-REM to work around some known issues in Visual Studio's linking step.
-REM Without this variable set, MSVC may take hours/days to link
-REM and may sometimes erroneously fail to find the library to link against.
-SET PreferredToolArchitecture=x64
-
-REM NOTE: The build option `/m` tells Visual Studio to build projects in
-REM parallel if possible.
-
-REM NOTE: Specifying a build "target" is done via the build option `/t`.
-REM Multiple targets can be specified with semi-comma separation.
-
 REM Build and run the stout tests.
-msbuild Mesos.sln /m /t:stout-tests
+cmake --build . --target stout-tests --config Debug
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 "3rdparty/stout/tests/Debug/stout-tests.exe"
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM Build and run the libprocess tests.
-msbuild Mesos.sln /m /t:libprocess-tests
+cmake --build . --target libprocess-tests --config Debug
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 "3rdparty/libprocess/src/tests/Debug/libprocess-tests.exe"
 if %errorlevel% neq 0 exit /b %errorlevel%
 
-REM Build everything else.
-msbuild Mesos.sln /m
+REM Build and run the mesos tests.
+cmake --build . --target mesos-tests --config Debug
 if %errorlevel% neq 0 exit /b %errorlevel%
 
 REM Due to how Mesos uses and creates symlinks, the next test suite
@@ -89,13 +80,12 @@ REM See: https://technet.microsoft.com/en-us/library/bb490711.aspx
 net session >nul 2>&1
 if %errorlevel% neq 0 (
     echo Administrator permissions not detected.  Skipping Mesos tests...
-    exit /b 0
+) else (
+    REM Run mesos tests.
+    "src/mesos-tests.exe" --verbose
+    if %errorlevel% neq 0 exit /b %errorlevel%
 )
 
-REM Run mesos tests.
-"src/mesos-tests.exe" --verbose
-if %errorlevel% neq 0 exit /b %errorlevel%
-
 goto :eof
 
 REM If we are not in the root directory, print error and exit.


[2/6] mesos git commit: Windows: Stout: Properly implemented path::absolute.

Posted by jo...@apache.org.
Windows: Stout: Properly implemented path::absolute.

On Posix, an absolute path simply starts with a forward-slash.

On Windows, there are a few more cases to consider:
  * Absolute paths can start with a drive letter (A-Z, a-z)
    and can be followed by a backslash or forward slash (i.e. `C:\`)
  * Anything that begins with `\\?\` is an absolute path.
  * Network paths like `\\server\...` are also absolute.
  * On the other hand, starting with a *single* backslash is not
    sufficient to make an absolute path.

NOTE: As with the Posix implementation, `path::absolute` returns
a valid only when the path itself is valid.

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


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

Branch: refs/heads/master
Commit: 7b742271b4e1bf56645433806b05a220bee31832
Parents: 8ca6e6f
Author: Jeff Coffler <je...@taltos.com>
Authored: Mon May 8 17:44:41 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon May 15 09:44:07 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/path.hpp | 39 ++++++++++++++++++++++++++++++
 3rdparty/stout/tests/CMakeLists.txt   |  2 +-
 3rdparty/stout/tests/path_tests.cpp   | 36 ++++++++++++++++++++++++---
 3 files changed, 72 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7b742271/3rdparty/stout/include/stout/path.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/path.hpp b/3rdparty/stout/include/stout/path.hpp
index 2d2088a..6ee3a44 100644
--- a/3rdparty/stout/include/stout/path.hpp
+++ b/3rdparty/stout/include/stout/path.hpp
@@ -62,9 +62,48 @@ inline std::string join(const std::vector<std::string>& paths)
 }
 
 
+/**
+ * Returns whether the given path is an absolute path.
+ * If an invalid path is given, the return result is also invalid.
+ */
 inline bool absolute(const std::string& path)
 {
+#ifndef __WINDOWS__
   return strings::startsWith(path, os::PATH_SEPARATOR);
+#else
+  // NOTE: We do not use `PathIsRelative` Windows utility function
+  // here because it does not support long paths.
+  //
+  // See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
+  // for details on paths. In short, an absolute path for files on Windows
+  // looks like one of the following:
+  //   * "[A-Za-z]:\"
+  //   * "[A-Za-z]:/"
+  //   * "\\?\..."
+  //   * "\\server\..." where "server" is a network host.
+  //
+  // NOLINT(whitespace/line_length)
+
+  // A uniform naming convention (UNC) name of any format,
+  // always starts with two backslash characters.
+  if (strings::startsWith(path, "\\\\")) {
+    return true;
+  }
+
+  // A disk designator with a slash, for example "C:\" or "d:/".
+  if (path.length() < 3) {
+    return false;
+  }
+
+  const char letter = path[0];
+  if (!((letter >= 'A' && letter <= 'Z') ||
+        (letter >= 'a' && letter <= 'z'))) {
+    return false;
+  }
+
+  std::string colon = path.substr(1, 2);
+  return colon == ":\\" || colon == ":/";
+#endif // __WINDOWS__
 }
 
 } // namespace path {

http://git-wip-us.apache.org/repos/asf/mesos/blob/7b742271/3rdparty/stout/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/CMakeLists.txt b/3rdparty/stout/tests/CMakeLists.txt
index 4bbe713..1ed8da5 100644
--- a/3rdparty/stout/tests/CMakeLists.txt
+++ b/3rdparty/stout/tests/CMakeLists.txt
@@ -41,6 +41,7 @@ set(STOUT_ROOT_TESTS_SRC
   numify_tests.cpp
   option_tests.cpp
   os_tests.cpp
+  path_tests.cpp
   protobuf_tests.pb.h
   protobuf_tests.proto
   recordio_tests.cpp
@@ -56,7 +57,6 @@ set(STOUT_ROOT_TESTS_SRC
 if (NOT WIN32)
   set(STOUT_ROOT_TESTS_SRC
     ${STOUT_ROOT_TESTS_SRC}
-    path_tests.cpp
     protobuf_tests.cpp
     protobuf_tests.pb.cc
     svn_tests.cpp

http://git-wip-us.apache.org/repos/asf/mesos/blob/7b742271/3rdparty/stout/tests/path_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/path_tests.cpp b/3rdparty/stout/tests/path_tests.cpp
index 0490d93..f8c14d5 100644
--- a/3rdparty/stout/tests/path_tests.cpp
+++ b/3rdparty/stout/tests/path_tests.cpp
@@ -31,7 +31,7 @@ using std::vector;
 
 
 // Test many corner cases of Path::basename.
-TEST(PathTest, Basename)
+TEST_TEMP_DISABLED_ON_WINDOWS(PathTest, Basename)
 {
   // Empty path check.
   EXPECT_EQ(".", Path("").basename());
@@ -63,7 +63,7 @@ TEST(PathTest, Basename)
 
 
 // Test many corner cases of Path::dirname.
-TEST(PathTest, Dirname)
+TEST_TEMP_DISABLED_ON_WINDOWS(PathTest, Dirname)
 {
   // Empty path check.
   EXPECT_EQ(".", Path("").dirname());
@@ -100,7 +100,7 @@ TEST(PathTest, Dirname)
 }
 
 
-TEST(PathTest, Extension)
+TEST_TEMP_DISABLED_ON_WINDOWS(PathTest, Extension)
 {
   EXPECT_NONE(Path(".").extension());
   EXPECT_NONE(Path("..").extension());
@@ -123,7 +123,7 @@ TEST(PathTest, Extension)
 }
 
 
-TEST(PathTest, Join)
+TEST_TEMP_DISABLED_ON_WINDOWS(PathTest, Join)
 {
   EXPECT_EQ("a/b/c", path::join("a", "b", "c"));
   EXPECT_EQ("/a/b/c", path::join("/a", "b", "c"));
@@ -152,6 +152,33 @@ TEST(PathTest, Join)
 
 TEST(PathTest, Absolute)
 {
+#ifdef __WINDOWS__
+  // Check absolute paths.
+  EXPECT_TRUE(path::absolute("C:\\foo\\bar\\baz"));
+  EXPECT_TRUE(path::absolute("c:\\"));
+  EXPECT_TRUE(path::absolute("C:/"));
+  EXPECT_TRUE(path::absolute("c:/"));
+  EXPECT_TRUE(path::absolute("X:\\foo"));
+  EXPECT_TRUE(path::absolute("X:\\foo"));
+  EXPECT_TRUE(path::absolute("y:\\bar"));
+  EXPECT_TRUE(path::absolute("y:/bar"));
+  EXPECT_TRUE(path::absolute("\\\\?\\"));
+  EXPECT_TRUE(path::absolute("\\\\?\\C:\\Program Files"));
+  EXPECT_TRUE(path::absolute("\\\\?\\C:/Program Files"));
+  EXPECT_TRUE(path::absolute("\\\\?\\C:\\Path"));
+  EXPECT_TRUE(path::absolute("\\\\server\\share"));
+
+  // Check invalid paths.
+  EXPECT_FALSE(path::absolute("abc:/"));
+  EXPECT_FALSE(path::absolute("1:/"));
+  EXPECT_TRUE(path::absolute("\\\\?\\relative"));
+
+  // Check relative paths.
+  EXPECT_FALSE(path::absolute("relative"));
+  EXPECT_FALSE(path::absolute("\\file-without-disk"));
+  EXPECT_FALSE(path::absolute("/file-without-disk"));
+  EXPECT_FALSE(path::absolute("N:file-without-dir"));
+#else
   // Check absolute paths.
   EXPECT_TRUE(path::absolute("/"));
   EXPECT_TRUE(path::absolute("/foo"));
@@ -165,6 +192,7 @@ TEST(PathTest, Absolute)
   EXPECT_FALSE(path::absolute("../"));
   EXPECT_FALSE(path::absolute("./foo"));
   EXPECT_FALSE(path::absolute("../foo"));
+#endif // __WINDOWS__
 }
 
 


[4/6] mesos git commit: CMake: Fixed `/debug:fastlink` on Windows.

Posted by jo...@apache.org.
CMake: Fixed `/debug:fastlink` on Windows.

A previous commit attempted to enable this option, but it was not
actually being used by the linker. This patch correctly adds the option
to each linker flag variable for static/shared libraries, modules, and
executables, and only for the debug configuration. This results in much
faster link times.

Also, the `/zc:inline` option was removed, as it is only relevant in
optimized builds (i.e. release configurations).

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


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

Branch: refs/heads/master
Commit: e938dade76cba4202cc14c6b7fbdcf24d1cccd4e
Parents: 877f24b
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed May 10 14:03:22 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon May 15 09:44:08 2017 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e938dade/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 7b2669f..08ecf27 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -74,11 +74,6 @@ if (WIN32)
         echo "ERROR: Environment variable 'PreferredToolArchitecture' must be set to 'x64', see MESOS-6720 for details" 1>&2 && EXIT 1
       )
     )
-
-  # Speed up incremental linking for the VS compiler/linker, for more info, see:
-  # https://blogs.msdn.microsoft.com/vcblog/2014/11/12/speeding-up-the-incremental-developer-build-scenario/
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline")
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /debug:FASTLINK")
 endif (WIN32)
 
 
@@ -239,6 +234,12 @@ string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "Linux" LINUX)
 # WINDOWS CONFIGURATION.
 ########################
 if (WIN32)
+  # Speed up incremental linking for the VS compiler/linker, for more info, see:
+  # https://blogs.msdn.microsoft.com/vcblog/2014/11/12/speeding-up-the-incremental-developer-build-scenario/
+  foreach(t EXE SHARED STATIC MODULE)
+    string(APPEND CMAKE_${t}_LINKER_FLAGS_DEBUG " /debug:fastlink")
+  endforeach()
+
   # COFF/PE and friends are somewhat limited in the number of sections they
   # allow for an object file. We use this to avoid those problems.
   set(CMAKE_CXX_FLAGS


[3/6] mesos git commit: CMake: Use `list(APPEND x ...)` over `set(x ${x} ...)`.

Posted by jo...@apache.org.
CMake: Use `list(APPEND x ...)` over `set(x ${x} ...)`.

This removes a CMake anti-pattern where `set` was used to append to a
variable, instead of the more explicit `list(APPEND)` or
`string(APPEND)` alternatives.

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


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

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

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 50 ++++++++++-------------------------
 1 file changed, 14 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4ce689c8/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 08ecf27..9d10781 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -41,7 +41,6 @@ if (ENABLE_PRECOMPILED_HEADERS)
   # a single source file to reduce the number of files that need to be opened
   # and read. We disable "unity" builds for now.
   set(COTIRE_ADD_UNITY_BUILD FALSE)
-
   set(COTIRE_VERBOSE ${VERBOSE})
 endif (ENABLE_PRECOMPILED_HEADERS)
 
@@ -212,7 +211,7 @@ if (NOT WIN32)
       "flag. Please use a different C++ compiler.")
   endif (NOT COMPILER_SUPPORTS_CXX11)
 
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+  string(APPEND CMAKE_CXX_FLAGS " -std=c++11")
 
   # Directory structure for some build artifacts.
   # This is defined for use in tests.
@@ -242,15 +241,15 @@ if (WIN32)
 
   # COFF/PE and friends are somewhat limited in the number of sections they
   # allow for an object file. We use this to avoid those problems.
-  set(CMAKE_CXX_FLAGS
-    "${CMAKE_CXX_FLAGS} /bigobj -DGOOGLE_GLOG_DLL_DECL= -DCURL_STATICLIB /vd2")
+  string(APPEND CMAKE_CXX_FLAGS
+    " /bigobj -DGOOGLE_GLOG_DLL_DECL= -DCURL_STATICLIB /vd2")
 
   # Enable multi-threaded compilation.
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+  string(APPEND CMAKE_CXX_FLAGS " /MP")
 
   # Build against the multi-threaded, static version of the runtime library.
-  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
-  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
+  string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MTd")
+  string(APPEND CMAKE_CXX_FLAGS_RELEASE " /MT")
 
   # Convenience flags to simplify Windows support in C++ source; used to
   # `#ifdef` out some platform-specific parts of Mesos.  We choose to define
@@ -258,18 +257,13 @@ if (WIN32)
   # to give the build system fine-grained control over what code is #ifdef'd
   # out in the future.  Using only flags defined by our build system to control
   # this logic is the clearest and most stable way of accomplishing this.
-  set(MESOS_CPPFLAGS
-    ${MESOS_CPPFLAGS}
-    -D__WINDOWS__
-    -DHAVE_LIBZ
-    )
+  list(APPEND MESOS_CPPFLAGS -D__WINDOWS__ -DHAVE_LIBZ)
 
   # Defines to disable warnings generated by Visual Studio when using
   # deprecated functions in CRT and the use of insecure functions in CRT.
   # TODO(dpravat): Once the entire codebase is changed to use secure CRT
   # functions, these defines should be removed.
-  set(MESOS_CPPFLAGS
-    ${MESOS_CPPFLAGS}
+  list(APPEND MESOS_CPPFLAGS
     -D_SCL_SECURE_NO_WARNINGS
     -D_CRT_SECURE_NO_WARNINGS
     -D_CRT_NONSTDC_NO_WARNINGS
@@ -295,11 +289,7 @@ if (WIN32)
   #
   # [1] https://google-glog.googlecode.com/svn/trunk/doc/glog.html#windows
   # [2] https://code.google.com/p/google-glog/source/browse/trunk/src/windows/glog/logging.h?r=113
-  set(MESOS_CPPFLAGS
-    ${MESOS_CPPFLAGS}
-    -DNOGDI
-    -DNOMINMAX
-    )
+  list(APPEND MESOS_CPPFLAGS -DNOGDI -DNOMINMAX)
 endif (WIN32)
 
 # GLOBAL CONFIGURATION.
@@ -309,10 +299,7 @@ if (HAS_AUTHENTICATION)
   # `-DHAS_AUTHENTICATION=${HAS_AUTHENTICATION}`, as this will define the
   # symbol, and our intention is to only define it if the CMake variable
   # `HAS_AUTHENTICATION` is set.
-  set(MESOS_CPPFLAGS
-    ${MESOS_CPPFLAGS}
-    -DHAS_AUTHENTICATION=1
-    )
+  list(APPEND MESOS_CPPFLAGS -DHAS_AUTHENTICATION=1)
 endif (HAS_AUTHENTICATION)
 
 # Enable the INT64 support for PicoJSON.
@@ -320,14 +307,9 @@ endif (HAS_AUTHENTICATION)
 # 'inttypes.h'.  Since other libraries may also import this header, it must
 # be globally defined so that PicoJson has access to the macros, regardless
 # of the order of inclusion.
-set(MESOS_CPPFLAGS
-  ${MESOS_CPPFLAGS}
-  -DPICOJSON_USE_INT64
-  -D__STDC_FORMAT_MACROS
-  )
+list(APPEND MESOS_CPPFLAGS -DPICOJSON_USE_INT64 -D__STDC_FORMAT_MACROS)
 
-set(MESOS_CPPFLAGS
-  ${MESOS_CPPFLAGS}
+list(APPEND MESOS_CPPFLAGS
   -DPKGLIBEXECDIR="${PKG_LIBEXEC_INSTALL_DIR}"
   -DLIBDIR="${LIB_INSTALL_DIR}"
   -DVERSION="${PACKAGE_VERSION}"
@@ -335,10 +317,7 @@ set(MESOS_CPPFLAGS
   )
 
 if (ENABLE_SSL)
-  set(MESOS_CPPFLAGS
-    ${MESOS_CPPFLAGS}
-    -DUSE_SSL_SOCKET=1
-    )
+  list(APPEND MESOS_CPPFLAGS -DUSE_SSL_SOCKET=1)
 endif (ENABLE_SSL)
 
 # Calculate some build information.
@@ -370,8 +349,7 @@ set(BUILD_JAVA_JVM_LIBRARY "")
 # NOTE: The quotes in these definitions are necessary. Without them, the
 # preprocessor will interpret the symbols as (e.g.) int literals and uquoted
 # identifiers, rather than the string values our code expects.
-set(MESOS_CPPFLAGS
-  ${MESOS_CPPFLAGS}
+list(APPEND MESOS_CPPFLAGS
   -DUSE_STATIC_LIB
   -DUSE_CMAKE_BUILD_CONFIG
   -DBUILD_JAVA_JVM_LIBRARY="${BUILD_JAVA_JVM_LIBRARY}"


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

Posted by jo...@apache.org.
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).
 ###############################################################################