e21a9aabbb9c69df58474333e37e8201cb9187c7
[platform/upstream/openblas.git] / lapack / CMakeLists.txt
1
2 include_directories(${PROJECT_SOURCE_DIR})
3 include_directories(${PROJECT_BINARY_DIR})
4
5
6 set(LAPACK_SOURCES
7   potrf/potrf_U_single.c
8   potrf/potrf_L_single.c
9   lauum/lauum_U_single.c
10   lauum/lauum_L_single.c
11 )
12
13 # add a 'z' to filename for complex version
14 set(LAPACK_MANGLED_SOURCES
15   getf2/getf2_k.c
16   lauu2/lauu2_U.c
17   lauu2/lauu2_L.c
18   potf2/potf2_U.c
19   potf2/potf2_L.c
20 )
21
22 # sources that need TRANS set
23 # this has a 'z' version
24 set(TRANS_SOURCES
25   getrs/getrs_single.c
26 )
27
28 # sources that need UNIT set
29 # these do NOT have a z version
30 set(UNIT_SOURCES
31   trtri/trtri_U_single.c
32   trtri/trtri_L_single.c
33 )
34
35 # these have a 'z' version
36 set(UNIT_SOURCES2
37   trti2/trti2_U.c
38   trti2/trti2_L.c
39 )
40
41 GenerateNamedObjects("${LAPACK_SOURCES}")
42 GenerateNamedObjects("${LAPACK_MANGLED_SOURCES}" "" "" false "" "" false 3)
43
44 GenerateNamedObjects("laswp/generic/laswp_k_4.c" "" "laswp_plus" false "" ""  false 3)
45 GenerateNamedObjects("laswp/generic/laswp_k_4.c" "MINUS" "laswp_minus" false "" ""  false 3)
46
47 foreach (float_type ${FLOAT_TYPES})
48 GenerateNamedObjects("getrf/getrf_single.c" "UNIT" "getrf_single" false "" "" false ${float_type})
49 endforeach ()
50
51 # dynamic_arch laswp needs arch specific code ?
52 #foreach(TARGET_CORE ${DYNAMIC_CORE})
53 #      set(TSUFFIX "_${TARGET_CORE}")
54 #
55 #GenerateNamedObjects("laswp/generic/laswp_k_4.c" "" "laswp_plus" false "" ${TSUFFIX}  false 3)
56 #GenerateNamedObjects("laswp/generic/laswp_k_4.c" "MINUS" "laswp_minus" false "" ${TSUFFIX}  false 3)
57 #endforeach ()
58
59 if (USE_THREAD)
60
61   if (USE_OPENMP)
62     set(GETRF_SRC getrf/getrf_parallel_omp.c)
63   else ()
64     set(GETRF_SRC getrf/getrf_parallel.c)
65   endif ()
66
67   # these do not have 'z' versions
68   set(PARALLEL_SOURCES
69     lauum/lauum_U_parallel.c
70     lauum/lauum_L_parallel.c
71     potrf/potrf_U_parallel.c
72     potrf/potrf_L_parallel.c
73   )
74
75   # this has a z version
76   list(APPEND TRANS_SOURCES
77     getrs/getrs_parallel.c
78   )
79
80   # these do NOT have a z version
81   list(APPEND UNIT_SOURCES
82     trtri/trtri_U_parallel.c
83     trtri/trtri_L_parallel.c
84   )
85
86   foreach (float_type ${FLOAT_TYPES})
87     GenerateNamedObjects("${GETRF_SRC}" "UNIT" "getrf_parallel" false "" "" false ${float_type})
88   endforeach()
89
90   GenerateNamedObjects("${PARALLEL_SOURCES}")
91 endif ()
92
93 foreach (float_type ${FLOAT_TYPES})
94   if (${float_type} STREQUAL "COMPLEX" OR ${float_type} STREQUAL "ZCOMPLEX")
95     foreach (trans_src ${TRANS_SOURCES})
96       string(REGEX MATCH "[a-z]/([a-z]+_)([a-z]+)" op_name ${trans_src})
97       string(REPLACE "/" "/z" ztrans_src ${trans_src})
98       GenerateNamedObjects("${ztrans_src}" "TRANS=1" "${CMAKE_MATCH_1}N_${CMAKE_MATCH_2}" false "" "" false ${float_type})
99       GenerateNamedObjects("${ztrans_src}" "TRANS=2" "${CMAKE_MATCH_1}T_${CMAKE_MATCH_2}" false "" "" false ${float_type})
100       GenerateNamedObjects("${ztrans_src}" "TRANS=3" "${CMAKE_MATCH_1}R_${CMAKE_MATCH_2}" false "" "" false ${float_type})
101       GenerateNamedObjects("${ztrans_src}" "TRANS=4" "${CMAKE_MATCH_1}C_${CMAKE_MATCH_2}" false "" "" false ${float_type})
102     endforeach ()
103   else ()
104     GenerateCombinationObjects("${TRANS_SOURCES}" "TRANS" "N" "" 4 "" false ${float_type})
105   endif ()
106 endforeach ()
107
108 GenerateCombinationObjects("${UNIT_SOURCES}" "UNIT" "N" "" 4)
109 GenerateCombinationObjects("${UNIT_SOURCES2}" "UNIT" "N" "" 0 "" "" 3)
110
111 add_library(lapack OBJECT ${OPENBLAS_SRC})
112