From d2afd2df031d37dc139e80815aa35862630c1b48 Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 19 Jan 2020 22:57:11 +0100 Subject: [PATCH 01/16] Initial commit --- recipes/openblas/all/conandata.yml | 4 + recipes/openblas/all/conanfile.py | 76 +++++++++++++++++++ .../openblas/all/test_package/CMakeLists.txt | 10 +++ .../openblas/all/test_package/conanfile.py | 17 +++++ .../all/test_package/test_package.cpp | 15 ++++ recipes/openblas/config.yml | 3 + 6 files changed, 125 insertions(+) create mode 100644 recipes/openblas/all/conandata.yml create mode 100644 recipes/openblas/all/conanfile.py create mode 100644 recipes/openblas/all/test_package/CMakeLists.txt create mode 100644 recipes/openblas/all/test_package/conanfile.py create mode 100644 recipes/openblas/all/test_package/test_package.cpp create mode 100644 recipes/openblas/config.yml diff --git a/recipes/openblas/all/conandata.yml b/recipes/openblas/all/conandata.yml new file mode 100644 index 0000000000000..0dd590ea07db1 --- /dev/null +++ b/recipes/openblas/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.3.7: + sha256: bde136122cef3dd6efe2de1c6f65c10955bbb0cc01a520c2342f5287c28f9379 + url: https://github.com/xianyi/OpenBLAS/archive/v0.3.7.tar.gz diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py new file mode 100644 index 0000000000000..cc44588e8740b --- /dev/null +++ b/recipes/openblas/all/conanfile.py @@ -0,0 +1,76 @@ +from conans import ConanFile, CMake, tools +import sys +import os + + +class OpenBLAS(ConanFile): + name = "openblas" + version = "0.3.7" + license = "BSD 3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.openblas.net" + description = "An optimized BLAS library based on GotoBLAS2 1.13 BSD version" + topics = ( + "OpenBLAS", + "BLAS", + "LAPACK" + ) + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_lapack": [True, False] + } + default_options = { + "shared": True, + "fPIC": True, + "build_lapack": False + } + generators = "cmake", "cmake_find_package" + no_copy_source = True + _source_subfolder = "source_subfolder" + _build_subfolder = "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename('OpenBLAS-{}'.format(self.version), self._source_subfolder) + + def _configure_cmake(self): + cmake = CMake(self) + if self.options.build_lapack: + self.output.warn( + "Building with lapack support requires a Fortran compiler.") + + cmake.definitions["NOFORTRAN"] = not self.options.build_lapack + cmake.definitions["BUILD_WITHOUT_LAPACK"] = not self.options.build_lapack + + cmake.configure( + build_folder=self._build_subfolder, + source_folder=self._source_subfolder) + return cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy( + pattern="LICENSE", + dst="licenses", + src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.builddirs.append( + os.path.join('share', 'cmake', 'OpenBLAS')) + self.cpp_info.names["cmake_find_package"] = "OpenBLAS" + self.cpp_info.names["cmake_find_package_multi"] = "OpenBLAS" + self.cpp_info.names['pkg_config'] = "OpenBLAS" diff --git a/recipes/openblas/all/test_package/CMakeLists.txt b/recipes/openblas/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..56a1bba89a19d --- /dev/null +++ b/recipes/openblas/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.12) +project(test_package) + +set(CMAKE_VERBOSE_MAKEFILE TRUE) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/openblas/all/test_package/conanfile.py b/recipes/openblas/all/test_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/openblas/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openblas/all/test_package/test_package.cpp b/recipes/openblas/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..61c4249b3b56f --- /dev/null +++ b/recipes/openblas/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include + +int main() +{ + int i=0; + double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0}; + double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0}; + double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5}; + cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3); + + for(i=0; i<9; i++) + printf("%lf ", C[i]); + printf("\n"); +} \ No newline at end of file diff --git a/recipes/openblas/config.yml b/recipes/openblas/config.yml new file mode 100644 index 0000000000000..a8f8151d88fe9 --- /dev/null +++ b/recipes/openblas/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.7": + folder: all \ No newline at end of file From 561cbb0dbee85c7f87f750e1f8cd00e8b28200fe Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 19 Jan 2020 23:42:28 +0100 Subject: [PATCH 02/16] Fix test_package openblas include --- recipes/openblas/all/test_package/test_package.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/test_package/test_package.cpp b/recipes/openblas/all/test_package/test_package.cpp index 61c4249b3b56f..03a0ac6803396 100644 --- a/recipes/openblas/all/test_package/test_package.cpp +++ b/recipes/openblas/all/test_package/test_package.cpp @@ -1,4 +1,4 @@ -#include +#include #include int main() From 4c2fd329a12b6642981c71846048d62e75c04751 Mon Sep 17 00:00:00 2001 From: bmanga Date: Mon, 20 Jan 2020 13:48:53 +0100 Subject: [PATCH 03/16] Update openblas recipe to link pthread on linux Co-Authored-By: SSE4 --- recipes/openblas/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index cc44588e8740b..0c941d82c10de 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -69,6 +69,8 @@ def package(self): def package_info(self): self.cpp_info.libs = tools.collect_libs(self) + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["pthread"] self.cpp_info.builddirs.append( os.path.join('share', 'cmake', 'OpenBLAS')) self.cpp_info.names["cmake_find_package"] = "OpenBLAS" From 5cc47c56cc1094fd40d8d7b9acb51f0a68983d61 Mon Sep 17 00:00:00 2001 From: bruno Date: Mon, 20 Jan 2020 14:58:33 +0100 Subject: [PATCH 04/16] Attempt to fix openblas static build on msvc --- recipes/openblas/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 0c941d82c10de..3b71e64144fa0 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -48,6 +48,9 @@ def _configure_cmake(self): cmake.definitions["NOFORTRAN"] = not self.options.build_lapack cmake.definitions["BUILD_WITHOUT_LAPACK"] = not self.options.build_lapack + if self.settings.compiler == "Visual Studio" and not self.options.shared: + cmake.definitions["MSVC_STATIC_CRT"] = True + cmake.configure( build_folder=self._build_subfolder, source_folder=self._source_subfolder) From 983c83def3186bfa025252fced2825c8b3978f0c Mon Sep 17 00:00:00 2001 From: bruno Date: Mon, 20 Jan 2020 16:07:05 +0100 Subject: [PATCH 05/16] Add the math library on linux for the openblas library --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 3b71e64144fa0..529c3a96c43eb 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -73,7 +73,7 @@ def package(self): def package_info(self): self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.system_libs = ["pthread", "m"] self.cpp_info.builddirs.append( os.path.join('share', 'cmake', 'OpenBLAS')) self.cpp_info.names["cmake_find_package"] = "OpenBLAS" From 2cc650b0b4c96f71eafe5380b7b469666891fa03 Mon Sep 17 00:00:00 2001 From: bmanga Date: Tue, 21 Jan 2020 21:54:06 +0100 Subject: [PATCH 06/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 529c3a96c43eb..62cf359ef05d8 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -6,7 +6,7 @@ class OpenBLAS(ConanFile): name = "openblas" version = "0.3.7" - license = "BSD 3-Clause" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.openblas.net" description = "An optimized BLAS library based on GotoBLAS2 1.13 BSD version" From 19216e9c5176bb02aa2b3286ed41cd60b3e76c88 Mon Sep 17 00:00:00 2001 From: bmanga Date: Tue, 21 Jan 2020 21:54:13 +0100 Subject: [PATCH 07/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 62cf359ef05d8..e3d091b4c0355 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -22,7 +22,7 @@ class OpenBLAS(ConanFile): "build_lapack": [True, False] } default_options = { - "shared": True, + "shared": False, "fPIC": True, "build_lapack": False } From 87a84de145f5bc1700f655d67c3530b40fd62b71 Mon Sep 17 00:00:00 2001 From: bmanga Date: Tue, 21 Jan 2020 21:54:22 +0100 Subject: [PATCH 08/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index e3d091b4c0355..7525635dce40c 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -27,7 +27,6 @@ class OpenBLAS(ConanFile): "build_lapack": False } generators = "cmake", "cmake_find_package" - no_copy_source = True _source_subfolder = "source_subfolder" _build_subfolder = "build_subfolder" From 11b007ce9bac134695b93e8c81fcba5141f44e1c Mon Sep 17 00:00:00 2001 From: bruno Date: Tue, 21 Jan 2020 22:41:09 +0100 Subject: [PATCH 09/16] Update openblas recipe --- recipes/openblas/all/conanfile.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 7525635dce40c..aec5ca241da93 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -26,7 +26,8 @@ class OpenBLAS(ConanFile): "fPIC": True, "build_lapack": False } - generators = "cmake", "cmake_find_package" + exports_sources = ["CMakeLists.txt"] + generators = "cmake" _source_subfolder = "source_subfolder" _build_subfolder = "build_subfolder" @@ -50,9 +51,7 @@ def _configure_cmake(self): if self.settings.compiler == "Visual Studio" and not self.options.shared: cmake.definitions["MSVC_STATIC_CRT"] = True - cmake.configure( - build_folder=self._build_subfolder, - source_folder=self._source_subfolder) + cmake.configure(build_folder=self._build_subfolder) return cmake def build(self): @@ -70,11 +69,12 @@ def package(self): tools.rmdir(os.path.join(self.package_folder, "share")) def package_info(self): + self.env_info.OpenBLAS_HOME = self.package_folder self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread", "m"] - self.cpp_info.builddirs.append( - os.path.join('share', 'cmake', 'OpenBLAS')) + self.cpp_info.system_libs = ["pthread"] + if self.options.build_lapack: + self.cpp_info.libs.append("gfortran") self.cpp_info.names["cmake_find_package"] = "OpenBLAS" self.cpp_info.names["cmake_find_package_multi"] = "OpenBLAS" self.cpp_info.names['pkg_config'] = "OpenBLAS" From 52453c3bb9c6c30dbb8bdf6a3ed961e90f3ca820 Mon Sep 17 00:00:00 2001 From: bmanga Date: Fri, 24 Jan 2020 13:39:38 +0100 Subject: [PATCH 10/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index aec5ca241da93..894a915e83eac 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -13,7 +13,7 @@ class OpenBLAS(ConanFile): topics = ( "OpenBLAS", "BLAS", - "LAPACK" + "lapack" ) settings = "os", "compiler", "build_type", "arch" options = { From 6476642c3a05c6beb116386ba4564999dba36113 Mon Sep 17 00:00:00 2001 From: bmanga Date: Fri, 24 Jan 2020 13:39:45 +0100 Subject: [PATCH 11/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 894a915e83eac..955002455cd16 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -11,7 +11,7 @@ class OpenBLAS(ConanFile): homepage = "https://www.openblas.net" description = "An optimized BLAS library based on GotoBLAS2 1.13 BSD version" topics = ( - "OpenBLAS", + "openblas", "BLAS", "lapack" ) From 51412aa9e1d97578efea7acc522f1b14fe3e8230 Mon Sep 17 00:00:00 2001 From: bmanga Date: Fri, 24 Jan 2020 13:39:57 +0100 Subject: [PATCH 12/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 955002455cd16..8114f009d4911 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -5,7 +5,6 @@ class OpenBLAS(ConanFile): name = "openblas" - version = "0.3.7" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.openblas.net" From 3368b928a7ff7be0b35eb536b871c02ba2e562b8 Mon Sep 17 00:00:00 2001 From: bruno Date: Fri, 24 Jan 2020 13:48:03 +0100 Subject: [PATCH 13/16] Added missing CMakeLists wrapper --- recipes/openblas/all/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 recipes/openblas/all/CMakeLists.txt diff --git a/recipes/openblas/all/CMakeLists.txt b/recipes/openblas/all/CMakeLists.txt new file mode 100644 index 0000000000000..cdeeef45d13c1 --- /dev/null +++ b/recipes/openblas/all/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cmake_wrapper) + +if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +else() + include(conanbuildinfo.cmake) +endif() +conan_basic_setup() + +add_subdirectory("source_subfolder") From 8566b701c6f6740b0ea9189a05b7c312cda88be9 Mon Sep 17 00:00:00 2001 From: bruno Date: Fri, 24 Jan 2020 13:49:10 +0100 Subject: [PATCH 14/16] Tentative workaround for errors in older gccs --- recipes/openblas/all/conanfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 8114f009d4911..ab62a0d920f6b 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -50,6 +50,11 @@ def _configure_cmake(self): if self.settings.compiler == "Visual Studio" and not self.options.shared: cmake.definitions["MSVC_STATIC_CRT"] = True + if self.settings.os == "Linux": + # This is a workaround to add the libm dependency on linux, + # which is required to successfully compile on older gcc versions. + cmake.definitions["ANDROID"] = True + cmake.configure(build_folder=self._build_subfolder) return cmake @@ -70,7 +75,7 @@ def package(self): def package_info(self): self.env_info.OpenBLAS_HOME = self.package_folder self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": + if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] if self.options.build_lapack: self.cpp_info.libs.append("gfortran") From 06f54f9cddf17525bdd5c9d9b1d1e87ae127c997 Mon Sep 17 00:00:00 2001 From: bmanga Date: Fri, 24 Jan 2020 13:49:28 +0100 Subject: [PATCH 15/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index ab62a0d920f6b..7b13cf44446ad 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -11,7 +11,7 @@ class OpenBLAS(ConanFile): description = "An optimized BLAS library based on GotoBLAS2 1.13 BSD version" topics = ( "openblas", - "BLAS", + "blas", "lapack" ) settings = "os", "compiler", "build_type", "arch" From 0f2feef9e5e941f0f77474ea2ada0f338d61800c Mon Sep 17 00:00:00 2001 From: bmanga Date: Fri, 24 Jan 2020 19:15:50 +0100 Subject: [PATCH 16/16] Update recipes/openblas/all/conanfile.py Co-Authored-By: Uilian Ries --- recipes/openblas/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 7b13cf44446ad..5e426733692a4 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -78,7 +78,7 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] if self.options.build_lapack: - self.cpp_info.libs.append("gfortran") + self.cpp_info.system_libs.append("gfortran") self.cpp_info.names["cmake_find_package"] = "OpenBLAS" self.cpp_info.names["cmake_find_package_multi"] = "OpenBLAS" self.cpp_info.names['pkg_config'] = "OpenBLAS"