Skip to content

Commit

Permalink
Add ALPAQA_WITH_BLAS option
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Dec 8, 2023
1 parent d03eb48 commit 571480c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ option(ALPAQA_DEBUG_CHECKS_EIGEN
"Initialize Eigen matrices to NaN, and raise an assertion error if memory (re)allocation is used in the inner loops of the algorithms" Off)
option(ALPAQA_DONT_PARALLELIZE_EIGEN
"Add the EIGEN_DONT_PARALLELIZE option" On)
option(ALPAQA_WITH_BLAS
"Enable use of BLAS and enable EIGEN_USE_BLAS" Off)
option(ALPAQA_NO_DLCLOSE
"Never call dlclose when a shared library is no longer needed, leave it open instead. Useful for profiling using gperftools." Off)
option(ALPAQA_WITH_ACCURATE_BUILD_TIME
Expand Down
3 changes: 3 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class AlpaqaRecipe(ConanFile):
"debug_checks_eigen": False,
"dont_parallelize_eigen": True,
"no_dlclose": False,
"with_blas": False,
}
options = {
"shared": [True, False],
Expand Down Expand Up @@ -74,6 +75,8 @@ def requirements(self):
self.requires("pybind11/2.10.1")
if self.options.with_matlab:
self.requires("utfcpp/4.0.1")
if self.options.with_blas:
self.requires("openblas/0.3.24")

def config_options(self):
if self.settings.get_safe("os") == "Windows":
Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ endif()
if (ALPAQA_DONT_PARALLELIZE_EIGEN)
target_compile_definitions(alpaqa PUBLIC EIGEN_DONT_PARALLELIZE)
endif()
if (ALPAQA_WITH_BLAS)
find_package(BLAS REQUIRED)
target_link_libraries(alpaqa PUBLIC BLAS::BLAS)
target_compile_definitions(alpaqa PUBLIC EIGEN_USE_BLAS)
endif()
set_target_properties(alpaqa PROPERTIES SOVERSION ${PROJECT_VERSION})
add_library(alpaqa::alpaqa ALIAS alpaqa)
list(APPEND ALPAQA_INSTALL_TARGETS alpaqa)
Expand Down
3 changes: 3 additions & 0 deletions src/cmake/CoreConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ if (@ALPAQA_WITH_JSON@)
INTERFACE nlohmann_json::nlohmann_json)
endif()
endif()
if (@ALPAQA_WITH_BLAS@)
find_dependency(BLAS)
endif()

check_required_components(alpaqaCore)

0 comments on commit 571480c

Please sign in to comment.