Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenBLAS/0.3.7 #705

Merged
merged 16 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/openblas/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
0.3.7:
sha256: bde136122cef3dd6efe2de1c6f65c10955bbb0cc01a520c2342f5287c28f9379
url: https://github.com/xianyi/OpenBLAS/archive/v0.3.7.tar.gz
76 changes: 76 additions & 0 deletions recipes/openblas/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from conans import ConanFile, CMake, tools
import sys
import os


class OpenBLAS(ConanFile):
name = "openblas"
version = "0.3.7"
bmanga marked this conversation as resolved.
Show resolved Hide resolved
license = "BSD 3-Clause"
bmanga marked this conversation as resolved.
Show resolved Hide resolved
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",
bmanga marked this conversation as resolved.
Show resolved Hide resolved
"BLAS",
bmanga marked this conversation as resolved.
Show resolved Hide resolved
"LAPACK"
bmanga marked this conversation as resolved.
Show resolved Hide resolved
)
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"build_lapack": [True, False]
SSE4 marked this conversation as resolved.
Show resolved Hide resolved
}
default_options = {
"shared": True,
bmanga marked this conversation as resolved.
Show resolved Hide resolved
"fPIC": True,
"build_lapack": False
}
generators = "cmake", "cmake_find_package"
no_copy_source = True
bmanga marked this conversation as resolved.
Show resolved Hide resolved
_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)
bmanga marked this conversation as resolved.
Show resolved Hide resolved
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)
bmanga marked this conversation as resolved.
Show resolved Hide resolved
self.cpp_info.builddirs.append(
os.path.join('share', 'cmake', 'OpenBLAS'))
bmanga marked this conversation as resolved.
Show resolved Hide resolved
self.cpp_info.names["cmake_find_package"] = "OpenBLAS"
self.cpp_info.names["cmake_find_package_multi"] = "OpenBLAS"
self.cpp_info.names['pkg_config'] = "OpenBLAS"
10 changes: 10 additions & 0 deletions recipes/openblas/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
17 changes: 17 additions & 0 deletions recipes/openblas/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 15 additions & 0 deletions recipes/openblas/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <openblas/cblas.h>
#include <stdio.h>

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");
}
3 changes: 3 additions & 0 deletions recipes/openblas/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.3.7":
folder: all