-
Notifications
You must be signed in to change notification settings - Fork 441
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
CMake build: Add -DLAPACK option, un-break CBLAS+BLAS build, do not require C++ if unnecessary #972
Open
drhpc
wants to merge
3
commits into
Reference-LAPACK:master
Choose a base branch
from
drhpc:lapacklib-option
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
project(LAPACK) | ||
project(LAPACK Fortran C) | ||
|
||
set(LAPACK_MAJOR_VERSION 3) | ||
set(LAPACK_MINOR_VERSION 12) | ||
|
@@ -245,8 +245,12 @@ endif() | |
# Neither user specified or optimized BLAS libraries can be used | ||
if(NOT BLAS_FOUND) | ||
message(STATUS "Using supplied NETLIB BLAS implementation") | ||
set(LAPACK_INSTALL_EXPORT_NAME_CACHE ${LAPACK_INSTALL_EXPORT_NAME}) | ||
set(LAPACK_INSTALL_EXPORT_NAME ${BLASLIB}-targets) | ||
add_subdirectory(BLAS) | ||
set(BLAS_LIBRARIES ${BLASLIB}) | ||
set(LAPACK_INSTALL_EXPORT_NAME ${LAPACK_INSTALL_EXPORT_NAME_CACHE}) | ||
unset(LAPACK_INSTALL_EXPORT_NAME_CACHE) | ||
else() | ||
set(CMAKE_EXE_LINKER_FLAGS | ||
"${CMAKE_EXE_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}" | ||
|
@@ -278,6 +282,10 @@ endif() | |
|
||
option(USE_OPTIMIZED_LAPACK "Whether or not to use an optimized LAPACK library instead of included netlib LAPACK" OFF) | ||
|
||
option(LAPACK "Whether to build or use LAPACK (to enable a BLAS-only build)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please be explicit, do not omit |
||
|
||
if(LAPACK) | ||
|
||
# -------------------------------------------------- | ||
# LAPACK | ||
# User did not provide a LAPACK Library but specified to search for one | ||
|
@@ -349,6 +357,8 @@ else() | |
CACHE STRING "Linker flags for shared libs" FORCE) | ||
endif() | ||
|
||
endif() | ||
|
||
if(BUILD_TESTING) | ||
add_subdirectory(TESTING) | ||
endif() | ||
|
@@ -414,6 +424,7 @@ function(_display_cpp_implementation_msg name) | |
message(STATUS "----------------") | ||
endfunction() | ||
if (BLAS++) | ||
enable_language(CXX) | ||
_display_cpp_implementation_msg("BLAS") | ||
include(ExternalProject) | ||
ExternalProject_Add(blaspp | ||
|
@@ -425,6 +436,7 @@ if (BLAS++) | |
ExternalProject_Add_StepDependencies(blaspp build ${BLAS_LIBRARIES}) | ||
endif() | ||
if (LAPACK++) | ||
enable_language(CXX) | ||
message (STATUS "linking lapack++ against ${LAPACK_LIBRARIES}") | ||
_display_cpp_implementation_msg("LAPACK") | ||
include(ExternalProject) | ||
|
@@ -483,10 +495,14 @@ if(NOT BLAS_FOUND) | |
set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB}) | ||
endif() | ||
|
||
if(LAPACK) | ||
if(NOT LATESTLAPACK_FOUND) | ||
set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKLIB}) | ||
set(BUILD_LAPACK ON) | ||
endif() | ||
endif() | ||
|
||
if(LAPACK) | ||
# Export lapack targets, not including lapacke, from the | ||
# install tree, if any. | ||
set(_lapack_config_install_guard_target "") | ||
|
@@ -500,6 +516,7 @@ if(ALL_TARGETS) | |
# lapack-config.cmake to load targets from the install tree. | ||
list(GET ALL_TARGETS 0 _lapack_config_install_guard_target) | ||
endif() | ||
endif() | ||
|
||
# Include cblas in targets exported from the build tree. | ||
if(CBLAS) | ||
|
@@ -515,6 +532,8 @@ if(NOT LAPACK_WITH_TMGLIB_FOUND AND LAPACKE_WITH_TMG) | |
set(ALL_TARGETS ${ALL_TARGETS} ${TMGLIB}) | ||
endif() | ||
|
||
if(BUILD_LAPACK) | ||
|
||
# Export lapack and lapacke targets from the build tree, if any. | ||
set(_lapack_config_build_guard_target "") | ||
if(ALL_TARGETS) | ||
|
@@ -552,6 +571,9 @@ install(FILES | |
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKLIB}-${LAPACK_VERSION} | ||
COMPONENT Development | ||
) | ||
|
||
endif() # BUILD_LAPACK | ||
|
||
if (LAPACK++) | ||
install( | ||
DIRECTORY "${LAPACK_BINARY_DIR}/lib/" | ||
|
@@ -563,6 +585,7 @@ if (LAPACK++) | |
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
FILES_MATCHING REGEX "\\.(h|hh)$" | ||
) | ||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
"lapackppConfigVersion.cmake" | ||
VERSION 2020.10.02 | ||
|
@@ -576,6 +599,7 @@ if (LAPACK++) | |
|
||
endif() | ||
if (BLAS++) | ||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
"blasppConfigVersion.cmake" | ||
VERSION 2020.10.02 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the project language specified here, statements
enable_language(Fortran)
at lines 226 and 301 are not needed anymore.