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