xref: /aosp_15_r20/external/executorch/kernels/optimized/External/EigenBLAS.cmake (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the BSD-style license found in the
5# LICENSE file in the root directory of this source tree.
6
7if(__EIGEN_BLAS_INCLUDED)
8  return()
9endif()
10set(__EIGEN_BLAS_INCLUDED TRUE)
11
12# ##############################################################################
13# Eigen BLAS is built together with Libtorch mobile. By default, it builds code
14# from third-party/eigen/blas submodule.
15# ##############################################################################
16
17set(EIGEN_BLAS_SRC_DIR
18    "${CMAKE_CURRENT_SOURCE_DIR}/third-party/eigen/blas"
19    CACHE STRING "Eigen BLAS source directory"
20)
21
22set(EigenBlas_SRCS
23    ${EIGEN_BLAS_SRC_DIR}/single.cpp
24    ${EIGEN_BLAS_SRC_DIR}/double.cpp
25    ${EIGEN_BLAS_SRC_DIR}/complex_single.cpp
26    ${EIGEN_BLAS_SRC_DIR}/complex_double.cpp
27    ${EIGEN_BLAS_SRC_DIR}/xerbla.cpp
28    ${EIGEN_BLAS_SRC_DIR}/f2c/srotm.c
29    ${EIGEN_BLAS_SRC_DIR}/f2c/srotmg.c
30    ${EIGEN_BLAS_SRC_DIR}/f2c/drotm.c
31    ${EIGEN_BLAS_SRC_DIR}/f2c/drotmg.c
32    ${EIGEN_BLAS_SRC_DIR}/f2c/lsame.c
33    ${EIGEN_BLAS_SRC_DIR}/f2c/dspmv.c
34    ${EIGEN_BLAS_SRC_DIR}/f2c/ssbmv.c
35    ${EIGEN_BLAS_SRC_DIR}/f2c/chbmv.c
36    ${EIGEN_BLAS_SRC_DIR}/f2c/sspmv.c
37    ${EIGEN_BLAS_SRC_DIR}/f2c/zhbmv.c
38    ${EIGEN_BLAS_SRC_DIR}/f2c/chpmv.c
39    ${EIGEN_BLAS_SRC_DIR}/f2c/dsbmv.c
40    ${EIGEN_BLAS_SRC_DIR}/f2c/zhpmv.c
41    ${EIGEN_BLAS_SRC_DIR}/f2c/dtbmv.c
42    ${EIGEN_BLAS_SRC_DIR}/f2c/stbmv.c
43    ${EIGEN_BLAS_SRC_DIR}/f2c/ctbmv.c
44    ${EIGEN_BLAS_SRC_DIR}/f2c/ztbmv.c
45    ${EIGEN_BLAS_SRC_DIR}/f2c/complexdots.c
46)
47
48add_library(eigen_blas STATIC ${EigenBlas_SRCS})
49
50# Dont know what to do with this We build static versions of eigen blas but link
51# into a shared library, so they need PIC.
52set_property(TARGET eigen_blas PROPERTY POSITION_INDEPENDENT_CODE ON)
53
54install(
55  TARGETS eigen_blas
56  LIBRARY DESTINATION lib
57  ARCHIVE DESTINATION lib
58)
59