Add CMake-based build system for the process library. See MESOS-898.
This commit is the second in a series of two commits that will introduce a CMake-based build system for Mesos. The first introduced the build system for the "core Mesos" project; this one will introduce a similar system for the process library. For more details see the "core Mesos" commit. Review: https://reviews.apache.org/r/36514 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/619f45f0 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/619f45f0 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/619f45f0 Branch: refs/heads/master Commit: 619f45f0f72381372fc31e824aec2aa5d27de467 Parents: 4c1aa47 Author: Alex Clemmer <[email protected]> Authored: Tue Jul 21 17:24:26 2015 -0700 Committer: Benjamin Hindman <[email protected]> Committed: Tue Jul 21 17:49:53 2015 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/3rdparty/CMakeLists.txt | 138 +++++++++++++++++ 3rdparty/libprocess/CMakeLists.txt | 28 ++++ .../libprocess/cmake/ProcessConfigure.cmake | 148 +++++++++++++++++++ .../cmake/ProcessTestsConfigure.cmake | 50 +++++++ 3rdparty/libprocess/cmake/macros/External.cmake | 80 ++++++++++ .../libprocess/cmake/macros/PatchCommand.cmake | 29 ++++ 3rdparty/libprocess/src/CMakeLists.txt | 74 ++++++++++ 3rdparty/libprocess/src/tests/CMakeLists.txt | 57 +++++++ 8 files changed, 604 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/3rdparty/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt new file mode 100644 index 0000000..fc6125e --- /dev/null +++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt @@ -0,0 +1,138 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +include(ExternalProject) + +# Downloads, configures, and compiles the third party libraries for the process +# library (i.e., 3rdparty/libprocess/3rdparty). + +# DEFINE SOURCES OF THIRD_PARTY DEPENDENCIES. +############################################# +set(REBUNDLED_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +if (REBUNDLED) + set(BOOST_URL ${REBUNDLED_DIR}/boost-${BOOST_VERSION}.tar.gz) + set(GLOG_URL ${REBUNDLED_DIR}/glog-${GLOG_VERSION}.tar.gz) + set(PICOJSON_URL ${REBUNDLED_DIR}/picojson-${PICOJSON_VERSION}.tar.gz) + set(HTTP_PARSER_URL ${REBUNDLED_DIR}/ry-http-parser-${HTTP_PARSER_VERSION}.tar.gz) + set(LIBEV_URL ${REBUNDLED_DIR}/libev-${LIBEV_VERSION}.tar.gz) +else (REBUNDLED) + # TODO(hausdorff): depends on the github mirror, should remove when possible. + set(BOOST_URL https://github.com/apache/mesos/raw/master/3rdparty/libprocess/3rdparty/boost-${BOOST_VERSION}.tar.gz) + set(GLOG_URL https://google-glog.googlecode.com/files/glog-${GLOG_VERSION}.tar.gz) + # NOTE: This url can't be versioned like the others, because it depends on + # specific commit, and isn't in our upstream. + set(PICOJSON_URL https://github.com/kazuho/picojson/tarball/4f93734ade33ea0f5e5b4de35fc6b2c324a8dca6) + # TODO(hausdorff): depends on the github mirror, should remove when possible. + set(HTTP_PARSER_URL https://github.com/apache/mesos/raw/master/3rdparty/libprocess/3rdparty/ry-http-parser-${HTTP_PARSER_VERSION}.tar.gz) + # TODO(hausdorff): depends on the github mirror, should remove when possible. + set(LIBEV_URL https://github.com/apache/mesos/raw/master/3rdparty/libprocess/3rdparty/libev-${LIBEV_VERSION}.tar.gz) +endif (REBUNDLED) + +# DEFINE BUILD/PATCH/CONFIGURE COMMANDS FOR THIRD-PARTY LIBS. +############################################################# +if (NOT WIN32) + set(GLOG_CONFIG_CMD ${GLOG_ROOT}/src/../configure --prefix=${GLOG_LIB}) + set(GLOG_BUILD_CMD make) + set(GLOG_INSTALL_CMD make install) + # Patch glog to deal with a problem that appears when compiling on clang + # under the C++11 standard. cf. MESOS-860, MESOS-966. + PATCH_CMD(${PROCESS_3RD_SRC}/glog-0.3.3.patch GLOG_PATCH_CMD) + + set(RY_BUILD_CMD make -C ${HTTP_PARSER_ROOT}) + set(RY_INSTALL_CMD ar -rv libhttp_parser.a ${HTTP_PARSER_ROOT}/http_parser_g.o) + + set(LIBEV_CONFIG_CMD ${LIBEV_ROOT}/configure) + set(LIBEV_BUILD_CMD make) + # Patch libev to keep it from reaping child processes. + PATCH_CMD(${PROCESS_3RD_SRC}/libev-4.15.patch LIBEV_PATCH_CMD) +endif (NOT WIN32) + +# THIRD-PARTY LIBRARIES. Tell the build system how to pull in and build third- +# party libraries at compile time, using the ExternalProject_Add macro. +############################################################################## +ExternalProject_Add( + ${BOOST_TARGET} + PREFIX ${BOOST_CMAKE_ROOT} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + URL "${BOOST_URL}" + ) + +ExternalProject_Add( + ${GLOG_TARGET} + PREFIX ${GLOG_CMAKE_ROOT} + # Quotes are important in the following commands. Building glog on WIN32 + # must be done in Visual Studio, and in that case, these commands must be + # nops. But if you take out the quote marks, CMake will treat this as an + # empty build command, and will attempt to build glog as a CMake project. + PATCH_COMMAND "${GLOG_PATCH_CMD}" + CONFIGURE_COMMAND "${GLOG_CONFIG_CMD}" + BUILD_COMMAND "${GLOG_BUILD_CMD}" + INSTALL_COMMAND "${GLOG_INSTALL_CMD}" + URL "${GLOG_URL}" + ) + +ExternalProject_Add( + ${PICOJSON_TARGET} + PREFIX ${PICOJSON_CMAKE_ROOT} + DOWNLOAD_NAME ${PICOJSON_TARGET}.tar.gz + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + URL "${PICOJSON_URL}" + ) + +ExternalProject_Add( + ${HTTP_PARSER_TARGET} + PREFIX ${HTTP_PARSER_CMAKE_ROOT} + CONFIGURE_COMMAND "" + BUILD_COMMAND "${RY_BUILD_CMD}" + INSTALL_COMMAND "${RY_INSTALL_CMD}" + URL "${HTTP_PARSER_URL}" + ) + +ExternalProject_Add( + ${LIBEV_TARGET} + PREFIX ${LIBEV_CMAKE_ROOT} + PATCH_COMMAND "${LIBEV_PATCH_CMD}" + CONFIGURE_COMMAND "${LIBEV_CONFIG_CMD}" + BUILD_COMMAND "${LIBEV_BUILD_CMD}" + INSTALL_COMMAND "" + URL "${LIBEV_URL}" + ) + +# THIRD-PARTY LIBRARIES FOR TESTS. +################################## +if (REBUNDLED) + set(GMOCK_URL ${REBUNDLED_DIR}/gmock-${GMOCK_VERSION}.tar.gz) +else (REBUNDLED) + # TODO(hausdorff): depends on the github mirror, should remove when possible. + set(GMOCK_URL https://github.com/apache/mesos/raw/master/3rdparty/libprocess/3rdparty/gmock-${GMOCK_VERSION}.tar.gz) +endif (REBUNDLED) + +if (NOT WIN32) + set(GMOCK_CONFIG_CMD ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib/lib) + set(GMOCK_BUILD_CMD make) +endif (NOT WIN32) + +ExternalProject_Add( + ${GMOCK_TARGET} + PREFIX ${GMOCK_CMAKE_ROOT} + CONFIGURE_COMMAND "${GMOCK_CONFIG_CMD}" + BUILD_COMMAND "${GMOCK_BUILD_CMD}" + INSTALL_COMMAND "" + URL "${GMOCK_URL}" + ) http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/CMakeLists.txt b/3rdparty/libprocess/CMakeLists.txt new file mode 100755 index 0000000..6bc5a68 --- /dev/null +++ b/3rdparty/libprocess/CMakeLists.txt @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +include(ProcessTestsConfigure) + +# BUILD THIRD-PARTY DEPENDENCIES FIRST. +####################################### +add_subdirectory(3rdparty) + +# BUILD THE PROCESS LIBRARY. +############################ +add_subdirectory(src) + +# PROCESS TESTING INFRASTRUCTURE. +################################# +add_subdirectory(src/tests) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/cmake/ProcessConfigure.cmake ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake b/3rdparty/libprocess/cmake/ProcessConfigure.cmake new file mode 100755 index 0000000..cb5fd1d --- /dev/null +++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake @@ -0,0 +1,148 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +############################################################### +# EXPORTS VARIABLES NEEDED TO LINK TO THIRD-PARTY LIBS. These are used +# throughout the Mesos project. +# +# THIS INCLUDES things like: +# * "Public interface" stuff, like which headers we need in order to link to +# libprocess. +# * Where to look to find built libraries. +# * Version information of the third-party libraries in use. +# +# This DOES NOT include: +# * Where to find include headers for tests -- the rest of Mesos does not +# need this information. +# * Any information about how to build these libraries. That's in +# libprocess/CMakeLists.txt +# * Information required to build third-party libraries, wuch as what source +# files we need to compile libprocess. +# * Build commands actually used to compile (e.g.) libprocess. +# +# RATIONALE: Autoconf makes linking to third party dependencies as simple as +# pointing at the underlying makefile. In CMake, this is harder because we do +# not assume there are Makefiles at all. Thus, it is useful to export variables +# with things like which header files you need to include to link to third +# party libraries, and where in the directory tree you need to look to get the +# actual libraries. + +set(PROCESS_PACKAGE_VERSION 0.0.1) +set(PROCESS_PACKAGE_SOVERSION 0) +set(PROCESS_TARGET process-${PROCESS_PACKAGE_VERSION}) + +# VARIABLES REQUIRED TO RUN CONFIG SCRIPTS. +########################################### +set(PROTOBUF_VERSION 2.5.0) + +# DEFINE DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS. +################################################## +set(PROCESS_3RD_SRC ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/3rdparty/) +set(PROCESS_3RD_BIN ${CMAKE_BINARY_DIR}/3rdparty/libprocess/3rdparty/) + +set(STOUT ${PROCESS_3RD_SRC}/stout) + +EXTERNAL("boost" "1.53.0" "${PROCESS_3RD_BIN}") +EXTERNAL("glog" "0.3.3" "${PROCESS_3RD_BIN}") +EXTERNAL("picojson" "4f93734" "${PROCESS_3RD_BIN}") +EXTERNAL("http_parser" "1c3624a" "${PROCESS_3RD_BIN}") +EXTERNAL("libev" "4.15" "${PROCESS_3RD_BIN}") + +set(GLOG_LIB ${GLOG_ROOT}-lib/lib) + +# DEFINE PROCESS LIBRARY DEPENDENCIES. Tells the process library build targets +# download/configure/build all third-party libraries before attempting to build. +################################################################################ +set(PROCESS_DEPENDENCIES + ${PROCESS_DEPENDENCIES} + ${BOOST_TARGET} + ${GLOG_TARGET} + ${PICOJSON_TARGET} + ${HTTP_PARSER_TARGET} + ${LIBEV_TARGET} + ) + +# 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). +############################################################################### +set(PROCESS_INCLUDE_DIRS + ${PROCESS_INCLUDE_DIRS} + ${PROCESS_3RD_SRC}/../include + ${STOUT}/include + ${BOOST_ROOT} + ${LIBEV_ROOT} + ${PICOJSON_ROOT} + ) + +if (WIN32) + set(PROCESS_INCLUDE_DIRS + ${PROCESS_INCLUDE_DIRS} + ${GLOG_ROOT}/src/windows + ) +else (WIN32) + set(PROCESS_INCLUDE_DIRS + ${PROCESS_INCLUDE_DIRS} + ${GLOG_LIB}/include + ) +endif (WIN32) + +set(PROCESS_INCLUDE_DIRS + ${PROCESS_INCLUDE_DIRS} + ${HTTP_PARSER_ROOT} + ) + +if (HAS_GPERFTOOLS) + set(PROCESS_INCLUDE_DIRS + ${PROCESS_INCLUDE_DIRS} + ${GPERFTOOLS}/src + ) +endif (HAS_GPERFTOOLS) + +# DEFINE THIRD-PARTY LIB INSTALL DIRECTORIES. Used to tell the compiler +# toolchain where to find our third party libs (e.g., -L/path/to/glog on +# Linux). +######################################################################## +set(PROCESS_LIB_DIRS + ${PROCESS_LIB_DIRS} + ${GLOG_LIB}/lib + ${LIBEV_ROOT}-build/.libs + ${HTTP_PARSER_ROOT}-build + ) + +# DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to +# include our third-party libs (e.g., -lglog on Linux). +######################################################################### +find_package(Threads REQUIRED) + +set(PROCESS_LIBS + ${PROCESS_LIBS} + ${PROCESS_TARGET} + glog + ev + http_parser + ${CMAKE_THREAD_LIBS_INIT} + ) + +if (NOT WIN32) + find_package(ZLIB REQUIRED) + find_library(LIBRT_LIBRARIES rt REQUIRED) + + set(PROCESS_LIBS + ${PROCESS_LIBS} + ${ZLIB_LIBRARIES} + ${LIBRT_LIBRARIES} + ) +endif (NOT WIN32) http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake new file mode 100644 index 0000000..d349d2e --- /dev/null +++ b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +############################################################### +# Defines the variables useful for tests, and exports them to the scope of +# whatever file includes this file. There are a few important consequence of this: +# +# * This file MUST be included before the third-party dependencies like gmock +# are configured/built/downloaded (if you're doing this). If this code isn't +# run first, then we won't know (e.g.) what folders to unpack the code to. +# * This file ONLY defines and exports variables for third-party dependencies +# that are required by the test suite, but are not a dependency that +# libprocess core takes. That is, this file handles the gmock dependency, +# but not the glog dependency (which the process library itself takes a +# dependency on). +# * This file and the config file for the libprocess "core" dependencies (e.g., +# glog, boost, etc.) so that we can export the variables for the core +# dependencies (e.g., where to find the .so/.dll files) without having to also +# export the variables for the dependencies that only the test package has. + +# DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS REQUIRED FOR TEST INFRASTRUCTURE. +########################################################################### +EXTERNAL("gmock" "1.6.0" "${PROCESS_3RD_BIN}") + +set(GTEST_SRC ${GMOCK_ROOT}/gtest) +set(GPERFTOOLS_VERSION 2.0) +set(GPERFTOOLS ${PROCESS_3RD_BIN}/gperftools-${GPERFTOOLS_VERSION}) + +# DEFINE PROCESS TEST LIBRARY DEPENDENCIES. Tells the process library build +# tests target download/configure/build all third-party libraries before +# attempting to build. +########################################################################### +set(PROCESS_TEST_DEPENDENCIES + ${PROCESS_TEST_DEPENDENCIES} + ${PROCESS_DEPENDENCIES} + ${GMOCK_TARGET} + ) http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/cmake/macros/External.cmake ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/cmake/macros/External.cmake b/3rdparty/libprocess/cmake/macros/External.cmake new file mode 100644 index 0000000..e3901b6 --- /dev/null +++ b/3rdparty/libprocess/cmake/macros/External.cmake @@ -0,0 +1,80 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +############################################################### +# EXTERNAL defines a few variables that make it easy for us to track the +# directory structure of a dependency. In particular, if our library's name is +# boost, we will define the following variables: +# +# BOOST_VERSION (e.g., 1.53.0) +# BOOST_TARGET (a target folder name to put dep in e.g., boost-1.53.0) +# BOOST_CMAKE_ROOT (where to have CMake put the uncompressed source, e.g., +# build/3rdparty/libprocess/3rdparty/boost-1.53.0) +# BOOST_ROOT (where the code goes in various stages of build, e.g., +# build/.../boost-1.53.0/src, which might contain folders +# build-1.53.0-build, -lib, and so on, for each build step +# that dependency has) +function(EXTERNAL + LIB_NAME + LIB_VERSION + BIN_ROOT) + + string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER) + + # Names of variables we will set in this function. + set(VERSION_VAR ${LIB_NAME_UPPER}_VERSION) # e.g., BOOST_VERSION + set(TARGET_VAR ${LIB_NAME_UPPER}_TARGET) # e.g., BOOST_TARGET + set(CMAKE_ROOT_VAR ${LIB_NAME_UPPER}_CMAKE_ROOT) # e.g., BOOST_CMAKE_ROOT + set(ROOT_VAR ${LIB_NAME_UPPER}_ROOT) # e.g., BOOST_ROOT + + # Generate data that we will put in the above variables. + # NOTE: bundled packages are untar'd into the BIN_ROOT, which is why we're + # pointing the source root into BIN_ROOT rather than SRC_ROOT. + # TODO(hausdorff): SRC_DATA doesn't work for HTTP, LIBEV, GMOCK, or GTEST. + set(VERSION_DATA ${LIB_VERSION}) + set(TARGET_DATA ${LIB_NAME}-${VERSION_DATA}) + set(CMAKE_ROOT_DATA ${BIN_ROOT}/${TARGET_DATA}) + set(ROOT_DATA ${CMAKE_ROOT_DATA}/src/${TARGET_DATA}) + + # Finally, EXPORT THE ABOVE VARIABLES. We take the data variables we just + # defined, and export them to variables in the parent scope. + # + # NOTE: The "export" step is different from the "define the data vars" step + # because an expression like ${VERSION_VAR} will evaluate to + # something like "BOOST_VERSION", not something like "1.53.0". That + # is: to get the version in the parent scope we would do something + # like ${BOOST_VERSION}, which might evaluate to something like + # "1.53.0". So in this function, if you wanted to generate (e.g.) the + # target variable, it is not sufficient to write + # "${LIB_NAME}-${VERSION_VAR}", because this would result in + # something like "boost-BOOST_VERSION" when what we really wanted was + # "boost-1.53.0". Hence, these two steps are different. + set(${VERSION_VAR} # e.g., 1.53.0 + ${VERSION_DATA} + PARENT_SCOPE) + + set(${TARGET_VAR} # e.g., boost-1.53.0 + ${TARGET_DATA} + PARENT_SCOPE) + + set(${CMAKE_ROOT_VAR} # e.g., build/3rdparty/libprocess/3rdparty/boost-1.53.0 + ${CMAKE_ROOT_DATA} + PARENT_SCOPE) + + set(${ROOT_VAR} # e.g., build/.../boost-1.53.0/src + ${ROOT_DATA} + PARENT_SCOPE) +endfunction() http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/cmake/macros/PatchCommand.cmake ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/cmake/macros/PatchCommand.cmake b/3rdparty/libprocess/cmake/macros/PatchCommand.cmake new file mode 100644 index 0000000..12ee3f1 --- /dev/null +++ b/3rdparty/libprocess/cmake/macros/PatchCommand.cmake @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +############################################################## +# PATCH_CMD generates a patch command for those dependencies that need it. For +# example, when the rebundled version of GLOG needs to be patched, we would run +# this command. +function(PATCH_CMD patch_filename patch_cmd_varname) + # CMake does not appear to have a good way for macro functions to return + # values, so here we assign the patch command to a variable in the + # PARENT_SCOPE. (The name of the variable to assign to in the parent scope + # is passed in as a parameter to the macro function.) + set (${patch_cmd_varname} + test ! -e ${patch_filename} || patch -p1 < ${patch_filename} + PARENT_SCOPE) +endfunction() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/src/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/CMakeLists.txt b/3rdparty/libprocess/src/CMakeLists.txt new file mode 100644 index 0000000..9d1b1f5 --- /dev/null +++ b/3rdparty/libprocess/src/CMakeLists.txt @@ -0,0 +1,74 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# SOURCE FILES FOR THE PROCESS LIBRARY. +####################################### +set(PROCESS_SRC + ${PROCESS_SRC} + clock.cpp + config.hpp + decoder.hpp + encoder.hpp + event_loop.hpp + gate.hpp + help.cpp + http.cpp + io.cpp + latch.cpp + logging.cpp + metrics/metrics.cpp + pid.cpp + poll_socket.cpp + poll_socket.hpp + profiler.cpp + process.cpp + process_reference.hpp + reap.cpp + socket.cpp + subprocess.cpp + time.cpp + timeseries.cpp + ) + +if (ENABLE_LIBEVENT) + set(PROCESS_SRC + ${PROCESS_SRC} + libevent.hpp + libevent.cpp + libevent_poll.cpp) +else (ENABLE_LIBEVENT) + set(PROCESS_SRC + ${PROCESS_SRC} + libev.hpp + libev.cpp + libev_poll.cpp + ) +endif (ENABLE_LIBEVENT) + +# INCLUDE DIRECTIVES FOR PROCESS LIBRARY (generates, e.g., -I/path/to/thing +# on Linux). +########################################################################### +include_directories(${PROCESS_INCLUDE_DIRS}) + +# THE PROCESS LIBRARY (generates, e.g., libprocess.so, etc., on Linux). +####################################################################### +add_library(${PROCESS_TARGET} ${PROCESS_SRC}) +set_target_properties( + ${PROCESS_TARGET} PROPERTIES + VERSION ${PROCESS_PACKAGE_VERSION} + SOVERSION ${PROCESS_PACKAGE_SOVERSION} + ) +add_dependencies(${PROCESS_TARGET} ${PROCESS_DEPENDENCIES}) http://git-wip-us.apache.org/repos/asf/mesos/blob/619f45f0/3rdparty/libprocess/src/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/tests/CMakeLists.txt b/3rdparty/libprocess/src/tests/CMakeLists.txt new file mode 100644 index 0000000..56b1861 --- /dev/null +++ b/3rdparty/libprocess/src/tests/CMakeLists.txt @@ -0,0 +1,57 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set(PROCESS_TESTS_SRC + ${PROCESS_TESTS_SRC} + decoder_tests.cpp + encoder_tests.cpp + http_tests.cpp + io_tests.cpp + limiter_tests.cpp + main.cpp + mutex_tests.cpp + metrics_tests.cpp + owned_tests.cpp + process_tests.cpp + queue_tests.cpp + reap_tests.cpp + sequence_tests.cpp + shared_tests.cpp + statistics_tests.cpp + subprocess_tests.cpp + system_tests.cpp + timeseries_tests.cpp + time_tests.cpp + ) + +include_directories( + ../ # includes, e.g., decoder.hpp + ${PROCESS_INCLUDE_DIRS} + ${GMOCK_ROOT}/include + ${GTEST_SRC}/include + src + ) + +link_directories( + ${PROCESS_LIB_DIRS} + ${GMOCK_ROOT}-build/lib/.libs + ${GMOCK_ROOT}-build/gtest/lib/.libs + ) + +add_executable(tests ${PROCESS_TESTS_SRC}) +target_link_libraries(tests ${PROCESS_LIBS} gmock gtest) +add_dependencies(tests ${PROCESS_TEST_DEPENDENCIES}) +add_test(NAME ProcessTests COMMAND ./tests) \ No newline at end of file
