Make CMakeLists.txt compatible with CMake 3.3 (#4420)
* Make CMakeLists.txt compatible with CMake 3.3; require CMake 3.11 for MSVC * Use CMake 3.12 when sanitizer is enabled * Disable funroll-loops for MSVC * Use cmake version in container name * Add missing arg * Fix egrep use in ci_build.sh * Display CMake version * Do not set OpenMP_CXX_LIBRARIES for MSVC * Use cmake_minimum_required()
This commit is contained in:
committed by
Jiaming Yuan
parent
17df5fd296
commit
bfddc2c42c
@@ -1,4 +1,5 @@
|
||||
FROM ubuntu:18.04
|
||||
ARG CMAKE_VERSION=3.3
|
||||
|
||||
# Environment
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
@@ -6,10 +7,10 @@ ENV DEBIAN_FRONTEND noninteractive
|
||||
# Install all basic requirements
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install -y tar unzip wget git build-essential doxygen graphviz llvm libasan2 && \
|
||||
apt-get install -y tar unzip wget git build-essential doxygen graphviz llvm libasan2 libidn11 && \
|
||||
# CMake
|
||||
wget -nv -nc https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.sh --no-check-certificate && \
|
||||
bash cmake-3.12.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
||||
wget -nv -nc https://cmake.org/files/v$CMAKE_VERSION/cmake-$CMAKE_VERSION.0-Linux-x86_64.sh --no-check-certificate && \
|
||||
bash cmake-$CMAKE_VERSION.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
||||
# Python
|
||||
wget https://repo.continuum.io/miniconda/Miniconda3-4.5.12-Linux-x86_64.sh && \
|
||||
bash Miniconda3-4.5.12-Linux-x86_64.sh -b -p /opt/python
|
||||
|
||||
@@ -90,10 +90,12 @@ WORKSPACE="${WORKSPACE:-${SCRIPT_DIR}/../../}"
|
||||
DOCKER_IMG_NAME="xgb-ci.${CONTAINER_TYPE}"
|
||||
|
||||
# Append cuda version if available
|
||||
CUDA_VERSION=$(echo "${CI_DOCKER_BUILD_ARG}" | grep CUDA_VERSION | egrep -o '[0-9]*\.[0-9]*')
|
||||
CUDA_VERSION=$(echo "${CI_DOCKER_BUILD_ARG}" | egrep -o 'CUDA_VERSION=[0-9]+\.[0-9]+' | egrep -o '[0-9]+\.[0-9]+')
|
||||
# Append jdk version if available
|
||||
JDK_VERSION=$(echo "${CI_DOCKER_BUILD_ARG}" | grep JDK_VERSION | egrep -o '[0-9]*')
|
||||
DOCKER_IMG_NAME=$DOCKER_IMG_NAME$CUDA_VERSION$JDK_VERSION
|
||||
JDK_VERSION=$(echo "${CI_DOCKER_BUILD_ARG}" | egrep -o 'JDK_VERSION=[0-9]+' | egrep -o '[0-9]+')
|
||||
# Append cmake version if available
|
||||
CMAKE_VERSION=$(echo "${CI_DOCKER_BUILD_ARG}" | egrep -o 'CMAKE_VERSION=[0-9]+\.[0-9]+' | egrep -o '[0-9]+\.[0-9]+')
|
||||
DOCKER_IMG_NAME=$DOCKER_IMG_NAME$CUDA_VERSION$JDK_VERSION$CMAKE_VERSION
|
||||
|
||||
# Under Jenkins matrix build, the build tag may contain characters such as
|
||||
# commas (,) and equal signs (=), which are not valid inside docker image names.
|
||||
|
||||
@@ -44,6 +44,9 @@ set_target_properties(
|
||||
testxgboost PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_STANDARD_REQUIRED ON)
|
||||
if ((NOT OpenMP_CXX_LIBRARIES) AND (NOT MSVC)) # old CMake doesn't define this variable
|
||||
set(OpenMP_CXX_LIBRARIES "gomp;pthread")
|
||||
endif ((NOT OpenMP_CXX_LIBRARIES) AND (NOT MSVC))
|
||||
target_link_libraries(testxgboost
|
||||
PRIVATE
|
||||
${GTEST_LIBRARIES}
|
||||
|
||||
Reference in New Issue
Block a user