Skip to content

Commit

Permalink
Add CMake option USE_BUNDLED_BLAS_WIN (#1940)
Browse files Browse the repository at this point in the history
This option controls whether CMake uses the bundled OpenBLAS library
when building on Windows (defaults to True). Having this option allows a
user to build qiskit-aer against a different system BLAS without needing
to specify a full path using the `AER_BLAS_LIB_PATH` option.

Co-authored-by: Jun Doi <doichan@jp.ibm.com>
  • Loading branch information
wshanks and doichanj authored Nov 29, 2023
1 parent 893461c commit 17edfa3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ endif()
option(STATIC_LINKING "Specify if we want statically link the executable (for
redistribution mainly)" FALSE)
option(BUILD_TESTS "Specify whether we want to build tests or not" FALSE)
option(USE_BUNDLED_BLAS_WIN "Use the bundled openblas library on Windows when
not using AER_BLAS_LIB_PATH" TRUE)

# Allow disabling conan for downstream package managers. Requires all libraries to be present in path
# Default is value of environment variable if defined or ON
Expand Down Expand Up @@ -237,7 +239,7 @@ else()
set(BLA_VENDOR "OpenBLAS")
endif()
endif()
if(WIN32)
if(WIN32 AND USE_BUNDLED_BLAS_WIN)
message(STATUS "Uncompressing OpenBLAS static library...")
set(WIN_ARCH "win64" )
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # Checking if win32 build
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,16 @@ These are the flags:
Default: No value.
Example: ``python ./setup.py bdist_wheel -- -DAER_BLAS_LIB_PATH=/path/to/look/for/blas/``

* USE_BUNDLED_BLAS_WIN

Tells CMake to use the bundled OpenBLAS library vendored into the source code when building on Windows.
When this option is set to `False`, CMake will use its standard method to search for the BLAS library aginst which to link instead of using the vendored version.
The `AER_BLAS_LIB_PATH` option takes precedence over this option.

Values: True|False
Default: True
Example: ``python ./setup.py bdist_wheel -- -DUSE_BUNDLED_BLAS_WIN=FALSE``

* BUILD_TESTS

It will tell the build system to build C++ tests along with the simulator.
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/windows-blas-42b3dbc170c5ae94.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
Added CMake option ``USE_BUNDLED_BLAS_WIN`` which allows CMake to search
for a BLAS library against which to link instead of using the OpenBLAS
library bundled into the repo.

0 comments on commit 17edfa3

Please sign in to comment.