Skip to content

Commit

Permalink
Remove redundant FindGTest.cmake. (#3533)
Browse files Browse the repository at this point in the history
During removal of FindGTest.cmake, also

* Fix gtest include dirs.
* Remove some blanks and use PWD for gtest dir.
  • Loading branch information
trivialfis authored and RAMitchell committed Aug 6, 2018
1 parent 69454d9 commit 55caad6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 93 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ set_default_configuration_release()
msvc_use_static_runtime()

# Options
option(USE_CUDA "Build with GPU acceleration")
option(USE_AVX "Build with AVX instructions. May not produce identical results due to approximate math." OFF)
option(USE_NCCL "Build using NCCL for multi-GPU. Also requires USE_CUDA")
option(USE_CUDA "Build with GPU acceleration")
option(USE_AVX "Build with AVX instructions. May not produce identical results due to approximate math." OFF)
option(USE_NCCL "Build using NCCL for multi-GPU. Also requires USE_CUDA")
option(JVM_BINDINGS "Build JVM bindings" OFF)
option(GOOGLE_TEST "Build google tests" OFF)
option(R_LIB "Build shared library for R package" OFF)
Expand Down Expand Up @@ -89,7 +89,7 @@ include_directories (
${PROJECT_SOURCE_DIR}/rabit/include
)

file(GLOB_RECURSE SOURCES
file(GLOB_RECURSE SOURCES
src/*.cc
src/*.h
include/*.h
Expand Down Expand Up @@ -127,7 +127,7 @@ if(USE_CUDA)
cmake_minimum_required(VERSION 3.5)

add_definitions(-DXGBOOST_USE_CUDA)

include_directories(cub)

if(USE_NCCL)
Expand All @@ -146,12 +146,12 @@ if(USE_CUDA)
endif()

cuda_add_library(gpuxgboost ${CUDA_SOURCES} STATIC)

if(USE_NCCL)
link_directories(${NCCL_LIBRARY})
target_link_libraries(gpuxgboost ${NCCL_LIB_NAME})
endif()
list(APPEND LINK_LIBRARIES gpuxgboost)
list(APPEND LINK_LIBRARIES gpuxgboost)
endif()


Expand Down Expand Up @@ -232,12 +232,12 @@ endif()

# Test
if(GOOGLE_TEST)
find_package(GTest REQUIRED)
enable_testing()
find_package(GTest REQUIRED)

file(GLOB_RECURSE TEST_SOURCES "tests/cpp/*.cc")
auto_source_group("${TEST_SOURCES}")
include_directories(${GTEST_INCLUDE_DIR})
include_directories(${GTEST_INCLUDE_DIRS})

if(USE_CUDA)
file(GLOB_RECURSE CUDA_TEST_SOURCES "tests/cpp/*.cu")
Expand Down
79 changes: 0 additions & 79 deletions cmake/modules/FindGTest.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions tests/ci_build/build_via_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ rm -rf gtest
wget -nc https://github.com/google/googletest/archive/release-1.7.0.zip
unzip -n release-1.7.0.zip
mv googletest-release-1.7.0 gtest && cd gtest
cmake . && make
cmake . && make
mkdir lib && mv libgtest.a lib
cd ..
rm -rf release-1.7.0.zip*

rm -rf build
mkdir build
cd build
cmake .. "$@" -DGOOGLE_TEST=ON -DGTEST_ROOT=../gtest
cmake .. "$@" -DGOOGLE_TEST=ON -DGTEST_ROOT=$PWD/../gtest
make clean
make -j
cd ..
7 changes: 4 additions & 3 deletions tests/travis/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,17 @@ if [ ${TASK} == "cmake_test" ]; then
rm -rf release-1.7.0.zip

# Build/test without AVX
rm -rf build
mkdir build && cd build
cmake .. -DGOOGLE_TEST=ON -DGTEST_ROOT=../gtest/
cmake .. -DGOOGLE_TEST=ON -DGTEST_ROOT=$PWD/../gtest/
make
cd ..
./testxgboost
rm -rf build

# Build/test with AVX
mkdir build && cd build
cmake .. -DGOOGLE_TEST=ON -DUSE_AVX=ON -DGTEST_ROOT=../gtest/
cmake .. -DGOOGLE_TEST=ON -DUSE_AVX=ON -DGTEST_ROOT=$PWD/../gtest/
make
cd ..
./testxgboost
Expand Down

0 comments on commit 55caad6

Please sign in to comment.