Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Use cmake for all CI builds
Browse files Browse the repository at this point in the history
Improvements to CMake build
- Enable -Werror for RelWithDebugInfo build in analogy to "make DEV=1" build
- Add USE_LIBJPEG_TURBO to CMake build

Changes to CI setup
- Install protobuf in ubuntu_core.sh and centos_core.sh
- Install up-to-date CMake on Centos 7
- Don't use RelWithDebInfo on Android builds, as gcc 4.9 throws
  -Wdelete-non-virtual-dtor
  • Loading branch information
leezu committed Feb 21, 2020
1 parent 9dcf71d commit 9ebc1a5
Show file tree
Hide file tree
Showing 18 changed files with 348 additions and 305 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/os_x_staticbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v2
- name: Install Dependencies
run: |
brew install nasm automake ninja libtool
brew install nasm automake ninja libtool cmake pkgconfig protobuf
- name: Build project
run: |
git --version
Expand Down
10 changes: 10 additions & 0 deletions 3rdparty/mshadow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ add_library(mshadow INTERFACE)
file(GLOB_RECURSE MSHADOWSOURCE "mshadow/*.h")
target_include_directories(mshadow INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
target_sources(mshadow INTERFACE ${MSHADOWSOURCE})
if(UNIX)
target_compile_options(mshadow INTERFACE
"$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -Wno-error=unused-parameter>"
"$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -Wno-error=unknown-pragmas>"
"$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -Wno-error=unused-local-typedefs>")
target_compile_options(mshadow INTERFACE
"$<$<COMPILE_LANGUAGE:CXX>:-Wno-error=unused-parameter>"
"$<$<COMPILE_LANGUAGE:CXX>:-Wno-error=unknown-pragmas>"
"$<$<COMPILE_LANGUAGE:CXX>:-Wno-error=unused-local-typedefs>")
endif()

if(USE_CUDA)
enable_language(CUDA)
Expand Down
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ else()
endif()
option(USE_GPERFTOOLS "Build with GPerfTools support" OFF)
option(USE_JEMALLOC "Build with Jemalloc support" OFF)
option(USE_LIBJPEG_TURBO "Use libjpeg-turbo" OFF)
option(USE_DIST_KVSTORE "Build with DIST_KVSTORE support" OFF)
option(USE_PLUGINS_WARPCTC "Use WARPCTC Plugins" OFF)
option(USE_PLUGIN_CAFFE "Use Caffe Plugin" OFF)
Expand Down Expand Up @@ -370,6 +371,15 @@ if(USE_JEMALLOC)
endif()
endif()

if(USE_LIBJPEG_TURBO)
# We can switch from pkgconfig to libjpeg-turboConfig.cmake once libjpeg-turbo
# 2.1 is released https://github.com/libjpeg-turbo/libjpeg-turbo/pull/342
find_package(PkgConfig REQUIRED)
pkg_search_module(TURBOJPEG REQUIRED libturbojpeg)
include_directories(SYSTEM ${TURBOJPEG_INCLUDE_DIRS})
list(APPEND mxnet_LINKER_LIBS ${TURBOJPEG_LIBRARIES})
endif()

# ---[ OpenCV
if(USE_OPENCV)
find_package(OpenCV COMPONENTS core highgui imgproc imgcodecs)
Expand Down Expand Up @@ -663,6 +673,17 @@ if(UNIX)
target_link_libraries(mxnet PRIVATE mxnet_static)
target_link_libraries(mxnet_static PUBLIC ${CMAKE_DL_LIBS})
set_target_properties(mxnet_static PROPERTIES OUTPUT_NAME mxnet)
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
target_compile_options(mxnet_static PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Werror>")
# Ignore erroneous compiler warnings:
# 1) variables used in '#pragma omp parallel' are considered unused
target_compile_options(mxnet_static PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wno-error=unused-variable>")
if(USE_CUDA)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Werror cross-execution-space-call)
target_compile_options(mxnet_static PRIVATE
"$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -Wno-error=unused-variable>")
endif()
endif()
elseif(MSVC)
if(USE_CUDA)
if(MSVC)
Expand Down
2 changes: 1 addition & 1 deletion R-package/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rcpplint:
3rdparty/dmlc-core/scripts/lint.py mxnet-rcpp ${LINT_LANG} R-package/src
./3rdparty/dmlc-core/scripts/lint.py mxnet-rcpp all R-package/src

rpkg:
mkdir -p R-package/inst/libs
Expand Down
15 changes: 14 additions & 1 deletion ci/docker/install/centos7_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,20 @@ yum -y install epel-release
yum -y install git
yum -y install wget
yum -y install make
yum -y install cmake
yum -y install unzip
yum -y install ninja-build
yum -y install gcc-gfortran
yum -y install protobuf-compiler
yum -y install protobuf-devel
yum -y install zeromq-devel

# Centos 7 only provides ninja-build
ln -s /usr/bin/ninja-build /usr/bin/ninja

# CMake 3.13.2+ is required
mkdir /opt/cmake && cd /opt/cmake
wget -nv https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.sh
sh cmake-3.13.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
rm cmake-3.13.5-Linux-x86_64.sh
cmake --version
15 changes: 14 additions & 1 deletion ci/docker/install/centos7_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,23 @@ yum -y install atlas-devel # Provide clbas headerfiles
yum -y install openblas-devel
yum -y install lapack-devel
yum -y install opencv-devel
yum -y install protobuf-compiler
yum -y install protobuf-devel
yum -y install zeromq-devel
yum -y install openssl-devel
yum -y install gcc-c++-4.8.*
yum -y install make
yum -y install cmake
yum -y install wget
yum -y install unzip
yum -y install ninja-build

# Centos 7 only provides ninja-build
ln -s /usr/bin/ninja-build /usr/bin/ninja

# CMake 3.13.2+ is required
mkdir /opt/cmake && cd /opt/cmake
wget -nv https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.sh
sh cmake-3.13.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
rm cmake-3.13.5-Linux-x86_64.sh
cmake --version
2 changes: 2 additions & 0 deletions ci/docker/install/ubuntu_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ apt-get install -y \
zlib1g-dev \
libedit-dev \
libxml2-dev \
libprotobuf-dev \
protobuf-compiler \
ninja-build \
software-properties-common \
sudo \
Expand Down
Loading

0 comments on commit 9ebc1a5

Please sign in to comment.