Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
add LAPACK 3.7.1 (needs fortran)
Browse files Browse the repository at this point in the history
- add LAPACK example building targets blas and lapack
- add LAPACK-CBLAS example using local cmake config file
  • Loading branch information
riegl-gc committed Jul 3, 2017
1 parent 376e8e5 commit 760355e
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Expand Up @@ -69,6 +69,7 @@ if(MSVC_VERSION LESS 1600)
else()
hunter_config(jsoncpp VERSION 1.8.0)
endif()
hunter_config(LAPACK VERSION 3.7.1)
hunter_config(LLVM VERSION 3.6.2-p0) # Clang
hunter_config(LLVMCompilerRT VERSION 3.6.0) # Clang
hunter_config(Leathers VERSION 0.1.6)
Expand Down
41 changes: 41 additions & 0 deletions cmake/projects/LAPACK/hunter.cmake
@@ -0,0 +1,41 @@
# Copyright (c) 2017, NeroBurner
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

# Load used modules
include(hunter_add_version)
include(hunter_cmake_args)
include(hunter_download)
include(hunter_pick_scheme)
include(hunter_cacheable)

hunter_cacheable(LAPACK)

# List of versions here...
hunter_add_version(
PACKAGE_NAME
LAPACK
VERSION
"3.7.1"
URL
https://github.com/hunter-packages/lapack/archive/v3.7.1-p0.tar.gz
SHA1
82616c0878fbe42f22ece5fadfb38e09456ba5b5
)

# pass cmake arguments
hunter_cmake_args(
LAPACK
CMAKE_ARGS
HUNTER_INSTALL_LICENSE_FILES=LICENSE
)

# Pick a download scheme
hunter_pick_scheme(DEFAULT url_sha1_cmake)

# Download package.
# Two versions of library will be build:
# * libexample_A.a
# * libexample_Ad.a
hunter_download(PACKAGE_NAME LAPACK)
35 changes: 35 additions & 0 deletions examples/LAPACK-CBLAS/CMakeLists.txt
@@ -0,0 +1,35 @@
# Copyright (c) 2015, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)


set(TESTING_CONFIG_OPT FILEPATH "${CMAKE_CURRENT_LIST_DIR}/config.cmake")
# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-LAPACK)

hunter_add_package(LAPACK)

string(COMPARE EQUAL "${LAPACK_LICENSES}" "" is_empty)
if(is_empty)
message(FATAL_ERROR "Licenses not found")
endif()

message("LAPACK licenses:")
foreach(x ${LAPACK_LICENSES})
message("* ${x}")
if(NOT EXISTS "${LAPACK_LICENSES}")
message(FATAL_ERROR "File not found")
endif()
endforeach()

find_package(cblas CONFIG REQUIRED)
# Test double library creation
find_package(cblas CONFIG REQUIRED)

add_executable(foo foo.cpp)
target_link_libraries(foo cblas)

4 changes: 4 additions & 0 deletions examples/LAPACK-CBLAS/config.cmake
@@ -0,0 +1,4 @@
hunter_config(LAPACK
VERSION ${HUNTER_LAPACK_VERSION}
CMAKE_ARGS CBLAS=ON
)
14 changes: 14 additions & 0 deletions examples/LAPACK-CBLAS/foo.cpp
@@ -0,0 +1,14 @@
#include <iostream> // std::cout
#include <cblas.h>

int main() {
double X[3];
X[0] = 1;
X[1] = 2;
X[2] = 3;
const int N = 3;
const int incX = 1;

double sum = cblas_dasum(N, X, incX);
std::cout << "sum over [1, 2, 3] = " << sum << std::endl;
}
33 changes: 33 additions & 0 deletions examples/LAPACK/CMakeLists.txt
@@ -0,0 +1,33 @@
# Copyright (c) 2015, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-LAPACK)

hunter_add_package(LAPACK)

string(COMPARE EQUAL "${LAPACK_LICENSES}" "" is_empty)
if(is_empty)
message(FATAL_ERROR "Licenses not found")
endif()

message("LAPACK licenses:")
foreach(x ${LAPACK_LICENSES})
message("* ${x}")
if(NOT EXISTS "${LAPACK_LICENSES}")
message(FATAL_ERROR "File not found")
endif()
endforeach()

find_package(LAPACK CONFIG REQUIRED)
# Test double library creation
find_package(LAPACK CONFIG REQUIRED)

add_executable(foo foo.cpp)
target_link_libraries(foo blas lapack)

5 changes: 5 additions & 0 deletions examples/LAPACK/foo.cpp
@@ -0,0 +1,5 @@
#include <iostream> // std::cout

int main() {
std::cout << "This program is doing nothing!" << std::endl;
}

0 comments on commit 760355e

Please sign in to comment.