Closed miroi closed 9 years ago
You can change the order using MATH_LIB_SEARCH_ORDER: https://github.com/scisoft/autocmake/blob/master/modules/math_libs.cmake#L7
The order is fine (MKL first !), but I would like explicitly assign library (as in DIRAC)....
In DIRAC we solve it like this:
[explicit]
docopt: --explicit-libs=<LIBS> Explicit linker specification for extra libraries passed directly to the linker [default: off].
define: '-DEXPLICIT_LIBS=%s' % arguments['--explicit-libs'].strip()
And then you use ${EXPLICIT_LIBS}
in target_link_libraries
.
Good. In such a case I have to switch off autocmake selection of math libs:
python setup.py --static --fc=gfortran --explicit-libs="/usr/lib64/libblas.a" --blas=off --lapack=off build_gfortran_libblas_static1
.
.
.milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake/.py.test -v test/test.py
=============================================================== test session starts ================================================================
platform linux2 -- Python 2.6.6 -- py-1.4.28 -- pytest-2.7.1 -- /usr/bin/python
rootdir: /home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake/test, inifile:
collected 8 items
test/test.py::test_cxx_custom PASSED
test/test.py::test_extra_cmake_options PASSED
test/test.py::test_cxx PASSED
test/test.py::test_cxx_static PASSED
test/test.py::test_fc PASSED
test/test.py::test_fc_static PASSED
test/test.py::test_fc_blas PASSED
test/test.py::test_fc_blas_static PASSED
============================================================ 8 passed in 30.68 seconds =============================================================
Well, your comment https://github.com/scisoft/autocmake/issues/52#issuecomment-127051854 can be put in into the documentation and than we can close this issue, IMHO.
I agree that the documentation should have a section on linking.
Hi Rado,
due to the importance of passing the EXPLICIT_LIBS to linked (if the automatic math-libs detection does not work), I advocate for two new tests, fc_blas_explicit, fc_lapack_explicit.
These could be based upon existing tests, fc_blas+fc_lapack, where we would change local CMakeFiles.txt files for EXPLICIT_LIBS detection.
Maybe it would be sufficient to have only one extra test for EXPLICIT_LIBS detection, fc_blas_explicit.
I have one working example for Windows, https://github.com/miroi/mathlibs-tester/blob/master/src/CMakeLists.txt . At the moment we don't have OpenBLAS automatic detection on Windows, so explicit_libs is the workaround.
Comments, please ?
A problem with such tests is that they might work on Travis/Appveyor but fail outside. I want the test suite to work also on my laptop without jumping through hoops. Also testing explicit libs is in principle independent of math so I would avoid couple those.
Ok, fine. Let us rely on math_libs.cmake detection only. Closing this issue.
On my system I have GNU blas as well as MKL-blas. By default is chooses MKL, but I want to force it to use other library.
The -blas="/usr/lib64/libblas.a" is not working. I haven't found in the manual how to do it. Any help ?