[CI] Simplify CMake build with modern CMake techniques (#5871)

* [CI] Simplify CMake build

* Make sure that plugins can be built

* [CI] Install lz4 on Mac
This commit is contained in:
Philip Hyunsu Cho
2020-07-08 04:23:24 -07:00
committed by GitHub
parent 22a31b1faa
commit 0d411b0397
10 changed files with 42 additions and 56 deletions

View File

@@ -7,7 +7,7 @@ SHELL ["/bin/bash", "-c"] # Use Bash as shell
# Install all basic requirements
RUN \
apt-get update && \
apt-get install -y tar unzip wget git build-essential doxygen graphviz llvm libasan2 libidn11 && \
apt-get install -y tar unzip wget git build-essential doxygen graphviz llvm libasan2 libidn11 liblz4-dev && \
# CMake
wget -nv -nc https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.sh --no-check-certificate && \
bash cmake-3.13.0-Linux-x86_64.sh --skip-license --prefix=/usr && \

View File

@@ -12,8 +12,9 @@ if (USE_CUDA)
file(GLOB_RECURSE CUDA_TEST_SOURCES "*.cu")
list(APPEND TEST_SOURCES ${CUDA_TEST_SOURCES})
endif (USE_CUDA)
add_executable(testxgboost ${TEST_SOURCES} ${XGBOOST_OBJ_SOURCES}
add_executable(testxgboost ${TEST_SOURCES}
${xgboost_SOURCE_DIR}/plugin/example/custom_obj.cc)
target_link_libraries(testxgboost PRIVATE objxgboost)
if (USE_CUDA)
# OpenMP is mandatory for CUDA
@@ -73,10 +74,8 @@ set_target_properties(
CXX_STANDARD_REQUIRED ON)
target_link_libraries(testxgboost
PRIVATE
${GTEST_LIBRARIES}
${LINKED_LIBRARIES_PRIVATE})
${GTEST_LIBRARIES})
target_compile_definitions(testxgboost PRIVATE ${XGBOOST_DEFINITIONS})
set_output_directory(testxgboost ${xgboost_BINARY_DIR})
# This grouping organises source files nicely in visual studio