[MXNET-1229] use OpenBLAS, lapack & OpenCV from conan (#13400)
* - use OpenBLAS, lapack & OpenCV from conan
Signed-off-by: SSE4 <tomskside@gmail.com>
* - add license to the conanfile.py
Signed-off-by: SSE4 <tomskside@gmail.com>
* - remove lapack (OpenBLAS provides it)
* - remove lapack (OpenBLAS provides it)
* - remove lapack (OpenBLAS provides it)
* - add option for conan
* Update CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f8c33b..5fbfab8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,13 @@
mxnet_option(USE_ASAN "Enable Clang/GCC ASAN sanitizers." OFF)
mxnet_option(ENABLE_TESTCOVERAGE "Enable compilation with test coverage metric output" OFF)
mxnet_option(USE_INT64_TENSOR_SIZE "Use int64_t to represent the total number of elements in a tensor" OFF)
+mxnet_option(USE_CONAN "Enable conan.io for package management." OFF)
+
+if(USE_CONAN AND EXISTS ${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
+ include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
+ conan_basic_setup(TARGETS)
+ message(STATUS "using conan")
+endif()
message(STATUS "CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING}")
message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR}")
diff --git a/cmake/Modules/FindOpenBLAS.cmake b/cmake/Modules/FindOpenBLAS.cmake
index a3a79ca..1847c3c 100644
--- a/cmake/Modules/FindOpenBLAS.cmake
+++ b/cmake/Modules/FindOpenBLAS.cmake
@@ -15,6 +15,13 @@
# specific language governing permissions and limitations
# under the License.
+if(TARGET CONAN_PKG::openblas)
+ set(OpenBLAS_FOUND ON)
+ set(OpenBLAS_LIB CONAN_PKG::openblas)
+ set(OpenBLAS_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_OPENBLAS})
+ return()
+endif()
+
file(TO_CMAKE_PATH "$ENV{OpenBLAS_HOME}" OpenBLAS_HOME)
file(TO_CMAKE_PATH "$ENV{OpenBLAS}" OpenBLAS_DIR)
diff --git a/conanfile.py b/conanfile.py
new file mode 100644
index 0000000..de23e4c
--- /dev/null
+++ b/conanfile.py
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from conans import ConanFile
+
+class IncubatorMXNetConan(ConanFile):
+ settings = "os", "compiler", "build_type", "arch"
+ requires = "openblas/0.2.20@conan/stable", "opencv/3.4.3@conan/stable"
+ generators = ["cmake"]