-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up cmake script and code includes (#106)
* Clean up CMake scripts and related include paths. * Add unittests.
- Loading branch information
1 parent
e926418
commit ddcc2d8
Showing
28 changed files
with
321 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# code copied from https://crascit.com/2015/07/25/cmake-gtest/ | ||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | ||
|
||
project(googletest-download NONE) | ||
|
||
include(ExternalProject) | ||
|
||
ExternalProject_Add( | ||
googletest | ||
SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src" | ||
BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build" | ||
GIT_REPOSITORY | ||
https://github.com/google/googletest.git | ||
GIT_TAG | ||
release-1.8.0 | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# the following code to fetch googletest | ||
# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/ | ||
# download and unpack googletest at configure time | ||
|
||
macro(fetch_googletest _download_module_path _download_root) | ||
set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root}) | ||
configure_file( | ||
${_download_module_path}/googletest-download.cmake | ||
${_download_root}/CMakeLists.txt | ||
@ONLY | ||
) | ||
unset(GOOGLETEST_DOWNLOAD_ROOT) | ||
|
||
execute_process( | ||
COMMAND | ||
"${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . | ||
WORKING_DIRECTORY | ||
${_download_root} | ||
) | ||
execute_process( | ||
COMMAND | ||
"${CMAKE_COMMAND}" --build . | ||
WORKING_DIRECTORY | ||
${_download_root} | ||
) | ||
|
||
# adds the targers: gtest, gtest_main, gmock, gmock_main | ||
add_subdirectory( | ||
${_download_root}/googletest-src | ||
${_download_root}/googletest-build | ||
) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
echo "Testing on: ${TRAVIS_OS_NAME}, Home directory: ${HOME}" | ||
|
||
pip3 install cpplint pylint urllib3 numpy cpplint | ||
pip3 install websocket-client kubernetes | ||
|
||
|
||
# Install googletest under home directory | ||
GTEST_VERSION=1.8.1 | ||
GTEST_RELEASE=release-${GTEST_VERSION}.tar.gz | ||
GTEST_TAR_BALL=googletest_${GTEST_RELEASE} | ||
|
||
wget https://github.com/google/googletest/archive/${GTEST_RELEASE} -O ${GTEST_TAR_BALL} | ||
echo "152b849610d91a9dfa1401293f43230c2e0c33f8 ${GTEST_TAR_BALL}" | sha1sum -c | ||
tar -xf ${GTEST_TAR_BALL} | ||
pushd . | ||
|
||
cd googletest-release-${GTEST_VERSION} | ||
mkdir build | ||
cd build | ||
echo "Installing to ${HOME}/.local" | ||
cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${HOME}/.local | ||
make -j$(nproc) | ||
make install | ||
|
||
popd | ||
|
||
if [ ${TRAVIS_OS_NAME} == "linux" ]; then | ||
sudo apt-get install python3-pip tree | ||
fi | ||
|
||
if [ ${TRAVIS_OS_NAME} == "osx" ]; then | ||
brew install python3 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
option(DMLC_ROOT "Specify root of external dmlc core.") | ||
|
||
add_library(allreduce_base "") | ||
|
||
target_sources( | ||
allreduce_base | ||
PRIVATE | ||
allreduce_base.cc | ||
PUBLIC | ||
${CMAKE_CURRENT_LIST_DIR}/allreduce_base.h | ||
) | ||
|
||
target_include_directories( | ||
allreduce_base | ||
PUBLIC | ||
${DMLC_ROOT}/include | ||
${CMAKE_CURRENT_LIST_DIR}/../../include) |
Oops, something went wrong.