Skip to content

Commit

Permalink
Windows:[2/2] Used ZK in Windows build.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlawindi authored and jmlvanre committed Jan 29, 2016
1 parent e547845 commit 00a4db1
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 5 deletions.
15 changes: 12 additions & 3 deletions 3rdparty/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ if (NOT WIN32)
${MESOS_3RDPARTY_SRC}/zookeeper-${ZOOKEEPER_VERSION}.patch
ZOOKEEPER_PATCH_CMD)
elseif (WIN32)
set(ZOOKEEPER_PATCH_CMD ${CMAKE_NOOP})
# Set the patch command which will utilize patch.exe in temp location for no elevation prompt
set(
ZOOKEEPER_PATCH_CMD
${PATCHEXE_LOCATION} --binary -p1 < ${MESOS_3RDPARTY_SRC}/zookeeper-${ZOOKEEPER_VERSION}.patch)

VS_BUILD_CMD(
ZOOKEEPER
${ZOOKEEPER_C_ROOT}/zookeeper-vs2015.sln
${CMAKE_BUILD_TYPE}
"zookeeper")

set(ZOOKEEPER_CONFIG_CMD ${CMAKE_NOOP})
set(ZOOKEEPER_BUILD_CMD ${CMAKE_NOOP})
set(ZOOKEEPER_INSTALL_CMD ${CMAKE_NOOP})
endif (NOT WIN32)

Expand All @@ -59,4 +68,4 @@ ExternalProject_Add(
BUILD_COMMAND ${ZOOKEEPER_BUILD_CMD}
INSTALL_COMMAND ${ZOOKEEPER_INSTALL_CMD}
URL ${ZOOKEEPER_URL}
)
)
84 changes: 82 additions & 2 deletions 3rdparty/cmake/Mesos3rdpartyConfigure.cmake
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,98 @@
set(MESOS_3RDPARTY_SRC ${CMAKE_SOURCE_DIR}/3rdparty)
set(MESOS_3RDPARTY_BIN ${CMAKE_BINARY_DIR}/3rdparty)

EXTERNAL("zookeeper" ${ZOOKEEPER_VERSION} "${MESOS_3RDPARTY_BIN}")
if (NOT WIN32)
EXTERNAL("zookeeper" ${ZOOKEEPER_VERSION} "${MESOS_3RDPARTY_BIN}")
elseif (WIN32)
# The latest release of ZK, 3.4.7, does not compile on Windows. Therefore, we
# pick a recent commit that does until the next release stabilizes.
EXTERNAL("zookeeper" "06d3f3f" "${MESOS_3RDPARTY_BIN}")
endif (NOT WIN32)

# Intermediate convenience variables for oddly-structured directories.
set(ZOOKEEPER_C_ROOT ${ZOOKEEPER_ROOT}/src/c)
set(ZOOKEEPER_LIB ${ZOOKEEPER_ROOT}-lib/lib)

# Convenience variables for include directories of third-party dependencies.
set(ZOOKEEPER_INCLUDE_DIR ${ZOOKEEPER_LIB}/include/zookeeper)
set(ZOOKEEPER_INCLUDE_GENDIR ${ZOOKEEPER_C_ROOT}/generated)
set(ZOOKEEPER_INCLUDE_DIR ${ZOOKEEPER_C_ROOT}/include)

# Convenience variables for `lib` directories of built third-party dependencies.
set(ZOOKEEPER_LIB_DIR ${ZOOKEEPER_LIB}/lib)

# Convenience variables for "lflags", the symbols we pass to CMake to generate
# things like `-L/path/to/glog` or `-lglog`.
set(ZOOKEEPER_LFLAG zookeeper_mt)

# Configure Windows use of the GNU patch utility;
# we attempt to find it in its default location,
# but this path may be customized.
#################################################
if (WIN32)
set(PROGRAMFILESX86 "PROGRAMFILES(X86)")
set(PATCHEXE_DEFAULT_LOCATION $ENV{${PROGRAMFILESX86}}/GnuWin32/bin)

set(PATCHEXE_PATH
${PATCHEXE_DEFAULT_LOCATION}
CACHE PATH "Path for GnuWin32 patch.exe")

set(
GNUWIN32_PATCH_EXECUTABLE
${PATCHEXE_PATH}/patch.exe
CACHE PATH "Full path for GnuWin32 patch.exe")

if (NOT EXISTS ${GNUWIN32_PATCH_EXECUTABLE})
message(
FATAL_ERROR
"GnuWin32 patch.exe was not found. Use -DPATCHEXE_PATH to "
"provide the local path of GnuWin32 patch.exe. "
"Mesos for Windows requires GnuWin32 patch.exe "
"to apply updates. You may get it from "
"http://gnuwin32.sourceforge.net/packages/patch.htm"
)
else (NOT EXISTS ${GNUWIN32_PATCH_EXECUTABLE})
message(
STATUS
"GnuWin32 patch.exe exists at: "
${GNUWIN32_PATCH_EXECUTABLE})

# Since Windows Vista patch.exe has been reqesting elevation to work
# eventhough it is not required to apply patches. So to avoid a prompt
# for elevation a manifest will be applied to patch.exe in the current
# user temp directory.

# First: Copy patch.exe and patch.exe.manifest to the user temp dir where
# elevation is not required. 'Set \Users\<user>\AppData\Local\Temp' dir.
set(USER_TMP_DIR "TMP")

# Set full path for temp location of patch.exe.
set(PATCHEXE_LOCATION $ENV{${USER_TMP_DIR}}/patch.exe)

#set full path for patch.exe.manifest.
set(PATCHMANIFEST_LOCATION ${MESOS_3RDPARTY_SRC}/patch.exe.manifest)

# Set full path for temp location of patch.exe.manifest.
set(PATCHMANIFEST_TMP_LOCATION $ENV{${USER_TMP_DIR}}/patch.exe.manifest)

# Copy patch.exe and path.exe.manifest to temp location.
configure_file(
${GNUWIN32_PATCH_EXECUTABLE}
${PATCHEXE_LOCATION}
COPYONLY)
configure_file(
${PATCHMANIFEST_LOCATION}
${PATCHMANIFEST_TMP_LOCATION}
COPYONLY)

# Second: Apply manifest to patch command.
set(
APPLY_PATCH_MANIFEST_COMMAND
"mt.exe"
-manifest mt ${PATCHMANIFEST_TMP_LOCATION}
-outputresource:${PATCHEXE_LOCATION};1)

add_custom_command(
OUTPUT patch.exe
COMMAND ${APPLY_PATCH_MANIFEST_COMMAND})
endif (NOT EXISTS ${GNUWIN32_PATCH_EXECUTABLE})
endif (WIN32)
12 changes: 12 additions & 0 deletions 3rdparty/patch.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<!-- Make sure that UAC believes
that it does not require administrative privilege -->
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ if (REBUNDLED AND ENABLE_LIBEVENT)
)
endif (REBUNDLED AND ENABLE_LIBEVENT)

if (WIN32 AND REBUNDLED)
message(
WARNING
"The current supported version of ZK does not compile on Windows, and does "
"not come rebundled in the Mesos repository. It must be downloaded from "
"the Internet, even though the `REBUNDLED` flag was set."
)
endif (WIN32 AND REBUNDLED)

if (WIN32 AND (NOT ENABLE_LIBEVENT))
message(
FATAL_ERROR
Expand Down
1 change: 1 addition & 0 deletions src/slave/cmake/SlaveConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set(AGENT_INCLUDE_DIRS
${PICOJSON_INCLUDE_DIR}
${PROTOBUF_INCLUDE_DIR}
${ZOOKEEPER_INCLUDE_DIR}
${ZOOKEEPER_INCLUDE_GENDIR}
)

# Define third-party lib install directories. Used to tell the compiler
Expand Down

0 comments on commit 00a4db1

Please sign in to comment.